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

Commite2424b9

Browse files
knizhnikkelvich
authored andcommitted
Create fake portal
1 parentf2afd06 commite2424b9

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

‎bgwpool.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@ static void BgwPoolMainLoop(BgwPool* pool)
2020
{
2121
intsize;
2222
void*work;
23+
staticPortalDatafakePortal;
2324

2425
MtmIsLogicalReceiver= true;
2526

2627
BackgroundWorkerUnblockSignals();
2728
BackgroundWorkerInitializeConnection(pool->dbname,pool->dbuser);
28-
ActivePortal=CreatePortal("", true, true);
29+
ActivePortal=&fakePortal;
2930
ActivePortal->status=PORTAL_ACTIVE;
3031
ActivePortal->sourceText="";
3132

‎multimaster.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ extern int MtmReplicationNodeId;
288288
externintMtmNodes;
289289
externintMtmArbiterPort;
290290
externchar*MtmDatabaseName;
291+
externchar*MtmDatabaseUser;
291292
externintMtmConnectTimeout;
292293
externintMtmReconnectTimeout;
293294
externintMtmRaftPollDelay;

‎pglogical_apply.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,8 @@ process_remote_transactional_message(StringInfo s)
371371
}
372372

373373
MTM_LOG1("%d: Executing utility statement %s",MyProcPid,stmt);
374-
SPI_connect();
374+
SPI_connect();
375+
ActivePortal->sourceText=stmt;
375376
rc=SPI_execute(stmt, false,0);
376377
SPI_finish();
377378
if (rc<0)
@@ -971,8 +972,8 @@ void MtmExecutor(void* work, size_t size)
971972
StringInfoDatas;
972973
Relationrel=NULL;
973974
intspill_file=-1;
974-
intsave_cursor;
975-
intsave_len;
975+
intsave_cursor=0;
976+
intsave_len=0;
976977
s.data=work;
977978
s.len=size;
978979
s.maxlen=-1;

‎pglogical_receiver.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
#include"utils/memutils.h"
3636
#include"executor/spi.h"
3737
#include"replication/origin.h"
38+
#include"utils/portal.h"
39+
#include"tcop/pquery.h"
3840

3941
#include"multimaster.h"
4042
#include"spill.h"
@@ -218,6 +220,8 @@ pglogical_receiver_main(Datum main_arg)
218220
StringInfoDataspill_info;
219221
char*slotName;
220222
char*connString=psprintf("replication=database %s",Mtm->nodes[nodeId-1].con.connStr);
223+
staticPortalDatafakePortal;
224+
221225
slotName=psprintf(MULTIMASTER_SLOT_PATTERN,MtmNodeId);
222226

223227
MtmIsLogicalReceiver= true;
@@ -239,7 +243,10 @@ pglogical_receiver_main(Datum main_arg)
239243
BackgroundWorkerUnblockSignals();
240244

241245
/* Connect to a database */
242-
BackgroundWorkerInitializeConnection(MtmDatabaseName,NULL);
246+
BackgroundWorkerInitializeConnection(MtmDatabaseName,MtmDatabaseUser);
247+
ActivePortal=&fakePortal;
248+
ActivePortal->status=PORTAL_ACTIVE;
249+
ActivePortal->sourceText="";
243250

244251
/* This is main loop of logical replication.
245252
* In case of errors we will try to reestablish connection.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp