matt_cooley
01/13/2021, 5:51 PMpipe closed by peer or os.write(pipe, data) raised exception.
Not sure what it meansdouwe_maan
01/13/2021, 5:51 PMmatt_cooley
01/13/2021, 5:53 PMdouwe_maan
01/13/2021, 5:54 PMmatt_cooley
01/13/2021, 5:55 PMmatt_cooley
01/13/2021, 5:55 PMdouwe_maan
01/13/2021, 5:56 PMdouwe_maan
01/13/2021, 5:56 PMmatt_cooley
01/13/2021, 5:58 PMmatt_cooley
01/13/2021, 8:09 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.matt_cooley
01/13/2021, 8:13 PMplugin inheritance can be pretty helpful. I could seperate the large tables into their own plugins allowing me to full-refresh individually if neededmatt_cooley
01/13/2021, 8:43 PM--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')douwe_maan
01/13/2021, 8:44 PM--full-refresh in combination with --select=<stream> to only fully refresh a specific stream.matt_cooley
01/13/2021, 8:45 PMmatt_cooley
01/13/2021, 8:45 PMmatt_cooley
01/13/2021, 8:45 PMdouwe_maan
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 anymatt_cooley
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')douwe_maan
01/13/2021, 8:47 PMdouwe_maan
01/13/2021, 8:47 PMmatt_cooley
01/13/2021, 8:52 PMdouwe_maan
01/13/2021, 8:54 PMmatt_cooley
01/13/2021, 9:08 PMmatt_cooley
01/15/2021, 4:39 PM52428800 and got the same error. I was planning on going a bit higher, but it seemed like x5 would be enoughdouwe_maan
01/15/2021, 4:46 PMdouwe_maan
01/15/2021, 4:47 PMmatt_cooley
01/15/2021, 5:21 PMdouwe_maan
01/15/2021, 5:22 PMmatt_cooley
01/15/2021, 5:23 PMdouwe_maan
01/15/2021, 5:26 PMdouwe_maan
01/15/2021, 5:27 PMdouwe_maan
01/15/2021, 5:27 PMdouwe_maan
01/15/2021, 5:28 PMdouwe_maan
01/15/2021, 5:29 PMdouwe_maan
01/15/2021, 5:29 PMmatt_cooley
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 basicdouwe_maan
01/15/2021, 5:52 PMmatt_cooley
01/15/2021, 5:59 PMdouwe_maan
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" thingdouwe_maan
01/15/2021, 6:02 PMmatt_cooley
01/15/2021, 6:03 PMmatt_cooley
01/15/2021, 6:03 PMdouwe_maan
01/15/2021, 6:04 PMmatt_cooley
01/15/2021, 6:06 PMmatt_cooley
01/15/2021, 6:18 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.douwe_maan
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.douwe_maan
01/15/2021, 6:21 PMsync_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#L255douwe_maan
01/15/2021, 6:23 PMI want to make sure I understand the problem correctly.
TheĀĀ writes the data to a buffertap
TheĀ⢠The buffer gets filled up completely ⢠The tap is blocked on itsĀ reads from the buffer too slowlytarget
write call until half the buffer is depleted
TheĀMore accurately: while it waits for target to work through half the buffer and for Meltano to unblock the tap'sĀ connection times out while it waits for theĀtap'sĀ to finish.target
write calldouwe_maan
01/15/2021, 6:24 PMdouwe_maan
01/15/2021, 6:34 PMmatt_cooley
01/15/2021, 6:36 PMdouwe_maan
01/15/2021, 6:37 PMmatt_cooley
01/15/2021, 6:41 PMdouwe_maan
01/15/2021, 6:41 PMmatt_cooley
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!douwe_maan
01/19/2021, 5:14 PMmeltano/meltano:latest-python3.7 Docker image as well?matt_cooley
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.matt_cooley
01/19/2021, 5:18 PMdouwe_maan
01/19/2021, 5:21 PMmatt_cooley
01/19/2021, 5:21 PMdouwe_maan
01/19/2021, 5:23 PMdouwe_maan
01/19/2021, 5:28 PMdouwe_maan
01/19/2021, 6:03 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.matt_cooley
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?douwe_maan
01/20/2021, 9:26 PMmatt_cooley
01/20/2021, 9:28 PMdouwe_maan
01/20/2021, 9:29 PMdouwe_maan
01/20/2021, 9:29 PMmatt_cooley
01/20/2021, 9:31 PMmatt_cooley
01/20/2021, 9:31 PMmatt_cooley
01/20/2021, 9:31 PMdouwe_maan
01/20/2021, 9:31 PMdouwe_maan
01/20/2021, 9:32 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 reasonmatt_cooley
01/20/2021, 9:33 PMdouwe_maan
01/20/2021, 9:40 PMdouwe_maan
01/20/2021, 9:40 PMmatt_cooley
01/20/2021, 10:21 PMmatt_cooley
01/20/2021, 10:22 PMmatt_cooley
01/20/2021, 10:22 PMdouwe_maan
01/20/2021, 10:32 PMdouwe_maan
01/20/2021, 10:33 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-streamsdouwe_maan
01/20/2021, 10:34 PMdouwe_maan
01/20/2021, 10:35 PM<number of streams> * <batch size rows - 1>matt_cooley
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!douwe_maan
01/22/2021, 9:48 PMConnectionResetError you saw: https://gitlab.com/meltano/meltano/-/issues/2526