@@ -839,6 +839,36 @@ TEST_F(VersionBuilderTest, CheckConsistencyForBlobFilesAllGarbage) {
839
839
UnrefFilesInVersion (&new_vstorage);
840
840
}
841
841
842
+ TEST_F (VersionBuilderTest, CheckConsistencyForFileDeletedTwice) {
843
+ Add (0 , 1U , " 150" , " 200" , 100U );
844
+ UpdateVersionStorageInfo ();
845
+
846
+ VersionEdit version_edit;
847
+ version_edit.DeleteFile (0 , 1U );
848
+
849
+ EnvOptions env_options;
850
+ constexpr TableCache* table_cache = nullptr ;
851
+ constexpr VersionSet* version_set = nullptr ;
852
+
853
+ VersionBuilder version_builder (env_options, &ioptions_, table_cache,
854
+ &vstorage_, version_set);
855
+ VersionStorageInfo new_vstorage (&icmp_, ucmp_, options_.num_levels ,
856
+ kCompactionStyleLevel , nullptr ,
857
+ true /* force_consistency_checks */ );
858
+ ASSERT_OK (version_builder.Apply (&version_edit));
859
+ ASSERT_OK (version_builder.SaveTo (&new_vstorage));
860
+
861
+ VersionBuilder version_builder2 (env_options, &ioptions_, table_cache,
862
+ &new_vstorage, version_set);
863
+ VersionStorageInfo new_vstorage2 (&icmp_, ucmp_, options_.num_levels ,
864
+ kCompactionStyleLevel , nullptr ,
865
+ true /* force_consistency_checks */ );
866
+ ASSERT_NOK (version_builder2.Apply (&version_edit));
867
+
868
+ UnrefFilesInVersion (&new_vstorage);
869
+ UnrefFilesInVersion (&new_vstorage2);
870
+ }
871
+
842
872
TEST_F (VersionBuilderTest, EstimatedActiveKeys) {
843
873
const uint32_t kTotalSamples = 20 ;
844
874
const uint32_t kNumLevels = 5 ;
0 commit comments