@ -40,6 +40,7 @@ class FlushJobTest : public testing::Test {
EXPECT_OK ( env_ - > CreateDirIfMissing ( dbname_ ) ) ;
db_options_ . db_paths . emplace_back ( dbname_ ,
std : : numeric_limits < uint64_t > : : max ( ) ) ;
db_options_ . statistics = rocksdb : : CreateDBStatistics ( ) ;
// TODO(icanadi) Remove this once we mock out VersionSet
NewDB ( ) ;
std : : vector < ColumnFamilyDescriptor > column_families ;
@ -138,16 +139,22 @@ TEST_F(FlushJobTest, NonEmpty) {
EventLogger event_logger ( db_options_ . info_log . get ( ) ) ;
SnapshotChecker * snapshot_checker = nullptr ; // not relavant
FlushJob flush_job (
dbname_ , versions_ - > GetColumnFamilySet ( ) - > GetDefault ( ) , db_options_ ,
* cfd - > GetLatestMutableCFOptions ( ) , env_options_ , versions_ . get ( ) , & mutex_ ,
& shutting_down_ , { } , kMaxSequenceNumber , snapshot_checker , & job_context ,
nullptr , nullptr , nullptr , kNoCompression , nullptr , & event_logger , true ) ;
FlushJob flush_job ( dbname_ , versions_ - > GetColumnFamilySet ( ) - > GetDefault ( ) ,
db_options_ , * cfd - > GetLatestMutableCFOptions ( ) ,
env_options_ , versions_ . get ( ) , & mutex_ , & shutting_down_ ,
{ } , kMaxSequenceNumber , snapshot_checker , & job_context ,
nullptr , nullptr , nullptr , kNoCompression ,
db_options_ . statistics . get ( ) , & event_logger , true ) ;
HistogramData hist ;
FileMetaData fd ;
mutex_ . Lock ( ) ;
flush_job . PickMemTable ( ) ;
ASSERT_OK ( flush_job . Run ( & fd ) ) ;
mutex_ . Unlock ( ) ;
db_options_ . statistics - > histogramData ( FLUSH_TIME , & hist ) ;
ASSERT_GT ( hist . average , 0.0 ) ;
ASSERT_EQ ( ToString ( 0 ) , fd . smallest . user_key ( ) . ToString ( ) ) ;
ASSERT_EQ ( " 9999a " ,
fd . largest . user_key ( ) . ToString ( ) ) ; // range tombstone end key
@ -210,12 +217,15 @@ TEST_F(FlushJobTest, Snapshots) {
env_options_ , versions_ . get ( ) , & mutex_ , & shutting_down_ ,
snapshots , kMaxSequenceNumber , snapshot_checker ,
& job_context , nullptr , nullptr , nullptr , kNoCompression ,
nullptr , & event_logger , true ) ;
db_options_ . statistics . get ( ) , & event_logger , true ) ;
mutex_ . Lock ( ) ;
flush_job . PickMemTable ( ) ;
ASSERT_OK ( flush_job . Run ( ) ) ;
mutex_ . Unlock ( ) ;
mock_table_factory_ - > AssertSingleFile ( inserted_keys ) ;
HistogramData hist ;
db_options_ . statistics - > histogramData ( FLUSH_TIME , & hist ) ;
ASSERT_GT ( hist . average , 0.0 ) ;
job_context . Clean ( ) ;
}