diff --git a/tx_service/include/cc/cc_request.h b/tx_service/include/cc/cc_request.h index ca1ae612..6b266621 100644 --- a/tx_service/include/cc/cc_request.h +++ b/tx_service/include/cc/cc_request.h @@ -4299,6 +4299,8 @@ struct RangePartitionDataSyncScanCc : public CcRequestBase while (curr_slice->EndTxKey() < pause_pos_[core_id].first) { ++curr_slice_idx; + assert(curr_slice_idx < + slice_coordinator_.pinned_slices_.size()); curr_slice = slice_coordinator_.pinned_slices_[curr_slice_idx]; } curr_slice_index_[core_id] = curr_slice_idx; diff --git a/tx_service/include/cc/template_cc_map.h b/tx_service/include/cc/template_cc_map.h index 56c357ce..d32c8e32 100644 --- a/tx_service/include/cc/template_cc_map.h +++ b/tx_service/include/cc/template_cc_map.h @@ -5734,7 +5734,11 @@ class TemplateCcMap : public CcMap bool no_more_data = (key_it == slice_end_it) && req.IsLastBatch(); if (!no_more_data) { - next_pause_key = key_it->first->CloneTxKey(); + // If key_it == slice_end_it, it means the current slice is + // completed. The paused key should be the slice end key. + next_pause_key = key_it != slice_end_it + ? key_it->first->CloneTxKey() + : slice_end_key->CloneTxKey(); } // Set the pause_pos_ to mark resume position.