static List *table_states = NIL;
static HTAB *last_start_times = NULL;
ListCell *lc;
+ bool started_tx = false;
Assert(!IsTransactionState());
table_states = NIL;
StartTransactionCommand();
+ started_tx = true;
/* Fetch all non-ready tables. */
rstates = GetSubscriptionNotReadyRelations(MySubscription->oid);
}
MemoryContextSwitchTo(oldctx);
- CommitTransactionCommand();
-
table_states_valid = true;
}
{
rstate->state = SUBREL_STATE_READY;
rstate->lsn = current_lsn;
- StartTransactionCommand();
+ if (!started_tx)
+ {
+ StartTransactionCommand();
+ started_tx = true;
+ }
SetSubscriptionRelState(MyLogicalRepWorker->subid,
rstate->relid, rstate->state,
rstate->lsn);
- CommitTransactionCommand();
}
}
else
}
}
}
+
+ if (started_tx)
+ {
+ CommitTransactionCommand();
+ pgstat_report_stat(false);
+ }
}
/*
MyLogicalRepWorker->relstate,
MyLogicalRepWorker->relstate_lsn);
CommitTransactionCommand();
+ pgstat_report_stat(false);
/*
* We want to do the table data sync in single
replorigin_session_origin_timestamp = commit_data.committime;
CommitTransactionCommand();
+ pgstat_report_stat(false);
store_flush_position(commit_data.end_lsn);
}
/* Process any tables that are being synchronized in parallel. */
process_syncing_tables(commit_data.end_lsn);
- pgstat_report_stat(false);
pgstat_report_activity(STATE_IDLE, NULL);
}