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

Commitca6bec3

Browse files
committed
merge guc serializatuion fix
2 parents6a8d759 +acaad1c commitca6bec3

File tree

5 files changed

+24
-6
lines changed

5 files changed

+24
-6
lines changed

‎contrib/mmts/arbiter.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,8 @@ static void MtmSender(Datum arg)
715715
intnNodes=MtmMaxNodes;
716716
inti;
717717

718+
MtmBackgroundWorker= true;
719+
718720
MtmBuffer*txBuffer= (MtmBuffer*)palloc0(sizeof(MtmBuffer)*nNodes);
719721
MTM_ELOG(LOG,"Start arbiter sender %d",MyProcPid);
720722
InitializeTimeouts();
@@ -802,6 +804,8 @@ static void MtmMonitor(Datum arg)
802804
pqsignal(SIGQUIT,SetStop);
803805
pqsignal(SIGTERM,SetStop);
804806

807+
MtmBackgroundWorker= true;
808+
805809
/* We're now ready to receive signals */
806810
BackgroundWorkerUnblockSignals();
807811

@@ -838,7 +842,9 @@ static void MtmReceiver(Datum arg)
838842
pqsignal(SIGINT,SetStop);
839843
pqsignal(SIGQUIT,SetStop);
840844
pqsignal(SIGTERM,SetStop);
841-
845+
846+
MtmBackgroundWorker= true;
847+
842848
/* We're now ready to receive signals */
843849
BackgroundWorkerUnblockSignals();
844850

‎contrib/mmts/bgwpool.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ static void BgwPoolMainLoop(BgwPool* pool)
3636

3737
MTM_ELOG(LOG,"Start background worker %d, shutdown=%d",MyProcPid,pool->shutdown);
3838

39+
MtmBackgroundWorker= true;
3940
MtmIsLogicalReceiver= true;
4041
MtmPool=pool;
4142

‎contrib/mmts/multimaster.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ bool MtmDoReplication;
238238
char*MtmDatabaseName;
239239
char*MtmDatabaseUser;
240240
OidMtmDatabaseId;
241+
boolMtmBackgroundWorker;
241242

242243
intMtmNodes;
243244
intMtmNodeId;
@@ -902,7 +903,7 @@ MtmIsUserTransaction()
902903
IsNormalProcessingMode()&&
903904
MtmDoReplication&&
904905
!am_walsender&&
905-
!IsBackgroundWorker&&
906+
!MtmBackgroundWorker&&
906907
!IsAutoVacuumWorkerProcess();
907908
}
908909

@@ -4924,7 +4925,7 @@ static void MtmGucInit(void)
49244925
*/
49254926
oldcontext=MemoryContextSwitchTo(TopMemoryContext);
49264927
current_role=GetConfigOptionByName("session_authorization",NULL, false);
4927-
if (strcmp(MtmDatabaseUser,current_role)!=0)
4928+
if (current_role&&*current_role&&strcmp(MtmDatabaseUser,current_role)!=0)
49284929
MtmGucUpdate("session_authorization",current_role);
49294930
MemoryContextSwitchTo(oldcontext);
49304931
}
@@ -5018,13 +5019,20 @@ char* MtmGucSerialize(void)
50185019
{
50195020
StringInfoserialized_gucs;
50205021
dlist_iteriter;
5021-
intnvars=0;
5022+
constchar*search_path;
50225023

50235024
if (!MtmGucHash)
50245025
MtmGucInit();
50255026

50265027
serialized_gucs=makeStringInfo();
50275028

5029+
/*
5030+
* Crutch for scheduler. It sets search_path through SetConfigOption()
5031+
* so our callback do not react on that.
5032+
*/
5033+
search_path=GetConfigOption("search_path", false, true);
5034+
appendStringInfo(serialized_gucs,"SET search_path TO %s; ",search_path);
5035+
50285036
dlist_foreach(iter,&MtmGucList)
50295037
{
50305038
MtmGucEntry*cur_entry=dlist_container(MtmGucEntry,list_node,iter.cur);
@@ -5045,7 +5053,6 @@ char* MtmGucSerialize(void)
50455053
appendStringInfoString(serialized_gucs,cur_entry->value);
50465054
}
50475055
appendStringInfoString(serialized_gucs,"; ");
5048-
nvars++;
50495056
}
50505057

50515058
returnserialized_gucs->data;
@@ -5163,6 +5170,7 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
51635170
caseT_CheckPointStmt:
51645171
caseT_ReindexStmt:
51655172
caseT_ExplainStmt:
5173+
caseT_AlterSystemStmt:
51665174
skipCommand= true;
51675175
break;
51685176

@@ -5374,7 +5382,7 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
53745382
if (!skipCommand&& !MtmTx.isReplicated&& (context==PROCESS_UTILITY_TOPLEVEL||MtmUtilityProcessedInXid!=GetCurrentTransactionId()))
53755383
{
53765384
MtmUtilityProcessedInXid=GetCurrentTransactionId();
5377-
if (context==PROCESS_UTILITY_TOPLEVEL) {
5385+
if (context==PROCESS_UTILITY_TOPLEVEL|| !ActivePortal) {
53785386
MtmProcessDDLCommand(queryString, true);
53795387
}else {
53805388
MtmProcessDDLCommand(ActivePortal->sourceText, true);

‎contrib/mmts/multimaster.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ extern MemoryContext MtmApplyContext;
378378
externlsn_tMtmSenderWalEnd;
379379
externtimestamp_tMtmRefreshClusterStatusSchedule;
380380
externMtmConnectionInfo*MtmConnections;
381+
externboolMtmBackgroundWorker;
381382

382383

383384
externvoidMtmArbiterInitialize(void);

‎contrib/mmts/pglogical_receiver.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,8 @@ pglogical_receiver_main(Datum main_arg)
224224
char*connString=psprintf("replication=database %s",Mtm->nodes[nodeId-1].con.connStr);
225225
staticPortalDatafakePortal;
226226

227+
MtmBackgroundWorker= true;
228+
227229
ByteBufferAlloc(&buf);
228230

229231
slotName=psprintf(MULTIMASTER_SLOT_PATTERN,MtmNodeId);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp