@ -73,7 +73,8 @@ class VersionBuilderTest : public testing::Test {
/* marked_for_compact */ false , Temperature : : kUnknown ,
/* marked_for_compact */ false , Temperature : : kUnknown ,
oldest_blob_file_number , kUnknownOldestAncesterTime ,
oldest_blob_file_number , kUnknownOldestAncesterTime ,
kUnknownFileCreationTime , epoch_number , kUnknownFileChecksum ,
kUnknownFileCreationTime , epoch_number , kUnknownFileChecksum ,
kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 , 0 ) ;
kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 , 0 ,
/* user_defined_timestamps_persisted */ true ) ;
f - > compensated_file_size = file_size ;
f - > compensated_file_size = file_size ;
f - > num_entries = num_entries ;
f - > num_entries = num_entries ;
f - > num_deletions = num_deletions ;
f - > num_deletions = num_deletions ;
@ -130,13 +131,13 @@ class VersionBuilderTest : public testing::Test {
constexpr SequenceNumber largest_seqno = 300 ;
constexpr SequenceNumber largest_seqno = 300 ;
constexpr bool marked_for_compaction = false ;
constexpr bool marked_for_compaction = false ;
edit - > AddFile ( level , table_file_number , path_id , file_size ,
edit - > AddFile (
GetInternalKey ( smallest ) , GetInternalKey ( larg est ) ,
level , table_file_number , path_id , file_size , GetInternalKey ( smal lest) ,
smallest_seqno , largest_seqno , marked_for_compaction ,
GetInternalKey ( largest ) , smallest_seqno , largest_seqno ,
Temperature : : kUnknown , blob_file_number ,
marked_for_compaction , Temperature : : kUnknown , blob_file_number ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime , epoch_number ,
epoch_number , kUnknownFileChecksum ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName , kNullUniqueId64x2 ,
kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 , 0 ) ;
0 , 0 , /* user_defined_timestamps_persisted */ true ) ;
}
}
void UpdateVersionStorageInfo ( VersionStorageInfo * vstorage ) {
void UpdateVersionStorageInfo ( VersionStorageInfo * vstorage ) {
@ -183,12 +184,12 @@ TEST_F(VersionBuilderTest, ApplyAndSaveTo) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
VersionEdit version_edit ;
VersionEdit version_edit ;
version_edit . AddFile ( 2 , 666 , 0 , 100U , GetInternalKey ( " 301 " ) ,
version_edit . AddFile (
GetInternalKey ( " 350 " ) , 200 , 200 , false ,
2 , 666 , 0 , 100U , GetInternalKey ( " 301 " ) , GetInternalKey ( " 350 " ) , 200 , 200 ,
Temperature : : kUnknown , kInvalidBlobFileNumber ,
false , Temperature : : kUnknown , kInvalidBlobFileNumber ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownEpochNumber , kUnknownFileChecksum ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 ,
kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 , 0 ) ;
0 , /* user_defined_timestamps_persisted */ true ) ;
version_edit . DeleteFile ( 3 , 27U ) ;
version_edit . DeleteFile ( 3 , 27U ) ;
EnvOptions env_options ;
EnvOptions env_options ;
@ -231,12 +232,12 @@ TEST_F(VersionBuilderTest, ApplyAndSaveToDynamic) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
VersionEdit version_edit ;
VersionEdit version_edit ;
version_edit . AddFile ( 3 , 666 , 0 , 100U , GetInternalKey ( " 301 " ) ,
version_edit . AddFile (
GetInternalKey ( " 350 " ) , 200 , 200 , false ,
3 , 666 , 0 , 100U , GetInternalKey ( " 301 " ) , GetInternalKey ( " 350 " ) , 200 , 200 ,
Temperature : : kUnknown , kInvalidBlobFileNumber ,
false , Temperature : : kUnknown , kInvalidBlobFileNumber ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownEpochNumber , kUnknownFileChecksum ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 ,
kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 , 0 ) ;
0 , /* user_defined_timestamps_persisted */ true ) ;
version_edit . DeleteFile ( 0 , 1U ) ;
version_edit . DeleteFile ( 0 , 1U ) ;
version_edit . DeleteFile ( 0 , 88U ) ;
version_edit . DeleteFile ( 0 , 88U ) ;
@ -283,12 +284,12 @@ TEST_F(VersionBuilderTest, ApplyAndSaveToDynamic2) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
VersionEdit version_edit ;
VersionEdit version_edit ;
version_edit . AddFile ( 4 , 666 , 0 , 100U , GetInternalKey ( " 301 " ) ,
version_edit . AddFile (
GetInternalKey ( " 350 " ) , 200 , 200 , false ,
4 , 666 , 0 , 100U , GetInternalKey ( " 301 " ) , GetInternalKey ( " 350 " ) , 200 , 200 ,
Temperature : : kUnknown , kInvalidBlobFileNumber ,
false , Temperature : : kUnknown , kInvalidBlobFileNumber ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownEpochNumber , kUnknownFileChecksum ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 ,
kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 , 0 ) ;
0 , /* user_defined_timestamps_persisted */ true ) ;
version_edit . DeleteFile ( 0 , 1U ) ;
version_edit . DeleteFile ( 0 , 1U ) ;
version_edit . DeleteFile ( 0 , 88U ) ;
version_edit . DeleteFile ( 0 , 88U ) ;
version_edit . DeleteFile ( 4 , 6U ) ;
version_edit . DeleteFile ( 4 , 6U ) ;
@ -320,36 +321,36 @@ TEST_F(VersionBuilderTest, ApplyMultipleAndSaveTo) {
UpdateVersionStorageInfo ( ) ;
UpdateVersionStorageInfo ( ) ;
VersionEdit version_edit ;
VersionEdit version_edit ;
version_edit . AddFile ( 2 , 666 , 0 , 100U , GetInternalKey ( " 301 " ) ,
version_edit . AddFile (
GetInternalKey ( " 350 " ) , 200 , 200 , false ,
2 , 666 , 0 , 100U , GetInternalKey ( " 301 " ) , GetInternalKey ( " 350 " ) , 200 , 200 ,
Temperature : : kUnknown , kInvalidBlobFileNumber ,
false , Temperature : : kUnknown , kInvalidBlobFileNumber ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownEpochNumber , kUnknownFileChecksum ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 ,
kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 , 0 ) ;
0 , /* user_defined_timestamps_persisted */ true ) ;
version_edit . AddFile ( 2 , 676 , 0 , 100U , GetInternalKey ( " 401 " ) ,
version_edit . AddFile (
GetInternalKey ( " 450 " ) , 200 , 200 , false ,
2 , 676 , 0 , 100U , GetInternalKey ( " 401 " ) , GetInternalKey ( " 450 " ) , 200 , 200 ,
Temperature : : kUnknown , kInvalidBlobFileNumber ,
false , Temperature : : kUnknown , kInvalidBlobFileNumber ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownEpochNumber , kUnknownFileChecksum ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 ,
kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 , 0 ) ;
0 , /* user_defined_timestamps_persisted */ true ) ;
version_edit . AddFile ( 2 , 636 , 0 , 100U , GetInternalKey ( " 601 " ) ,
version_edit . AddFile (
GetInternalKey ( " 650 " ) , 200 , 200 , false ,
2 , 636 , 0 , 100U , GetInternalKey ( " 601 " ) , GetInternalKey ( " 650 " ) , 200 , 200 ,
Temperature : : kUnknown , kInvalidBlobFileNumber ,
false , Temperature : : kUnknown , kInvalidBlobFileNumber ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownEpochNumber , kUnknownFileChecksum ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 ,
kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 , 0 ) ;
0 , /* user_defined_timestamps_persisted */ true ) ;
version_edit . AddFile ( 2 , 616 , 0 , 100U , GetInternalKey ( " 501 " ) ,
version_edit . AddFile (
GetInternalKey ( " 550 " ) , 200 , 200 , false ,
2 , 616 , 0 , 100U , GetInternalKey ( " 501 " ) , GetInternalKey ( " 550 " ) , 200 , 200 ,
Temperature : : kUnknown , kInvalidBlobFileNumber ,
false , Temperature : : kUnknown , kInvalidBlobFileNumber ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownEpochNumber , kUnknownFileChecksum ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 ,
kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 , 0 ) ;
0 , /* user_defined_timestamps_persisted */ true ) ;
version_edit . AddFile ( 2 , 606 , 0 , 100U , GetInternalKey ( " 701 " ) ,
version_edit . AddFile (
GetInternalKey ( " 750 " ) , 200 , 200 , false ,
2 , 606 , 0 , 100U , GetInternalKey ( " 701 " ) , GetInternalKey ( " 750 " ) , 200 , 200 ,
Temperature : : kUnknown , kInvalidBlobFileNumber ,
false , Temperature : : kUnknown , kInvalidBlobFileNumber ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownEpochNumber , kUnknownFileChecksum ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 ,
kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 , 0 ) ;
0 , /* user_defined_timestamps_persisted */ true ) ;
EnvOptions env_options ;
EnvOptions env_options ;
constexpr TableCache * table_cache = nullptr ;
constexpr TableCache * table_cache = nullptr ;
@ -384,53 +385,53 @@ TEST_F(VersionBuilderTest, ApplyDeleteAndSaveTo) {
kCompactionStyleLevel , nullptr , false ) ;
kCompactionStyleLevel , nullptr , false ) ;
VersionEdit version_edit ;
VersionEdit version_edit ;
version_edit . AddFile ( 2 , 666 , 0 , 100U , GetInternalKey ( " 301 " ) ,
version_edit . AddFile (
GetInternalKey ( " 350 " ) , 200 , 200 , false ,
2 , 666 , 0 , 100U , GetInternalKey ( " 301 " ) , GetInternalKey ( " 350 " ) , 200 , 200 ,
Temperature : : kUnknown , kInvalidBlobFileNumber ,
false , Temperature : : kUnknown , kInvalidBlobFileNumber ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownEpochNumber , kUnknownFileChecksum ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 ,
kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 , 0 ) ;
0 , /* user_defined_timestamps_persisted */ true ) ;
version_edit . AddFile ( 2 , 676 , 0 , 100U , GetInternalKey ( " 401 " ) ,
version_edit . AddFile (
GetInternalKey ( " 450 " ) , 200 , 200 , false ,
2 , 676 , 0 , 100U , GetInternalKey ( " 401 " ) , GetInternalKey ( " 450 " ) , 200 , 200 ,
Temperature : : kUnknown , kInvalidBlobFileNumber ,
false , Temperature : : kUnknown , kInvalidBlobFileNumber ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownEpochNumber , kUnknownFileChecksum ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 ,
kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 , 0 ) ;
0 , /* user_defined_timestamps_persisted */ true ) ;
version_edit . AddFile ( 2 , 636 , 0 , 100U , GetInternalKey ( " 601 " ) ,
version_edit . AddFile (
GetInternalKey ( " 650 " ) , 200 , 200 , false ,
2 , 636 , 0 , 100U , GetInternalKey ( " 601 " ) , GetInternalKey ( " 650 " ) , 200 , 200 ,
Temperature : : kUnknown , kInvalidBlobFileNumber ,
false , Temperature : : kUnknown , kInvalidBlobFileNumber ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownEpochNumber , kUnknownFileChecksum ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 ,
kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 , 0 ) ;
0 , /* user_defined_timestamps_persisted */ true ) ;
version_edit . AddFile ( 2 , 616 , 0 , 100U , GetInternalKey ( " 501 " ) ,
version_edit . AddFile (
GetInternalKey ( " 550 " ) , 200 , 200 , false ,
2 , 616 , 0 , 100U , GetInternalKey ( " 501 " ) , GetInternalKey ( " 550 " ) , 200 , 200 ,
Temperature : : kUnknown , kInvalidBlobFileNumber ,
false , Temperature : : kUnknown , kInvalidBlobFileNumber ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownEpochNumber , kUnknownFileChecksum ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 ,
kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 , 0 ) ;
0 , /* user_defined_timestamps_persisted */ true ) ;
version_edit . AddFile ( 2 , 606 , 0 , 100U , GetInternalKey ( " 701 " ) ,
version_edit . AddFile (
GetInternalKey ( " 750 " ) , 200 , 200 , false ,
2 , 606 , 0 , 100U , GetInternalKey ( " 701 " ) , GetInternalKey ( " 750 " ) , 200 , 200 ,
Temperature : : kUnknown , kInvalidBlobFileNumber ,
false , Temperature : : kUnknown , kInvalidBlobFileNumber ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownEpochNumber , kUnknownFileChecksum ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 ,
kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 , 0 ) ;
0 , /* user_defined_timestamps_persisted */ true ) ;
ASSERT_OK ( version_builder . Apply ( & version_edit ) ) ;
ASSERT_OK ( version_builder . Apply ( & version_edit ) ) ;
VersionEdit version_edit2 ;
VersionEdit version_edit2 ;
version_edit . AddFile ( 2 , 808 , 0 , 100U , GetInternalKey ( " 901 " ) ,
version_edit . AddFile (
GetInternalKey ( " 950 " ) , 200 , 200 , false ,
2 , 808 , 0 , 100U , GetInternalKey ( " 901 " ) , GetInternalKey ( " 950 " ) , 200 , 200 ,
Temperature : : kUnknown , kInvalidBlobFileNumber ,
false , Temperature : : kUnknown , kInvalidBlobFileNumber ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownEpochNumber , kUnknownFileChecksum ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 ,
kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 , 0 ) ;
0 , /* user_defined_timestamps_persisted */ true ) ;
version_edit2 . DeleteFile ( 2 , 616 ) ;
version_edit2 . DeleteFile ( 2 , 616 ) ;
version_edit2 . DeleteFile ( 2 , 636 ) ;
version_edit2 . DeleteFile ( 2 , 636 ) ;
version_edit . AddFile ( 2 , 806 , 0 , 100U , GetInternalKey ( " 801 " ) ,
version_edit . AddFile (
GetInternalKey ( " 850 " ) , 200 , 200 , false ,
2 , 806 , 0 , 100U , GetInternalKey ( " 801 " ) , GetInternalKey ( " 850 " ) , 200 , 200 ,
Temperature : : kUnknown , kInvalidBlobFileNumber ,
false , Temperature : : kUnknown , kInvalidBlobFileNumber ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownEpochNumber , kUnknownFileChecksum ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 ,
kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 , 0 ) ;
0 , /* user_defined_timestamps_persisted */ true ) ;
ASSERT_OK ( version_builder . Apply ( & version_edit2 ) ) ;
ASSERT_OK ( version_builder . Apply ( & version_edit2 ) ) ;
ASSERT_OK ( version_builder . SaveTo ( & new_vstorage ) ) ;
ASSERT_OK ( version_builder . SaveTo ( & new_vstorage ) ) ;
@ -535,14 +536,14 @@ TEST_F(VersionBuilderTest, ApplyFileDeletionAndAddition) {
constexpr bool marked_for_compaction = false ;
constexpr bool marked_for_compaction = false ;
addition . AddFile ( level , file_number , path_id , file_size ,
addition . AddFile (
GetInternalKey ( smallest , smallest_seq ) ,
level , file_number , path_id , file_size ,
GetInternalKey ( larg est , largest_seq ) , smallest_seqno ,
GetInternalKey ( smal lest, smallest_seq ) ,
largest_seqno , marked_for_compaction , Temperature : : kUnknown ,
GetInternalKey ( largest , largest_seq ) , smallest_seqno , largest_seqno ,
kInvalidBlobFileNumber , kUnknownOldestAncesterTime ,
marked_for_compaction , Temperature : : kUnknown , kInvalidBlobFileNumber ,
kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 ,
kNullUniqueId64x2 , 0 , 0 ) ;
0 , /* user_defined_timestamps_persisted */ true ) ;
ASSERT_OK ( builder . Apply ( & addition ) ) ;
ASSERT_OK ( builder . Apply ( & addition ) ) ;
@ -586,13 +587,13 @@ TEST_F(VersionBuilderTest, ApplyFileAdditionAlreadyInBase) {
constexpr SequenceNumber largest_seqno = 1000 ;
constexpr SequenceNumber largest_seqno = 1000 ;
constexpr bool marked_for_compaction = false ;
constexpr bool marked_for_compaction = false ;
edit . AddFile ( new_level , file_number , path_id , file_size ,
edit . AddFile (
GetInternalKey ( smallest ) , GetInternalKey ( larg est ) ,
new_level , file_number , path_id , file_size , GetInternalKey ( smal lest) ,
smallest_seqno , largest_seqno , marked_for_compaction ,
GetInternalKey ( largest ) , smallest_seqno , largest_seqno ,
Temperature : : kUnknown , kInvalidBlobFileNumber ,
marked_for_compaction , Temperature : : kUnknown , kInvalidBlobFileNumber ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownEpochNumber , kUnknownFileChecksum ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 ,
kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 , 0 ) ;
0 , /* user_defined_timestamps_persisted */ true ) ;
const Status s = builder . Apply ( & edit ) ;
const Status s = builder . Apply ( & edit ) ;
ASSERT_TRUE ( s . IsCorruption ( ) ) ;
ASSERT_TRUE ( s . IsCorruption ( ) ) ;
@ -623,13 +624,13 @@ TEST_F(VersionBuilderTest, ApplyFileAdditionAlreadyApplied) {
constexpr SequenceNumber largest_seqno = 1000 ;
constexpr SequenceNumber largest_seqno = 1000 ;
constexpr bool marked_for_compaction = false ;
constexpr bool marked_for_compaction = false ;
edit . AddFile ( level , file_number , path_id , file_size , GetInternalKey ( smallest ) ,
edit . AddFile (
GetInternalKey ( largest ) , smallest_seqno , largest_seqno ,
level , file_number , path_id , file_size , GetInternalKey ( smallest ) ,
marked_for_compaction , Temperature : : kUnknown ,
GetInternalKey ( largest ) , smallest_seqno , largest_seqno ,
kInvalidBlobFileNumber , kUnknownOldestAncesterTime ,
marked_for_compaction , Temperature : : kUnknown , kInvalidBlobFileNumber ,
kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 ,
kNullUniqueId64x2 , 0 , 0 ) ;
0 , /* user_defined_timestamps_persisted */ true ) ;
ASSERT_OK ( builder . Apply ( & edit ) ) ;
ASSERT_OK ( builder . Apply ( & edit ) ) ;
@ -637,13 +638,13 @@ TEST_F(VersionBuilderTest, ApplyFileAdditionAlreadyApplied) {
constexpr int new_level = 2 ;
constexpr int new_level = 2 ;
other_edit . AddFile ( new_level , file_number , path_id , file_size ,
other_edit . AddFile (
GetInternalKey ( smallest ) , GetInternalKey ( larg est ) ,
new_level , file_number , path_id , file_size , GetInternalKey ( smal lest) ,
smallest_seqno , largest_seqno , marked_for_compaction ,
GetInternalKey ( largest ) , smallest_seqno , largest_seqno ,
Temperature : : kUnknown , kInvalidBlobFileNumber ,
marked_for_compaction , Temperature : : kUnknown , kInvalidBlobFileNumber ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownEpochNumber , kUnknownFileChecksum ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 ,
kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 , 0 ) ;
0 , /* user_defined_timestamps_persisted */ true ) ;
const Status s = builder . Apply ( & other_edit ) ;
const Status s = builder . Apply ( & other_edit ) ;
ASSERT_TRUE ( s . IsCorruption ( ) ) ;
ASSERT_TRUE ( s . IsCorruption ( ) ) ;
@ -674,13 +675,13 @@ TEST_F(VersionBuilderTest, ApplyFileAdditionAndDeletion) {
VersionEdit addition ;
VersionEdit addition ;
addition . AddFile ( level , file_number , path_id , file_size ,
addition . AddFile (
GetInternalKey ( smallest ) , GetInternalKey ( larg est ) ,
level , file_number , path_id , file_size , GetInternalKey ( smal lest) ,
smallest_seqno , largest_seqno , marked_for_compaction ,
GetInternalKey ( largest ) , smallest_seqno , largest_seqno ,
Temperature : : kUnknown , kInvalidBlobFileNumber ,
marked_for_compaction , Temperature : : kUnknown , kInvalidBlobFileNumber ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownEpochNumber , kUnknownFileChecksum ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 ,
kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 , 0 ) ;
0 , /* user_defined_timestamps_persisted */ true ) ;
ASSERT_OK ( builder . Apply ( & addition ) ) ;
ASSERT_OK ( builder . Apply ( & addition ) ) ;
@ -1253,7 +1254,8 @@ TEST_F(VersionBuilderTest, SaveBlobFilesToConcurrentJobs) {
GetInternalKey ( largest ) , smallest_seqno , largest_seqno ,
GetInternalKey ( largest ) , smallest_seqno , largest_seqno ,
marked_for_compaction , Temperature : : kUnknown , blob_file_number ,
marked_for_compaction , Temperature : : kUnknown , blob_file_number ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime , 2 /*epoch_number*/ ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime , 2 /*epoch_number*/ ,
checksum_value , checksum_method , kNullUniqueId64x2 , 0 , 0 ) ;
checksum_value , checksum_method , kNullUniqueId64x2 , 0 , 0 ,
/* user_defined_timestamps_persisted */ true ) ;
edit . AddBlobFile ( blob_file_number , total_blob_count , total_blob_bytes ,
edit . AddBlobFile ( blob_file_number , total_blob_count , total_blob_bytes ,
checksum_method , checksum_value ) ;
checksum_method , checksum_value ) ;
@ -1341,7 +1343,8 @@ TEST_F(VersionBuilderTest, CheckConsistencyForBlobFiles) {
/* oldest_blob_file_number */ 16 , kUnknownOldestAncesterTime ,
/* oldest_blob_file_number */ 16 , kUnknownOldestAncesterTime ,
kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName ,
kNullUniqueId64x2 , 0 , 0 ) ;
kNullUniqueId64x2 , 0 , 0 ,
/* user_defined_timestamps_persisted */ true ) ;
edit . AddFile ( /* level */ 1 , /* file_number */ 700 , /* path_id */ 0 ,
edit . AddFile ( /* level */ 1 , /* file_number */ 700 , /* path_id */ 0 ,
/* file_size */ 100 , /* smallest */ GetInternalKey ( " 801 " ) ,
/* file_size */ 100 , /* smallest */ GetInternalKey ( " 801 " ) ,
@ -1351,7 +1354,8 @@ TEST_F(VersionBuilderTest, CheckConsistencyForBlobFiles) {
/* oldest_blob_file_number */ 1000 , kUnknownOldestAncesterTime ,
/* oldest_blob_file_number */ 1000 , kUnknownOldestAncesterTime ,
kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName ,
kNullUniqueId64x2 , 0 , 0 ) ;
kNullUniqueId64x2 , 0 , 0 ,
/* user_defined_timestamps_persisted */ true ) ;
edit . AddBlobFile ( /* blob_file_number */ 1000 , /* total_blob_count */ 2000 ,
edit . AddBlobFile ( /* blob_file_number */ 1000 , /* total_blob_count */ 2000 ,
/* total_blob_bytes */ 200000 ,
/* total_blob_bytes */ 200000 ,
/* checksum_method */ std : : string ( ) ,
/* checksum_method */ std : : string ( ) ,
@ -1572,7 +1576,8 @@ TEST_F(VersionBuilderTest, MaintainLinkedSstsForBlobFiles) {
Temperature : : kUnknown ,
Temperature : : kUnknown ,
/* oldest_blob_file_number */ 1 , kUnknownOldestAncesterTime ,
/* oldest_blob_file_number */ 1 , kUnknownOldestAncesterTime ,
kUnknownFileCreationTime , kUnknownEpochNumber , kUnknownFileChecksum ,
kUnknownFileCreationTime , kUnknownEpochNumber , kUnknownFileChecksum ,
kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 , 0 ) ;
kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 , 0 ,
/* user_defined_timestamps_persisted */ true ) ;
// Add an SST that does not reference any blob files.
// Add an SST that does not reference any blob files.
edit . AddFile (
edit . AddFile (
@ -1582,7 +1587,8 @@ TEST_F(VersionBuilderTest, MaintainLinkedSstsForBlobFiles) {
/* largest_seqno */ 2200 , /* marked_for_compaction */ false ,
/* largest_seqno */ 2200 , /* marked_for_compaction */ false ,
Temperature : : kUnknown , kInvalidBlobFileNumber , kUnknownOldestAncesterTime ,
Temperature : : kUnknown , kInvalidBlobFileNumber , kUnknownOldestAncesterTime ,
kUnknownFileCreationTime , kUnknownEpochNumber , kUnknownFileChecksum ,
kUnknownFileCreationTime , kUnknownEpochNumber , kUnknownFileChecksum ,
kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 , 0 ) ;
kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 , 0 ,
/* user_defined_timestamps_persisted */ true ) ;
// Delete a file that references a blob file.
// Delete a file that references a blob file.
edit . DeleteFile ( /* level */ 1 , /* file_number */ 6 ) ;
edit . DeleteFile ( /* level */ 1 , /* file_number */ 6 ) ;
@ -1605,7 +1611,8 @@ TEST_F(VersionBuilderTest, MaintainLinkedSstsForBlobFiles) {
/* oldest_blob_file_number */ 3 , kUnknownOldestAncesterTime ,
/* oldest_blob_file_number */ 3 , kUnknownOldestAncesterTime ,
kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName ,
kNullUniqueId64x2 , 0 , 0 ) ;
kNullUniqueId64x2 , 0 , 0 ,
/* user_defined_timestamps_persisted */ true ) ;
// Trivially move a file that does not reference any blob files.
// Trivially move a file that does not reference any blob files.
edit . DeleteFile ( /* level */ 1 , /* file_number */ 13 ) ;
edit . DeleteFile ( /* level */ 1 , /* file_number */ 13 ) ;
@ -1617,7 +1624,8 @@ TEST_F(VersionBuilderTest, MaintainLinkedSstsForBlobFiles) {
Temperature : : kUnknown , kInvalidBlobFileNumber ,
Temperature : : kUnknown , kInvalidBlobFileNumber ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime ,
kUnknownEpochNumber , kUnknownFileChecksum ,
kUnknownEpochNumber , kUnknownFileChecksum ,
kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 , 0 ) ;
kUnknownFileChecksumFuncName , kNullUniqueId64x2 , 0 , 0 ,
/* user_defined_timestamps_persisted */ true ) ;
// Add one more SST file that references a blob file, then promptly
// Add one more SST file that references a blob file, then promptly
// delete it in a second version edit before the new version gets saved.
// delete it in a second version edit before the new version gets saved.
@ -1631,7 +1639,8 @@ TEST_F(VersionBuilderTest, MaintainLinkedSstsForBlobFiles) {
/* oldest_blob_file_number */ 5 , kUnknownOldestAncesterTime ,
/* oldest_blob_file_number */ 5 , kUnknownOldestAncesterTime ,
kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownFileCreationTime , kUnknownEpochNumber ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName ,
kUnknownFileChecksum , kUnknownFileChecksumFuncName ,
kNullUniqueId64x2 , 0 , 0 ) ;
kNullUniqueId64x2 , 0 , 0 ,
/* user_defined_timestamps_persisted */ true ) ;
VersionEdit edit2 ;
VersionEdit edit2 ;
@ -1732,7 +1741,7 @@ TEST_F(VersionBuilderTest, CheckConsistencyForL0FilesSortedByEpochNumber) {
/* oldest_blob_file_number */ kInvalidBlobFileNumber ,
/* oldest_blob_file_number */ kInvalidBlobFileNumber ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime ,
1 /* epoch_number */ , kUnknownFileChecksum , kUnknownFileChecksumFuncName ,
1 /* epoch_number */ , kUnknownFileChecksum , kUnknownFileChecksumFuncName ,
kNullUniqueId64x2 , 0 , 0 ) ;
kNullUniqueId64x2 , 0 , 0 , /* user_defined_timestamps_persisted */ true ) ;
version_edit_1 . AddFile (
version_edit_1 . AddFile (
/* level */ 0 , /* file_number */ 2U , /* path_id */ 0 ,
/* level */ 0 , /* file_number */ 2U , /* path_id */ 0 ,
/* file_size */ 100 , /* smallest */ GetInternalKey ( " b " , 2 ) ,
/* file_size */ 100 , /* smallest */ GetInternalKey ( " b " , 2 ) ,
@ -1742,7 +1751,7 @@ TEST_F(VersionBuilderTest, CheckConsistencyForL0FilesSortedByEpochNumber) {
/* oldest_blob_file_number */ kInvalidBlobFileNumber ,
/* oldest_blob_file_number */ kInvalidBlobFileNumber ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime ,
1 /* epoch_number */ , kUnknownFileChecksum , kUnknownFileChecksumFuncName ,
1 /* epoch_number */ , kUnknownFileChecksum , kUnknownFileChecksumFuncName ,
kNullUniqueId64x2 , 0 , 0 ) ;
kNullUniqueId64x2 , 0 , 0 , /* user_defined_timestamps_persisted */ true ) ;
VersionBuilder version_builder_1 ( EnvOptions ( ) , & ioptions_ ,
VersionBuilder version_builder_1 ( EnvOptions ( ) , & ioptions_ ,
nullptr /* table_cache */ , & vstorage_ ,
nullptr /* table_cache */ , & vstorage_ ,
@ -1769,7 +1778,7 @@ TEST_F(VersionBuilderTest, CheckConsistencyForL0FilesSortedByEpochNumber) {
/* oldest_blob_file_number */ kInvalidBlobFileNumber ,
/* oldest_blob_file_number */ kInvalidBlobFileNumber ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime ,
1 /* epoch_number */ , kUnknownFileChecksum , kUnknownFileChecksumFuncName ,
1 /* epoch_number */ , kUnknownFileChecksum , kUnknownFileChecksumFuncName ,
kNullUniqueId64x2 , 0 , 0 ) ;
kNullUniqueId64x2 , 0 , 0 , /* user_defined_timestamps_persisted */ true ) ;
version_edit_2 . AddFile (
version_edit_2 . AddFile (
/* level */ 0 , /* file_number */ 2U , /* path_id */ 0 ,
/* level */ 0 , /* file_number */ 2U , /* path_id */ 0 ,
/* file_size */ 100 , /* smallest */ GetInternalKey ( " b " , 2 ) ,
/* file_size */ 100 , /* smallest */ GetInternalKey ( " b " , 2 ) ,
@ -1779,7 +1788,7 @@ TEST_F(VersionBuilderTest, CheckConsistencyForL0FilesSortedByEpochNumber) {
/* oldest_blob_file_number */ kInvalidBlobFileNumber ,
/* oldest_blob_file_number */ kInvalidBlobFileNumber ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime ,
kUnknownOldestAncesterTime , kUnknownFileCreationTime ,
2 /* epoch_number */ , kUnknownFileChecksum , kUnknownFileChecksumFuncName ,
2 /* epoch_number */ , kUnknownFileChecksum , kUnknownFileChecksumFuncName ,
kNullUniqueId64x2 , 0 , 0 ) ;
kNullUniqueId64x2 , 0 , 0 , /* user_defined_timestamps_persisted */ true ) ;
VersionBuilder version_builder_2 ( EnvOptions ( ) , & ioptions_ ,
VersionBuilder version_builder_2 ( EnvOptions ( ) , & ioptions_ ,
nullptr /* table_cache */ , & vstorage_ ,
nullptr /* table_cache */ , & vstorage_ ,