File tree 2 files changed +12
-8
lines changed
2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -1274,6 +1274,8 @@ dmq_reattach_shm_mq(int handle_id)
1274
1274
dsm_handle receiver_dsm ;
1275
1275
int i ;
1276
1276
1277
+ dsm_segment * new_segmap ;
1278
+
1277
1279
LWLockAcquire (dmq_state -> lock , LW_SHARED );
1278
1280
for (i = 0 ; i < DMQ_MAX_RECEIVERS ; i ++ )
1279
1281
{
@@ -1310,6 +1312,14 @@ dmq_reattach_shm_mq(int handle_id)
1310
1312
dmq_local .inhandles [handle_id ].name ,
1311
1313
receiver_dsm );
1312
1314
1315
+ /* try to attch new segment before destroying old ones */
1316
+ new_segmap = dsm_attach (receiver_dsm );
1317
+ if (new_segmap == NULL )
1318
+ {
1319
+ mtm_log (DmqTraceShmMq , "unable to map dynamic shared memory segment" );
1320
+ return false;
1321
+ }
1322
+
1313
1323
if (dmq_local .inhandles [handle_id ].dsm_seg )
1314
1324
{
1315
1325
if (dmq_local .inhandles [handle_id ].mqh )
@@ -1323,13 +1333,7 @@ dmq_reattach_shm_mq(int handle_id)
1323
1333
dsm_detach (dmq_local .inhandles [handle_id ].dsm_seg );
1324
1334
}
1325
1335
1326
- dmq_local .inhandles [handle_id ].dsm_seg = dsm_attach (receiver_dsm );
1327
- if (dmq_local .inhandles [handle_id ].dsm_seg == NULL )
1328
- {
1329
- mtm_log (DmqTraceShmMq , "unable to map dynamic shared memory segment" );
1330
- return false;
1331
- }
1332
-
1336
+ dmq_local .inhandles [handle_id ].dsm_seg = new_segmap ;
1333
1337
dsm_pin_mapping (dmq_local .inhandles [handle_id ].dsm_seg );
1334
1338
1335
1339
toc = shm_toc_attach (DMQ_MQ_MAGIC ,
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ typedef enum MtmLogTag
26
26
DmqStateFinal = LOG ,
27
27
DmqTraceOutgoing = DEBUG2 ,
28
28
DmqTraceIncoming = DEBUG2 ,
29
- DmqTraceShmMq = DEBUG1 ,
29
+ DmqTraceShmMq = LOG ,
30
30
DmqPqTiming = LOG ,
31
31
32
32
/* resolver */
You can’t perform that action at this time.
0 commit comments