Skip to content

Commit 8652d7c

Browse files
committed
Merge branch 'tmp_index_fix'
2 parents 56aaa09 + 2706559 commit 8652d7c

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

contrib/mmts/multimaster.c

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2231,9 +2231,10 @@ static void MtmBroadcastUtilityStmt(char const* sql, bool ignoreError)
22312231
}
22322232
if (!MtmRunUtilityStmt(conns[i], sql, &utility_errmsg) && !ignoreError)
22332233
{
2234-
// errorMsg = "Failed to run command at node %d";
2235-
// XXX: add check for our node
2236-
errorMsg = utility_errmsg;
2234+
if (i + 1 == MtmNodeId)
2235+
errorMsg = utility_errmsg;
2236+
else
2237+
errorMsg = "Failed to run command at node %d";
22372238

22382239
failedNode = i;
22392240
break;
@@ -2438,6 +2439,23 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
24382439
skipCommand = stmt->relation->relpersistence == RELPERSISTENCE_TEMP;
24392440
}
24402441
break;
2442+
case T_IndexStmt:
2443+
{
2444+
Oid relid;
2445+
Relation rel;
2446+
IndexStmt *stmt = (IndexStmt *) parsetree;
2447+
bool isTopLevel = (context == PROCESS_UTILITY_TOPLEVEL);
2448+
2449+
if (stmt->concurrent)
2450+
PreventTransactionChain(isTopLevel,
2451+
"CREATE INDEX CONCURRENTLY");
2452+
2453+
relid = RelnameGetRelid(stmt->relation->relname);
2454+
rel = heap_open(relid, ShareLock);
2455+
skipCommand = rel->rd_rel->relpersistence == RELPERSISTENCE_TEMP;
2456+
heap_close(rel, NoLock);
2457+
}
2458+
break;
24412459
default:
24422460
skipCommand = false;
24432461
break;

0 commit comments

Comments
 (0)