Skip to content

Instantly share code, notes, and snippets.

@ajkr
Created August 12, 2019 18:22
Show Gist options
  • Save ajkr/2874c8348ff4731cd10a3bea505d720d to your computer and use it in GitHub Desktop.
Save ajkr/2874c8348ff4731cd10a3bea505d720d to your computer and use it in GitHub Desktop.
diff --git a/db/external_sst_file_test.cc b/db/external_sst_file_test.cc
index ebd6cb2b1..5e5c0527c 100644
--- a/db/external_sst_file_test.cc
+++ b/db/external_sst_file_test.cc
@@ -2335,6 +2335,34 @@ TEST_F(ExternalSSTFileTest, SkipBloomFilter) {
}
}
+TEST_F(ExternalSSTFileTest, IngestMultipleFilesToL0) {
+ const int kNumLevels = 2;
+ const int kNumFilesPerLevel = 2;
+ Options options = CurrentOptions();
+ options.num_levels = kNumLevels;
+ DestroyAndReopen(options);
+ for (int l = 0; l < kNumLevels; ++l) {
+ IngestExternalFileOptions ifo;
+ ifo.allow_global_seqno = true;
+ std::vector<std::vector<std::pair<std::string, std::string>>> data;
+ data.push_back(
+ {std::make_pair("foo1", "fv1"), std::make_pair("foo2", "fv2")});
+ data.push_back(
+ {std::make_pair("bar1", "bv1"), std::make_pair("bar2", "bv2")});
+ std::vector<std::map<std::string, std::string>> true_data(kNumFilesPerLevel);
+ int file_id = (++last_file_id_);
+ Status s;
+ std::vector<std::string> external_file_paths(kNumFilesPerLevel);
+ for (size_t i = 0; i != kNumFilesPerLevel; ++i) {
+ ASSERT_OK(GenerateOneExternalFile(
+ options, dbfull()->DefaultColumnFamily(), data[i], file_id, false,
+ &external_file_paths[i], &true_data[i]));
+ ++file_id;
+ }
+ ASSERT_OK(db_->IngestExternalFile(dbfull()->DefaultColumnFamily(), external_file_paths, ifo));
+ }
+}
+
TEST_F(ExternalSSTFileTest, IngestFileWrittenWithCompressionDictionary) {
if (!ZSTD_Supported()) {
return;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment