aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/commands/indexcmds.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c
index 4448b986b62..374e2d0efe4 100644
--- a/src/backend/commands/indexcmds.c
+++ b/src/backend/commands/indexcmds.c
@@ -3057,11 +3057,16 @@ ReindexRelationConcurrently(Oid relationOid, int options)
Oid newIndexId = lfirst_oid(lc2);
Oid heapId;
- CHECK_FOR_INTERRUPTS();
-
/* Start new transaction for this index's concurrent build */
StartTransactionCommand();
+ /*
+ * Check for user-requested abort. This is inside a transaction so as
+ * xact.c does not issue a useless WARNING, and ensures that
+ * session-level locks are cleaned up on abort.
+ */
+ CHECK_FOR_INTERRUPTS();
+
/* Set ActiveSnapshot since functions in the indexes may need it */
PushActiveSnapshot(GetTransactionSnapshot());
@@ -3101,10 +3106,15 @@ ReindexRelationConcurrently(Oid relationOid, int options)
TransactionId limitXmin;
Snapshot snapshot;
- CHECK_FOR_INTERRUPTS();
-
StartTransactionCommand();
+ /*
+ * Check for user-requested abort. This is inside a transaction so as
+ * xact.c does not issue a useless WARNING, and ensures that
+ * session-level locks are cleaned up on abort.
+ */
+ CHECK_FOR_INTERRUPTS();
+
heapId = IndexGetRelation(newIndexId, false);
/*
@@ -3166,6 +3176,11 @@ ReindexRelationConcurrently(Oid relationOid, int options)
Oid newIndexId = lfirst_oid(lc2);
Oid heapId;
+ /*
+ * Check for user-requested abort. This is inside a transaction so as
+ * xact.c does not issue a useless WARNING, and ensures that
+ * session-level locks are cleaned up on abort.
+ */
CHECK_FOR_INTERRUPTS();
heapId = IndexGetRelation(oldIndexId, false);
@@ -3221,7 +3236,13 @@ ReindexRelationConcurrently(Oid relationOid, int options)
Oid oldIndexId = lfirst_oid(lc);
Oid heapId;
+ /*
+ * Check for user-requested abort. This is inside a transaction so as
+ * xact.c does not issue a useless WARNING, and ensures that
+ * session-level locks are cleaned up on abort.
+ */
CHECK_FOR_INTERRUPTS();
+
heapId = IndexGetRelation(oldIndexId, false);
index_concurrently_set_dead(heapId, oldIndexId);
}