wide-salesclerk-68871
01/13/2021, 5:51 PMpipe closed by peer or os.write(pipe, data) raised exception.
Not sure what it meansripe-musician-59933
01/13/2021, 5:51 PMwide-salesclerk-68871
01/13/2021, 5:53 PMripe-musician-59933
01/13/2021, 5:54 PMwide-salesclerk-68871
01/13/2021, 5:55 PMripe-musician-59933
01/13/2021, 5:56 PMwide-salesclerk-68871
01/13/2021, 5:58 PMLOG_BASED
replication. It was replicating one of 5 tables when it failed. After upgrading I reran it and it skipped the table it was replicating when I it failed.
tap-mysql | INFO LOG_BASED stream fake_schema-table_name requires full historical sync
is the only mention of it in the run. Not sure if this is expected or not. I’m planning on trying a --full-refresh
, but the other tables worked great so I’d like to avoid it if possible.plugin inheritance
can be pretty helpful. I could seperate the large tables into their own plugins allowing me to full-refresh individually if needed--full-refresh
again it’s giving me this error:
tap-mysql | CRITICAL 'NoneType' object has no attribute 'settimeout'
and
tap-mysql | pymysql.err.OperationalError: (2013, 'Lost connection to MySQL server during query')
ripe-musician-59933
01/13/2021, 8:44 PM--full-refresh
in combination with --select=<stream>
to only fully refresh a specific stream.wide-salesclerk-68871
01/13/2021, 8:45 PMripe-musician-59933
01/13/2021, 8:45 PM'NoneType' object has no attribute 'settimeout'
looks like a legitimate bug in tap-mysql; it would help to see the rest of the stack trace if there is anywide-salesclerk-68871
01/13/2021, 8:46 PMtap-mysql | CRITICAL 'NoneType' object has no attribute 'settimeout'
tap-mysql | Traceback (most recent call last):
tap-mysql | File "/opt/meltano/.meltano/extractors/tap-mysql/venv/lib/python3.7/site-packages/tap_mysql/sync_strategies/full_table.py", line 266, in sync_table
tap-mysql | params)
tap-mysql | File "/opt/meltano/.meltano/extractors/tap-mysql/venv/lib/python3.7/site-packages/tap_mysql/sync_strategies/common.py", line 255, in sync_query
tap-mysql | row = cursor.fetchone()
tap-mysql | File "/opt/meltano/.meltano/extractors/tap-mysql/venv/lib/python3.7/site-packages/pymysql/cursors.py", line 469, in fetchone
tap-mysql | row = self.read_next()
tap-mysql | File "/opt/meltano/.meltano/extractors/tap-mysql/venv/lib/python3.7/site-packages/pymysql/cursors.py", line 464, in read_next
tap-mysql | return self._conv_row(self._result._read_rowdata_packet_unbuffered())
tap-mysql | File "/opt/meltano/rails/.meltano/extractors/tap-mysql/venv/lib/python3.7/site-packages/pymysql/connections.py", line 1160, in _read_rowdata_packet_unbuffered
tap-mysql | packet = self.connection._read_packet()
tap-mysql | File "/opt/meltano/.meltano/extractors/tap-mysql/venv/lib/python3.7/site-packages/pymysql/connections.py", line 674, in _read_packet
tap-mysql | recv_data = self._read_bytes(bytes_to_read)
tap-mysql | File "/opt/meltano/.meltano/extractors/tap-mysql/venv/lib/python3.7/site-packages/pymysql/connections.py", line 707, in _read_bytes
tap-mysql | CR.CR_SERVER_LOST, "Lost connection to MySQL server during query")
tap-mysql | pymysql.err.OperationalError: (2013, 'Lost connection to MySQL server during query')
ripe-musician-59933
01/13/2021, 8:47 PMwide-salesclerk-68871
01/13/2021, 8:52 PMripe-musician-59933
01/13/2021, 8:54 PMwide-salesclerk-68871
01/13/2021, 9:08 PM52428800
and got the same error. I was planning on going a bit higher, but it seemed like x5 would be enoughripe-musician-59933
01/15/2021, 4:46 PMwide-salesclerk-68871
01/15/2021, 5:21 PMripe-musician-59933
01/15/2021, 5:22 PMwide-salesclerk-68871
01/15/2021, 5:23 PMripe-musician-59933
01/15/2021, 5:26 PMwide-salesclerk-68871
01/15/2021, 5:49 PM1.63.0
the first time (the beginning of this thread). I do think it’s a pretty wide table though so that might be it.
It looked like the tap was chunking rows about 100,000 at a time. I would assume that would be help control the size of the buffer? That’s why I thought it weird that it was able to handle 1.1m the first time (11 chunks) but won’t even run a single “chunk” the second time. But maybe I’m missing something basicripe-musician-59933
01/15/2021, 5:52 PMwide-salesclerk-68871
01/15/2021, 5:59 PMripe-musician-59933
01/15/2021, 6:01 PMpipe closed by peer or os.write(pipe, data) raised exception.
error you saw. So I wouldn't read too much into the "1.1M on the first run, 100k on subsequent runs" thingwide-salesclerk-68871
01/15/2021, 6:03 PMripe-musician-59933
01/15/2021, 6:04 PMwide-salesclerk-68871
01/15/2021, 6:06 PMtap
writes the data to a buffer
• The target
reads from the buffer too slowly
• The tap's
connection times out while it waits for the target
to finish.ripe-musician-59933
01/15/2021, 6:18 PMcursor.fetchone()
at https://github.com/singer-io/tap-mysql/blob/master/tap_mysql/sync_strategies/common.py#L255 as the call that triggers the pymysql.err.OperationalError
, so that's where you'd likely want to add a try/except
block to handle the error by attempting to reconnect.
That sync_query
method is called here: https://github.com/singer-io/tap-mysql/blob/f6b0277a0020764b0834aa77651895a7cc550ad7/tap_mysql/sync_strategies/incremental.py#L55-L56, wrapped by contextmanagers that create the connection and cursor, so you'd want to have sync_query
communicate to its parent method that it needs to run the whole thing again, starting past the row it did manage to get to successfully. Fortunately, the replication key value of that row would already have been stored in state (https://github.com/singer-io/tap-mysql/blob/master/tap_mysql/sync_strategies/common.py#L248-L251), so just letting the logic get back to https://github.com/singer-io/tap-mysql/blob/f6b0277a0020764b0834aa77651895a7cc550ad7/tap_mysql/sync_strategies/incremental.py#L24 and try the whole thing again may be enough for it to pick up where it left off.
That means that you may want to rescue from the OperationError
(with the correct disconnect error ID) around https://github.com/singer-io/tap-mysql/blob/f6b0277a0020764b0834aa77651895a7cc550ad7/tap_mysql/sync_strategies/incremental.py#L75 instead of inside sync_query
, ensure that iterate_limit
is not set to False
, and let the loop continue as normal.sync_query
is also called from https://github.com/singer-io/tap-mysql/blob/f6b0277a0020764b0834aa77651895a7cc550ad7/tap_mysql/sync_strategies/full_table.py#L260, where you'd want to do something similar: handle the error and make it go back to with connect_with_backoff
, and makes sure you get into the perform_resumable_sync
branch with the correct pk clause matching how far the sync got the last time: https://github.com/singer-io/tap-mysql/blob/f6b0277a0020764b0834aa77651895a7cc550ad7/tap_mysql/sync_strategies/full_table.py#L255I want to make sure I understand the problem correctly.
Thewrites the data to a buffertap
The• The buffer gets filled up completely • The tap is blocked on itsreads from the buffer too slowlytarget
write
call until half the buffer is depleted
TheMore accurately: while it waits for target to work through half the buffer and for Meltano to unblock the tap'sconnection times out while it waits for thetap's
to finish.target
write
callwide-salesclerk-68871
01/15/2021, 6:36 PMripe-musician-59933
01/15/2021, 6:37 PMwide-salesclerk-68871
01/15/2021, 6:41 PMripe-musician-59933
01/15/2021, 6:41 PMwide-salesclerk-68871
01/19/2021, 5:11 PMBUFFER
again, but I wanted to get set up locally to test where I should set it.
I got set up and got a different error. For whatever reason when I run this on my local docker images, meltano
doesn’t seem to be respecting the BUFFER
. The RAM usage just keeps going up until the containers crash and then it fails:
File "/usr/local/lib/python3.7/asyncio/streams.py", line 202, in _drain_helper
raise ConnectionResetError('Connection lost')
I can see this happening if I watch the docker stats
. Anyway, I realize this is likely an issue with my local setup but if you have any other ideas please let me know. Thanks!ripe-musician-59933
01/19/2021, 5:14 PMmeltano/meltano:latest-python3.7
Docker image as well?wide-salesclerk-68871
01/19/2021, 5:17 PM1.65.0
. We’re running our own docker image (mono-repo using the apache/airflow:1.10.11-python3.7
image). For what’s it’s work the job
table in the metadata db is showing a failed run.ripe-musician-59933
01/19/2021, 5:21 PMwide-salesclerk-68871
01/19/2021, 5:21 PMripe-musician-59933
01/19/2021, 5:23 PMbath_size_rows
setting (https://meltano.com/plugins/loaders/postgres--transferwise.html#batch-size-rows) was set to the default value of 100,000, meaning that it would keep that many rows in memory before flushing to Postgres. Because the rows were relatively wide, that ended up quickly exceeding the 2GB memory limit on the Docker container, resulting in the process being killed and meltano elt
dying along with it.
Dropping batch_size_rows
down to 1000 resulted in maximum target memory usage of about 500MB, and the issue disappeared.wide-salesclerk-68871
01/20/2021, 9:22 PMbatch_size_rows
setting is causing another problem. It’s not syncing the last batch of rows (that is less than 10k). For example:
• batch_size_rows = 10000
• source table row count = 10,500
• After elt the target table will have 10,000 rows.
I’m guessing this is an issue with the pipelinewise target?ripe-musician-59933
01/20/2021, 9:26 PMwide-salesclerk-68871
01/20/2021, 9:28 PMripe-musician-59933
01/20/2021, 9:29 PMwide-salesclerk-68871
01/20/2021, 9:31 PMripe-musician-59933
01/20/2021, 9:31 PMmeltano elt
again with the PYTHONASYNCIODEBUG=1
env var? I'd like to see what it prints just before the pipeline completes, when presumably the tap finishes first, and then some time later, the target. It may tell us whether the target is getting killed early for some reasonwide-salesclerk-68871
01/20/2021, 9:33 PMripe-musician-59933
01/20/2021, 9:40 PMwide-salesclerk-68871
01/20/2021, 10:21 PMripe-musician-59933
01/20/2021, 10:32 PMflush_all_streams
setting so that it flushes all streams when one batch is full: https://meltano.com/plugins/loaders/postgres--transferwise.html#flush-all-streams<number of streams> * <batch size rows - 1>
wide-salesclerk-68871
01/20/2021, 10:53 PMAh all right, I’m glad to hear that! Was the thing that tripped you up the fact that it would already move to a different table before finishing up the previous one(s)?Yep! Taking a look at the
flush_all_streams
setting. Thanks!ripe-musician-59933
01/22/2021, 9:48 PMConnectionResetError
you saw: https://gitlab.com/meltano/meltano/-/issues/2526