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
This commit is contained in:
Andrew Kryczka 2022-09-28 16:21:43 -07:00 committed by Facebook GitHub Bot
parent b0d8ccbbca
commit dc9f499639
1 changed files with 4 additions and 0 deletions

View File

@ -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();
}