Skip to content

Commit 6681d70

Browse files
committed
replicate grant stmt
1 parent 1cb8c17 commit 6681d70

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

contrib/mmts/multimaster.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2245,6 +2245,7 @@ static void MtmBroadcastUtilityStmt(char const* sql, bool ignoreError)
22452245
if (MtmGUCBufferAllocated && !MtmRunUtilityStmt(conns[i], MtmGUCBuffer->data, &utility_errmsg) && !ignoreError)
22462246
{
22472247
errorMsg = "Failed to set GUC variables at node %d";
2248+
elog(ERROR, utility_errmsg);
22482249
failedNode = i;
22492250
break;
22502251
}
@@ -2431,7 +2432,7 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
24312432
case T_PrepareStmt:
24322433
case T_ExecuteStmt:
24332434
case T_DeallocateStmt:
2434-
case T_GrantStmt: /* XXX: we could replicate some of these these */;
2435+
//case T_GrantStmt: /* XXX: we could replicate some of these these */;
24352436
//case T_GrantRoleStmt:
24362437
//case T_AlterDatabaseStmt:
24372438
//case T_AlterDatabaseSetStmt:
@@ -2442,7 +2443,7 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
24422443
case T_ClusterStmt: /* XXX: we could replicate these */;
24432444
case T_VacuumStmt:
24442445
case T_ExplainStmt:
2445-
case T_AlterSystemStmt:
2446+
//case T_AlterSystemStmt:
24462447
case T_VariableShowStmt:
24472448
case T_DiscardStmt:
24482449
//case T_CreateEventTrigStmt:
@@ -2460,7 +2461,13 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
24602461
break;
24612462
case T_VariableSetStmt:
24622463
{
2463-
//VariableSetStmt *stmt = (VariableSetStmt *) parsetree;
2464+
VariableSetStmt *stmt = (VariableSetStmt *) parsetree;
2465+
2466+
skipCommand = true;
2467+
2468+
/* Prevent SET TRANSACTION from replication */
2469+
if (MtmTx.isTransactionBlock || stmt->kind == VAR_SET_MULTI)
2470+
break;
24642471

24652472
if (!MtmGUCBufferAllocated)
24662473
{
@@ -2479,8 +2486,6 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
24792486
//appendStringInfoString(MtmGUCBuffer, "; ");
24802487

24812488
appendStringInfoString(MtmGUCBuffer, queryString);
2482-
2483-
skipCommand = true;
24842489
}
24852490
break;
24862491
case T_CreateStmt:
@@ -2507,7 +2512,7 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
25072512
{
25082513
rel = heap_open(relid, ShareLock);
25092514
skipCommand = rel->rd_rel->relpersistence == RELPERSISTENCE_TEMP;
2510-
heap_close(rel, NoLock);
2515+
heap_close(rel, ShareLock);
25112516
}
25122517
}
25132518
break;

0 commit comments

Comments
 (0)