File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
src/backend/replication/logical Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -172,9 +172,10 @@ static ReplicationState *replication_states;
172172static ReplicationStateCtl * replication_states_ctl ;
173173
174174/*
175- * Backend-local, cached element from ReplicationState for use in a backend
176- * replaying remote commits, so we don't have to search ReplicationState for
177- * the backends current RepOriginId.
175+ * We keep a pointer to this backend's ReplicationState to avoid having to
176+ * search the replication_states array in replorigin_session_advance for each
177+ * remote commit. (Ownership of a backend's own entry can only be changed by
178+ * that backend.)
178179 */
179180static ReplicationState * session_replication_state = NULL ;
180181
@@ -1056,10 +1057,12 @@ ReplicationOriginExitCleanup(int code, Datum arg)
10561057{
10571058 ConditionVariable * cv = NULL ;
10581059
1060+ if (session_replication_state == NULL )
1061+ return ;
1062+
10591063 LWLockAcquire (ReplicationOriginLock , LW_EXCLUSIVE );
10601064
1061- if (session_replication_state != NULL &&
1062- session_replication_state -> acquired_by == MyProcPid )
1065+ if (session_replication_state -> acquired_by == MyProcPid )
10631066 {
10641067 cv = & session_replication_state -> origin_cv ;
10651068
You can’t perform that action at this time.
0 commit comments