This is an automated email from the ASF dual-hosted git repository.
maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
The following commit(s) were added to refs/heads/main by this push:
new 6a754f7a7ca Fix: use correct offset to access members of Serialized
Snapshot Data
6a754f7a7ca is described below
commit 6a754f7a7ca3ad9f6fc9f8e723a05710b0505e31
Author: leo <[email protected]>
AuthorDate: Thu Aug 14 18:38:19 2025 +0800
Fix: use correct offset to access members of Serialized Snapshot Data
---
src/backend/utils/time/snapmgr.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/backend/utils/time/snapmgr.c b/src/backend/utils/time/snapmgr.c
index a5e94e065c2..34f45d5b59b 100644
--- a/src/backend/utils/time/snapmgr.c
+++ b/src/backend/utils/time/snapmgr.c
@@ -2592,13 +2592,19 @@ RestoreSnapshot(char *start_address)
if (serialized_snapshot.haveDistribSnapshot &&
serialized_snapshot.ds_count > 0)
{
+ Size ds_off = sizeof(SerializedSnapshotData) +
+ serialized_snapshot.xcnt *
sizeof(TransactionId) +
+ serialized_snapshot.subxcnt *
sizeof(TransactionId);
+ Size ds_lmoff = ds_off +
+ serialized_snapshot.ds_count *
sizeof(DistributedTransactionId);
+
snapshot->distribSnapshotWithLocalMapping.ds.inProgressXidArray
=
(DistributedTransactionId*) ((char *) snapshot + dsoff);
snapshot->distribSnapshotWithLocalMapping.inProgressMappedLocalXids =
(TransactionId*) ((char *) snapshot + dslmoff);
memcpy(snapshot->distribSnapshotWithLocalMapping.ds.inProgressXidArray,
- (DistributedTransactionId*) (start_address +
dsoff),
+ (DistributedTransactionId*) (start_address +
ds_off),
serialized_snapshot.ds_count *
sizeof(DistributedTransactionId));
@@ -2608,7 +2614,7 @@ RestoreSnapshot(char *start_address)
0,
serialized_snapshot.ds_count *
sizeof(TransactionId));
memcpy(snapshot->distribSnapshotWithLocalMapping.inProgressMappedLocalXids,
- (TransactionId*) (start_address +
dslmoff),
+ (TransactionId*) (start_address +
ds_lmoff),
serialized_snapshot.currentLocalXidsCount *
sizeof(TransactionId));
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]