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

Commit979a388

Browse files
knizhnikkelvich
authored andcommitted
Store GID on stack
1 parent1ecd0d6 commit979a388

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

‎pglogical_apply.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -616,10 +616,10 @@ process_remote_commit(StringInfo in)
616616
{
617617
uint8event;
618618
csn_tcsn;
619-
constchar*gid=NULL;
620619
lsn_tend_lsn;
621620
lsn_torigin_lsn;
622621
intorigin_node;
622+
chargid[MULTIMASTER_MAX_GID_SIZE];
623623
/* read event */
624624
event=pq_getmsgbyte(in);
625625
MtmReplicationNodeId=pq_getmsgbyte(in);
@@ -640,7 +640,7 @@ process_remote_commit(StringInfo in)
640640
casePGLOGICAL_PRECOMMIT_PREPARED:
641641
{
642642
Assert(!TransactionIdIsValid(MtmGetCurrentTransactionId()));
643-
gid=pq_getmsgstring(in);
643+
strcpy(gid,pq_getmsgstring(in));
644644
MTM_LOG2("%d: PGLOGICAL_PRECOMMIT_PREPARED %s",MyProcPid,gid);
645645
MtmBeginSession(origin_node);
646646
MtmPrecommitTransaction(gid);
@@ -661,7 +661,7 @@ process_remote_commit(StringInfo in)
661661
casePGLOGICAL_PREPARE:
662662
{
663663
Assert(IsTransactionState()&&TransactionIdIsValid(MtmGetCurrentTransactionId()));
664-
gid=pq_getmsgstring(in);
664+
strcpy(gid,pq_getmsgstring(in));
665665
if (MtmExchangeGlobalTransactionStatus(gid,TRANSACTION_STATUS_IN_PROGRESS)==TRANSACTION_STATUS_ABORTED) {
666666
MTM_LOG1("Avoid prepare of previously aborted global transaction %s",gid);
667667
AbortCurrentTransaction();
@@ -694,7 +694,7 @@ process_remote_commit(StringInfo in)
694694
{
695695
Assert(!TransactionIdIsValid(MtmGetCurrentTransactionId()));
696696
csn=pq_getmsgint64(in);
697-
gid=pq_getmsgstring(in);
697+
strcpy(gid,pq_getmsgstring(in));
698698
MTM_LOG2("PGLOGICAL_COMMIT_PREPARED commit: csn=%lld, gid=%s, lsn=%llx",csn,gid,end_lsn);
699699
MtmResetTransaction();
700700
StartTransactionCommand();
@@ -711,7 +711,7 @@ process_remote_commit(StringInfo in)
711711
casePGLOGICAL_ABORT_PREPARED:
712712
{
713713
Assert(!TransactionIdIsValid(MtmGetCurrentTransactionId()));
714-
gid=pq_getmsgstring(in);
714+
strcpy(gid,pq_getmsgstring(in));
715715
/* MtmRollbackPreparedTransaction will set origin session itself */
716716
MTM_LOG1("Receive ABORT_PREPARED logical message for transaction %s from node %d",gid,origin_node);
717717
MtmRollbackPreparedTransaction(origin_node,gid);
@@ -1034,19 +1034,21 @@ void MtmExecutor(void* work, size_t size)
10341034
intspill_file=-1;
10351035
intsave_cursor=0;
10361036
intsave_len=0;
1037+
10371038
s.data=work;
10381039
s.len=size;
10391040
s.maxlen=-1;
10401041
s.cursor=0;
1041-
1042+
10421043
if (MtmApplyContext==NULL) {
10431044
MtmApplyContext=AllocSetContextCreate(TopMemoryContext,
10441045
"ApplyContext",
10451046
ALLOCSET_DEFAULT_MINSIZE,
10461047
ALLOCSET_DEFAULT_INITSIZE,
10471048
ALLOCSET_DEFAULT_MAXSIZE);
10481049
}
1049-
TopMemoryContext=MemoryContextSwitchTo(MtmApplyContext);
1050+
MemoryContextSwitchTo(MtmApplyContext);
1051+
10501052
replorigin_session_origin=InvalidRepOriginId;
10511053
PG_TRY();
10521054
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp