Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 175001e

Browse files
committed
MtmToggleReplication for scheduler
1 parent 8cf0a87 commit 175001e

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/commit.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#include "state.h"
2929
#include "syncpoint.h"
3030

31+
static bool force_in_bgworker;
32+
3133
static bool subchange_cb_registered;
3234
static bool config_valid;
3335
// XXX: change dmq api and avoid that
@@ -70,7 +72,7 @@ MtmXactCallback2(XactEvent event, void *arg)
7072
* backends with multimaster enabled.
7173
*/
7274
if (IsAnyAutoVacuumProcess() || !IsNormalProcessingMode() ||
73-
am_walsender || IsBackgroundWorker)
75+
am_walsender || (IsBackgroundWorker && !force_in_bgworker))
7476
{
7577
return;
7678
}
@@ -366,3 +368,14 @@ GatherPrecommits(TransactionId xid, nodemask_t participantsMask, MtmMessageCode
366368

367369
// XXX: assert that majority has responded
368370
}
371+
372+
/*
373+
* Allow replication in bgworker.
374+
* Needed for scheduler.
375+
*/
376+
void
377+
MtmToggleReplication(void)
378+
{
379+
force_in_bgworker = true;
380+
}
381+

src/include/multimaster.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,4 +242,6 @@ extern void MtmInitMessage(MtmArbiterMessage *msg, MtmMessageCode code);
242242

243243
extern bool MtmIsEnabled(void);
244244

245+
extern void MtmToggleReplication(void);
246+
245247
#endif /* MULTIMASTER_H */

0 commit comments

Comments
 (0)