Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Commit

Permalink
[AP-483] Update bookmark only before writing state message (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
koszti authored Jan 20, 2020
1 parent 21ee88e commit 550547f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from setuptools import setup

setup(name='pipelinewise-tap-mysql',
version='1.1.2',
version='1.1.3',
description='Singer.io tap for extracting data from MySQL - PipelineWise compatible',
author='Stitch',
url='https://github.com/transferwise/pipelinewise-tap-mysql',
Expand Down
9 changes: 4 additions & 5 deletions tap_mysql/sync_strategies/binlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,11 +378,6 @@ def _run_binlog_sync(mysql_conn, reader, binlog_streams_map, state):
binlog_event.schema,
binlog_event.table)

state = update_bookmarks(state,
binlog_streams_map,
reader.log_file,
reader.log_pos)

# The iterator across python-mysql-replication's fetchone method should ultimately terminate
# upon receiving an EOF packet. There seem to be some cases when a MySQL server will not send
# one causing binlog replication to hang.
Expand All @@ -391,6 +386,10 @@ def _run_binlog_sync(mysql_conn, reader, binlog_streams_map, state):

if ((rows_saved and rows_saved % UPDATE_BOOKMARK_PERIOD == 0) or
(events_skipped and events_skipped % UPDATE_BOOKMARK_PERIOD == 0)):
state = update_bookmarks(state,
binlog_streams_map,
reader.log_file,
reader.log_pos)
singer.write_message(singer.StateMessage(value=copy.deepcopy(state)))


Expand Down

0 comments on commit 550547f

Please sign in to comment.