@ -231,6 +231,20 @@ class SpecialEnv : public EnvWrapper {
return base_ - > Append ( data ) ;
}
}
Status PositionedAppend ( const Slice & data , uint64_t offset ) {
if ( env_ - > table_write_callback_ ) {
( * env_ - > table_write_callback_ ) ( ) ;
}
if ( env_ - > drop_writes_ . load ( std : : memory_order_acquire ) ) {
// Drop writes on the floor
return Status : : OK ( ) ;
} else if ( env_ - > no_space_ . load ( std : : memory_order_acquire ) ) {
return Status : : NoSpace ( " No space left on device " ) ;
} else {
env_ - > bytes_written_ + = data . size ( ) ;
return base_ - > PositionedAppend ( data , offset ) ;
}
}
Status Truncate ( uint64_t size ) override { return base_ - > Truncate ( size ) ; }
Status Close ( ) override {
// SyncPoint is not supported in Released Windows Mode.
@ -257,6 +271,9 @@ class SpecialEnv : public EnvWrapper {
Env : : IOPriority GetIOPriority ( ) override {
return base_ - > GetIOPriority ( ) ;
}
bool use_direct_io ( ) const override {
return base_ - > use_direct_io ( ) ;
}
} ;
class ManifestFile : public WritableFile {
public :
@ -358,7 +375,14 @@ class SpecialEnv : public EnvWrapper {
return Status : : IOError ( " simulated write error " ) ;
}
Status s = target ( ) - > NewWritableFile ( f , r , soptions ) ;
EnvOptions optimized = soptions ;
if ( strstr ( f . c_str ( ) , " MANIFEST " ) ! = nullptr | |
strstr ( f . c_str ( ) , " log " ) ! = nullptr ) {
optimized . use_mmap_writes = false ;
optimized . use_direct_writes = false ;
}
Status s = target ( ) - > NewWritableFile ( f , r , optimized ) ;
if ( s . ok ( ) ) {
if ( strstr ( f . c_str ( ) , " .sst " ) ! = nullptr ) {
r - > reset ( new SSTableFile ( this , std : : move ( * r ) ) ) ;