@@ -139,7 +139,7 @@ HTAB* MtmXid2State;
139139static HTAB * MtmGid2State ;
140140static HTAB * MtmLocalTables ;
141141
142- static bool MtmIsRecoverySession ;
142+ static bool MtmIsRecoverySession ;
143143
144144static MtmCurrentTrans MtmTx ;
145145
@@ -198,6 +198,9 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
198198ProcessUtilityContext context ,ParamListInfo params ,
199199DestReceiver * dest ,char * completionTag );
200200
201+ static StringInfo MtmGUCBuffer ;
202+ static bool MtmGUCBufferAllocated = false;
203+
201204/*
202205 * -------------------------------------------
203206 * Synchronize access to MTM structures.
@@ -2238,6 +2241,12 @@ static void MtmBroadcastUtilityStmt(char const* sql, bool ignoreError)
22382241{
22392242if (conns [i ])
22402243{
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+ }
22412250if (!MtmRunUtilityStmt (conns [i ],"BEGIN TRANSACTION" ,& utility_errmsg )&& !ignoreError )
22422251{
22432252errorMsg = "Failed to start transaction at node %d" ;
@@ -2249,7 +2258,10 @@ static void MtmBroadcastUtilityStmt(char const* sql, bool ignoreError)
22492258if (i + 1 == MtmNodeId )
22502259errorMsg = utility_errmsg ;
22512260else
2261+ {
2262+ elog (ERROR ,utility_errmsg );
22522263errorMsg = "Failed to run command at node %d" ;
2264+ }
22532265
22542266failedNode = i ;
22552267break ;
@@ -2407,7 +2419,6 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
24072419case T_FetchStmt :
24082420case T_DoStmt :
24092421case T_CreateTableSpaceStmt :
2410- case T_DropTableSpaceStmt :
24112422case T_AlterTableSpaceOptionsStmt :
24122423case T_TruncateStmt :
24132424case T_CommentStmt :/* XXX: we could replicate these */ ;
@@ -2416,9 +2427,9 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
24162427case T_ExecuteStmt :
24172428case T_DeallocateStmt :
24182429case 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:
24222433case T_NotifyStmt :
24232434case T_ListenStmt :
24242435case T_UnlistenStmt :
@@ -2427,22 +2438,46 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
24272438case T_VacuumStmt :
24282439case T_ExplainStmt :
24292440case T_AlterSystemStmt :
2430- case T_VariableSetStmt :
24312441case T_VariableShowStmt :
24322442case 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:
24392449case T_ReassignOwnedStmt :
24402450case T_LockStmt :
2441- case T_ConstraintsSetStmt :
2451+ // case T_ConstraintsSetStmt:
24422452case T_CheckPointStmt :
24432453case T_ReindexStmt :
24442454skipCommand = true;
24452455break ;
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 ;
24462481case T_CreateStmt :
24472482{
24482483/* Do not replicate temp tables */
@@ -2490,7 +2525,6 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
24902525}
24912526}
24922527break ;
2493- case T_CreateSchemaStmt :
24942528default :
24952529skipCommand = false;
24962530break ;