diff --git a/src/backend/fts/ftsmessagehandler.c b/src/backend/fts/ftsmessagehandler.c index 2661a987997bb17e2a061ad45980387bcf6327ce..c59f1ff449180f7ced4e8b8ae4dc11f5a3a77761 100644 --- a/src/backend/fts/ftsmessagehandler.c +++ b/src/backend/fts/ftsmessagehandler.c @@ -339,7 +339,18 @@ HandleFtsWalRepPromote(void) */ DBState state = GetCurrentDBState(); if (state == DB_IN_STANDBY_MODE) + { + /* + * Reset sync_standby_names on promotion. This is to avoid commits + * hanging/waiting for replication till next FTS probe. Next FTS probe + * will detect this node to be not in sync and reset the same which + * can take a min. Since we know on mirror promotion its marked as not + * in sync in gp_segment_configuration, best to right away clean the + * sync_standby_names. + */ + UnsetSyncStandbysDefined(); SignalPromote(); + } else { elog(LOG, "ignoring promote request, walreceiver not running," diff --git a/src/backend/fts/test/ftsmessagehandler_test.c b/src/backend/fts/test/ftsmessagehandler_test.c index 2b96bb3b1a39f3688475171e1741a6cacd57ca2f..950eb9e56fb0d83b74fd51d35e5cf22ae2cff75e 100644 --- a/src/backend/fts/test/ftsmessagehandler_test.c +++ b/src/backend/fts/test/ftsmessagehandler_test.c @@ -136,6 +136,7 @@ test_HandleFtsWalRepPromoteMirror(void **state) am_mirror = true; will_return(GetCurrentDBState, DB_IN_STANDBY_MODE); + will_be_called(UnsetSyncStandbysDefined); will_be_called(SignalPromote); FtsResponse mockresponse;