@@ -65,8 +65,9 @@ SSTFilesToBlockInputStream::SSTFilesToBlockInputStream( //
65
65
auto make_inner_func = [&](const TiFlashRaftProxyHelper * proxy_helper,
66
66
SSTView snap,
67
67
SSTReader::RegionRangeFilter range,
68
- size_t split_id) {
69
- return std::make_unique<MonoSSTReader>(proxy_helper, snap, range, split_id);
68
+ size_t split_id,
69
+ size_t region_id) {
70
+ return std::make_unique<MonoSSTReader>(proxy_helper, snap, range, split_id, region_id);
70
71
};
71
72
for (UInt64 i = 0 ; i < snaps.len ; ++i)
72
73
{
@@ -95,7 +96,8 @@ SSTFilesToBlockInputStream::SSTFilesToBlockInputStream( //
95
96
ssts_default,
96
97
log ,
97
98
region->getRange (),
98
- soft_limit.has_value () ? soft_limit.value ().split_id : DM::SSTScanSoftLimit::HEAD_OR_ONLY_SPLIT);
99
+ soft_limit.has_value () ? soft_limit.value ().split_id : DM::SSTScanSoftLimit::HEAD_OR_ONLY_SPLIT,
100
+ region->id ());
99
101
}
100
102
if (!ssts_write.empty ())
101
103
{
@@ -106,7 +108,8 @@ SSTFilesToBlockInputStream::SSTFilesToBlockInputStream( //
106
108
ssts_write,
107
109
log ,
108
110
region->getRange (),
109
- soft_limit.has_value () ? soft_limit.value ().split_id : DM::SSTScanSoftLimit::HEAD_OR_ONLY_SPLIT);
111
+ soft_limit.has_value () ? soft_limit.value ().split_id : DM::SSTScanSoftLimit::HEAD_OR_ONLY_SPLIT,
112
+ region->id ());
110
113
}
111
114
if (!ssts_lock.empty ())
112
115
{
@@ -117,7 +120,8 @@ SSTFilesToBlockInputStream::SSTFilesToBlockInputStream( //
117
120
ssts_lock,
118
121
log ,
119
122
region->getRange (),
120
- soft_limit.has_value () ? soft_limit.value ().split_id : DM::SSTScanSoftLimit::HEAD_OR_ONLY_SPLIT);
123
+ soft_limit.has_value () ? soft_limit.value ().split_id : DM::SSTScanSoftLimit::HEAD_OR_ONLY_SPLIT,
124
+ region->id ());
121
125
}
122
126
LOG_INFO (
123
127
log ,
@@ -451,6 +455,7 @@ bool SSTFilesToBlockInputStream::maybeSkipBySoftLimit(ColumnFamilyType cf, SSTRe
451
455
452
456
// Skip other versions of the same PK.
453
457
// TODO(split) use seek to optimize if failed several iterations.
458
+ size_t skipped_times = 0 ;
454
459
while (reader && reader->remained ())
455
460
{
456
461
// Read until find the next pk.
@@ -463,17 +468,22 @@ bool SSTFilesToBlockInputStream::maybeSkipBySoftLimit(ColumnFamilyType cf, SSTRe
463
468
{
464
469
RUNTIME_CHECK_MSG (
465
470
current_truncated_ts > start_limit,
466
- " current pk decreases as reader advances, start_raw {} start_pk {} current {}, cf={}, split_id={}, "
471
+ " current pk decreases as reader advances, skipped_times={} start_raw={} start_pk={} current_pk={} "
472
+ " current_raw={} cf={} split_id={}, "
467
473
" region_id={}" ,
474
+ skipped_times,
468
475
soft_limit.value ().raw_start .toDebugString (),
469
476
start_limit.value ().toDebugString (),
470
477
current_truncated_ts.toDebugString (),
478
+ tikv_key.toDebugString (),
471
479
magic_enum::enum_name (cf),
472
480
soft_limit.value ().split_id ,
473
481
region->id ());
474
482
LOG_INFO (
475
483
log ,
476
- " Re-Seek after start_raw {} start_pk {} to {}, current_pk = {}, cf={}, split_id={}, region_id={}" ,
484
+ " Re-Seek after skipped_times={} start_raw={} start_pk={} current_raw={} current_pk={} cf={} "
485
+ " split_id={} region_id={}" ,
486
+ skipped_times,
477
487
soft_limit.value ().raw_start .toDebugString (),
478
488
start_limit.value ().toDebugString (),
479
489
tikv_key.toDebugString (),
@@ -483,6 +493,7 @@ bool SSTFilesToBlockInputStream::maybeSkipBySoftLimit(ColumnFamilyType cf, SSTRe
483
493
region->id ());
484
494
return true ;
485
495
}
496
+ skipped_times++;
486
497
reader->next ();
487
498
}
488
499
// `start_limit` is the last pk of the sst file.
0 commit comments