@ -182,6 +182,7 @@ TEST_F(ExternalSSTFileBasicTest, NoCopy) {
}
TEST_F ( ExternalSSTFileBasicTest , IngestFileWithGlobalSeqnoPickedSeqno ) {
do {
Options options = CurrentOptions ( ) ;
DestroyAndReopen ( options ) ;
std : : map < std : : string , std : : string > true_data ;
@ -203,8 +204,8 @@ TEST_F(ExternalSSTFileBasicTest, IngestFileWithGlobalSeqnoPickedSeqno) {
// File overwrite some keys, a seqno will be assigned
ASSERT_EQ ( dbfull ( ) - > GetLatestSequenceNumber ( ) , 1 ) ;
ASSERT_OK (
GenerateAndAddExternalFile ( options , { 11 , 15 , 19 } , file_id + + , & true_data ) ) ;
ASSERT_OK ( GenerateAndAddExternalFile ( options , { 11 , 15 , 19 } , file_id + + ,
& true_data ) ) ;
// File overwrite some keys, a seqno will be assigned
ASSERT_EQ ( dbfull ( ) - > GetLatestSequenceNumber ( ) , 2 ) ;
@ -225,18 +226,18 @@ TEST_F(ExternalSSTFileBasicTest, IngestFileWithGlobalSeqnoPickedSeqno) {
}
SequenceNumber last_seqno = dbfull ( ) - > GetLatestSequenceNumber ( ) ;
ASSERT_OK (
GenerateAndAddExternalFile ( options , { 60 , 61 , 62 } , file_id + + , & true_data ) ) ;
ASSERT_OK ( GenerateAndAddExternalFile ( options , { 60 , 61 , 62 } , file_id + + ,
& true_data ) ) ;
// File dont overwrite any keys, No seqno needed
ASSERT_EQ ( dbfull ( ) - > GetLatestSequenceNumber ( ) , last_seqno ) ;
ASSERT_OK (
GenerateAndAddExternalFile ( options , { 40 , 41 , 42 } , file_id + + , & true_data ) ) ;
ASSERT_OK ( GenerateAndAddExternalFile ( options , { 40 , 41 , 42 } , file_id + + ,
& true_data ) ) ;
// File overwrite some keys, a seqno will be assigned
ASSERT_EQ ( dbfull ( ) - > GetLatestSequenceNumber ( ) , last_seqno + 1 ) ;
ASSERT_OK (
GenerateAndAddExternalFile ( options , { 20 , 30 , 40 } , file_id + + , & true_data ) ) ;
ASSERT_OK ( GenerateAndAddExternalFile ( options , { 20 , 30 , 40 } , file_id + + ,
& true_data ) ) ;
// File overwrite some keys, a seqno will be assigned
ASSERT_EQ ( dbfull ( ) - > GetLatestSequenceNumber ( ) , last_seqno + 2 ) ;
@ -244,13 +245,13 @@ TEST_F(ExternalSSTFileBasicTest, IngestFileWithGlobalSeqnoPickedSeqno) {
// We will need a seqno for the file regardless if the file overwrite
// keys in the DB or not because we have a snapshot
ASSERT_OK (
GenerateAndAddExternalFile ( options , { 1000 , 1002 } , file_id + + , & true_data ) ) ;
ASSERT_OK ( GenerateAndAddExternalFile ( options , { 1000 , 1002 } , file_id + + ,
& true_data ) ) ;
// A global seqno will be assigned anyway because of the snapshot
ASSERT_EQ ( dbfull ( ) - > GetLatestSequenceNumber ( ) , last_seqno + 3 ) ;
ASSERT_OK (
GenerateAndAddExternalFile ( options , { 2000 , 3002 } , file_id + + , & true_data ) ) ;
ASSERT_OK ( GenerateAndAddExternalFile ( options , { 2000 , 3002 } , file_id + + ,
& true_data ) ) ;
// A global seqno will be assigned anyway because of the snapshot
ASSERT_EQ ( dbfull ( ) - > GetLatestSequenceNumber ( ) , last_seqno + 4 ) ;
@ -261,13 +262,14 @@ TEST_F(ExternalSSTFileBasicTest, IngestFileWithGlobalSeqnoPickedSeqno) {
db_ - > ReleaseSnapshot ( snapshot ) ;
ASSERT_OK (
GenerateAndAddExternalFile ( options , { 5000 , 5001 } , file_id + + , & true_data ) ) ;
ASSERT_OK ( GenerateAndAddExternalFile ( options , { 5000 , 5001 } , file_id + + ,
& true_data ) ) ;
// No snapshot anymore, no need to assign a seqno
ASSERT_EQ ( dbfull ( ) - > GetLatestSequenceNumber ( ) , last_seqno + 5 ) ;
size_t kcnt = 0 ;
VerifyDBFromMap ( true_data , & kcnt , false ) ;
} while ( ChangeCompactOptions ( ) ) ;
}
TEST_F ( ExternalSSTFileBasicTest , FadviseTrigger ) {