diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index 92b263a..e09ed67 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -2138,7 +2138,7 @@ CommitTransaction(void)
 	AtEOXact_HashTables(true);
 	AtEOXact_PgStat(true);
 	AtEOXact_Snapshot(true, false);
-	AtCommit_ApplyLauncher();
+	AtEOXact_ApplyLauncher(true);
 	pgstat_report_xact_timestamp(0);
 
 	CurrentResourceOwner = NULL;
@@ -2612,6 +2612,7 @@ AbortTransaction(void)
 		AtEOXact_ComboCid();
 		AtEOXact_HashTables(false);
 		AtEOXact_PgStat(false);
+		AtEOXact_ApplyLauncher(false);
 		pgstat_report_xact_timestamp(0);
 	}
 
diff --git a/src/backend/replication/logical/launcher.c b/src/backend/replication/logical/launcher.c
index f6ae610..92cf274 100644
--- a/src/backend/replication/logical/launcher.c
+++ b/src/backend/replication/logical/launcher.c
@@ -633,13 +633,26 @@ ApplyLauncherShmemInit(void)
 }
 
 /*
- * Wakeup the launcher on commit if requested.
+ * AtEOXact_ApplyLauncher
+ *      Wakeup the launcher on commit if requested.
+ *
+ * Note that on_commit_launcher_wakeup flag doesn't work as expected in
+ * two-phase commit case. For example, COMMIT PREPARED on the transaction
+ * enabling the flag doesn't wake up  the logical replication launcher if
+ * ROLLBACK on another transaction runs before it. To handle this case
+ * properly, the flag needs to be recoreded in two-phase commit state file
+ * so that COMMIT PREPARED and ROLLBACK PREPREAED can determine whether to
+ * wake up the launcher. However this is overkill for small gain and false
+ * wakeup of the launcher is not so harmful (probably we can live with
+ * that), so we do nothing here for this issue.
  */
 void
-AtCommit_ApplyLauncher(void)
+AtEOXact_ApplyLauncher(bool isCommit)
 {
-	if (on_commit_launcher_wakeup)
+	if (isCommit && on_commit_launcher_wakeup)
 		ApplyLauncherWakeup();
+
+	on_commit_launcher_wakeup = false;
 }
 
 /*
diff --git a/src/include/replication/logicallauncher.h b/src/include/replication/logicallauncher.h
index 0c2bf03..fb3c2f5 100644
--- a/src/include/replication/logicallauncher.h
+++ b/src/include/replication/logicallauncher.h
@@ -22,6 +22,6 @@ extern Size ApplyLauncherShmemSize(void);
 extern void ApplyLauncherShmemInit(void);
 
 extern void ApplyLauncherWakeupAtCommit(void);
-extern void AtCommit_ApplyLauncher(void);
+extern void AtEOXact_ApplyLauncher(bool isCommit);
 
 #endif   /* LOGICALLAUNCHER_H */
