@ -483,7 +483,6 @@ TEST_F(DBTest, LevelLimitReopen) {
}
# endif // ROCKSDB_LITE
TEST_F ( DBTest , PutSingleDeleteGet ) {
do {
CreateAndReopenWithCF ( { " pikachu " } , CurrentOptions ( ) ) ;
@ -782,7 +781,6 @@ TEST_F(DBTest, GetFromImmutableLayer) {
} while ( ChangeOptions ( ) ) ;
}
TEST_F ( DBTest , GetLevel0Ordering ) {
do {
CreateAndReopenWithCF ( { " pikachu " } , CurrentOptions ( ) ) ;
@ -6070,7 +6068,6 @@ TEST_F(DBTest, DISABLED_SuggestCompactRangeTest) {
ASSERT_EQ ( 1 , NumTableFilesAtLevel ( 1 ) ) ;
}
TEST_F ( DBTest , PromoteL0 ) {
Options options = CurrentOptions ( ) ;
options . disable_auto_compactions = true ;
@ -6251,13 +6248,12 @@ TEST_F(DBTest, CompactFilesShouldTriggerAutoCompaction) {
SyncPoint : : GetInstance ( ) - > EnableProcessing ( ) ;
port : : Thread manual_compaction_thread ( [ & ] ( ) {
auto s = db_ - > CompactFiles ( CompactionOptions ( ) ,
db_ - > DefaultColumnFamily ( ) , input_files , 0 ) ;
auto s = db_ - > CompactFiles ( CompactionOptions ( ) , db_ - > DefaultColumnFamily ( ) ,
input_files , 0 ) ;
ASSERT_OK ( s ) ;
} ) ;
TEST_SYNC_POINT (
" DBTest::CompactFilesShouldTriggerAutoCompaction:Begin " ) ;
TEST_SYNC_POINT ( " DBTest::CompactFilesShouldTriggerAutoCompaction:Begin " ) ;
// generate enough files to trigger compaction
for ( int i = 0 ; i < 20 ; + + i ) {
for ( int j = 0 ; j < 2 ; + + j ) {
@ -6268,8 +6264,7 @@ TEST_F(DBTest, CompactFilesShouldTriggerAutoCompaction) {
db_ - > GetColumnFamilyMetaData ( db_ - > DefaultColumnFamily ( ) , & cf_meta_data ) ;
ASSERT_GT ( cf_meta_data . levels [ 0 ] . files . size ( ) ,
options . level0_file_num_compaction_trigger ) ;
TEST_SYNC_POINT (
" DBTest::CompactFilesShouldTriggerAutoCompaction:End " ) ;
TEST_SYNC_POINT ( " DBTest::CompactFilesShouldTriggerAutoCompaction:End " ) ;
manual_compaction_thread . join ( ) ;
ASSERT_OK ( dbfull ( ) - > TEST_WaitForCompact ( ) ) ;
@ -6501,6 +6496,7 @@ class WriteStallListener : public EventListener {
MutexLock l ( & mutex_ ) ;
return expected = = condition_ ;
}
private :
port : : Mutex mutex_ ;
WriteStallCondition condition_ ;
@ -6730,7 +6726,8 @@ TEST_F(DBTest, LastWriteBufferDelay) {
sleeping_task . WakeUp ( ) ;
sleeping_task . WaitUntilDone ( ) ;
}
# endif // !defined(ROCKSDB_LITE) && !defined(ROCKSDB_DISABLE_STALL_NOTIFICATION)
# endif // !defined(ROCKSDB_LITE) &&
// !defined(ROCKSDB_DISABLE_STALL_NOTIFICATION)
TEST_F ( DBTest , FailWhenCompressionNotSupportedTest ) {
CompressionType compressions [ ] = { kZlibCompression , kBZip2Compression ,
@ -6815,6 +6812,89 @@ TEST_F(DBTest, PinnableSliceAndRowCache) {
1 ) ;
}
TEST_F ( DBTest , ReusePinnableSlice ) {
Options options = CurrentOptions ( ) ;
options . statistics = ROCKSDB_NAMESPACE : : CreateDBStatistics ( ) ;
options . row_cache = NewLRUCache ( 8192 ) ;
DestroyAndReopen ( options ) ;
ASSERT_OK ( Put ( " foo " , " bar " ) ) ;
ASSERT_OK ( Flush ( ) ) ;
ASSERT_EQ ( Get ( " foo " ) , " bar " ) ;
ASSERT_EQ (
reinterpret_cast < LRUCache * > ( options . row_cache . get ( ) ) - > TEST_GetLRUSize ( ) ,
1 ) ;
{
PinnableSlice pin_slice ;
ASSERT_EQ ( Get ( " foo " , & pin_slice ) , Status : : OK ( ) ) ;
ASSERT_EQ ( Get ( " foo " , & pin_slice ) , Status : : OK ( ) ) ;
ASSERT_EQ ( pin_slice . ToString ( ) , " bar " ) ;
// Entry is already in cache, lookup will remove the element from lru
ASSERT_EQ (
reinterpret_cast < LRUCache * > ( options . row_cache . get ( ) ) - > TEST_GetLRUSize ( ) ,
0 ) ;
}
// After PinnableSlice destruction element is added back in LRU
ASSERT_EQ (
reinterpret_cast < LRUCache * > ( options . row_cache . get ( ) ) - > TEST_GetLRUSize ( ) ,
1 ) ;
{
std : : vector < Slice > multiget_keys ;
multiget_keys . push_back ( " foo " ) ;
std : : vector < PinnableSlice > multiget_values ( 1 ) ;
std : : vector < Status > statuses ( { Status : : NotFound ( ) } ) ;
ReadOptions ropt ;
dbfull ( ) - > MultiGet ( ropt , dbfull ( ) - > DefaultColumnFamily ( ) ,
multiget_keys . size ( ) , multiget_keys . data ( ) ,
multiget_values . data ( ) , statuses . data ( ) ) ;
ASSERT_EQ ( Status : : OK ( ) , statuses [ 0 ] ) ;
dbfull ( ) - > MultiGet ( ropt , dbfull ( ) - > DefaultColumnFamily ( ) ,
multiget_keys . size ( ) , multiget_keys . data ( ) ,
multiget_values . data ( ) , statuses . data ( ) ) ;
ASSERT_EQ ( Status : : OK ( ) , statuses [ 0 ] ) ;
// Entry is already in cache, lookup will remove the element from lru
ASSERT_EQ (
reinterpret_cast < LRUCache * > ( options . row_cache . get ( ) ) - > TEST_GetLRUSize ( ) ,
0 ) ;
}
// After PinnableSlice destruction element is added back in LRU
ASSERT_EQ (
reinterpret_cast < LRUCache * > ( options . row_cache . get ( ) ) - > TEST_GetLRUSize ( ) ,
1 ) ;
{
std : : vector < ColumnFamilyHandle * > multiget_cfs ;
multiget_cfs . push_back ( dbfull ( ) - > DefaultColumnFamily ( ) ) ;
std : : vector < Slice > multiget_keys ;
multiget_keys . push_back ( " foo " ) ;
std : : vector < PinnableSlice > multiget_values ( 1 ) ;
std : : vector < Status > statuses ( { Status : : NotFound ( ) } ) ;
ReadOptions ropt ;
dbfull ( ) - > MultiGet ( ropt , multiget_keys . size ( ) , multiget_cfs . data ( ) ,
multiget_keys . data ( ) , multiget_values . data ( ) ,
statuses . data ( ) ) ;
ASSERT_EQ ( Status : : OK ( ) , statuses [ 0 ] ) ;
dbfull ( ) - > MultiGet ( ropt , multiget_keys . size ( ) , multiget_cfs . data ( ) ,
multiget_keys . data ( ) , multiget_values . data ( ) ,
statuses . data ( ) ) ;
ASSERT_EQ ( Status : : OK ( ) , statuses [ 0 ] ) ;
// Entry is already in cache, lookup will remove the element from lru
ASSERT_EQ (
reinterpret_cast < LRUCache * > ( options . row_cache . get ( ) ) - > TEST_GetLRUSize ( ) ,
0 ) ;
}
// After PinnableSlice destruction element is added back in LRU
ASSERT_EQ (
reinterpret_cast < LRUCache * > ( options . row_cache . get ( ) ) - > TEST_GetLRUSize ( ) ,
1 ) ;
}
# endif // ROCKSDB_LITE
TEST_F ( DBTest , DeletingOldWalAfterDrop ) {
@ -6894,9 +6974,7 @@ TEST_F(DBTest, PauseBackgroundWorkTest) {
TEST_F ( DBTest , ThreadLocalPtrDeadlock ) {
std : : atomic < int > flushes_done { 0 } ;
std : : atomic < int > threads_destroyed { 0 } ;
auto done = [ & ] {
return flushes_done . load ( ) > 10 ;
} ;
auto done = [ & ] { return flushes_done . load ( ) > 10 ; } ;
port : : Thread flushing_thread ( [ & ] {
for ( int i = 0 ; ! done ( ) ; + + i ) {