Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4378dd7

Browse files
committed
replicate grant stmt
1 parent a0acd7b commit 4378dd7

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

multimaster.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,6 +2272,7 @@ static void MtmBroadcastUtilityStmt(char const* sql, bool ignoreError)
22722272
if (MtmGUCBufferAllocated && !MtmRunUtilityStmt(conns[i], MtmGUCBuffer->data, &utility_errmsg) && !ignoreError)
22732273
{
22742274
errorMsg = "Failed to set GUC variables at node %d";
2275+
elog(ERROR, utility_errmsg);
22752276
failedNode = i;
22762277
break;
22772278
}
@@ -2454,7 +2455,7 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
24542455
case T_PrepareStmt:
24552456
case T_ExecuteStmt:
24562457
case T_DeallocateStmt:
2457-
case T_GrantStmt: /* XXX: we could replicate some of these these */;
2458+
//case T_GrantStmt: /* XXX: we could replicate some of these these */;
24582459
//case T_GrantRoleStmt:
24592460
//case T_AlterDatabaseStmt:
24602461
//case T_AlterDatabaseSetStmt:
@@ -2465,7 +2466,7 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
24652466
case T_ClusterStmt: /* XXX: we could replicate these */;
24662467
case T_VacuumStmt:
24672468
case T_ExplainStmt:
2468-
case T_AlterSystemStmt:
2469+
//case T_AlterSystemStmt:
24692470
case T_VariableShowStmt:
24702471
case T_DiscardStmt:
24712472
//case T_CreateEventTrigStmt:
@@ -2483,7 +2484,13 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
24832484
break;
24842485
case T_VariableSetStmt:
24852486
{
2486-
//VariableSetStmt *stmt = (VariableSetStmt *) parsetree;
2487+
VariableSetStmt *stmt = (VariableSetStmt *) parsetree;
2488+
2489+
skipCommand = true;
2490+
2491+
/* Prevent SET TRANSACTION from replication */
2492+
if (MtmTx.isTransactionBlock || stmt->kind == VAR_SET_MULTI)
2493+
break;
24872494

24882495
if (!MtmGUCBufferAllocated)
24892496
{
@@ -2502,8 +2509,6 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
25022509
//appendStringInfoString(MtmGUCBuffer, "; ");
25032510

25042511
appendStringInfoString(MtmGUCBuffer, queryString);
2505-
2506-
skipCommand = true;
25072512
}
25082513
break;
25092514
case T_CreateStmt:
@@ -2530,7 +2535,7 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
25302535
{
25312536
rel = heap_open(relid, ShareLock);
25322537
skipCommand = rel->rd_rel->relpersistence == RELPERSISTENCE_TEMP;
2533-
heap_close(rel, NoLock);
2538+
heap_close(rel, ShareLock);
25342539
}
25352540
}
25362541
break;

0 commit comments

Comments
 (0)