@@ -716,6 +716,7 @@ static void DtmInitialize()
716
716
dtm -> nNodes = MMNodes ;
717
717
pg_atomic_write_u32 (& dtm -> nReceivers , 0 );
718
718
dtm -> initialized = false;
719
+ dtm -> pool = BgwPoolCreate (MMExecutor , MMDatabaseName , MMQueueSize , MMWorkers );
719
720
RegisterXactCallback (DtmXactCallback , NULL );
720
721
}
721
722
LWLockRelease (AddinShmemInitLock );
@@ -824,14 +825,6 @@ _PG_init(void)
824
825
if (!process_shared_preload_libraries_in_progress )
825
826
return ;
826
827
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
-
835
828
DefineCustomIntVariable (
836
829
"multimaster.workers" ,
837
830
"Number of multimaster executor workers per node" ,
@@ -948,11 +941,18 @@ _PG_init(void)
948
941
NULL
949
942
);
950
943
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
+
951
952
MMNodes = MMStartReceivers (MMConnStrs , MMNodeId );
952
953
if (MMNodes < 2 ) {
953
954
elog (ERROR , "Multimaster should have at least two nodes" );
954
955
}
955
- dtm -> pool = BgwPoolCreate (MMExecutor , MMDatabaseName , MMQueueSize , MMWorkers );
956
956
957
957
if (DtmBufferSize != 0 )
958
958
{
@@ -1189,6 +1189,7 @@ static void MMExecutor(int id, void* work, size_t size)
1189
1189
TransactionId xid = * (TransactionId * )work ;
1190
1190
char * stmts = (char * )work + 4 ;
1191
1191
int rc = SPI_ERROR_TRANSACTION ;
1192
+
1192
1193
MMJoinTransaction (xid );
1193
1194
1194
1195
SetCurrentStatementStartTimestamp ();
0 commit comments