Skip to content

Commit

Permalink
Apply fixes from community Pr: transferwise#219
Browse files Browse the repository at this point in the history
  • Loading branch information
ashishparimi committed Apr 10, 2024
1 parent d3180a1 commit fa48041
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions tap_postgres/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ def sync_method_for_streams(streams, state, default_replication_method):
# finishing previously interrupted full-table (first stage of logical replication)
lookup[stream['tap_stream_id']] = 'logical_initial_interrupted'
traditional_steams.append(stream)
# do any required logical replication after inital sync is complete
logical_streams.append(stream)

# inconsistent state
elif get_bookmark(state, stream['tap_stream_id'], 'xmin') and \
Expand All @@ -142,6 +144,8 @@ def sync_method_for_streams(streams, state, default_replication_method):
# initial full-table phase of logical replication
lookup[stream['tap_stream_id']] = 'logical_initial'
traditional_steams.append(stream)
# do any required logical replication after inital sync is complete
logical_streams.append(stream)

else: # no xmin but we have an lsn
# initial stage of logical replication(full-table) has been completed. moving onto pure logical replication
Expand Down
3 changes: 2 additions & 1 deletion tap_postgres/sync_strategies/logical_replication.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,8 @@ def sync_tables(conn_info, logical_streams, state, end_lsn, state_file):
LOGGER.debug('Unable to open and parse %s', state_file)
finally:
lsn_comitted = min(
[get_bookmark(state_comitted, s['tap_stream_id'], 'lsn') for s in logical_streams])
[get_bookmark(state_comitted, s['tap_stream_id'], 'lsn', start_lsn)
for s in logical_streams])
if (lsn_currently_processing > lsn_comitted) and (lsn_comitted > lsn_to_flush):
lsn_to_flush = lsn_comitted
LOGGER.info('Confirming write up to %s, flush to %s',
Expand Down

0 comments on commit fa48041

Please sign in to comment.