This is an automated email from the ASF dual-hosted git repository. leborchuk pushed a commit to branch REL_2_STABLE in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 054aa5dd51e25be745047c0102198ba9c2371550 Author: Michael Paquier <[email protected]> AuthorDate: Tue Dec 12 17:05:33 2023 +0100 Prevent tuples to be marked as dead in subtransactions on standbys Dead tuples are ignored and are not marked as dead during recovery, as it can lead to MVCC issues on a standby because its xmin may not match with the primary. This information is tracked by a field called "xactStartedInRecovery" in the transaction state data, switched on when starting a transaction in recovery. Unfortunately, this information was not correctly tracked when starting a subtransaction, because the transaction state used for the subtransaction did not update "xactStartedInRecovery" based on the state of its parent. This would cause index scans done in subtransactions to return inconsistent data, depending on how the xmin of the primary and/or the standby evolved. This is broken since the introduction of hot standby in efc16ea52067, so backpatch all the way down. Author: Fei Changhong Reviewed-by: Kyotaro Horiguchi Discussion: https://postgr.es/m/[email protected] Backpatch-through: 12 (cherry picked from commit 0cfd3ddfe070af0fe42ac15c26b7f22e3799f544) --- src/backend/access/transam/xact.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index 3aaf2ef9cb5..978a264b246 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -6444,6 +6444,7 @@ PushTransaction(void) s->blockState = TBLOCK_SUBBEGIN; GetUserIdAndSecContext(&s->prevUser, &s->prevSecContext); s->prevXactReadOnly = XactReadOnly; + s->startedInRecovery = p->startedInRecovery; s->parallelModeLevel = 0; s->assigned = false; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
