Skip to content

Commit 406b48d

Browse files
committed
Don't use LWLock for now in the origin tracking emulation
We might need to revisit this but since currenly everything is only accessed from single process we don't need the LWLock.
1 parent b808666 commit 406b48d

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

compat/pglogical_compat.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ typedef struct ReplicationState
9292
/*
9393
* Lock protecting remote_lsn and local_lsn.
9494
*/
95-
LWLock lock;
95+
/* LWLock lock;*/
9696
} ReplicationState;
9797

9898
static ReplicationState *session_replication_state = NULL;
@@ -375,10 +375,8 @@ replorigin_session_get_progress(bool flush)
375375

376376
Assert(session_replication_state != NULL);
377377

378-
LWLockAcquire(&session_replication_state->lock, LW_SHARED);
379378
remote_lsn = session_replication_state->remote_lsn;
380379
local_lsn = session_replication_state->local_lsn;
381-
LWLockRelease(&session_replication_state->lock);
382380

383381
if (flush && local_lsn != InvalidXLogRecPtr)
384382
XLogFlush(local_lsn);
@@ -457,12 +455,10 @@ replorigin_session_advance(XLogRecPtr remote_commit, XLogRecPtr local_commit)
457455
Assert(session_replication_state != NULL);
458456
Assert(session_replication_state->roident != InvalidRepOriginId);
459457

460-
LWLockAcquire(&session_replication_state->lock, LW_EXCLUSIVE);
461458
if (session_replication_state->local_lsn < local_commit)
462459
session_replication_state->local_lsn = local_commit;
463460
if (session_replication_state->remote_lsn < remote_commit)
464461
session_replication_state->remote_lsn = remote_commit;
465-
LWLockRelease(&session_replication_state->lock);
466462

467463
replorigin_advance(session_replication_state->roident, remote_commit,
468464
local_commit, false, true);

0 commit comments

Comments
 (0)