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
main
Andrew Kryczka 2 years ago committed by Facebook GitHub Bot
parent b0d8ccbbca
commit dc9f499639
  1. 4
      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)); s = sst_file_writer.Put(Slice(key_str), Slice(value, value_len));
} }
if (s.ok() && keys.empty()) {
return;
}
if (s.ok()) { if (s.ok()) {
s = sst_file_writer.Finish(); s = sst_file_writer.Finish();
} }

Loading…
Cancel
Save