@ -57,9 +57,9 @@ class EnvCounter : public EnvWrapper {
std : : atomic < int > num_new_writable_file_ ;
std : : atomic < int > num_new_writable_file_ ;
} ;
} ;
class ColumnFamilyTest : public testing : : Test {
class ColumnFamilyTestBase : public testing : : Test {
public :
public :
ColumnFamilyTest ( ) : rnd_ ( 139 ) {
ColumnFamilyTestBase ( uint32_t format ) : rnd_ ( 139 ) , format_ ( format ) {
env_ = new EnvCounter ( Env : : Default ( ) ) ;
env_ = new EnvCounter ( Env : : Default ( ) ) ;
dbname_ = test : : TmpDir ( ) + " /column_family_test " ;
dbname_ = test : : TmpDir ( ) + " /column_family_test " ;
db_options_ . create_if_missing = true ;
db_options_ . create_if_missing = true ;
@ -68,7 +68,7 @@ class ColumnFamilyTest : public testing::Test {
DestroyDB ( dbname_ , Options ( db_options_ , column_family_options_ ) ) ;
DestroyDB ( dbname_ , Options ( db_options_ , column_family_options_ ) ) ;
}
}
~ ColumnFamilyTest ( ) {
virtual ~ ColumnFamilyTestBase ( ) {
std : : vector < ColumnFamilyDescriptor > column_families ;
std : : vector < ColumnFamilyDescriptor > column_families ;
for ( auto h : handles_ ) {
for ( auto h : handles_ ) {
ColumnFamilyDescriptor cfdescriptor ;
ColumnFamilyDescriptor cfdescriptor ;
@ -81,6 +81,12 @@ class ColumnFamilyTest : public testing::Test {
delete env_ ;
delete env_ ;
}
}
BlockBasedTableOptions GetBlockBasedTableOptions ( ) {
BlockBasedTableOptions options ;
options . format_version = format_ ;
return options ;
}
// Return the value to associate with the specified key
// Return the value to associate with the specified key
Slice Value ( int k , std : : string * storage ) {
Slice Value ( int k , std : : string * storage ) {
if ( k = = 0 ) {
if ( k = = 0 ) {
@ -516,9 +522,22 @@ class ColumnFamilyTest : public testing::Test {
DB * db_ = nullptr ;
DB * db_ = nullptr ;
EnvCounter * env_ ;
EnvCounter * env_ ;
Random rnd_ ;
Random rnd_ ;
uint32_t format_ ;
} ;
class ColumnFamilyTest
: public ColumnFamilyTestBase ,
virtual public : : testing : : WithParamInterface < uint32_t > {
public :
ColumnFamilyTest ( ) : ColumnFamilyTestBase ( GetParam ( ) ) { }
} ;
} ;
TEST_F ( ColumnFamilyTest , DontReuseColumnFamilyID ) {
INSTANTIATE_TEST_CASE_P ( FormatDef , ColumnFamilyTest ,
testing : : Values ( test : : kDefaultFormatVersion ) ) ;
INSTANTIATE_TEST_CASE_P ( FormatLatest , ColumnFamilyTest ,
testing : : Values ( test : : kLatestFormatVersion ) ) ;
TEST_P ( ColumnFamilyTest , DontReuseColumnFamilyID ) {
for ( int iter = 0 ; iter < 3 ; + + iter ) {
for ( int iter = 0 ; iter < 3 ; + + iter ) {
Open ( ) ;
Open ( ) ;
CreateColumnFamilies ( { " one " , " two " , " three " } ) ;
CreateColumnFamilies ( { " one " , " two " , " three " } ) ;
@ -537,7 +556,8 @@ TEST_F(ColumnFamilyTest, DontReuseColumnFamilyID) {
Reopen ( ) ;
Reopen ( ) ;
}
}
CreateColumnFamilies ( { " three2 " } ) ;
CreateColumnFamilies ( { " three2 " } ) ;
// ID 3 that was used for dropped column family "three" should not be reused
// ID 3 that was used for dropped column family "three" should not be
// reused
auto cfh3 = reinterpret_cast < ColumnFamilyHandleImpl * > ( handles_ [ 3 ] ) ;
auto cfh3 = reinterpret_cast < ColumnFamilyHandleImpl * > ( handles_ [ 3 ] ) ;
ASSERT_EQ ( 4U , cfh3 - > GetID ( ) ) ;
ASSERT_EQ ( 4U , cfh3 - > GetID ( ) ) ;
Close ( ) ;
Close ( ) ;
@ -546,7 +566,7 @@ TEST_F(ColumnFamilyTest, DontReuseColumnFamilyID) {
}
}
# ifndef ROCKSDB_LITE
# ifndef ROCKSDB_LITE
TEST_F ( ColumnFamilyTest , CreateCFRaceWithGetAggProperty ) {
TEST_P ( ColumnFamilyTest , CreateCFRaceWithGetAggProperty ) {
Open ( ) ;
Open ( ) ;
rocksdb : : SyncPoint : : GetInstance ( ) - > LoadDependency (
rocksdb : : SyncPoint : : GetInstance ( ) - > LoadDependency (
@ -569,10 +589,13 @@ TEST_F(ColumnFamilyTest, CreateCFRaceWithGetAggProperty) {
}
}
# endif // !ROCKSDB_LITE
# endif // !ROCKSDB_LITE
class FlushEmptyCFTestWithParam : public ColumnFamilyTest ,
class FlushEmptyCFTestWithParam
public testing : : WithParamInterface < bool > {
: public ColumnFamilyTestBase ,
virtual public testing : : WithParamInterface < std : : tuple < uint32_t , bool > > {
public :
public :
FlushEmptyCFTestWithParam ( ) { allow_2pc_ = GetParam ( ) ; }
FlushEmptyCFTestWithParam ( )
: ColumnFamilyTestBase ( std : : get < 0 > ( GetParam ( ) ) ) ,
allow_2pc_ ( std : : get < 1 > ( GetParam ( ) ) ) { }
// Required if inheriting from testing::WithParamInterface<>
// Required if inheriting from testing::WithParamInterface<>
static void SetUpTestCase ( ) { }
static void SetUpTestCase ( ) { }
@ -697,10 +720,16 @@ TEST_P(FlushEmptyCFTestWithParam, FlushEmptyCFTest2) {
db_options_ . env = env_ ;
db_options_ . env = env_ ;
}
}
INSTANTIATE_TEST_CASE_P ( FlushEmptyCFTestWithParam , FlushEmptyCFTestWithParam ,
INSTANTIATE_TEST_CASE_P (
: : testing : : Bool ( ) ) ;
FormatDef , FlushEmptyCFTestWithParam ,
testing : : Values ( std : : make_tuple ( test : : kDefaultFormatVersion , true ) ,
std : : make_tuple ( test : : kDefaultFormatVersion , false ) ) ) ;
INSTANTIATE_TEST_CASE_P (
FormatLatest , FlushEmptyCFTestWithParam ,
testing : : Values ( std : : make_tuple ( test : : kLatestFormatVersion , true ) ,
std : : make_tuple ( test : : kLatestFormatVersion , false ) ) ) ;
TEST_F ( ColumnFamilyTest , AddDrop ) {
TEST_P ( ColumnFamilyTest , AddDrop ) {
Open ( ) ;
Open ( ) ;
CreateColumnFamilies ( { " one " , " two " , " three " } ) ;
CreateColumnFamilies ( { " one " , " two " , " three " } ) ;
ASSERT_EQ ( " NOT_FOUND " , Get ( 1 , " fodor " ) ) ;
ASSERT_EQ ( " NOT_FOUND " , Get ( 1 , " fodor " ) ) ;
@ -726,7 +755,7 @@ TEST_F(ColumnFamilyTest, AddDrop) {
std : : vector < std : : string > ( { " default " , " four " , " three " } ) ) ;
std : : vector < std : : string > ( { " default " , " four " , " three " } ) ) ;
}
}
TEST_F ( ColumnFamilyTest , BulkAddDrop ) {
TEST_P ( ColumnFamilyTest , BulkAddDrop ) {
constexpr int kNumCF = 1000 ;
constexpr int kNumCF = 1000 ;
ColumnFamilyOptions cf_options ;
ColumnFamilyOptions cf_options ;
WriteOptions write_options ;
WriteOptions write_options ;
@ -764,7 +793,7 @@ TEST_F(ColumnFamilyTest, BulkAddDrop) {
ASSERT_TRUE ( families = = std : : vector < std : : string > ( { " default " } ) ) ;
ASSERT_TRUE ( families = = std : : vector < std : : string > ( { " default " } ) ) ;
}
}
TEST_F ( ColumnFamilyTest , DropTest ) {
TEST_P ( ColumnFamilyTest , DropTest ) {
// first iteration - dont reopen DB before dropping
// first iteration - dont reopen DB before dropping
// second iteration - reopen DB before dropping
// second iteration - reopen DB before dropping
for ( int iter = 0 ; iter < 2 ; + + iter ) {
for ( int iter = 0 ; iter < 2 ; + + iter ) {
@ -788,7 +817,7 @@ TEST_F(ColumnFamilyTest, DropTest) {
}
}
}
}
TEST_F ( ColumnFamilyTest , WriteBatchFailure ) {
TEST_P ( ColumnFamilyTest , WriteBatchFailure ) {
Open ( ) ;
Open ( ) ;
CreateColumnFamiliesAndReopen ( { " one " , " two " } ) ;
CreateColumnFamiliesAndReopen ( { " one " , " two " } ) ;
WriteBatch batch ;
WriteBatch batch ;
@ -806,7 +835,7 @@ TEST_F(ColumnFamilyTest, WriteBatchFailure) {
Close ( ) ;
Close ( ) ;
}
}
TEST_F ( ColumnFamilyTest , ReadWrite ) {
TEST_P ( ColumnFamilyTest , ReadWrite ) {
Open ( ) ;
Open ( ) ;
CreateColumnFamiliesAndReopen ( { " one " , " two " } ) ;
CreateColumnFamiliesAndReopen ( { " one " , " two " } ) ;
ASSERT_OK ( Put ( 0 , " foo " , " v1 " ) ) ;
ASSERT_OK ( Put ( 0 , " foo " , " v1 " ) ) ;
@ -830,7 +859,7 @@ TEST_F(ColumnFamilyTest, ReadWrite) {
Close ( ) ;
Close ( ) ;
}
}
TEST_F ( ColumnFamilyTest , IgnoreRecoveredLog ) {
TEST_P ( ColumnFamilyTest , IgnoreRecoveredLog ) {
std : : string backup_logs = dbname_ + " /backup_logs " ;
std : : string backup_logs = dbname_ + " /backup_logs " ;
// delete old files in backup_logs directory
// delete old files in backup_logs directory
@ -906,7 +935,7 @@ TEST_F(ColumnFamilyTest, IgnoreRecoveredLog) {
}
}
# ifndef ROCKSDB_LITE // TEST functions used are not supported
# ifndef ROCKSDB_LITE // TEST functions used are not supported
TEST_F ( ColumnFamilyTest , FlushTest ) {
TEST_P ( ColumnFamilyTest , FlushTest ) {
Open ( ) ;
Open ( ) ;
CreateColumnFamiliesAndReopen ( { " one " , " two " } ) ;
CreateColumnFamiliesAndReopen ( { " one " , " two " } ) ;
ASSERT_OK ( Put ( 0 , " foo " , " v1 " ) ) ;
ASSERT_OK ( Put ( 0 , " foo " , " v1 " ) ) ;
@ -954,7 +983,7 @@ TEST_F(ColumnFamilyTest, FlushTest) {
}
}
// Makes sure that obsolete log files get deleted
// Makes sure that obsolete log files get deleted
TEST_F ( ColumnFamilyTest , LogDeletionTest ) {
TEST_P ( ColumnFamilyTest , LogDeletionTest ) {
db_options_ . max_total_wal_size = std : : numeric_limits < uint64_t > : : max ( ) ;
db_options_ . max_total_wal_size = std : : numeric_limits < uint64_t > : : max ( ) ;
column_family_options_ . arena_block_size = 4 * 1024 ;
column_family_options_ . arena_block_size = 4 * 1024 ;
column_family_options_ . write_buffer_size = 128000 ; // 128KB
column_family_options_ . write_buffer_size = 128000 ; // 128KB
@ -1022,7 +1051,7 @@ TEST_F(ColumnFamilyTest, LogDeletionTest) {
}
}
# endif // !ROCKSDB_LITE
# endif // !ROCKSDB_LITE
TEST_F ( ColumnFamilyTest , CrashAfterFlush ) {
TEST_P ( ColumnFamilyTest , CrashAfterFlush ) {
std : : unique_ptr < FaultInjectionTestEnv > fault_env (
std : : unique_ptr < FaultInjectionTestEnv > fault_env (
new FaultInjectionTestEnv ( env_ ) ) ;
new FaultInjectionTestEnv ( env_ ) ) ;
db_options_ . env = fault_env . get ( ) ;
db_options_ . env = fault_env . get ( ) ;
@ -1054,7 +1083,7 @@ TEST_F(ColumnFamilyTest, CrashAfterFlush) {
db_options_ . env = env_ ;
db_options_ . env = env_ ;
}
}
TEST_F ( ColumnFamilyTest , OpenNonexistentColumnFamily ) {
TEST_P ( ColumnFamilyTest , OpenNonexistentColumnFamily ) {
ASSERT_OK ( TryOpen ( { " default " } ) ) ;
ASSERT_OK ( TryOpen ( { " default " } ) ) ;
Close ( ) ;
Close ( ) ;
ASSERT_TRUE ( TryOpen ( { " default " , " dne " } ) . IsInvalidArgument ( ) ) ;
ASSERT_TRUE ( TryOpen ( { " default " , " dne " } ) . IsInvalidArgument ( ) ) ;
@ -1062,7 +1091,7 @@ TEST_F(ColumnFamilyTest, OpenNonexistentColumnFamily) {
# ifndef ROCKSDB_LITE // WaitForFlush() is not supported
# ifndef ROCKSDB_LITE // WaitForFlush() is not supported
// Makes sure that obsolete log files get deleted
// Makes sure that obsolete log files get deleted
TEST_F ( ColumnFamilyTest , DifferentWriteBufferSizes ) {
TEST_P ( ColumnFamilyTest , DifferentWriteBufferSizes ) {
// disable flushing stale column families
// disable flushing stale column families
db_options_ . max_total_wal_size = std : : numeric_limits < uint64_t > : : max ( ) ;
db_options_ . max_total_wal_size = std : : numeric_limits < uint64_t > : : max ( ) ;
Open ( ) ;
Open ( ) ;
@ -1168,7 +1197,7 @@ TEST_F(ColumnFamilyTest, DifferentWriteBufferSizes) {
# endif // !ROCKSDB_LITE
# endif // !ROCKSDB_LITE
# ifndef ROCKSDB_LITE // Cuckoo is not supported in lite
# ifndef ROCKSDB_LITE // Cuckoo is not supported in lite
TEST_F ( ColumnFamilyTest , MemtableNotSupportSnapshot ) {
TEST_P ( ColumnFamilyTest , MemtableNotSupportSnapshot ) {
db_options_ . allow_concurrent_memtable_write = false ;
db_options_ . allow_concurrent_memtable_write = false ;
Open ( ) ;
Open ( ) ;
auto * s1 = dbfull ( ) - > GetSnapshot ( ) ;
auto * s1 = dbfull ( ) - > GetSnapshot ( ) ;
@ -1206,7 +1235,7 @@ static TestComparator third_comparator;
static TestComparator fourth_comparator ;
static TestComparator fourth_comparator ;
// Test that we can retrieve the comparator from a created CF
// Test that we can retrieve the comparator from a created CF
TEST_F ( ColumnFamilyTest , GetComparator ) {
TEST_P ( ColumnFamilyTest , GetComparator ) {
Open ( ) ;
Open ( ) ;
// Add a column family with no comparator specified
// Add a column family with no comparator specified
CreateColumnFamilies ( { " first " } ) ;
CreateColumnFamilies ( { " first " } ) ;
@ -1225,7 +1254,7 @@ TEST_F(ColumnFamilyTest, GetComparator) {
Close ( ) ;
Close ( ) ;
}
}
TEST_F ( ColumnFamilyTest , DifferentMergeOperators ) {
TEST_P ( ColumnFamilyTest , DifferentMergeOperators ) {
Open ( ) ;
Open ( ) ;
CreateColumnFamilies ( { " first " , " second " } ) ;
CreateColumnFamilies ( { " first " , " second " } ) ;
ColumnFamilyOptions default_cf , first , second ;
ColumnFamilyOptions default_cf , first , second ;
@ -1256,7 +1285,7 @@ TEST_F(ColumnFamilyTest, DifferentMergeOperators) {
}
}
# ifndef ROCKSDB_LITE // WaitForFlush() is not supported
# ifndef ROCKSDB_LITE // WaitForFlush() is not supported
TEST_F ( ColumnFamilyTest , DifferentCompactionStyles ) {
TEST_P ( ColumnFamilyTest , DifferentCompactionStyles ) {
Open ( ) ;
Open ( ) ;
CreateColumnFamilies ( { " one " , " two " } ) ;
CreateColumnFamilies ( { " one " , " two " } ) ;
ColumnFamilyOptions default_cf , one , two ;
ColumnFamilyOptions default_cf , one , two ;
@ -1268,7 +1297,7 @@ TEST_F(ColumnFamilyTest, DifferentCompactionStyles) {
default_cf . target_file_size_base = 30 < < 10 ;
default_cf . target_file_size_base = 30 < < 10 ;
default_cf . max_compaction_bytes = static_cast < uint64_t > ( 1 ) < < 60 ;
default_cf . max_compaction_bytes = static_cast < uint64_t > ( 1 ) < < 60 ;
BlockBasedTableOptions table_options ;
BlockBasedTableOptions table_options = GetBlockBasedTableOptions ( ) ;
table_options . no_block_cache = true ;
table_options . no_block_cache = true ;
default_cf . table_factory . reset ( NewBlockBasedTableFactory ( table_options ) ) ;
default_cf . table_factory . reset ( NewBlockBasedTableFactory ( table_options ) ) ;
@ -1328,7 +1357,7 @@ TEST_F(ColumnFamilyTest, DifferentCompactionStyles) {
# ifndef ROCKSDB_LITE
# ifndef ROCKSDB_LITE
// Sync points not supported in RocksDB Lite
// Sync points not supported in RocksDB Lite
TEST_F ( ColumnFamilyTest , MultipleManualCompactions ) {
TEST_P ( ColumnFamilyTest , MultipleManualCompactions ) {
Open ( ) ;
Open ( ) ;
CreateColumnFamilies ( { " one " , " two " } ) ;
CreateColumnFamilies ( { " one " , " two " } ) ;
ColumnFamilyOptions default_cf , one , two ;
ColumnFamilyOptions default_cf , one , two ;
@ -1340,7 +1369,7 @@ TEST_F(ColumnFamilyTest, MultipleManualCompactions) {
default_cf . write_buffer_size = 64 < < 10 ; // 64KB
default_cf . write_buffer_size = 64 < < 10 ; // 64KB
default_cf . target_file_size_base = 30 < < 10 ;
default_cf . target_file_size_base = 30 < < 10 ;
default_cf . max_compaction_bytes = default_cf . target_file_size_base * 1100 ;
default_cf . max_compaction_bytes = default_cf . target_file_size_base * 1100 ;
BlockBasedTableOptions table_options ;
BlockBasedTableOptions table_options = GetBlockBasedTableOptions ( ) ;
table_options . no_block_cache = true ;
table_options . no_block_cache = true ;
default_cf . table_factory . reset ( NewBlockBasedTableFactory ( table_options ) ) ;
default_cf . table_factory . reset ( NewBlockBasedTableFactory ( table_options ) ) ;
@ -1422,10 +1451,12 @@ TEST_F(ColumnFamilyTest, MultipleManualCompactions) {
ASSERT_NE ( " NOT_FOUND " , Get ( 1 , * key_iter ) ) ;
ASSERT_NE ( " NOT_FOUND " , Get ( 1 , * key_iter ) ) ;
key_iter + + ;
key_iter + + ;
}
}
rocksdb : : SyncPoint : : GetInstance ( ) - > DisableProcessing ( ) ;
rocksdb : : SyncPoint : : GetInstance ( ) - > ClearAllCallBacks ( ) ;
Close ( ) ;
Close ( ) ;
}
}
TEST_F ( ColumnFamilyTest , AutomaticAndManualCompactions ) {
TEST_P ( ColumnFamilyTest , AutomaticAndManualCompactions ) {
Open ( ) ;
Open ( ) ;
CreateColumnFamilies ( { " one " , " two " } ) ;
CreateColumnFamilies ( { " one " , " two " } ) ;
ColumnFamilyOptions default_cf , one , two ;
ColumnFamilyOptions default_cf , one , two ;
@ -1437,7 +1468,8 @@ TEST_F(ColumnFamilyTest, AutomaticAndManualCompactions) {
default_cf . write_buffer_size = 64 < < 10 ; // 64KB
default_cf . write_buffer_size = 64 < < 10 ; // 64KB
default_cf . target_file_size_base = 30 < < 10 ;
default_cf . target_file_size_base = 30 < < 10 ;
default_cf . max_compaction_bytes = default_cf . target_file_size_base * 1100 ;
default_cf . max_compaction_bytes = default_cf . target_file_size_base * 1100 ;
BlockBasedTableOptions table_options ;
BlockBasedTableOptions table_options = GetBlockBasedTableOptions ( ) ;
;
table_options . no_block_cache = true ;
table_options . no_block_cache = true ;
default_cf . table_factory . reset ( NewBlockBasedTableFactory ( table_options ) ) ;
default_cf . table_factory . reset ( NewBlockBasedTableFactory ( table_options ) ) ;
@ -1516,9 +1548,11 @@ TEST_F(ColumnFamilyTest, AutomaticAndManualCompactions) {
ASSERT_NE ( " NOT_FOUND " , Get ( 1 , * key_iter ) ) ;
ASSERT_NE ( " NOT_FOUND " , Get ( 1 , * key_iter ) ) ;
key_iter + + ;
key_iter + + ;
}
}
rocksdb : : SyncPoint : : GetInstance ( ) - > DisableProcessing ( ) ;
rocksdb : : SyncPoint : : GetInstance ( ) - > ClearAllCallBacks ( ) ;
}
}
TEST_F ( ColumnFamilyTest , ManualAndAutomaticCompactions ) {
TEST_P ( ColumnFamilyTest , ManualAndAutomaticCompactions ) {
Open ( ) ;
Open ( ) ;
CreateColumnFamilies ( { " one " , " two " } ) ;
CreateColumnFamilies ( { " one " , " two " } ) ;
ColumnFamilyOptions default_cf , one , two ;
ColumnFamilyOptions default_cf , one , two ;
@ -1530,7 +1564,8 @@ TEST_F(ColumnFamilyTest, ManualAndAutomaticCompactions) {
default_cf . write_buffer_size = 64 < < 10 ; // 64KB
default_cf . write_buffer_size = 64 < < 10 ; // 64KB
default_cf . target_file_size_base = 30 < < 10 ;
default_cf . target_file_size_base = 30 < < 10 ;
default_cf . max_compaction_bytes = default_cf . target_file_size_base * 1100 ;
default_cf . max_compaction_bytes = default_cf . target_file_size_base * 1100 ;
BlockBasedTableOptions table_options ;
BlockBasedTableOptions table_options = GetBlockBasedTableOptions ( ) ;
;
table_options . no_block_cache = true ;
table_options . no_block_cache = true ;
default_cf . table_factory . reset ( NewBlockBasedTableFactory ( table_options ) ) ;
default_cf . table_factory . reset ( NewBlockBasedTableFactory ( table_options ) ) ;
@ -1612,9 +1647,11 @@ TEST_F(ColumnFamilyTest, ManualAndAutomaticCompactions) {
ASSERT_NE ( " NOT_FOUND " , Get ( 1 , * key_iter ) ) ;
ASSERT_NE ( " NOT_FOUND " , Get ( 1 , * key_iter ) ) ;
key_iter + + ;
key_iter + + ;
}
}
rocksdb : : SyncPoint : : GetInstance ( ) - > DisableProcessing ( ) ;
rocksdb : : SyncPoint : : GetInstance ( ) - > ClearAllCallBacks ( ) ;
}
}
TEST_F ( ColumnFamilyTest , SameCFManualManualCompactions ) {
TEST_P ( ColumnFamilyTest , SameCFManualManualCompactions ) {
Open ( ) ;
Open ( ) ;
CreateColumnFamilies ( { " one " } ) ;
CreateColumnFamilies ( { " one " } ) ;
ColumnFamilyOptions default_cf , one ;
ColumnFamilyOptions default_cf , one ;
@ -1626,7 +1663,8 @@ TEST_F(ColumnFamilyTest, SameCFManualManualCompactions) {
default_cf . write_buffer_size = 64 < < 10 ; // 64KB
default_cf . write_buffer_size = 64 < < 10 ; // 64KB
default_cf . target_file_size_base = 30 < < 10 ;
default_cf . target_file_size_base = 30 < < 10 ;
default_cf . max_compaction_bytes = default_cf . target_file_size_base * 1100 ;
default_cf . max_compaction_bytes = default_cf . target_file_size_base * 1100 ;
BlockBasedTableOptions table_options ;
BlockBasedTableOptions table_options = GetBlockBasedTableOptions ( ) ;
;
table_options . no_block_cache = true ;
table_options . no_block_cache = true ;
default_cf . table_factory . reset ( NewBlockBasedTableFactory ( table_options ) ) ;
default_cf . table_factory . reset ( NewBlockBasedTableFactory ( table_options ) ) ;
@ -1711,9 +1749,11 @@ TEST_F(ColumnFamilyTest, SameCFManualManualCompactions) {
ASSERT_NE ( " NOT_FOUND " , Get ( 1 , * key_iter ) ) ;
ASSERT_NE ( " NOT_FOUND " , Get ( 1 , * key_iter ) ) ;
key_iter + + ;
key_iter + + ;
}
}
rocksdb : : SyncPoint : : GetInstance ( ) - > DisableProcessing ( ) ;
rocksdb : : SyncPoint : : GetInstance ( ) - > ClearAllCallBacks ( ) ;
}
}
TEST_F ( ColumnFamilyTest , SameCFManualAutomaticCompactions ) {
TEST_P ( ColumnFamilyTest , SameCFManualAutomaticCompactions ) {
Open ( ) ;
Open ( ) ;
CreateColumnFamilies ( { " one " } ) ;
CreateColumnFamilies ( { " one " } ) ;
ColumnFamilyOptions default_cf , one ;
ColumnFamilyOptions default_cf , one ;
@ -1725,7 +1765,8 @@ TEST_F(ColumnFamilyTest, SameCFManualAutomaticCompactions) {
default_cf . write_buffer_size = 64 < < 10 ; // 64KB
default_cf . write_buffer_size = 64 < < 10 ; // 64KB
default_cf . target_file_size_base = 30 < < 10 ;
default_cf . target_file_size_base = 30 < < 10 ;
default_cf . max_compaction_bytes = default_cf . target_file_size_base * 1100 ;
default_cf . max_compaction_bytes = default_cf . target_file_size_base * 1100 ;
BlockBasedTableOptions table_options ;
BlockBasedTableOptions table_options = GetBlockBasedTableOptions ( ) ;
;
table_options . no_block_cache = true ;
table_options . no_block_cache = true ;
default_cf . table_factory . reset ( NewBlockBasedTableFactory ( table_options ) ) ;
default_cf . table_factory . reset ( NewBlockBasedTableFactory ( table_options ) ) ;
@ -1801,9 +1842,11 @@ TEST_F(ColumnFamilyTest, SameCFManualAutomaticCompactions) {
ASSERT_NE ( " NOT_FOUND " , Get ( 1 , * key_iter ) ) ;
ASSERT_NE ( " NOT_FOUND " , Get ( 1 , * key_iter ) ) ;
key_iter + + ;
key_iter + + ;
}
}
rocksdb : : SyncPoint : : GetInstance ( ) - > DisableProcessing ( ) ;
rocksdb : : SyncPoint : : GetInstance ( ) - > ClearAllCallBacks ( ) ;
}
}
TEST_F ( ColumnFamilyTest , SameCFManualAutomaticCompactionsLevel ) {
TEST_P ( ColumnFamilyTest , SameCFManualAutomaticCompactionsLevel ) {
Open ( ) ;
Open ( ) ;
CreateColumnFamilies ( { " one " } ) ;
CreateColumnFamilies ( { " one " } ) ;
ColumnFamilyOptions default_cf , one ;
ColumnFamilyOptions default_cf , one ;
@ -1815,7 +1858,8 @@ TEST_F(ColumnFamilyTest, SameCFManualAutomaticCompactionsLevel) {
default_cf . write_buffer_size = 64 < < 10 ; // 64KB
default_cf . write_buffer_size = 64 < < 10 ; // 64KB
default_cf . target_file_size_base = 30 < < 10 ;
default_cf . target_file_size_base = 30 < < 10 ;
default_cf . max_compaction_bytes = default_cf . target_file_size_base * 1100 ;
default_cf . max_compaction_bytes = default_cf . target_file_size_base * 1100 ;
BlockBasedTableOptions table_options ;
BlockBasedTableOptions table_options = GetBlockBasedTableOptions ( ) ;
;
table_options . no_block_cache = true ;
table_options . no_block_cache = true ;
default_cf . table_factory . reset ( NewBlockBasedTableFactory ( table_options ) ) ;
default_cf . table_factory . reset ( NewBlockBasedTableFactory ( table_options ) ) ;
@ -1891,6 +1935,8 @@ TEST_F(ColumnFamilyTest, SameCFManualAutomaticCompactionsLevel) {
ASSERT_NE ( " NOT_FOUND " , Get ( 1 , * key_iter ) ) ;
ASSERT_NE ( " NOT_FOUND " , Get ( 1 , * key_iter ) ) ;
key_iter + + ;
key_iter + + ;
}
}
rocksdb : : SyncPoint : : GetInstance ( ) - > DisableProcessing ( ) ;
rocksdb : : SyncPoint : : GetInstance ( ) - > ClearAllCallBacks ( ) ;
}
}
// In this test, we generate enough files to trigger automatic compactions.
// In this test, we generate enough files to trigger automatic compactions.
@ -1899,7 +1945,7 @@ TEST_F(ColumnFamilyTest, SameCFManualAutomaticCompactionsLevel) {
// This will wait because the automatic compaction has files it needs.
// This will wait because the automatic compaction has files it needs.
// Once the conflict is hit, the automatic compaction starts and ends
// Once the conflict is hit, the automatic compaction starts and ends
// Then the manual will run and end.
// Then the manual will run and end.
TEST_F ( ColumnFamilyTest , SameCFAutomaticManualCompactions ) {
TEST_P ( ColumnFamilyTest , SameCFAutomaticManualCompactions ) {
Open ( ) ;
Open ( ) ;
CreateColumnFamilies ( { " one " } ) ;
CreateColumnFamilies ( { " one " } ) ;
ColumnFamilyOptions default_cf , one ;
ColumnFamilyOptions default_cf , one ;
@ -1911,7 +1957,8 @@ TEST_F(ColumnFamilyTest, SameCFAutomaticManualCompactions) {
default_cf . write_buffer_size = 64 < < 10 ; // 64KB
default_cf . write_buffer_size = 64 < < 10 ; // 64KB
default_cf . target_file_size_base = 30 < < 10 ;
default_cf . target_file_size_base = 30 < < 10 ;
default_cf . max_compaction_bytes = default_cf . target_file_size_base * 1100 ;
default_cf . max_compaction_bytes = default_cf . target_file_size_base * 1100 ;
BlockBasedTableOptions table_options ;
BlockBasedTableOptions table_options = GetBlockBasedTableOptions ( ) ;
;
table_options . no_block_cache = true ;
table_options . no_block_cache = true ;
default_cf . table_factory . reset ( NewBlockBasedTableFactory ( table_options ) ) ;
default_cf . table_factory . reset ( NewBlockBasedTableFactory ( table_options ) ) ;
@ -1980,6 +2027,8 @@ TEST_F(ColumnFamilyTest, SameCFAutomaticManualCompactions) {
ASSERT_NE ( " NOT_FOUND " , Get ( 1 , * key_iter ) ) ;
ASSERT_NE ( " NOT_FOUND " , Get ( 1 , * key_iter ) ) ;
key_iter + + ;
key_iter + + ;
}
}
rocksdb : : SyncPoint : : GetInstance ( ) - > DisableProcessing ( ) ;
rocksdb : : SyncPoint : : GetInstance ( ) - > ClearAllCallBacks ( ) ;
}
}
# endif // !ROCKSDB_LITE
# endif // !ROCKSDB_LITE
@ -1996,7 +2045,7 @@ std::string IterStatus(Iterator* iter) {
}
}
} // anonymous namespace
} // anonymous namespace
TEST_F ( ColumnFamilyTest , NewIteratorsTest ) {
TEST_P ( ColumnFamilyTest , NewIteratorsTest ) {
// iter == 0 -- no tailing
// iter == 0 -- no tailing
// iter == 2 -- tailing
// iter == 2 -- tailing
for ( int iter = 0 ; iter < 2 ; + + iter ) {
for ( int iter = 0 ; iter < 2 ; + + iter ) {
@ -2043,7 +2092,7 @@ TEST_F(ColumnFamilyTest, NewIteratorsTest) {
# endif // !ROCKSDB_LITE
# endif // !ROCKSDB_LITE
# ifndef ROCKSDB_LITE // ReadOnlyDB is not supported
# ifndef ROCKSDB_LITE // ReadOnlyDB is not supported
TEST_F ( ColumnFamilyTest , ReadOnlyDBTest ) {
TEST_P ( ColumnFamilyTest , ReadOnlyDBTest ) {
Open ( ) ;
Open ( ) ;
CreateColumnFamiliesAndReopen ( { " one " , " two " , " three " , " four " } ) ;
CreateColumnFamiliesAndReopen ( { " one " , " two " , " three " , " four " } ) ;
ASSERT_OK ( Put ( 0 , " a " , " b " ) ) ;
ASSERT_OK ( Put ( 0 , " a " , " b " ) ) ;
@ -2095,7 +2144,7 @@ TEST_F(ColumnFamilyTest, ReadOnlyDBTest) {
# endif // !ROCKSDB_LITE
# endif // !ROCKSDB_LITE
# ifndef ROCKSDB_LITE // WaitForFlush() is not supported in lite
# ifndef ROCKSDB_LITE // WaitForFlush() is not supported in lite
TEST_F ( ColumnFamilyTest , DontRollEmptyLogs ) {
TEST_P ( ColumnFamilyTest , DontRollEmptyLogs ) {
Open ( ) ;
Open ( ) ;
CreateColumnFamiliesAndReopen ( { " one " , " two " , " three " , " four " } ) ;
CreateColumnFamiliesAndReopen ( { " one " , " two " , " three " , " four " } ) ;
@ -2119,7 +2168,7 @@ TEST_F(ColumnFamilyTest, DontRollEmptyLogs) {
# endif // !ROCKSDB_LITE
# endif // !ROCKSDB_LITE
# ifndef ROCKSDB_LITE // WaitForCompaction() is not supported in lite
# ifndef ROCKSDB_LITE // WaitForCompaction() is not supported in lite
TEST_F ( ColumnFamilyTest , FlushStaleColumnFamilies ) {
TEST_P ( ColumnFamilyTest , FlushStaleColumnFamilies ) {
Open ( ) ;
Open ( ) ;
CreateColumnFamilies ( { " one " , " two " } ) ;
CreateColumnFamilies ( { " one " , " two " } ) ;
ColumnFamilyOptions default_cf , one , two ;
ColumnFamilyOptions default_cf , one , two ;
@ -2154,7 +2203,7 @@ TEST_F(ColumnFamilyTest, FlushStaleColumnFamilies) {
}
}
# endif // !ROCKSDB_LITE
# endif // !ROCKSDB_LITE
TEST_F ( ColumnFamilyTest , CreateMissingColumnFamilies ) {
TEST_P ( ColumnFamilyTest , CreateMissingColumnFamilies ) {
Status s = TryOpen ( { " one " , " two " } ) ;
Status s = TryOpen ( { " one " , " two " } ) ;
ASSERT_TRUE ( ! s . ok ( ) ) ;
ASSERT_TRUE ( ! s . ok ( ) ) ;
db_options_ . create_missing_column_families = true ;
db_options_ . create_missing_column_families = true ;
@ -2163,7 +2212,7 @@ TEST_F(ColumnFamilyTest, CreateMissingColumnFamilies) {
Close ( ) ;
Close ( ) ;
}
}
TEST_F ( ColumnFamilyTest , SanitizeOptions ) {
TEST_P ( ColumnFamilyTest , SanitizeOptions ) {
DBOptions db_options ;
DBOptions db_options ;
for ( int s = kCompactionStyleLevel ; s < = kCompactionStyleUniversal ; + + s ) {
for ( int s = kCompactionStyleLevel ; s < = kCompactionStyleUniversal ; + + s ) {
for ( int l = 0 ; l < = 2 ; l + + ) {
for ( int l = 0 ; l < = 2 ; l + + ) {
@ -2212,7 +2261,7 @@ TEST_F(ColumnFamilyTest, SanitizeOptions) {
}
}
}
}
TEST_F ( ColumnFamilyTest , ReadDroppedColumnFamily ) {
TEST_P ( ColumnFamilyTest , ReadDroppedColumnFamily ) {
// iter 0 -- drop CF, don't reopen
// iter 0 -- drop CF, don't reopen
// iter 1 -- delete CF, reopen
// iter 1 -- delete CF, reopen
for ( int iter = 0 ; iter < 2 ; + + iter ) {
for ( int iter = 0 ; iter < 2 ; + + iter ) {
@ -2284,7 +2333,7 @@ TEST_F(ColumnFamilyTest, ReadDroppedColumnFamily) {
}
}
}
}
TEST_F ( ColumnFamilyTest , FlushAndDropRaceCondition ) {
TEST_P ( ColumnFamilyTest , FlushAndDropRaceCondition ) {
db_options_ . create_missing_column_families = true ;
db_options_ . create_missing_column_families = true ;
Open ( { " default " , " one " } ) ;
Open ( { " default " , " one " } ) ;
ColumnFamilyOptions options ;
ColumnFamilyOptions options ;
@ -2350,12 +2399,13 @@ TEST_F(ColumnFamilyTest, FlushAndDropRaceCondition) {
// skipped as persisting options is not supported in ROCKSDB_LITE
// skipped as persisting options is not supported in ROCKSDB_LITE
namespace {
namespace {
std : : atomic < int > test_stage ( 0 ) ;
std : : atomic < int > test_stage ( 0 ) ;
std : : atomic < bool > ordered_by_writethread ( false ) ;
const int kMainThreadStartPersistingOptionsFile = 1 ;
const int kMainThreadStartPersistingOptionsFile = 1 ;
const int kChildThreadFinishDroppingColumnFamily = 2 ;
const int kChildThreadFinishDroppingColumnFamily = 2 ;
const int kChildThreadWaitingMainThreadPersistOptions = 3 ;
void DropSingleColumnFamily ( ColumnFamilyTest * cf_test , int cf_id ,
void DropSingleColumnFamily ( ColumnFamilyTest * cf_test , int cf_id ,
std : : vector < Comparator * > * comparators ) {
std : : vector < Comparator * > * comparators ) {
while ( test_stage < kMainThreadStartPersistingOptionsFile ) {
while ( test_stage < kMainThreadStartPersistingOptionsFile & &
! ordered_by_writethread ) {
Env : : Default ( ) - > SleepForMicroseconds ( 100 ) ;
Env : : Default ( ) - > SleepForMicroseconds ( 100 ) ;
}
}
cf_test - > DropColumnFamilies ( { cf_id } ) ;
cf_test - > DropColumnFamilies ( { cf_id } ) ;
@ -2367,7 +2417,7 @@ void DropSingleColumnFamily(ColumnFamilyTest* cf_test, int cf_id,
}
}
} // namespace
} // namespace
TEST_F ( ColumnFamilyTest , CreateAndDropRace ) {
TEST_P ( ColumnFamilyTest , CreateAndDropRace ) {
const int kCfCount = 5 ;
const int kCfCount = 5 ;
std : : vector < ColumnFamilyOptions > cf_opts ;
std : : vector < ColumnFamilyOptions > cf_opts ;
std : : vector < Comparator * > comparators ;
std : : vector < Comparator * > comparators ;
@ -2388,7 +2438,8 @@ TEST_F(ColumnFamilyTest, CreateAndDropRace) {
// will be blocked until some other thread update the test_stage.
// will be blocked until some other thread update the test_stage.
if ( main_thread_id = = current_thread_id ) {
if ( main_thread_id = = current_thread_id ) {
test_stage = kMainThreadStartPersistingOptionsFile ;
test_stage = kMainThreadStartPersistingOptionsFile ;
while ( test_stage < kChildThreadFinishDroppingColumnFamily ) {
while ( test_stage < kChildThreadFinishDroppingColumnFamily & &
! ordered_by_writethread ) {
Env : : Default ( ) - > SleepForMicroseconds ( 100 ) ;
Env : : Default ( ) - > SleepForMicroseconds ( 100 ) ;
}
}
}
}
@ -2399,11 +2450,7 @@ TEST_F(ColumnFamilyTest, CreateAndDropRace) {
// This means a thread doing DropColumnFamily() is waiting for
// This means a thread doing DropColumnFamily() is waiting for
// other thread to finish persisting options.
// other thread to finish persisting options.
// In such case, we update the test_stage to unblock the main thread.
// In such case, we update the test_stage to unblock the main thread.
test_stage = kChildThreadWaitingMainThreadPersistOptions ;
ordered_by_writethread = true ;
// Note that based on the test setting, this must not be the
// main thread.
ASSERT_NE ( main_thread_id , std : : this_thread : : get_id ( ) ) ;
} ) ;
} ) ;
// Create a database with four column families
// Create a database with four column families
@ -2414,7 +2461,8 @@ TEST_F(ColumnFamilyTest, CreateAndDropRace) {
// Start a thread that will drop the first column family
// Start a thread that will drop the first column family
// and its comparator
// and its comparator
rocksdb : : port : : Thread drop_cf_thread ( DropSingleColumnFamily , this , 1 , & comparators ) ;
rocksdb : : port : : Thread drop_cf_thread ( DropSingleColumnFamily , this , 1 ,
& comparators ) ;
DropColumnFamilies ( { 2 } ) ;
DropColumnFamilies ( { 2 } ) ;
@ -2426,10 +2474,13 @@ TEST_F(ColumnFamilyTest, CreateAndDropRace) {
delete comparator ;
delete comparator ;
}
}
}
}
rocksdb : : SyncPoint : : GetInstance ( ) - > DisableProcessing ( ) ;
rocksdb : : SyncPoint : : GetInstance ( ) - > ClearAllCallBacks ( ) ;
}
}
# endif // !ROCKSDB_LITE
# endif // !ROCKSDB_LITE
TEST_F ( ColumnFamilyTest , WriteStallSingleColumnFamily ) {
TEST_P ( ColumnFamilyTest , WriteStallSingleColumnFamily ) {
const uint64_t kBaseRate = 800000u ;
const uint64_t kBaseRate = 800000u ;
db_options_ . delayed_write_rate = kBaseRate ;
db_options_ . delayed_write_rate = kBaseRate ;
db_options_ . max_background_compactions = 6 ;
db_options_ . max_background_compactions = 6 ;
@ -2611,7 +2662,7 @@ TEST_F(ColumnFamilyTest, WriteStallSingleColumnFamily) {
ASSERT_EQ ( kBaseRate / 1.25 , GetDbDelayedWriteRate ( ) ) ;
ASSERT_EQ ( kBaseRate / 1.25 , GetDbDelayedWriteRate ( ) ) ;
}
}
TEST_F ( ColumnFamilyTest , CompactionSpeedupSingleColumnFamily ) {
TEST_P ( ColumnFamilyTest , CompactionSpeedupSingleColumnFamily ) {
db_options_ . max_background_compactions = 6 ;
db_options_ . max_background_compactions = 6 ;
Open ( { " default " } ) ;
Open ( { " default " } ) ;
ColumnFamilyData * cfd =
ColumnFamilyData * cfd =
@ -2675,7 +2726,7 @@ TEST_F(ColumnFamilyTest, CompactionSpeedupSingleColumnFamily) {
ASSERT_EQ ( 1 , dbfull ( ) - > TEST_BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 1 , dbfull ( ) - > TEST_BGCompactionsAllowed ( ) ) ;
}
}
TEST_F ( ColumnFamilyTest , WriteStallTwoColumnFamilies ) {
TEST_P ( ColumnFamilyTest , WriteStallTwoColumnFamilies ) {
const uint64_t kBaseRate = 810000u ;
const uint64_t kBaseRate = 810000u ;
db_options_ . delayed_write_rate = kBaseRate ;
db_options_ . delayed_write_rate = kBaseRate ;
Open ( ) ;
Open ( ) ;
@ -2750,7 +2801,7 @@ TEST_F(ColumnFamilyTest, WriteStallTwoColumnFamilies) {
ASSERT_EQ ( kBaseRate / 1.25 , GetDbDelayedWriteRate ( ) ) ;
ASSERT_EQ ( kBaseRate / 1.25 , GetDbDelayedWriteRate ( ) ) ;
}
}
TEST_F ( ColumnFamilyTest , CompactionSpeedupTwoColumnFamilies ) {
TEST_P ( ColumnFamilyTest , CompactionSpeedupTwoColumnFamilies ) {
db_options_ . max_background_compactions = 6 ;
db_options_ . max_background_compactions = 6 ;
column_family_options_ . soft_pending_compaction_bytes_limit = 200 ;
column_family_options_ . soft_pending_compaction_bytes_limit = 200 ;
column_family_options_ . hard_pending_compaction_bytes_limit = 2000 ;
column_family_options_ . hard_pending_compaction_bytes_limit = 2000 ;
@ -2815,7 +2866,7 @@ TEST_F(ColumnFamilyTest, CompactionSpeedupTwoColumnFamilies) {
ASSERT_EQ ( 1 , dbfull ( ) - > TEST_BGCompactionsAllowed ( ) ) ;
ASSERT_EQ ( 1 , dbfull ( ) - > TEST_BGCompactionsAllowed ( ) ) ;
}
}
TEST_F ( ColumnFamilyTest , CreateAndDestoryOptions ) {
TEST_P ( ColumnFamilyTest , CreateAndDestoryOptions ) {
std : : unique_ptr < ColumnFamilyOptions > cfo ( new ColumnFamilyOptions ( ) ) ;
std : : unique_ptr < ColumnFamilyOptions > cfo ( new ColumnFamilyOptions ( ) ) ;
ColumnFamilyHandle * cfh ;
ColumnFamilyHandle * cfh ;
Open ( ) ;
Open ( ) ;
@ -2827,7 +2878,7 @@ TEST_F(ColumnFamilyTest, CreateAndDestoryOptions) {
ASSERT_OK ( db_ - > DestroyColumnFamilyHandle ( cfh ) ) ;
ASSERT_OK ( db_ - > DestroyColumnFamilyHandle ( cfh ) ) ;
}
}
TEST_F ( ColumnFamilyTest , CreateDropAndDestroy ) {
TEST_P ( ColumnFamilyTest , CreateDropAndDestroy ) {
ColumnFamilyHandle * cfh ;
ColumnFamilyHandle * cfh ;
Open ( ) ;
Open ( ) ;
ASSERT_OK ( db_ - > CreateColumnFamily ( ColumnFamilyOptions ( ) , " yoyo " , & cfh ) ) ;
ASSERT_OK ( db_ - > CreateColumnFamily ( ColumnFamilyOptions ( ) , " yoyo " , & cfh ) ) ;
@ -2838,7 +2889,7 @@ TEST_F(ColumnFamilyTest, CreateDropAndDestroy) {
}
}
# ifndef ROCKSDB_LITE
# ifndef ROCKSDB_LITE
TEST_F ( ColumnFamilyTest , CreateDropAndDestroyWithoutFileDeletion ) {
TEST_P ( ColumnFamilyTest , CreateDropAndDestroyWithoutFileDeletion ) {
ColumnFamilyHandle * cfh ;
ColumnFamilyHandle * cfh ;
Open ( ) ;
Open ( ) ;
ASSERT_OK ( db_ - > CreateColumnFamily ( ColumnFamilyOptions ( ) , " yoyo " , & cfh ) ) ;
ASSERT_OK ( db_ - > CreateColumnFamily ( ColumnFamilyOptions ( ) , " yoyo " , & cfh ) ) ;
@ -2849,7 +2900,7 @@ TEST_F(ColumnFamilyTest, CreateDropAndDestroyWithoutFileDeletion) {
ASSERT_OK ( db_ - > DestroyColumnFamilyHandle ( cfh ) ) ;
ASSERT_OK ( db_ - > DestroyColumnFamilyHandle ( cfh ) ) ;
}
}
TEST_F ( ColumnFamilyTest , FlushCloseWALFiles ) {
TEST_P ( ColumnFamilyTest , FlushCloseWALFiles ) {
SpecialEnv env ( Env : : Default ( ) ) ;
SpecialEnv env ( Env : : Default ( ) ) ;
db_options_ . env = & env ;
db_options_ . env = & env ;
db_options_ . max_background_flushes = 1 ;
db_options_ . max_background_flushes = 1 ;
@ -2891,7 +2942,7 @@ TEST_F(ColumnFamilyTest, FlushCloseWALFiles) {
# endif // !ROCKSDB_LITE
# endif // !ROCKSDB_LITE
# ifndef ROCKSDB_LITE // WaitForFlush() is not supported
# ifndef ROCKSDB_LITE // WaitForFlush() is not supported
TEST_F ( ColumnFamilyTest , IteratorCloseWALFile1 ) {
TEST_P ( ColumnFamilyTest , IteratorCloseWALFile1 ) {
SpecialEnv env ( Env : : Default ( ) ) ;
SpecialEnv env ( Env : : Default ( ) ) ;
db_options_ . env = & env ;
db_options_ . env = & env ;
db_options_ . max_background_flushes = 1 ;
db_options_ . max_background_flushes = 1 ;
@ -2936,7 +2987,7 @@ TEST_F(ColumnFamilyTest, IteratorCloseWALFile1) {
Close ( ) ;
Close ( ) ;
}
}
TEST_F ( ColumnFamilyTest , IteratorCloseWALFile2 ) {
TEST_P ( ColumnFamilyTest , IteratorCloseWALFile2 ) {
SpecialEnv env ( Env : : Default ( ) ) ;
SpecialEnv env ( Env : : Default ( ) ) ;
// Allow both of flush and purge job to schedule.
// Allow both of flush and purge job to schedule.
env . SetBackgroundThreads ( 2 , Env : : HIGH ) ;
env . SetBackgroundThreads ( 2 , Env : : HIGH ) ;
@ -2993,7 +3044,7 @@ TEST_F(ColumnFamilyTest, IteratorCloseWALFile2) {
# endif // !ROCKSDB_LITE
# endif // !ROCKSDB_LITE
# ifndef ROCKSDB_LITE // TEST functions are not supported in lite
# ifndef ROCKSDB_LITE // TEST functions are not supported in lite
TEST_F ( ColumnFamilyTest , ForwardIteratorCloseWALFile ) {
TEST_P ( ColumnFamilyTest , ForwardIteratorCloseWALFile ) {
SpecialEnv env ( Env : : Default ( ) ) ;
SpecialEnv env ( Env : : Default ( ) ) ;
// Allow both of flush and purge job to schedule.
// Allow both of flush and purge job to schedule.
env . SetBackgroundThreads ( 2 , Env : : HIGH ) ;
env . SetBackgroundThreads ( 2 , Env : : HIGH ) ;
@ -3070,7 +3121,7 @@ TEST_F(ColumnFamilyTest, ForwardIteratorCloseWALFile) {
// Disable on windows because SyncWAL requires env->IsSyncThreadSafe()
// Disable on windows because SyncWAL requires env->IsSyncThreadSafe()
// to return true which is not so in unbuffered mode.
// to return true which is not so in unbuffered mode.
# ifndef OS_WIN
# ifndef OS_WIN
TEST_F ( ColumnFamilyTest , LogSyncConflictFlush ) {
TEST_P ( ColumnFamilyTest , LogSyncConflictFlush ) {
Open ( ) ;
Open ( ) ;
CreateColumnFamiliesAndReopen ( { " one " , " two " } ) ;
CreateColumnFamiliesAndReopen ( { " one " , " two " } ) ;
@ -3105,7 +3156,7 @@ TEST_F(ColumnFamilyTest, LogSyncConflictFlush) {
// test is being used to ensure a roll of wal files.
// test is being used to ensure a roll of wal files.
// Basic idea is to test that WAL truncation is being detected and not
// Basic idea is to test that WAL truncation is being detected and not
// ignored
// ignored
TEST_F ( ColumnFamilyTest , DISABLED_LogTruncationTest ) {
TEST_P ( ColumnFamilyTest , DISABLED_LogTruncationTest ) {
Open ( ) ;
Open ( ) ;
CreateColumnFamiliesAndReopen ( { " one " , " two " } ) ;
CreateColumnFamiliesAndReopen ( { " one " , " two " } ) ;
@ -3175,7 +3226,7 @@ TEST_F(ColumnFamilyTest, DISABLED_LogTruncationTest) {
env_ - > DeleteDir ( backup_logs ) ;
env_ - > DeleteDir ( backup_logs ) ;
}
}
TEST_F ( ColumnFamilyTest , DefaultCfPathsTest ) {
TEST_P ( ColumnFamilyTest , DefaultCfPathsTest ) {
Open ( ) ;
Open ( ) ;
// Leave cf_paths for one column families to be empty.
// Leave cf_paths for one column families to be empty.
// Files should be generated according to db_paths for that
// Files should be generated according to db_paths for that
@ -3202,7 +3253,7 @@ TEST_F(ColumnFamilyTest, DefaultCfPathsTest) {
ASSERT_EQ ( 1 , GetSstFileCount ( dbname_ ) ) ;
ASSERT_EQ ( 1 , GetSstFileCount ( dbname_ ) ) ;
}
}
TEST_F ( ColumnFamilyTest , MultipleCFPathsTest ) {
TEST_P ( ColumnFamilyTest , MultipleCFPathsTest ) {
Open ( ) ;
Open ( ) ;
// Configure Column family specific paths.
// Configure Column family specific paths.
ColumnFamilyOptions cf_opt1 , cf_opt2 ;
ColumnFamilyOptions cf_opt1 , cf_opt2 ;