File tree 3 files changed +13
-2
lines changed
3 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -191,7 +191,7 @@ HTAB* MtmGid2State;
191
191
static HTAB * MtmRemoteFunctions ;
192
192
static HTAB * MtmLocalTables ;
193
193
194
- static bool MtmIsRecoverySession ;
194
+ bool MtmIsRecoverySession ;
195
195
196
196
static MtmCurrentTrans MtmTx ;
197
197
static dlist_head MtmLsnMapping = DLIST_STATIC_INIT (MtmLsnMapping );
Original file line number Diff line number Diff line change @@ -393,6 +393,7 @@ extern bool MtmMajorNode;
393
393
extern bool MtmBackgroundWorker ;
394
394
extern char * MtmRefereeConnStr ;
395
395
extern bool MtmEnforceLocalTx ;
396
+ extern bool MtmIsRecoverySession ;
396
397
397
398
398
399
extern void MtmArbiterInitialize (void );
Original file line number Diff line number Diff line change @@ -441,7 +441,17 @@ pg_decode_caughtup(LogicalDecodingContext *ctx)
441
441
{
442
442
PGLogicalOutputData * data = (PGLogicalOutputData * )ctx -> output_plugin_private ;
443
443
444
- if (data -> api ) {
444
+ /*
445
+ * MtmOutputPluginPrepareWrite send some bytes to downstream,
446
+ * so we must avoid calling it in normal (non-recovery) situation.
447
+ *
448
+ * It's dirty hack to use MtmIsRecoverySession here and better to
449
+ * provide also filter-like callback, but we plan to migrate to native
450
+ * output plugin, so this code should anyway go away during next
451
+ * release.
452
+ */
453
+ if (data -> api && MtmIsRecoverySession )
454
+ {
445
455
MtmOutputPluginPrepareWrite (ctx , true, true);
446
456
data -> api -> write_caughtup (ctx -> out , data , ctx -> reader -> EndRecPtr );
447
457
MtmOutputPluginWrite (ctx , true, true);
You can’t perform that action at this time.
0 commit comments