diff --git a/fdbclient/AsyncFileBlobStore.actor.h b/fdbclient/AsyncFileBlobStore.actor.h index a8a422ade0..681c28ac6a 100644 --- a/fdbclient/AsyncFileBlobStore.actor.h +++ b/fdbclient/AsyncFileBlobStore.actor.h @@ -165,7 +165,7 @@ public: } // Ready once all data has been sent AND acknowledged from the remote side - virtual Future sync() { + Future sync() override { // Only initiate the finish operation once, and also prevent further writing. if(!m_finished.isValid()) { m_finished = doFinishUpload(this); @@ -259,23 +259,23 @@ public: virtual void addref() { ReferenceCounted::addref(); } virtual void delref() { ReferenceCounted::delref(); } - virtual Future read( void *data, int length, int64_t offset ); + Future read(void* data, int length, int64_t offset) override; - virtual Future write( void const *data, int length, int64_t offset ) { throw file_not_writable(); } - virtual Future truncate( int64_t size ) { throw file_not_writable(); } + Future write(void const* data, int length, int64_t offset) override { throw file_not_writable(); } + Future truncate(int64_t size) override { throw file_not_writable(); } - virtual Future sync() { return Void(); } - virtual Future flush() { return Void(); } + Future sync() override { return Void(); } + Future flush() override { return Void(); } Future size() const override; - virtual Future readZeroCopy( void** data, int* length, int64_t offset ) { + Future readZeroCopy(void** data, int* length, int64_t offset) override { TraceEvent(SevError, "ReadZeroCopyNotSupported").detail("FileType", "BlobStoreRead"); return platform_error(); } - virtual void releaseZeroCopy( void* data, int length, int64_t offset ) {} + void releaseZeroCopy(void* data, int length, int64_t offset) override {} - virtual int64_t debugFD() const override { return -1; } + int64_t debugFD() const override { return -1; } std::string getFilename() const override { return m_object; } diff --git a/fdbrpc/AsyncFileCached.actor.h b/fdbrpc/AsyncFileCached.actor.h index 8037e652a9..5ab91ff860 100644 --- a/fdbrpc/AsyncFileCached.actor.h +++ b/fdbrpc/AsyncFileCached.actor.h @@ -160,7 +160,7 @@ public: return openFiles[filename].get(); } - virtual Future read( void* data, int length, int64_t offset ) { + Future read(void* data, int length, int64_t offset) override { ++countFileCacheReads; ++countCacheReads; if (offset + length > this->length) { @@ -190,17 +190,15 @@ public: return Void(); } - virtual Future write( void const* data, int length, int64_t offset ) { + Future write(void const* data, int length, int64_t offset) override { return write_impl(this, data, length, offset); } - virtual Future readZeroCopy( void** data, int* length, int64_t offset ); - virtual void releaseZeroCopy( void* data, int length, int64_t offset ); + Future readZeroCopy(void** data, int* length, int64_t offset) override; + void releaseZeroCopy(void* data, int length, int64_t offset) override; // This waits for previously started truncates to finish and then truncates - virtual Future truncate( int64_t size ) { - return truncate_impl(this, size); - } + Future truncate(int64_t size) override { return truncate_impl(this, size); } // This is the 'real' truncate that does the actual removal of cache blocks and then shortens the file Future changeFileSize( int64_t size ); @@ -215,9 +213,7 @@ public: return Void(); } - virtual Future sync() { - return waitAndSync( this, flush() ); - } + Future sync() override { return waitAndSync(this, flush()); } Future size() const override { return length; } @@ -331,7 +327,7 @@ private: } } - virtual Future flush(); + Future flush() override; Future quiesce(); @@ -350,7 +346,7 @@ private: }; struct AFCPage : public EvictablePage, public FastAllocated { - virtual bool evict() { + bool evict() override { if ( notReading.isReady() && notFlushing.isReady() && !dirty && !zeroCopyRefCount && !truncated ) { owner->remove_page( this ); delete this; diff --git a/fdbrpc/AsyncFileEIO.actor.h b/fdbrpc/AsyncFileEIO.actor.h index 36988c43a4..683572faa3 100644 --- a/fdbrpc/AsyncFileEIO.actor.h +++ b/fdbrpc/AsyncFileEIO.actor.h @@ -117,24 +117,24 @@ public: int64_t debugFD() const override { return fd; } - virtual Future read( void* data, int length, int64_t offset ) { + Future read(void* data, int length, int64_t offset) override { ++countFileLogicalReads; ++countLogicalReads; return read_impl(fd, data, length, offset); } - virtual Future write( void const* data, int length, int64_t offset ) // Copies data synchronously + Future write(void const* data, int length, int64_t offset) override // Copies data synchronously { ++countFileLogicalWrites; ++countLogicalWrites; //Standalone copy = StringRef((const uint8_t*)data, length); return write_impl( fd, err, StringRef((const uint8_t*)data, length), offset ); } - virtual Future truncate( int64_t size ) { + Future truncate(int64_t size) override { ++countFileLogicalWrites; ++countLogicalWrites; return truncate_impl( fd, err, size ); } - virtual Future sync() { + Future sync() override { ++countFileLogicalWrites; ++countLogicalWrites; auto fsync = sync_impl( fd, err ); diff --git a/fdbrpc/AsyncFileKAIO.actor.h b/fdbrpc/AsyncFileKAIO.actor.h index d83dc4fac5..876a64be74 100644 --- a/fdbrpc/AsyncFileKAIO.actor.h +++ b/fdbrpc/AsyncFileKAIO.actor.h @@ -182,7 +182,7 @@ public: virtual void addref() { ReferenceCounted::addref(); } virtual void delref() { ReferenceCounted::delref(); } - virtual Future read( void* data, int length, int64_t offset ) { + Future read(void* data, int length, int64_t offset) override { ++countFileLogicalReads; ++countLogicalReads; //printf("%p Begin logical read\n", getCurrentCoro()); @@ -205,7 +205,7 @@ public: return result; } - virtual Future write( void const* data, int length, int64_t offset ) { + Future write(void const* data, int length, int64_t offset) override { ++countFileLogicalWrites; ++countLogicalWrites; //printf("%p Begin logical write\n", getCurrentCoro()); @@ -234,7 +234,7 @@ public: #ifndef FALLOC_FL_ZERO_RANGE #define FALLOC_FL_ZERO_RANGE 0x10 #endif - virtual Future zeroRange( int64_t offset, int64_t length ) override { + Future zeroRange(int64_t offset, int64_t length) override { bool success = false; if (ctx.fallocateZeroSupported) { int rc = fallocate( fd, FALLOC_FL_ZERO_RANGE, offset, length ); @@ -247,7 +247,7 @@ public: } return success ? Void() : IAsyncFile::zeroRange(offset, length); } - virtual Future truncate( int64_t size ) { + Future truncate(int64_t size) override { ++countFileLogicalWrites; ++countLogicalWrites; @@ -308,7 +308,7 @@ public: return Void(); } - virtual Future sync() { + Future sync() override { ++countFileLogicalWrites; ++countLogicalWrites; diff --git a/fdbrpc/AsyncFileNonDurable.actor.h b/fdbrpc/AsyncFileNonDurable.actor.h index 76f56ce23c..4b86f9776f 100644 --- a/fdbrpc/AsyncFileNonDurable.actor.h +++ b/fdbrpc/AsyncFileNonDurable.actor.h @@ -87,25 +87,25 @@ public: ReferenceCounted::delref(); } - Future read(void *data, int length, int64_t offset) { + Future read(void* data, int length, int64_t offset) override { if( !file.getPtr() || g_simulator.getCurrentProcess()->shutdownSignal.getFuture().isReady() ) return io_error().asInjectedFault(); return sendErrorOnShutdown( file->read( data, length, offset ) ); } - Future write(void const *data, int length, int64_t offset) { + Future write(void const* data, int length, int64_t offset) override { if( !file.getPtr() || g_simulator.getCurrentProcess()->shutdownSignal.getFuture().isReady() ) return io_error().asInjectedFault(); return sendErrorOnShutdown( file->write( data, length, offset ) ); } - - Future truncate(int64_t size) { + + Future truncate(int64_t size) override { if( !file.getPtr() || g_simulator.getCurrentProcess()->shutdownSignal.getFuture().isReady() ) return io_error().asInjectedFault(); return sendErrorOnShutdown( file->truncate( size ) ); } - Future sync() { + Future sync() override { if( !file.getPtr() || g_simulator.getCurrentProcess()->shutdownSignal.getFuture().isReady() ) return io_error().asInjectedFault(); return sendErrorOnShutdown( file->sync() ); @@ -263,13 +263,11 @@ public: } //Passes along reads straight to the underlying file, waiting for any outstanding changes that could affect the results - Future read(void *data, int length, int64_t offset) { - return read(this, data, length, offset); - } + Future read(void* data, int length, int64_t offset) override { return read(this, data, length, offset); } //Writes data to the file. Writes are delayed a random amount of time before being //passed to the underlying file - Future write(void const *data, int length, int64_t offset) { + Future write(void const* data, int length, int64_t offset) override { //TraceEvent("AsyncFileNonDurable_Write", id).detail("Filename", filename).detail("Offset", offset).detail("Length", length); if(length == 0) { TraceEvent(SevWarnAlways, "AsyncFileNonDurable_EmptyModification", id).detail("Filename", filename); @@ -283,10 +281,10 @@ public: writeEnded.send(write(this, writeStarted, writeEnded.getFuture(), data, length, offset)); return writeStarted.getFuture(); } - + //Truncates the file. Truncates are delayed a random amount of time before being //passed to the underlying file - Future truncate(int64_t size) { + Future truncate(int64_t size) override { //TraceEvent("AsyncFileNonDurable_Truncate", id).detail("Filename", filename).detail("Offset", size); debugFileTruncate("AsyncFileNonDurableTruncate", filename, size); diff --git a/fdbrpc/AsyncFileReadAhead.actor.h b/fdbrpc/AsyncFileReadAhead.actor.h index 38e7b2fa41..c27375194f 100644 --- a/fdbrpc/AsyncFileReadAhead.actor.h +++ b/fdbrpc/AsyncFileReadAhead.actor.h @@ -155,27 +155,27 @@ public: return wpos; } - virtual Future read( void *data, int length, int64_t offset ) { + Future read(void* data, int length, int64_t offset) override { return read_impl(Reference::addRef(this), data, length, offset); } - virtual Future write( void const *data, int length, int64_t offset ) { throw file_not_writable(); } - virtual Future truncate( int64_t size ) { throw file_not_writable(); } + Future write(void const* data, int length, int64_t offset) override { throw file_not_writable(); } + Future truncate(int64_t size) override { throw file_not_writable(); } - virtual Future sync() { return Void(); } - virtual Future flush() { return Void(); } + Future sync() override { return Void(); } + Future flush() override { return Void(); } Future size() const override { return m_f->size(); } - virtual Future readZeroCopy( void** data, int* length, int64_t offset ) { + Future readZeroCopy(void** data, int* length, int64_t offset) override { TraceEvent(SevError, "ReadZeroCopyNotSupported").detail("FileType", "ReadAheadCache"); return platform_error(); } - virtual void releaseZeroCopy( void* data, int length, int64_t offset ) {} + void releaseZeroCopy(void* data, int length, int64_t offset) override {} int64_t debugFD() const override { return -1; } - virtual std::string getFilename() const override { return m_f->getFilename(); } + std::string getFilename() const override { return m_f->getFilename(); } virtual ~AsyncFileReadAheadCache() { for(auto &it : m_blocks) { diff --git a/fdbrpc/sim2.actor.cpp b/fdbrpc/sim2.actor.cpp index a73dc53136..45500d4675 100644 --- a/fdbrpc/sim2.actor.cpp +++ b/fdbrpc/sim2.actor.cpp @@ -480,25 +480,19 @@ public: int64_t debugFD() const override { return (int64_t)h; } - virtual Future read( void* data, int length, int64_t offset ) { - return read_impl( this, data, length, offset ); - } + Future read(void* data, int length, int64_t offset) override { return read_impl(this, data, length, offset); } - virtual Future write( void const* data, int length, int64_t offset ) { + Future write(void const* data, int length, int64_t offset) override { return write_impl( this, StringRef((const uint8_t*)data, length), offset ); } - virtual Future truncate( int64_t size ) { - return truncate_impl( this, size ); - } + Future truncate(int64_t size) override { return truncate_impl(this, size); } - virtual Future sync() { - return sync_impl( this ); - } + Future sync() override { return sync_impl(this); } Future size() const override { return size_impl(this); } - virtual std::string getFilename() const override { return actualFilename; } + std::string getFilename() const override { return actualFilename; } ~SimpleFile() { _close( h );