diff --git a/tx_service/include/cc/cc_request.h b/tx_service/include/cc/cc_request.h index 47ebfce8..6b455843 100644 --- a/tx_service/include/cc/cc_request.h +++ b/tx_service/include/cc/cc_request.h @@ -8769,7 +8769,7 @@ struct ScanSliceDeltaSizeCcForRangePartition : public CcRequestBase return store_range_.load(std::memory_order_relaxed); } - bool SetStoreRange(StoreRange *store_range, uint16_t core_id) + bool SetStoreRange(StoreRange *store_range) { StoreRange *expect = nullptr; assert(store_range); diff --git a/tx_service/include/cc/cc_shard.h b/tx_service/include/cc/cc_shard.h index 0299a8c4..d548751d 100644 --- a/tx_service/include/cc/cc_shard.h +++ b/tx_service/include/cc/cc_shard.h @@ -1187,11 +1187,23 @@ class CcShard void DeleteSchemaCntl(const TableName &tbl_name); + /** + * @brief Create a data sync task for triggering the split range operation. + * + * @param table_name - The name of the table. + * @param ng_id - The id of the node group. + * @param ng_term - The term of the node group. + * @param range_id - The id of the range. + * @param data_sync_ts - The timestamp of the data sync. + * @param is_dirty - Whether the table is dirty (such as the secondary index + * table that is being built). + */ void CreateSplitRangeDataSyncTask(const TableName &table_name, uint32_t ng_id, int64_t ng_term, int32_t range_id, - uint64_t data_sync_ts); + uint64_t data_sync_ts, + bool is_dirty); void ClearNativeSchemaCntl(); void CollectCacheHit(); diff --git a/tx_service/include/cc/local_cc_shards.h b/tx_service/include/cc/local_cc_shards.h index 316d8042..9256516d 100644 --- a/tx_service/include/cc/local_cc_shards.h +++ b/tx_service/include/cc/local_cc_shards.h @@ -1756,11 +1756,23 @@ class LocalCcShards uint64_t txn, CcHandlerResult *hres); + /** + * @brief Create a data sync task for triggering the split range operation. + * + * @param table_name - The name of the table. + * @param ng_id - The id of the node group. + * @param ng_term - The term of the node group. + * @param range_id - The id of the range. + * @param data_sync_ts - The timestamp of the data sync. + * @param is_dirty - Whether the table is dirty (such as the secondary index + * table that is being built). + */ void CreateSplitRangeDataSyncTask(const TableName &table_name, uint32_t ng_id, int64_t ng_term, int32_t range_id, - uint64_t data_sync_ts); + uint64_t data_sync_ts, + bool is_dirty); std::pair PinStoreRange( const TableName &table_name, diff --git a/tx_service/include/cc/template_cc_map.h b/tx_service/include/cc/template_cc_map.h index 1870cbe5..10d18813 100644 --- a/tx_service/include/cc/template_cc_map.h +++ b/tx_service/include/cc/template_cc_map.h @@ -643,7 +643,8 @@ class TemplateCcMap : public CcMap cc_ng_id_, cce_addr->Term(), range_id, - commit_ts); + commit_ts, + false); } } } @@ -7362,7 +7363,8 @@ class TemplateCcMap : public CcMap cc_ng_id_, req.CcNgTerm(), static_cast(partition_id), - data_sync_ts); + data_sync_ts, + req.Kind() == UploadBatchType::SkIndexData); } } } @@ -7776,8 +7778,7 @@ class TemplateCcMap : public CcMap req.StartTxKey(), &req, shard_); - if (store_range && - !req.SetStoreRange(store_range, shard_->core_id_)) + if (store_range && !req.SetStoreRange(store_range)) { // StoreRange already been pinned by other core, unpin // on the current core. diff --git a/tx_service/src/cc/cc_req_misc.cpp b/tx_service/src/cc/cc_req_misc.cpp index 2d6dbf31..e490b410 100644 --- a/tx_service/src/cc/cc_req_misc.cpp +++ b/tx_service/src/cc/cc_req_misc.cpp @@ -1536,7 +1536,8 @@ bool FetchTableRangeSizeCc::Execute(CcShard &ccs) node_group_id_, node_group_term_, partition_id_, - data_sync_ts); + data_sync_ts, + false); } return true; diff --git a/tx_service/src/cc/cc_shard.cpp b/tx_service/src/cc/cc_shard.cpp index 661ceb5f..1343888b 100644 --- a/tx_service/src/cc/cc_shard.cpp +++ b/tx_service/src/cc/cc_shard.cpp @@ -3703,10 +3703,11 @@ void CcShard::CreateSplitRangeDataSyncTask(const TableName &table_name, uint32_t ng_id, int64_t ng_term, int32_t range_id, - uint64_t data_sync_ts) + uint64_t data_sync_ts, + bool is_dirty) { local_shards_.CreateSplitRangeDataSyncTask( - table_name, ng_id, ng_term, range_id, data_sync_ts); + table_name, ng_id, ng_term, range_id, data_sync_ts, is_dirty); } void CcShard::CollectCacheHit() diff --git a/tx_service/src/cc/local_cc_shards.cpp b/tx_service/src/cc/local_cc_shards.cpp index 280719e4..d57980d1 100644 --- a/tx_service/src/cc/local_cc_shards.cpp +++ b/tx_service/src/cc/local_cc_shards.cpp @@ -2949,7 +2949,8 @@ void LocalCcShards::CreateSplitRangeDataSyncTask(const TableName &table_name, uint32_t ng_id, int64_t ng_term, int32_t range_id, - uint64_t data_sync_ts) + uint64_t data_sync_ts, + bool is_dirty) { CODE_FAULT_INJECTOR("term_skip_auto_split_range", { DLOG(INFO) << "FaultInject term_skip_auto_split_range"; @@ -2970,7 +2971,7 @@ void LocalCcShards::CreateSplitRangeDataSyncTask(const TableName &table_name, ng_term, range_entry, data_sync_ts, - false, + is_dirty, false, last_sync_ts, status,