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

Commit26b59ca

Browse files
committed
send GUC variables to nodes
1 parent98aa93a commit26b59ca

File tree

1 file changed

+48
-14
lines changed

1 file changed

+48
-14
lines changed

‎multimaster.c

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

142-
staticboolMtmIsRecoverySession;
142+
staticboolMtmIsRecoverySession;
143143

144144
staticMtmCurrentTransMtmTx;
145145

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

201+
staticStringInfoMtmGUCBuffer;
202+
staticboolMtmGUCBufferAllocated= false;
203+
201204
/*
202205
* -------------------------------------------
203206
* Synchronize access to MTM structures.
@@ -2238,6 +2241,12 @@ static void MtmBroadcastUtilityStmt(char const* sql, bool ignoreError)
22382241
{
22392242
if (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+
}
22412250
if (!MtmRunUtilityStmt(conns[i],"BEGIN TRANSACTION",&utility_errmsg)&& !ignoreError)
22422251
{
22432252
errorMsg="Failed to start transaction at node %d";
@@ -2249,7 +2258,10 @@ static void MtmBroadcastUtilityStmt(char const* sql, bool ignoreError)
22492258
if (i+1==MtmNodeId)
22502259
errorMsg=utility_errmsg;
22512260
else
2261+
{
2262+
elog(ERROR,utility_errmsg);
22522263
errorMsg="Failed to run command at node %d";
2264+
}
22532265

22542266
failedNode=i;
22552267
break;
@@ -2407,7 +2419,6 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
24072419
caseT_FetchStmt:
24082420
caseT_DoStmt:
24092421
caseT_CreateTableSpaceStmt:
2410-
caseT_DropTableSpaceStmt:
24112422
caseT_AlterTableSpaceOptionsStmt:
24122423
caseT_TruncateStmt:
24132424
caseT_CommentStmt:/* XXX: we could replicate these */;
@@ -2416,9 +2427,9 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
24162427
caseT_ExecuteStmt:
24172428
caseT_DeallocateStmt:
24182429
caseT_GrantStmt:/* XXX: we could replicate some of these these */;
2419-
caseT_GrantRoleStmt:
2420-
caseT_AlterDatabaseStmt:
2421-
caseT_AlterDatabaseSetStmt:
2430+
//case T_GrantRoleStmt:
2431+
//case T_AlterDatabaseStmt:
2432+
//case T_AlterDatabaseSetStmt:
24222433
caseT_NotifyStmt:
24232434
caseT_ListenStmt:
24242435
caseT_UnlistenStmt:
@@ -2427,22 +2438,46 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
24272438
caseT_VacuumStmt:
24282439
caseT_ExplainStmt:
24292440
caseT_AlterSystemStmt:
2430-
caseT_VariableSetStmt:
24312441
caseT_VariableShowStmt:
24322442
caseT_DiscardStmt:
2433-
caseT_CreateEventTrigStmt:
2434-
caseT_AlterEventTrigStmt:
2435-
caseT_CreateRoleStmt:
2436-
caseT_AlterRoleStmt:
2437-
caseT_AlterRoleSetStmt:
2438-
caseT_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:
24392449
caseT_ReassignOwnedStmt:
24402450
caseT_LockStmt:
2441-
caseT_ConstraintsSetStmt:
2451+
//case T_ConstraintsSetStmt:
24422452
caseT_CheckPointStmt:
24432453
caseT_ReindexStmt:
24442454
skipCommand= true;
24452455
break;
2456+
caseT_VariableSetStmt:
2457+
{
2458+
//VariableSetStmt *stmt = (VariableSetStmt *) parsetree;
2459+
2460+
if (!MtmGUCBufferAllocated)
2461+
{
2462+
MemoryContextoldcontext;
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;
24462481
caseT_CreateStmt:
24472482
{
24482483
/* Do not replicate temp tables */
@@ -2490,7 +2525,6 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
24902525
}
24912526
}
24922527
break;
2493-
caseT_CreateSchemaStmt:
24942528
default:
24952529
skipCommand= false;
24962530
break;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp