@@ -139,7 +139,7 @@ HTAB* MtmXid2State;
139
139
static HTAB * MtmGid2State ;
140
140
static HTAB * MtmLocalTables ;
141
141
142
- static bool MtmIsRecoverySession ;
142
+ static bool MtmIsRecoverySession ;
143
143
144
144
static MtmCurrentTrans MtmTx ;
145
145
@@ -198,6 +198,9 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
198
198
ProcessUtilityContext context , ParamListInfo params ,
199
199
DestReceiver * dest , char * completionTag );
200
200
201
+ static StringInfo MtmGUCBuffer ;
202
+ static bool MtmGUCBufferAllocated = false;
203
+
201
204
/*
202
205
* -------------------------------------------
203
206
* Synchronize access to MTM structures.
@@ -2238,6 +2241,12 @@ static void MtmBroadcastUtilityStmt(char const* sql, bool ignoreError)
2238
2241
{
2239
2242
if (conns [i ])
2240
2243
{
2244
+ if (MtmGUCBufferAllocated && !MtmRunUtilityStmt (conns [i ], MtmGUCBuffer -> data , & utility_errmsg ) && !ignoreError )
2245
+ {
2246
+ errorMsg = "Failed to set GUC variables at node %d" ;
2247
+ failedNode = i ;
2248
+ break ;
2249
+ }
2241
2250
if (!MtmRunUtilityStmt (conns [i ], "BEGIN TRANSACTION" , & utility_errmsg ) && !ignoreError )
2242
2251
{
2243
2252
errorMsg = "Failed to start transaction at node %d" ;
@@ -2249,7 +2258,10 @@ static void MtmBroadcastUtilityStmt(char const* sql, bool ignoreError)
2249
2258
if (i + 1 == MtmNodeId )
2250
2259
errorMsg = utility_errmsg ;
2251
2260
else
2261
+ {
2262
+ elog (ERROR , utility_errmsg );
2252
2263
errorMsg = "Failed to run command at node %d" ;
2264
+ }
2253
2265
2254
2266
failedNode = i ;
2255
2267
break ;
@@ -2407,7 +2419,6 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
2407
2419
case T_FetchStmt :
2408
2420
case T_DoStmt :
2409
2421
case T_CreateTableSpaceStmt :
2410
- case T_DropTableSpaceStmt :
2411
2422
case T_AlterTableSpaceOptionsStmt :
2412
2423
case T_TruncateStmt :
2413
2424
case T_CommentStmt : /* XXX: we could replicate these */ ;
@@ -2416,9 +2427,9 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
2416
2427
case T_ExecuteStmt :
2417
2428
case T_DeallocateStmt :
2418
2429
case T_GrantStmt : /* XXX: we could replicate some of these these */ ;
2419
- case T_GrantRoleStmt :
2420
- case T_AlterDatabaseStmt :
2421
- case T_AlterDatabaseSetStmt :
2430
+ // case T_GrantRoleStmt:
2431
+ // case T_AlterDatabaseStmt:
2432
+ // case T_AlterDatabaseSetStmt:
2422
2433
case T_NotifyStmt :
2423
2434
case T_ListenStmt :
2424
2435
case T_UnlistenStmt :
@@ -2427,22 +2438,46 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
2427
2438
case T_VacuumStmt :
2428
2439
case T_ExplainStmt :
2429
2440
case T_AlterSystemStmt :
2430
- case T_VariableSetStmt :
2431
2441
case T_VariableShowStmt :
2432
2442
case T_DiscardStmt :
2433
- case T_CreateEventTrigStmt :
2434
- case T_AlterEventTrigStmt :
2435
- case T_CreateRoleStmt :
2436
- case T_AlterRoleStmt :
2437
- case T_AlterRoleSetStmt :
2438
- case T_DropRoleStmt :
2443
+ // case T_CreateEventTrigStmt:
2444
+ // case T_AlterEventTrigStmt:
2445
+ // case T_CreateRoleStmt:
2446
+ // case T_AlterRoleStmt:
2447
+ // case T_AlterRoleSetStmt:
2448
+ // case T_DropRoleStmt:
2439
2449
case T_ReassignOwnedStmt :
2440
2450
case T_LockStmt :
2441
- case T_ConstraintsSetStmt :
2451
+ // case T_ConstraintsSetStmt:
2442
2452
case T_CheckPointStmt :
2443
2453
case T_ReindexStmt :
2444
2454
skipCommand = true;
2445
2455
break ;
2456
+ case T_VariableSetStmt :
2457
+ {
2458
+ //VariableSetStmt *stmt = (VariableSetStmt *) parsetree;
2459
+
2460
+ if (!MtmGUCBufferAllocated )
2461
+ {
2462
+ MemoryContext oldcontext ;
2463
+
2464
+ oldcontext = MemoryContextSwitchTo (TopMemoryContext );
2465
+ MtmGUCBuffer = makeStringInfo ();
2466
+ MemoryContextSwitchTo (oldcontext );
2467
+ MtmGUCBufferAllocated = true;
2468
+ }
2469
+
2470
+ //appendStringInfoString(MtmGUCBuffer, "SET ");
2471
+ //appendStringInfoString(MtmGUCBuffer, stmt->name);
2472
+ //appendStringInfoString(MtmGUCBuffer, " TO ");
2473
+ //appendStringInfoString(MtmGUCBuffer, ExtractSetVariableArgs(stmt));
2474
+ //appendStringInfoString(MtmGUCBuffer, "; ");
2475
+
2476
+ appendStringInfoString (MtmGUCBuffer , queryString );
2477
+
2478
+ skipCommand = true;
2479
+ }
2480
+ break ;
2446
2481
case T_CreateStmt :
2447
2482
{
2448
2483
/* Do not replicate temp tables */
@@ -2490,7 +2525,6 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
2490
2525
}
2491
2526
}
2492
2527
break ;
2493
- case T_CreateSchemaStmt :
2494
2528
default :
2495
2529
skipCommand = false;
2496
2530
break ;
0 commit comments