Skip to content

Commit 338634a

Browse files
authored
Add flag for ingest range check (#7767) (#7787)
close #7766
1 parent dbf0cf0 commit 338634a

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

dbms/src/Interpreters/Settings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ struct Settings
228228
M(SettingChecksumAlgorithm, dt_checksum_algorithm, ChecksumAlgo::XXH3, "Checksum algorithm for delta tree stable storage") \
229229
M(SettingCompressionMethod, dt_compression_method, CompressionMethod::LZ4, "The method of data compression when writing.") \
230230
M(SettingInt64, dt_compression_level, 1, "The compression level.") \
231+
M(SettingBool, dt_enable_ingest_check, true, "Check for illegal ranges when ingesting SST files.") \
231232
\
232233
M(SettingInt64, remote_checkpoint_interval_seconds, 30, "The interval of uploading checkpoint to the remote store. Unit is second.") \
233234
M(SettingInt64, remote_gc_method, 1, "The method of running GC task on the remote store. 1 - lifecycle, 2 - scan.") \

dbms/src/Storages/DeltaMerge/DeltaMergeStore_Ingest.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -555,16 +555,19 @@ void DeltaMergeStore::ingestFiles(
555555
}
556556

557557
// Check whether all external files are contained by the range.
558-
for (const auto & ext_file : external_files)
558+
if (dm_context->db_context.getSettingsRef().dt_enable_ingest_check)
559559
{
560-
RUNTIME_CHECK(
561-
compare(range.getStart(), ext_file.range.getStart()) <= 0,
562-
range.toDebugString(),
563-
ext_file.range.toDebugString());
564-
RUNTIME_CHECK(
565-
compare(range.getEnd(), ext_file.range.getEnd()) >= 0,
566-
range.toDebugString(),
567-
ext_file.range.toDebugString());
560+
for (const auto & ext_file : external_files)
561+
{
562+
RUNTIME_CHECK_MSG(
563+
compare(range.getStart(), ext_file.range.getStart()) <= 0 && compare(range.getEnd(), ext_file.range.getEnd()) >= 0,
564+
"Detected illegal region boundary: range={} file_range={} . "
565+
"TiFlash will exit to prevent data inconsistency. "
566+
"If you accept data inconsistency and want to continue the service, "
567+
"set profiles.default.dt_enable_ingest_check=false .",
568+
range.toDebugString(),
569+
ext_file.range.toDebugString());
570+
}
568571
}
569572
}
570573

0 commit comments

Comments
 (0)