diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index 536edb3792..b9787d480f 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -5302,6 +5302,13 @@ PushTransaction(void) s->parallelModeLevel = 0; s->topXidLogged = false; + /* + * A correct value must be assigned to startedInRecovery, otherwise the + * index scan on Standby may mark the index item as dead. + * For details, please view the comments of RelationGetIndexScan. + */ + s->startedInRecovery = p->startedInRecovery; + CurrentTransactionState = s; /*