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

Commit480cda0

Browse files
committed
Add bgwpool
1 parentc19018d commit480cda0

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

‎contrib/multimaster/multimaster.c‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,7 @@ static void DtmInitialize()
716716
dtm->nNodes=MMNodes;
717717
pg_atomic_write_u32(&dtm->nReceivers,0);
718718
dtm->initialized= false;
719+
dtm->pool=BgwPoolCreate(MMExecutor,MMDatabaseName,MMQueueSize,MMWorkers);
719720
RegisterXactCallback(DtmXactCallback,NULL);
720721
}
721722
LWLockRelease(AddinShmemInitLock);
@@ -824,14 +825,6 @@ _PG_init(void)
824825
if (!process_shared_preload_libraries_in_progress)
825826
return;
826827

827-
/*
828-
* Request additional shared resources. (These are no-ops if we're not in
829-
* the postmaster process.) We'll allocate or attach to the shared
830-
* resources in imcs_shmem_startup().
831-
*/
832-
RequestAddinShmemSpace(DTM_SHMEM_SIZE);
833-
RequestAddinLWLocks(2);
834-
835828
DefineCustomIntVariable(
836829
"multimaster.workers",
837830
"Number of multimaster executor workers per node",
@@ -948,11 +941,18 @@ _PG_init(void)
948941
NULL
949942
);
950943

944+
/*
945+
* Request additional shared resources. (These are no-ops if we're not in
946+
* the postmaster process.) We'll allocate or attach to the shared
947+
* resources in dtm_shmem_startup().
948+
*/
949+
RequestAddinShmemSpace(DTM_SHMEM_SIZE+MMQueueSize);
950+
RequestAddinLWLocks(2);
951+
951952
MMNodes=MMStartReceivers(MMConnStrs,MMNodeId);
952953
if (MMNodes<2) {
953954
elog(ERROR,"Multimaster should have at least two nodes");
954955
}
955-
dtm->pool=BgwPoolCreate(MMExecutor,MMDatabaseName,MMQueueSize,MMWorkers);
956956

957957
if (DtmBufferSize!=0)
958958
{
@@ -1189,6 +1189,7 @@ static void MMExecutor(int id, void* work, size_t size)
11891189
TransactionIdxid=*(TransactionId*)work;
11901190
char*stmts= (char*)work+4;
11911191
intrc=SPI_ERROR_TRANSACTION;
1192+
11921193
MMJoinTransaction(xid);
11931194

11941195
SetCurrentStatementStartTimestamp();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp