|
3 | 3 | // COPYING file in the root directory) and Apache 2.0 License
|
4 | 4 | // (found in the LICENSE.Apache file in the root directory).
|
5 | 5 |
|
6 |
| - |
7 | 6 | #include "db/external_sst_file_ingestion_job.h"
|
8 | 7 |
|
9 | 8 | #include <algorithm>
|
@@ -912,16 +911,7 @@ Status ExternalSstFileIngestionJob::AssignLevelAndSeqnoForIngestedFile(
|
912 | 911 | if (lvl > 0 && lvl < vstorage->base_level()) {
|
913 | 912 | continue;
|
914 | 913 | }
|
915 |
| - if (cfd_->RangeOverlapWithCompaction( |
916 |
| - file_to_ingest->smallest_internal_key.user_key(), |
917 |
| - file_to_ingest->largest_internal_key.user_key(), lvl)) { |
918 |
| - // We must use L0 or any level higher than `lvl` to be able to overwrite |
919 |
| - // the compaction output keys that we overlap with in this level, We also |
920 |
| - // need to assign this file a seqno to overwrite the compaction output |
921 |
| - // keys in level `lvl` |
922 |
| - overlap_with_db = true; |
923 |
| - break; |
924 |
| - } else if (vstorage->NumLevelFiles(lvl) > 0) { |
| 914 | + if (vstorage->NumLevelFiles(lvl) > 0) { |
925 | 915 | bool overlap_with_level = false;
|
926 | 916 | status = sv->current->OverlapWithLevelIterator(
|
927 | 917 | ro, env_options_, file_to_ingest->smallest_internal_key.user_key(),
|
@@ -1123,6 +1113,13 @@ bool ExternalSstFileIngestionJob::IngestedFileFitInLevel(
|
1123 | 1113 | return false;
|
1124 | 1114 | }
|
1125 | 1115 |
|
| 1116 | + if (cfd_->RangeOverlapWithCompaction(file_smallest_user_key, |
| 1117 | + file_largest_user_key, level)) { |
| 1118 | + // File overlap with a running compaction output that will be stored |
| 1119 | + // in this level, we cannot add this file to this level |
| 1120 | + return false; |
| 1121 | + } |
| 1122 | + |
1126 | 1123 | // File did not overlap with level files, nor compaction output
|
1127 | 1124 | return true;
|
1128 | 1125 | }
|
|
0 commit comments