From 88bca782319df8a3be9d5add8a9d0ce347e27187 Mon Sep 17 00:00:00 2001 From: wangwei Date: Fri, 31 May 2024 10:13:19 +0800 Subject: [PATCH] use different undo slots on different nodes --- pkg/src/kernel/knl_database.c | 2 +- pkg/src/kernel/xact/knl_tran.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/src/kernel/knl_database.c b/pkg/src/kernel/knl_database.c index 676112f4..ec4f9ce2 100644 --- a/pkg/src/kernel/knl_database.c +++ b/pkg/src/kernel/knl_database.c @@ -646,7 +646,7 @@ status_t db_mount(knl_session_t *session) } knl_panic(db->status == DB_STATUS_NOMOUNT || db->status == DB_STATUS_CREATING); - kernel->undo_segid = 0; + kernel->undo_segid = kernel->id; if (db_register_iof(kernel) != CT_SUCCESS) { cm_spin_unlock(&kernel->lock); diff --git a/pkg/src/kernel/xact/knl_tran.c b/pkg/src/kernel/xact/knl_tran.c index 2370bbd1..74a0ee68 100644 --- a/pkg/src/kernel/xact/knl_tran.c +++ b/pkg/src/kernel/xact/knl_tran.c @@ -228,6 +228,7 @@ static inline undo_t *tx_bind_undo(knl_session_t *session, knl_rm_t *rm) { undo_context_t *ctx = &session->kernel->undo_ctx; uint64 global_segid; + uint32 node_count = g_dtc->profile.node_count; rm->undo_page_info.undo_rid = g_invalid_undo_rowid; rm->undo_page_info.undo_fs = 0; @@ -239,7 +240,7 @@ static inline undo_t *tx_bind_undo(knl_session_t *session, knl_rm_t *rm) rm->noredo_undo_page_info.encrypt_enable = CT_FALSE; rm->noredo_undo_page_info.undo_log_encrypt = CT_FALSE; - global_segid = (uint64)cm_atomic_inc(&session->kernel->undo_segid); + global_segid = (uint64)cm_atomic_add(&session->kernel->undo_segid, node_count); if (rm->prev == CT_INVALID_ID16) { tx_bind_segid(session, rm, global_segid); -- Gitee