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;
172
172
static ReplicationStateCtl * replication_states_ctl ;
173
173
174
174
/*
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.)
178
179
*/
179
180
static ReplicationState * session_replication_state = NULL ;
180
181
@@ -1056,10 +1057,12 @@ ReplicationOriginExitCleanup(int code, Datum arg)
1056
1057
{
1057
1058
ConditionVariable * cv = NULL ;
1058
1059
1060
+ if (session_replication_state == NULL )
1061
+ return ;
1062
+
1059
1063
LWLockAcquire (ReplicationOriginLock , LW_EXCLUSIVE );
1060
1064
1061
- if (session_replication_state != NULL &&
1062
- session_replication_state -> acquired_by == MyProcPid )
1065
+ if (session_replication_state -> acquired_by == MyProcPid )
1063
1066
{
1064
1067
cv = & session_replication_state -> origin_cv ;
1065
1068
You can’t perform that action at this time.
0 commit comments