From dc9f499639ee437006aed36d31eb4887511777aa Mon Sep 17 00:00:00 2001 From: Andrew Kryczka Date: Wed, 28 Sep 2022 16:21:43 -0700 Subject: [PATCH] db_stress TestIngestExternalFile avoid empty files (#10754) Summary: If all the keys in range [key_base, shared->GetMaxKey()) are non-overwritable `TestIngestExternalFile()` would attempt to ingest a file with zero keys, leading to the following error: "Cannot create sst file with no entries". This PR changes `TestIngestExternalFile()` to return early in that case instead of going through with the ingestion attempt. Pull Request resolved: https://github.com/facebook/rocksdb/pull/10754 Reviewed By: hx235 Differential Revision: D39909195 Pulled By: ajkr fbshipit-source-id: e06e6b9cc24826fbd450e5130885e6f07164badd --- db_stress_tool/no_batched_ops_stress.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/db_stress_tool/no_batched_ops_stress.cc b/db_stress_tool/no_batched_ops_stress.cc index 86a1b4a7d..ff9ca38a8 100644 --- a/db_stress_tool/no_batched_ops_stress.cc +++ b/db_stress_tool/no_batched_ops_stress.cc @@ -1029,6 +1029,10 @@ class NonBatchedOpsStressTest : public StressTest { s = sst_file_writer.Put(Slice(key_str), Slice(value, value_len)); } + if (s.ok() && keys.empty()) { + return; + } + if (s.ok()) { s = sst_file_writer.Finish(); }