Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1cb8c17

Browse files
committed
send GUC variables to nodes
1 parent629f40d commit1cb8c17

File tree

1 file changed

+48
-14
lines changed

1 file changed

+48
-14
lines changed

‎contrib/mmts/multimaster.c‎

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ HTAB* MtmXid2State;
140140
staticHTAB*MtmGid2State;
141141
staticHTAB*MtmLocalTables;
142142

143-
staticboolMtmIsRecoverySession;
143+
staticboolMtmIsRecoverySession;
144144

145145
staticMtmCurrentTransMtmTx;
146146

@@ -199,6 +199,9 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
199199
ProcessUtilityContextcontext,ParamListInfoparams,
200200
DestReceiver*dest,char*completionTag);
201201

202+
staticStringInfoMtmGUCBuffer;
203+
staticboolMtmGUCBufferAllocated= false;
204+
202205
/*
203206
* -------------------------------------------
204207
* Synchronize access to MTM structures.
@@ -2239,6 +2242,12 @@ static void MtmBroadcastUtilityStmt(char const* sql, bool ignoreError)
22392242
{
22402243
if (conns[i])
22412244
{
2245+
if (MtmGUCBufferAllocated&& !MtmRunUtilityStmt(conns[i],MtmGUCBuffer->data,&utility_errmsg)&& !ignoreError)
2246+
{
2247+
errorMsg="Failed to set GUC variables at node %d";
2248+
failedNode=i;
2249+
break;
2250+
}
22422251
if (!MtmRunUtilityStmt(conns[i],"BEGIN TRANSACTION",&utility_errmsg)&& !ignoreError)
22432252
{
22442253
errorMsg="Failed to start transaction at node %d";
@@ -2250,7 +2259,10 @@ static void MtmBroadcastUtilityStmt(char const* sql, bool ignoreError)
22502259
if (i+1==MtmNodeId)
22512260
errorMsg=utility_errmsg;
22522261
else
2262+
{
2263+
elog(ERROR,utility_errmsg);
22532264
errorMsg="Failed to run command at node %d";
2265+
}
22542266

22552267
failedNode=i;
22562268
break;
@@ -2412,7 +2424,6 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
24122424
caseT_FetchStmt:
24132425
caseT_DoStmt:
24142426
caseT_CreateTableSpaceStmt:
2415-
caseT_DropTableSpaceStmt:
24162427
caseT_AlterTableSpaceOptionsStmt:
24172428
caseT_TruncateStmt:
24182429
caseT_CommentStmt:/* XXX: we could replicate these */;
@@ -2421,9 +2432,9 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
24212432
caseT_ExecuteStmt:
24222433
caseT_DeallocateStmt:
24232434
caseT_GrantStmt:/* XXX: we could replicate some of these these */;
2424-
caseT_GrantRoleStmt:
2425-
caseT_AlterDatabaseStmt:
2426-
caseT_AlterDatabaseSetStmt:
2435+
//case T_GrantRoleStmt:
2436+
//case T_AlterDatabaseStmt:
2437+
//case T_AlterDatabaseSetStmt:
24272438
caseT_NotifyStmt:
24282439
caseT_ListenStmt:
24292440
caseT_UnlistenStmt:
@@ -2432,22 +2443,46 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
24322443
caseT_VacuumStmt:
24332444
caseT_ExplainStmt:
24342445
caseT_AlterSystemStmt:
2435-
caseT_VariableSetStmt:
24362446
caseT_VariableShowStmt:
24372447
caseT_DiscardStmt:
2438-
caseT_CreateEventTrigStmt:
2439-
caseT_AlterEventTrigStmt:
2440-
caseT_CreateRoleStmt:
2441-
caseT_AlterRoleStmt:
2442-
caseT_AlterRoleSetStmt:
2443-
caseT_DropRoleStmt:
2448+
//case T_CreateEventTrigStmt:
2449+
//case T_AlterEventTrigStmt:
2450+
//case T_CreateRoleStmt:
2451+
//case T_AlterRoleStmt:
2452+
//case T_AlterRoleSetStmt:
2453+
//case T_DropRoleStmt:
24442454
caseT_ReassignOwnedStmt:
24452455
caseT_LockStmt:
2446-
caseT_ConstraintsSetStmt:
2456+
//case T_ConstraintsSetStmt:
24472457
caseT_CheckPointStmt:
24482458
caseT_ReindexStmt:
24492459
skipCommand= true;
24502460
break;
2461+
caseT_VariableSetStmt:
2462+
{
2463+
//VariableSetStmt *stmt = (VariableSetStmt *) parsetree;
2464+
2465+
if (!MtmGUCBufferAllocated)
2466+
{
2467+
MemoryContextoldcontext;
2468+
2469+
oldcontext=MemoryContextSwitchTo(TopMemoryContext);
2470+
MtmGUCBuffer=makeStringInfo();
2471+
MemoryContextSwitchTo(oldcontext);
2472+
MtmGUCBufferAllocated= true;
2473+
}
2474+
2475+
//appendStringInfoString(MtmGUCBuffer, "SET ");
2476+
//appendStringInfoString(MtmGUCBuffer, stmt->name);
2477+
//appendStringInfoString(MtmGUCBuffer, " TO ");
2478+
//appendStringInfoString(MtmGUCBuffer, ExtractSetVariableArgs(stmt));
2479+
//appendStringInfoString(MtmGUCBuffer, "; ");
2480+
2481+
appendStringInfoString(MtmGUCBuffer,queryString);
2482+
2483+
skipCommand= true;
2484+
}
2485+
break;
24512486
caseT_CreateStmt:
24522487
{
24532488
/* Do not replicate temp tables */
@@ -2495,7 +2530,6 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
24952530
}
24962531
}
24972532
break;
2498-
caseT_CreateSchemaStmt:
24992533
default:
25002534
skipCommand= false;
25012535
break;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp