Skip to content

Commit 08762fd

Browse files
committed
temp index fix
1 parent 7a86d88 commit 08762fd

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

contrib/mmts/multimaster.c

Lines changed: 25 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,27 @@ 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+
LOCKMODE lockmode;
2446+
Relation rel;
2447+
2448+
IndexStmt *stmt = (IndexStmt *) parsetree;
2449+
lockmode = stmt->concurrent ? ShareUpdateExclusiveLock
2450+
: ShareLock;
2451+
relid = RangeVarGetRelidExtended(stmt->relation, lockmode,
2452+
false, false,
2453+
NULL, // ???
2454+
NULL);
2455+
2456+
rel = heap_open(relid, lockmode);
2457+
2458+
skipCommand = rel->rd_rel->relpersistence == RELPERSISTENCE_TEMP;
2459+
2460+
heap_close(rel, NoLock);
2461+
}
2462+
break;
24412463
default:
24422464
skipCommand = false;
24432465
break;

0 commit comments

Comments
 (0)