From 69341d35bf2e056ef258942e3aef5e8f9741fc05 Mon Sep 17 00:00:00 2001 From: yi-xmu Date: Sun, 4 Jan 2026 18:34:27 +0800 Subject: [PATCH 1/2] Fix slice index out of range --- tx_service/include/cc/cc_request.h | 2 ++ tx_service/include/cc/template_cc_map.h | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tx_service/include/cc/cc_request.h b/tx_service/include/cc/cc_request.h index 6b266621..50c78175 100644 --- a/tx_service/include/cc/cc_request.h +++ b/tx_service/include/cc/cc_request.h @@ -4342,6 +4342,8 @@ struct RangePartitionDataSyncScanCc : public CcRequestBase bool IsSlicePinned(uint16_t core_id) const { + assert(export_base_table_item_ || + curr_slice_index_[core_id] < slices_to_scan_.size()); return export_base_table_item_ ? true : slices_to_scan_[curr_slice_index_[core_id]].second; diff --git a/tx_service/include/cc/template_cc_map.h b/tx_service/include/cc/template_cc_map.h index d32c8e32..59ba5b93 100644 --- a/tx_service/include/cc/template_cc_map.h +++ b/tx_service/include/cc/template_cc_map.h @@ -5610,7 +5610,11 @@ class TemplateCcMap : public CcMap recycle_ts = shard_->GlobalMinSiTxStartTs(); } - bool slice_pinned = req.IsSlicePinned(shard_->core_id_); + // If reach to the batch end, it means there are no slices that need to + // be scanned. + bool slice_pinned = req.TheBatchEnd(shard_->core_id_) + ? false + : req.IsSlicePinned(shard_->core_id_); // The following flag is used to mark the behavior of one slice. // Only need to export the key if the key is already persisted, this // will happen when the slice need to split, and should export all the From 4d23ba4568411e929b60ae0e32a8886b126c8901 Mon Sep 17 00:00:00 2001 From: yi-xmu Date: Mon, 5 Jan 2026 11:40:12 +0800 Subject: [PATCH 2/2] update --- tx_service/include/cc/template_cc_map.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tx_service/include/cc/template_cc_map.h b/tx_service/include/cc/template_cc_map.h index 59ba5b93..6af998f4 100644 --- a/tx_service/include/cc/template_cc_map.h +++ b/tx_service/include/cc/template_cc_map.h @@ -5722,7 +5722,11 @@ class TemplateCcMap : public CcMap std::tie(key_it, slice_end_it, slice_end_key) = find_non_empty_slice(*search_start_key); - slice_pinned = req.IsSlicePinned(shard_->core_id_); + // If reach to the batch end, it means there are no slices + // that need to be scanned. + slice_pinned = req.TheBatchEnd(shard_->core_id_) + ? false + : req.IsSlicePinned(shard_->core_id_); export_persisted_key_only = !req.export_base_table_item_ && slice_pinned; }