@ -90,6 +90,7 @@ TEST_F(DBLogicalBlockSizeCacheTest, OpenClose) {
ASSERT_EQ ( 0 , cache_ - > Size ( ) ) ;
ASSERT_EQ ( 0 , cache_ - > Size ( ) ) ;
delete db ;
delete db ;
}
}
ASSERT_OK ( DestroyDB ( dbname_ , options , { } ) ) ;
}
}
TEST_F ( DBLogicalBlockSizeCacheTest , OpenDelete ) {
TEST_F ( DBLogicalBlockSizeCacheTest , OpenDelete ) {
@ -118,6 +119,7 @@ TEST_F(DBLogicalBlockSizeCacheTest, OpenDelete) {
delete db ;
delete db ;
ASSERT_EQ ( 0 , cache_ - > Size ( ) ) ;
ASSERT_EQ ( 0 , cache_ - > Size ( ) ) ;
}
}
ASSERT_OK ( DestroyDB ( dbname_ , options , { } ) ) ;
}
}
TEST_F ( DBLogicalBlockSizeCacheTest , CreateColumnFamily ) {
TEST_F ( DBLogicalBlockSizeCacheTest , CreateColumnFamily ) {
@ -163,6 +165,7 @@ TEST_F(DBLogicalBlockSizeCacheTest, CreateColumnFamily) {
delete db ;
delete db ;
ASSERT_EQ ( 0 , cache_ - > Size ( ) ) ;
ASSERT_EQ ( 0 , cache_ - > Size ( ) ) ;
ASSERT_OK ( DestroyDB ( dbname_ , options , { { " cf " , cf_options } } ) ) ;
}
}
TEST_F ( DBLogicalBlockSizeCacheTest , CreateColumnFamilies ) {
TEST_F ( DBLogicalBlockSizeCacheTest , CreateColumnFamilies ) {
@ -216,6 +219,8 @@ TEST_F(DBLogicalBlockSizeCacheTest, CreateColumnFamilies) {
delete db ;
delete db ;
ASSERT_EQ ( 0 , cache_ - > Size ( ) ) ;
ASSERT_EQ ( 0 , cache_ - > Size ( ) ) ;
ASSERT_OK ( DestroyDB ( dbname_ , options ,
{ { " cf1 " , cf_options } , { " cf2 " , cf_options } } ) ) ;
}
}
TEST_F ( DBLogicalBlockSizeCacheTest , OpenWithColumnFamilies ) {
TEST_F ( DBLogicalBlockSizeCacheTest , OpenWithColumnFamilies ) {
@ -303,6 +308,8 @@ TEST_F(DBLogicalBlockSizeCacheTest, OpenWithColumnFamilies) {
delete db ;
delete db ;
ASSERT_EQ ( 0 , cache_ - > Size ( ) ) ;
ASSERT_EQ ( 0 , cache_ - > Size ( ) ) ;
}
}
ASSERT_OK ( DestroyDB ( dbname_ , options ,
{ { " cf1 " , cf_options } , { " cf2 " , cf_options } } ) ) ;
}
}
TEST_F ( DBLogicalBlockSizeCacheTest , DestroyColumnFamilyHandle ) {
TEST_F ( DBLogicalBlockSizeCacheTest , DestroyColumnFamilyHandle ) {
@ -376,6 +383,7 @@ TEST_F(DBLogicalBlockSizeCacheTest, DestroyColumnFamilyHandle) {
delete db ;
delete db ;
ASSERT_EQ ( 0 , cache_ - > Size ( ) ) ;
ASSERT_EQ ( 0 , cache_ - > Size ( ) ) ;
}
}
ASSERT_OK ( DestroyDB ( dbname_ , options , { { " cf " , cf_options } } ) ) ;
}
}
TEST_F ( DBLogicalBlockSizeCacheTest , MultiDBWithDifferentPaths ) {
TEST_F ( DBLogicalBlockSizeCacheTest , MultiDBWithDifferentPaths ) {
@ -385,6 +393,8 @@ TEST_F(DBLogicalBlockSizeCacheTest, MultiDBWithDifferentPaths) {
options . create_if_missing = true ;
options . create_if_missing = true ;
options . env = env_ . get ( ) ;
options . env = env_ . get ( ) ;
ASSERT_OK ( env_ - > CreateDirIfMissing ( dbname_ ) ) ;
DB * db0 ;
DB * db0 ;
ASSERT_OK ( DB : : Open ( options , data_path_0_ , & db0 ) ) ;
ASSERT_OK ( DB : : Open ( options , data_path_0_ , & db0 ) ) ;
ASSERT_EQ ( 1 , cache_ - > Size ( ) ) ;
ASSERT_EQ ( 1 , cache_ - > Size ( ) ) ;
@ -431,10 +441,12 @@ TEST_F(DBLogicalBlockSizeCacheTest, MultiDBWithDifferentPaths) {
ASSERT_EQ ( 1 , cache_ - > GetRefCount ( data_path_1_ ) ) ;
ASSERT_EQ ( 1 , cache_ - > GetRefCount ( data_path_1_ ) ) ;
ASSERT_TRUE ( cache_ - > Contains ( cf_path_1_ ) ) ;
ASSERT_TRUE ( cache_ - > Contains ( cf_path_1_ ) ) ;
ASSERT_EQ ( 1 , cache_ - > GetRefCount ( cf_path_1_ ) ) ;
ASSERT_EQ ( 1 , cache_ - > GetRefCount ( cf_path_1_ ) ) ;
ASSERT_OK ( DestroyDB ( data_path_0_ , options , { { " cf " , cf_options0 } } ) ) ;
db1 - > DestroyColumnFamilyHandle ( cf1 ) ;
db1 - > DestroyColumnFamilyHandle ( cf1 ) ;
delete db1 ;
delete db1 ;
ASSERT_EQ ( 0 , cache_ - > Size ( ) ) ;
ASSERT_EQ ( 0 , cache_ - > Size ( ) ) ;
ASSERT_OK ( DestroyDB ( data_path_1_ , options , { { " cf " , cf_options1 } } ) ) ;
}
}
TEST_F ( DBLogicalBlockSizeCacheTest , MultiDBWithSamePaths ) {
TEST_F ( DBLogicalBlockSizeCacheTest , MultiDBWithSamePaths ) {
@ -447,6 +459,8 @@ TEST_F(DBLogicalBlockSizeCacheTest, MultiDBWithSamePaths) {
ColumnFamilyOptions cf_options ;
ColumnFamilyOptions cf_options ;
cf_options . cf_paths = { { cf_path_0_ , 1024 } } ;
cf_options . cf_paths = { { cf_path_0_ , 1024 } } ;
ASSERT_OK ( env_ - > CreateDirIfMissing ( dbname_ ) ) ;
DB * db0 ;
DB * db0 ;
ASSERT_OK ( DB : : Open ( options , dbname_ + " /db0 " , & db0 ) ) ;
ASSERT_OK ( DB : : Open ( options , dbname_ + " /db0 " , & db0 ) ) ;
ASSERT_EQ ( 1 , cache_ - > Size ( ) ) ;
ASSERT_EQ ( 1 , cache_ - > Size ( ) ) ;
@ -484,10 +498,12 @@ TEST_F(DBLogicalBlockSizeCacheTest, MultiDBWithSamePaths) {
ASSERT_EQ ( 1 , cache_ - > GetRefCount ( data_path_0_ ) ) ;
ASSERT_EQ ( 1 , cache_ - > GetRefCount ( data_path_0_ ) ) ;
ASSERT_TRUE ( cache_ - > Contains ( cf_path_0_ ) ) ;
ASSERT_TRUE ( cache_ - > Contains ( cf_path_0_ ) ) ;
ASSERT_EQ ( 1 , cache_ - > GetRefCount ( cf_path_0_ ) ) ;
ASSERT_EQ ( 1 , cache_ - > GetRefCount ( cf_path_0_ ) ) ;
ASSERT_OK ( DestroyDB ( dbname_ + " /db0 " , options , { { " cf " , cf_options } } ) ) ;
db1 - > DestroyColumnFamilyHandle ( cf1 ) ;
db1 - > DestroyColumnFamilyHandle ( cf1 ) ;
delete db1 ;
delete db1 ;
ASSERT_EQ ( 0 , cache_ - > Size ( ) ) ;
ASSERT_EQ ( 0 , cache_ - > Size ( ) ) ;
ASSERT_OK ( DestroyDB ( dbname_ + " /db1 " , options , { { " cf " , cf_options } } ) ) ;
}
}
} // namespace ROCKSDB_NAMESPACE
} // namespace ROCKSDB_NAMESPACE