Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/backend/commands/indexcmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -5444,6 +5444,17 @@ update_relispartition(Oid relationId, bool newval)
static inline void
set_indexsafe_procflags(void)
{
/*
* A catalog snapshot taken earlier in this transaction (for example, by
* resource-group slot assignment during StartTransaction) leaves a valid
* xmin advertised in MyProc. Drop it here so the assertion below holds;
* CREATE INDEX CONCURRENTLY phases must not hold any snapshot at this
* point anyway.
*/
if (MyProc->xid != InvalidTransactionId ||
MyProc->xmin != InvalidTransactionId)
InvalidateCatalogSnapshot();

/*
* This should only be called before installing xid or xmin in MyProc;
* otherwise, concurrent processes could see an Xmin that moves backwards.
Expand Down
13 changes: 13 additions & 0 deletions src/test/isolation2/expected/resgroup/resgroup_transaction.out
Original file line number Diff line number Diff line change
Expand Up @@ -237,3 +237,16 @@ DROP
-- cleanup
DROP VIEW rg_test_monitor;
DROP

-- ----------------------------------------------------------------------
-- Test: "CREATE INDEX CONCURRENTLY" when compiled with enable-cassert
-- ----------------------------------------------------------------------

CREATE TABLE t(a text, b text);
CREATE
CREATE INDEX CONCURRENTLY t_idx ON t(a, b);
CREATE
DROP INDEX CONCURRENTLY t_idx;
DROP
DROP TABLE t;
DROP
9 changes: 9 additions & 0 deletions src/test/isolation2/sql/resgroup/resgroup_transaction.sql
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,12 @@ DROP FUNCTION rg_drop_func();

-- cleanup
DROP VIEW rg_test_monitor;

-- ----------------------------------------------------------------------
-- Test: "CREATE INDEX CONCURRENTLY" when compiled with enable-cassert
-- ----------------------------------------------------------------------

CREATE TABLE t(a text, b text);
CREATE INDEX CONCURRENTLY t_idx ON t(a, b);
DROP INDEX CONCURRENTLY t_idx;
DROP TABLE t;
Loading