@ -231,11 +231,11 @@ TEST_F(DBTest, SkipDelay) {
std : : atomic < int > sleep_count ( 0 ) ;
std : : atomic < int > sleep_count ( 0 ) ;
rocksdb : : SyncPoint : : GetInstance ( ) - > SetCallBack (
rocksdb : : SyncPoint : : GetInstance ( ) - > SetCallBack (
" DBImpl::DelayWrite:Sleep " ,
" DBImpl::DelayWrite:Sleep " ,
[ & ] ( void * arg ) { sleep_count . fetch_add ( 1 ) ; } ) ;
[ & ] ( void * /*arg*/ ) { sleep_count . fetch_add ( 1 ) ; } ) ;
std : : atomic < int > wait_count ( 0 ) ;
std : : atomic < int > wait_count ( 0 ) ;
rocksdb : : SyncPoint : : GetInstance ( ) - > SetCallBack (
rocksdb : : SyncPoint : : GetInstance ( ) - > SetCallBack (
" DBImpl::DelayWrite:Wait " ,
" DBImpl::DelayWrite:Wait " ,
[ & ] ( void * arg ) { wait_count . fetch_add ( 1 ) ; } ) ;
[ & ] ( void * /*arg*/ ) { wait_count . fetch_add ( 1 ) ; } ) ;
rocksdb : : SyncPoint : : GetInstance ( ) - > EnableProcessing ( ) ;
rocksdb : : SyncPoint : : GetInstance ( ) - > EnableProcessing ( ) ;
WriteOptions wo ;
WriteOptions wo ;
@ -715,9 +715,9 @@ TEST_F(DBTest, FlushSchedule) {
namespace {
namespace {
class KeepFilter : public CompactionFilter {
class KeepFilter : public CompactionFilter {
public :
public :
virtual bool Filter ( int level , const Slice & key , const Slice & value ,
virtual bool Filter ( int /*level*/ , const Slice & /*key*/ ,
std : : string * new_value ,
const Slice & /*value*/ , std : : string * /*new_value*/ ,
bool * value_changed ) const override {
bool * /*value_changed*/ ) const override {
return false ;
return false ;
}
}
@ -747,9 +747,9 @@ class KeepFilterFactory : public CompactionFilterFactory {
class DelayFilter : public CompactionFilter {
class DelayFilter : public CompactionFilter {
public :
public :
explicit DelayFilter ( DBTestBase * d ) : db_test ( d ) { }
explicit DelayFilter ( DBTestBase * d ) : db_test ( d ) { }
virtual bool Filter ( int level , const Slice & key , const Slice & value ,
virtual bool Filter ( int /*level*/ , const Slice & /*key*/ ,
std : : string * new_value ,
const Slice & /*value*/ , std : : string * /*new_value*/ ,
bool * value_changed ) const override {
bool * /*value_changed*/ ) const override {
db_test - > env_ - > addon_time_ . fetch_add ( 1000 ) ;
db_test - > env_ - > addon_time_ . fetch_add ( 1000 ) ;
return true ;
return true ;
}
}
@ -764,7 +764,7 @@ class DelayFilterFactory : public CompactionFilterFactory {
public :
public :
explicit DelayFilterFactory ( DBTestBase * d ) : db_test ( d ) { }
explicit DelayFilterFactory ( DBTestBase * d ) : db_test ( d ) { }
virtual std : : unique_ptr < CompactionFilter > CreateCompactionFilter (
virtual std : : unique_ptr < CompactionFilter > CreateCompactionFilter (
const CompactionFilter : : Context & context ) override {
const CompactionFilter : : Context & /*context*/ ) override {
return std : : unique_ptr < CompactionFilter > ( new DelayFilter ( db_test ) ) ;
return std : : unique_ptr < CompactionFilter > ( new DelayFilter ( db_test ) ) ;
}
}
@ -2210,17 +2210,17 @@ class ModelDB : public DB {
return Write ( o , & batch ) ;
return Write ( o , & batch ) ;
}
}
using DB : : Get ;
using DB : : Get ;
virtual Status Get ( const ReadOptions & options , ColumnFamilyHandle * cf ,
virtual Status Get ( const ReadOptions & /*options*/ , ColumnFamilyHandle * /*cf*/ ,
const Slice & key , PinnableSlice * value ) override {
const Slice & key , PinnableSlice * /*value*/ ) override {
return Status : : NotSupported ( key ) ;
return Status : : NotSupported ( key ) ;
}
}
using DB : : MultiGet ;
using DB : : MultiGet ;
virtual std : : vector < Status > MultiGet (
virtual std : : vector < Status > MultiGet (
const ReadOptions & options ,
const ReadOptions & /*options*/ ,
const std : : vector < ColumnFamilyHandle * > & column_family ,
const std : : vector < ColumnFamilyHandle * > & /*column_family*/ ,
const std : : vector < Slice > & keys ,
const std : : vector < Slice > & keys ,
std : : vector < std : : string > * values ) override {
std : : vector < std : : string > * /*values*/ ) override {
std : : vector < Status > s ( keys . size ( ) ,
std : : vector < Status > s ( keys . size ( ) ,
Status : : NotSupported ( " Not implemented. " ) ) ;
Status : : NotSupported ( " Not implemented. " ) ) ;
return s ;
return s ;
@ -2229,30 +2229,30 @@ class ModelDB : public DB {
# ifndef ROCKSDB_LITE
# ifndef ROCKSDB_LITE
using DB : : IngestExternalFile ;
using DB : : IngestExternalFile ;
virtual Status IngestExternalFile (
virtual Status IngestExternalFile (
ColumnFamilyHandle * column_family ,
ColumnFamilyHandle * /*column_family*/ ,
const std : : vector < std : : string > & external_files ,
const std : : vector < std : : string > & /*external_files*/ ,
const IngestExternalFileOptions & options ) override {
const IngestExternalFileOptions & /*options*/ ) override {
return Status : : NotSupported ( " Not implemented. " ) ;
return Status : : NotSupported ( " Not implemented. " ) ;
}
}
using DB : : GetPropertiesOfAllTables ;
using DB : : GetPropertiesOfAllTables ;
virtual Status GetPropertiesOfAllTables (
virtual Status GetPropertiesOfAllTables (
ColumnFamilyHandle * column_family ,
ColumnFamilyHandle * /*column_family*/ ,
TablePropertiesCollection * props ) override {
TablePropertiesCollection * /*props*/ ) override {
return Status ( ) ;
return Status ( ) ;
}
}
virtual Status GetPropertiesOfTablesInRange (
virtual Status GetPropertiesOfTablesInRange (
ColumnFamilyHandle * column_family , const Range * range , std : : size_t n ,
ColumnFamilyHandle * /*column_family*/ , const Range * /*range*/ ,
TablePropertiesCollection * props ) override {
std : : size_t /*n*/ , TablePropertiesCollection * /*props*/ ) override {
return Status ( ) ;
return Status ( ) ;
}
}
# endif // ROCKSDB_LITE
# endif // ROCKSDB_LITE
using DB : : KeyMayExist ;
using DB : : KeyMayExist ;
virtual bool KeyMayExist ( const ReadOptions & options ,
virtual bool KeyMayExist ( const ReadOptions & /*options*/ ,
ColumnFamilyHandle * column_family , const Slice & key ,
ColumnFamilyHandle * /*column_family*/ ,
std : : string * value ,
const Slice & /*key*/ , std : : string * /*value*/ ,
bool * value_found = nullptr ) override {
bool * value_found = nullptr ) override {
if ( value_found ! = nullptr ) {
if ( value_found ! = nullptr ) {
* value_found = false ;
* value_found = false ;
@ -2260,8 +2260,9 @@ class ModelDB : public DB {
return true ; // Not Supported directly
return true ; // Not Supported directly
}
}
using DB : : NewIterator ;
using DB : : NewIterator ;
virtual Iterator * NewIterator ( const ReadOptions & options ,
virtual Iterator * NewIterator (
ColumnFamilyHandle * column_family ) override {
const ReadOptions & options ,
ColumnFamilyHandle * /*column_family*/ ) override {
if ( options . snapshot = = nullptr ) {
if ( options . snapshot = = nullptr ) {
KVMap * saved = new KVMap ;
KVMap * saved = new KVMap ;
* saved = map_ ;
* saved = map_ ;
@ -2273,9 +2274,9 @@ class ModelDB : public DB {
}
}
}
}
virtual Status NewIterators (
virtual Status NewIterators (
const ReadOptions & options ,
const ReadOptions & /*options*/ ,
const std : : vector < ColumnFamilyHandle * > & column_family ,
const std : : vector < ColumnFamilyHandle * > & /*column_family*/ ,
std : : vector < Iterator * > * iterators ) override {
std : : vector < Iterator * > * /*iterators*/ ) override {
return Status : : NotSupported ( " Not supported yet " ) ;
return Status : : NotSupported ( " Not supported yet " ) ;
}
}
virtual const Snapshot * GetSnapshot ( ) override {
virtual const Snapshot * GetSnapshot ( ) override {
@ -2288,7 +2289,7 @@ class ModelDB : public DB {
delete reinterpret_cast < const ModelSnapshot * > ( snapshot ) ;
delete reinterpret_cast < const ModelSnapshot * > ( snapshot ) ;
}
}
virtual Status Write ( const WriteOptions & options ,
virtual Status Write ( const WriteOptions & /*options*/ ,
WriteBatch * batch ) override {
WriteBatch * batch ) override {
class Handler : public WriteBatch : : Handler {
class Handler : public WriteBatch : : Handler {
public :
public :
@ -2296,7 +2297,8 @@ class ModelDB : public DB {
virtual void Put ( const Slice & key , const Slice & value ) override {
virtual void Put ( const Slice & key , const Slice & value ) override {
( * map_ ) [ key . ToString ( ) ] = value . ToString ( ) ;
( * map_ ) [ key . ToString ( ) ] = value . ToString ( ) ;
}
}
virtual void Merge ( const Slice & key , const Slice & value ) override {
virtual void Merge ( const Slice & /*key*/ ,
const Slice & /*value*/ ) override {
// ignore merge for now
// ignore merge for now
// (*map_)[key.ToString()] = value.ToString();
// (*map_)[key.ToString()] = value.ToString();
}
}
@ -2310,62 +2312,65 @@ class ModelDB : public DB {
}
}
using DB : : GetProperty ;
using DB : : GetProperty ;
virtual bool GetProperty ( ColumnFamilyHandle * column_family ,
virtual bool GetProperty ( ColumnFamilyHandle * /*column_family*/ ,
const Slice & property , std : : string * value ) override {
const Slice & /*property*/ ,
std : : string * /*value*/ ) override {
return false ;
return false ;
}
}
using DB : : GetIntProperty ;
using DB : : GetIntProperty ;
virtual bool GetIntProperty ( ColumnFamilyHandle * column_family ,
virtual bool GetIntProperty ( ColumnFamilyHandle * /*column_family*/ ,
const Slice & property , uint64_t * value ) override {
const Slice & /*property*/ ,
uint64_t * /*value*/ ) override {
return false ;
return false ;
}
}
using DB : : GetMapProperty ;
using DB : : GetMapProperty ;
virtual bool GetMapProperty ( ColumnFamilyHandle * column_family ,
virtual bool GetMapProperty (
const Slice & property ,
ColumnFamilyHandle * /*column_family*/ , const Slice & /*property*/ ,
std : : map < std : : string , double > * value ) override {
std : : map < std : : string , double > * /*value*/ ) override {
return false ;
return false ;
}
}
using DB : : GetAggregatedIntProperty ;
using DB : : GetAggregatedIntProperty ;
virtual bool GetAggregatedIntProperty ( const Slice & property ,
virtual bool GetAggregatedIntProperty ( const Slice & /*property*/ ,
uint64_t * value ) override {
uint64_t * /*value*/ ) override {
return false ;
return false ;
}
}
using DB : : GetApproximateSizes ;
using DB : : GetApproximateSizes ;
virtual void GetApproximateSizes ( ColumnFamilyHandle * column_family ,
virtual void GetApproximateSizes ( ColumnFamilyHandle * /*column_family*/ ,
const Range * range , int n , uint64_t * sizes ,
const Range * /*range*/ , int n ,
uint8_t include_flags
uint64_t * sizes ,
uint8_t /*include_flags*/
= INCLUDE_FILES ) override {
= INCLUDE_FILES ) override {
for ( int i = 0 ; i < n ; i + + ) {
for ( int i = 0 ; i < n ; i + + ) {
sizes [ i ] = 0 ;
sizes [ i ] = 0 ;
}
}
}
}
using DB : : GetApproximateMemTableStats ;
using DB : : GetApproximateMemTableStats ;
virtual void GetApproximateMemTableStats ( ColumnFamilyHandle * column_family ,
virtual void GetApproximateMemTableStats (
const Range & range ,
ColumnFamilyHandle * /*column_family*/ , const Range & /*range*/ ,
uint64_t * const count ,
uint64_t * const count , uint64_t * const size ) override {
uint64_t * const size ) override {
* count = 0 ;
* count = 0 ;
* size = 0 ;
* size = 0 ;
}
}
using DB : : CompactRange ;
using DB : : CompactRange ;
virtual Status CompactRange ( const CompactRangeOptions & options ,
virtual Status CompactRange ( const CompactRangeOptions & /*options*/ ,
ColumnFamilyHandle * column_family ,
ColumnFamilyHandle * /*column_family*/ ,
const Slice * start , const Slice * end ) override {
const Slice * /*start*/ ,
const Slice * /*end*/ ) override {
return Status : : NotSupported ( " Not supported operation. " ) ;
return Status : : NotSupported ( " Not supported operation. " ) ;
}
}
virtual Status SetDBOptions (
virtual Status SetDBOptions (
const std : : unordered_map < std : : string , std : : string > & new_options )
const std : : unordered_map < std : : string , std : : string > & /*new_options*/ )
override {
override {
return Status : : NotSupported ( " Not supported operation. " ) ;
return Status : : NotSupported ( " Not supported operation. " ) ;
}
}
using DB : : CompactFiles ;
using DB : : CompactFiles ;
virtual Status CompactFiles ( const CompactionOptions & compact_options ,
virtual Status CompactFiles (
ColumnFamilyHandle * column_family ,
const CompactionOptions & /*compact_options*/ ,
const std : : vector < std : : string > & input_file_names ,
ColumnFamilyHandle * /*column_family*/ ,
const int output_level ,
const std : : vector < std : : string > & /*input_file_names*/ ,
const int output_path_id = - 1 ) override {
const int /*output_level*/ , const int /*output_path_id*/ = - 1 ) override {
return Status : : NotSupported ( " Not supported operation. " ) ;
return Status : : NotSupported ( " Not supported operation. " ) ;
}
}
@ -2378,24 +2383,25 @@ class ModelDB : public DB {
}
}
Status EnableAutoCompaction (
Status EnableAutoCompaction (
const std : : vector < ColumnFamilyHandle * > & column_family_handles ) override {
const std : : vector < ColumnFamilyHandle * > & /*column_family_handles*/ )
override {
return Status : : NotSupported ( " Not supported operation. " ) ;
return Status : : NotSupported ( " Not supported operation. " ) ;
}
}
using DB : : NumberLevels ;
using DB : : NumberLevels ;
virtual int NumberLevels ( ColumnFamilyHandle * column_family ) override {
virtual int NumberLevels ( ColumnFamilyHandle * /*column_family*/ ) override {
return 1 ;
return 1 ;
}
}
using DB : : MaxMemCompactionLevel ;
using DB : : MaxMemCompactionLevel ;
virtual int MaxMemCompactionLevel (
virtual int MaxMemCompactionLevel (
ColumnFamilyHandle * column_family ) override {
ColumnFamilyHandle * /*column_family*/ ) override {
return 1 ;
return 1 ;
}
}
using DB : : Level0StopWriteTrigger ;
using DB : : Level0StopWriteTrigger ;
virtual int Level0StopWriteTrigger (
virtual int Level0StopWriteTrigger (
ColumnFamilyHandle * column_family ) override {
ColumnFamilyHandle * /*column_family*/ ) override {
return - 1 ;
return - 1 ;
}
}
@ -2404,7 +2410,8 @@ class ModelDB : public DB {
virtual Env * GetEnv ( ) const override { return nullptr ; }
virtual Env * GetEnv ( ) const override { return nullptr ; }
using DB : : GetOptions ;
using DB : : GetOptions ;
virtual Options GetOptions ( ColumnFamilyHandle * column_family ) const override {
virtual Options GetOptions (
ColumnFamilyHandle * /*column_family*/ ) const override {
return options_ ;
return options_ ;
}
}
@ -2412,8 +2419,8 @@ class ModelDB : public DB {
virtual DBOptions GetDBOptions ( ) const override { return options_ ; }
virtual DBOptions GetDBOptions ( ) const override { return options_ ; }
using DB : : Flush ;
using DB : : Flush ;
virtual Status Flush ( const rocksdb : : FlushOptions & options ,
virtual Status Flush ( const rocksdb : : FlushOptions & /*options*/ ,
ColumnFamilyHandle * column_family ) override {
ColumnFamilyHandle * /*column_family*/ ) override {
Status ret ;
Status ret ;
return ret ;
return ret ;
}
}
@ -2423,33 +2430,35 @@ class ModelDB : public DB {
# ifndef ROCKSDB_LITE
# ifndef ROCKSDB_LITE
virtual Status DisableFileDeletions ( ) override { return Status : : OK ( ) ; }
virtual Status DisableFileDeletions ( ) override { return Status : : OK ( ) ; }
virtual Status EnableFileDeletions ( bool force ) override {
virtual Status EnableFileDeletions ( bool /*force*/ ) override {
return Status : : OK ( ) ;
return Status : : OK ( ) ;
}
}
virtual Status GetLiveFiles ( std : : vector < std : : string > & , uint64_t * size ,
virtual Status GetLiveFiles ( std : : vector < std : : string > & , uint64_t * /*size*/ ,
bool flush_memtable = true ) override {
bool /*flush_memtable*/ = true ) override {
return Status : : OK ( ) ;
return Status : : OK ( ) ;
}
}
virtual Status GetSortedWalFiles ( VectorLogPtr & files ) override {
virtual Status GetSortedWalFiles ( VectorLogPtr & /*files*/ ) override {
return Status : : OK ( ) ;
return Status : : OK ( ) ;
}
}
virtual Status DeleteFile ( std : : string name ) override { return Status : : OK ( ) ; }
virtual Status DeleteFile ( std : : string /*name*/ ) override {
return Status : : OK ( ) ;
}
virtual Status GetUpdatesSince (
virtual Status GetUpdatesSince (
rocksdb : : SequenceNumber , unique_ptr < rocksdb : : TransactionLogIterator > * ,
rocksdb : : SequenceNumber , unique_ptr < rocksdb : : TransactionLogIterator > * ,
const TransactionLogIterator : : ReadOptions & read_options =
const TransactionLogIterator : : ReadOptions & /*read_options*/ =
TransactionLogIterator : : ReadOptions ( ) ) override {
TransactionLogIterator : : ReadOptions ( ) ) override {
return Status : : NotSupported ( " Not supported in Model DB " ) ;
return Status : : NotSupported ( " Not supported in Model DB " ) ;
}
}
virtual void GetColumnFamilyMetaData (
virtual void GetColumnFamilyMetaData (
ColumnFamilyHandle * column_family ,
ColumnFamilyHandle * /*column_family*/ ,
ColumnFamilyMetaData * metadata ) override { }
ColumnFamilyMetaData * /*metadata*/ ) override { }
# endif // ROCKSDB_LITE
# endif // ROCKSDB_LITE
virtual Status GetDbIdentity ( std : : string & identity ) const override {
virtual Status GetDbIdentity ( std : : string & /*identity*/ ) const override {
return Status : : OK ( ) ;
return Status : : OK ( ) ;
}
}
@ -3322,7 +3331,7 @@ TEST_F(DBTest, DynamicMemtableOptions) {
rocksdb : : SyncPoint : : GetInstance ( ) - > SetCallBack (
rocksdb : : SyncPoint : : GetInstance ( ) - > SetCallBack (
" DBImpl::DelayWrite:Wait " ,
" DBImpl::DelayWrite:Wait " ,
[ & ] ( void * arg ) { sleeping_task_low . WakeUp ( ) ; } ) ;
[ & ] ( void * /*arg*/ ) { sleeping_task_low . WakeUp ( ) ; } ) ;
rocksdb : : SyncPoint : : GetInstance ( ) - > EnableProcessing ( ) ;
rocksdb : : SyncPoint : : GetInstance ( ) - > EnableProcessing ( ) ;
while ( ! sleeping_task_low . WokenUp ( ) & & count < 256 ) {
while ( ! sleeping_task_low . WokenUp ( ) & & count < 256 ) {
@ -4530,7 +4539,7 @@ class DelayedMergeOperator : public MergeOperator {
public :
public :
explicit DelayedMergeOperator ( DBTest * d ) : db_test_ ( d ) { }
explicit DelayedMergeOperator ( DBTest * d ) : db_test_ ( d ) { }
virtual bool FullMergeV2 ( const MergeOperationInput & merge_in ,
virtual bool FullMergeV2 ( const MergeOperationInput & /*merge_in*/ ,
MergeOperationOutput * merge_out ) const override {
MergeOperationOutput * merge_out ) const override {
db_test_ - > env_ - > addon_time_ . fetch_add ( 1000 ) ;
db_test_ - > env_ - > addon_time_ . fetch_add ( 1000 ) ;
merge_out - > new_value = " " ;
merge_out - > new_value = " " ;
@ -4881,7 +4890,7 @@ TEST_F(DBTest, AutomaticConflictsWithManualCompaction) {
std : : atomic < int > callback_count ( 0 ) ;
std : : atomic < int > callback_count ( 0 ) ;
rocksdb : : SyncPoint : : GetInstance ( ) - > SetCallBack (
rocksdb : : SyncPoint : : GetInstance ( ) - > SetCallBack (
" DBImpl::BackgroundCompaction()::Conflict " ,
" DBImpl::BackgroundCompaction()::Conflict " ,
[ & ] ( void * arg ) { callback_count . fetch_add ( 1 ) ; } ) ;
[ & ] ( void * /*arg*/ ) { callback_count . fetch_add ( 1 ) ; } ) ;
rocksdb : : SyncPoint : : GetInstance ( ) - > EnableProcessing ( ) ;
rocksdb : : SyncPoint : : GetInstance ( ) - > EnableProcessing ( ) ;
CompactRangeOptions croptions ;
CompactRangeOptions croptions ;
croptions . exclusive_manual_compaction = false ;
croptions . exclusive_manual_compaction = false ;
@ -5080,7 +5089,7 @@ TEST_F(DBTest, HardLimit) {
std : : atomic < int > callback_count ( 0 ) ;
std : : atomic < int > callback_count ( 0 ) ;
rocksdb : : SyncPoint : : GetInstance ( ) - > SetCallBack ( " DBImpl::DelayWrite:Wait " ,
rocksdb : : SyncPoint : : GetInstance ( ) - > SetCallBack ( " DBImpl::DelayWrite:Wait " ,
[ & ] ( void * arg ) {
[ & ] ( void * /*arg*/ ) {
callback_count . fetch_add ( 1 ) ;
callback_count . fetch_add ( 1 ) ;
sleeping_task_low . WakeUp ( ) ;
sleeping_task_low . WakeUp ( ) ;
} ) ;
} ) ;
@ -5173,7 +5182,7 @@ TEST_F(DBTest, SoftLimit) {
// Only allow one compactin going through.
// Only allow one compactin going through.
rocksdb : : SyncPoint : : GetInstance ( ) - > SetCallBack (
rocksdb : : SyncPoint : : GetInstance ( ) - > SetCallBack (
" BackgroundCallCompaction:0 " , [ & ] ( void * arg ) {
" BackgroundCallCompaction:0 " , [ & ] ( void * /*arg*/ ) {
// Schedule a sleeping task.
// Schedule a sleeping task.
sleeping_task_low . Reset ( ) ;
sleeping_task_low . Reset ( ) ;
env_ - > Schedule ( & test : : SleepingBackgroundTask : : DoSleepTask ,
env_ - > Schedule ( & test : : SleepingBackgroundTask : : DoSleepTask ,