Skip to main content

MySQL purge binary logs: retention and error 1236

MySQL removes old binary log (binlog) files by expiry or by PURGE BINARY LOGS, and it does not check whether a stopped reader still needs them. A replica that comes back afterwards stops with Got fatal error 1236. A Debezium connector stops with The connector is trying to read binlog starting at ... but this is no longer available on the server.

This page is written by the team behind OLake Go, which reads MySQL change logs. The steps apply to any tool that reads them and need nothing from OLake Go. OLake is not affiliated with Oracle.

The short answer. Once a reader's position is purged, the server cannot give the missing changes back, and the reader has to be loaded again:

  • A MySQL replica: rebuild it from a new dump of the source.
  • A Debezium connector: let it take a new snapshot with snapshot.mode=when_needed.

Then keep binary logs for longer than the longest time any reader can be stopped, with binlog_expire_logs_seconds on MySQL 8.0 and 8.4 and expire_logs_days on 5.7, and purge by hand only up to the oldest file a reader still needs.

sql
SHOW BINARY LOGS; -- what the server has
SET GLOBAL binlog_expire_logs_seconds = 604800; -- keep 7 days (MySQL 8.0 and 8.4)
PURGE BINARY LOGS TO 'mysql-bin.000012'; -- removes every file before this one

Amazon Relational Database Service (RDS) and Aurora refuse the two statements above that change anything. Retention is set there in hours, with a stored procedure: see Amazon RDS and Aurora.

Key takeaways

  • MySQL 5.7 keeps binary logs forever by default and 8.0 and 8.4 keep them 30 days. An expired file is removed at the next log flush or restart, not at the moment it expires.
  • PURGE BINARY LOGS skipped a file that a connected replica was still reading (warning 1867 in the run). Nothing protects a reader that is stopped.
  • A replica rebuilt from a dump had equal checksums on MySQL 5.7.44, 8.0.46 and 8.4.13, and snapshot.mode=when_needed recovered Debezium 1.9.7, 3.0.8 and 3.7.1.

What you see​

The same event, a purged position, is worded differently by every reader and several times per reader. Each reader points at one issue:

IssueWhat the reader shows
1. A replica's position was purgedGot fatal error 1236 in Last_IO_Error, and Replica_IO_Running: No
2. A Debezium connector's position was purged... but this is no longer available on the server at task start
3. A connector on a quiet database falls behindThe same Debezium message, after a restart of a connector that was RUNNING

A MySQL replica​

After the file was purged, the replica stops reading.

SHOW SLAVE STATUS uses the older words and a different error number:

Last_IO_Errno: 1236
Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file'

With global transaction identifiers (GTIDs) and auto-positioning, the text in quotes names the missing transactions instead of a file:

Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'The slave is connecting using CHANGE MASTER TO MASTER_AUTO_POSITION = 1, but the master has purged binary logs containing GTIDs that the slave requires. Replicate the missing transactions from elsewhere, or provision a new slave from backup. Consider increasing the master's binary log expiration period. The GTID set sent by the slave is '73222c63-e1e3-11f1-a721-eeee9fc8c185:1-18', and the missing transactions are '73222c63-e1e3-11f1-a721-eeee9fc8c185:19-20'.'
MySQLLast_IO_ErrnoMessage starts withText in quotes with GTID auto-positioning
5.71236Got fatal error 1236 from master when reading data from binary log:The slave is connecting using CHANGE MASTER TO MASTER_AUTO_POSITION = 1, but the master has purged binary logs containing GTIDs that the slave requires. ...
8.0.12 to 8.0.32not runGot fatal error 1236 from master when reading data from binary log:Cannot replicate because the master purged required binary logs. ...
8.0.33 and later, 8.413114Got fatal error 1236 from source when reading data from binary log:Cannot replicate because the source purged required binary logs. ...

The 5.7.44, 8.0.46 and 8.4.13 rows are from the runs on this page. The 8.0.12 to 8.0.32 row and the 8.0.33 boundary come from the message files in the MySQL source at each release tag (5.7.44, 8.0.32, 8.0.33). Without GTIDs the text in quotes was the same on all three versions run.

Monitoring that waits for Last_IO_Errno = 1236 misses this failure on 8.0.46 and 8.4.13. There the number is 13114, and 1236 appears only inside the message.

Not every error 1236 is a retention problem. A replica pointed past the end of a file that still exists reported 'Client requested source to start replication from position > file size' in the run (master in place of source on 5.7.44), and more retention does not fix that.

A Debezium MySQL connector​

Debezium checks its stored position against the server before it starts to stream. What it does when the check fails changed twice.

DebeziumWhat the task doesMessage
1.9 to 2.5FAILED at startThe connector is trying to read binlog starting at ... , but this is no longer available on the server. Reconfigure the connector to use a snapshot when needed.
2.6 to 3.1Logs a warning and starts to stream. MySQL then refuses the positionThe connector is trying to read redo log starting at ... as a warning, then Could not find first log file name in binary log index file Error code: 1236; SQLSTATE: HY000.
3.2 and laterFAILED at startThe connector is trying to read change stream starting at ... , but this is no longer available on the server. Reconfigure the connector to use a snapshot mode when needed.

Debezium 1.9.7, 3.0.8 and 3.7.1 were run. The boundaries come from the Debezium source at each release tag (2.5.4, 2.6.0, 3.1.3, 3.2.0).

The task is FAILED, and its trace starts with this:

io.debezium.DebeziumException: The connector is trying to read binlog starting at SourceInfo [currentGtid=null, currentBinlogFilename=mysql-bin.000003, currentBinlogPosition=157, currentRowNumber=0, serverId=0, sourceTime=null, threadId=-1, currentQuery=null, tableIds=[], databaseName=null], but this is no longer available on the server. Reconfigure the connector to use a snapshot when needed.

One log line just before the error tells you which case you are in. Without GTIDs it names the file, and with GTIDs it names the purge.

Connector requires binlog file 'mysql-bin.000003', but server only has mysql-bin.000004, mysql-bin.000005
Some of the GTIDs needed to replicate have been already purged

Debezium 1.9.7 writes the first one as but MySQL only has in place of but server only has.

Why a stopped reader loses its position​

Binary log files leave the server, and neither way they leave asks a stopped reader.

The binary log is a series of numbered files plus an index file. Every reader remembers where it stopped: a file name and a position, or a set of GTIDs. The server keeps no list of those readers.

Expiry. Each version has its own setting and default. The table shows what each version answered in the run.

MySQLRetention settingDefaultThe other setting
5.7.44expire_logs_days, whole days0, which keeps every filebinlog_expire_logs_seconds: ERROR 1193 Unknown system variable
8.0.46binlog_expire_logs_seconds2592000 (30 days)expire_logs_days still exists, is 0, and warns that it is deprecated
8.4.13binlog_expire_logs_seconds2592000 (30 days)expire_logs_days: ERROR 1193 Unknown system variable

MySQL added binlog_expire_logs_seconds in 8.0.1, deprecated expire_logs_days in 8.0.3, made 30 days the default of the new variable in 8.0.11 and removed the old variable in 8.4. On 8.0.46 the two cannot both be set. With the seconds variable at its default, SET GLOBAL expire_logs_days = 7 returned this:

ERROR 3683 (HY000) at line 1: The option expire_logs_days and binlog_expire_logs_seconds cannot be used together. Please use binlog_expire_logs_seconds to set the expire time (expire_logs_days is deprecated)

The reverse fails too. With expire_logs_days at 7, SET GLOBAL binlog_expire_logs_seconds = 604800 returned this:

ERROR 4113 (HY000) at line 1: The option expire_logs_days cannot be used together with option binlog_expire_logs_seconds. To set one, first unset the other by setting it to 0.

Expiry is not a timer. In the run a file was back-dated by two days and the retention set to one day, and the file stayed listed until FLUSH BINARY LOGS. With a 5-second retention nothing was removed after 8 seconds, and the next flush removed every older file.

That matches the MySQL manual: "Possible removals happen at startup and when the binary log is flushed."

A full file counts as a flush. With max_binlog_size lowered to 4096 bytes, 40 inserts and no flush statement, the server started new files by itself and removed the back-dated file, on all three versions.

A manual purge. PURGE BINARY LOGS removes files at once. It protects only a reader that is connected and still reading an older file, as the purge section below shows.

Versions on this page

The runs used MySQL 5.7.44, 8.0.46 and 8.4.13, each as a source with one replica, with and without GTIDs. Debezium ran as Debezium 1.9.7 on Kafka Connect 3.2.0 with MySQL 8.0.46, Debezium 3.0.8 on Kafka Connect 3.9.0 and Debezium 3.7.1 on Kafka Connect 4.3.1, both with MySQL 8.4.13. Rows for versions that were not run, MySQL 8.0.12 to 8.0.32 and the Debezium boundaries at 2.6 and 3.2, come from the MySQL and Debezium source at each release tag, linked under each table.

Confirm the diagnosis​

Compare what the server still has with what the reader asks for.

sql
SHOW BINARY LOGS; -- the oldest file listed is the oldest position anyone can read
SHOW REPLICA STATUS\G -- Relay_Source_Log_File, Last_IO_Error (5.7: SHOW SLAVE STATUS, Relay_Master_Log_File)
SELECT @@GLOBAL.gtid_purged; -- with GTIDs: everything in this set is gone from the server

For Debezium, read the stored position and look for its file in the list. The endpoint is in the Kafka Connect documentation from 3.5.

bash
curl -s localhost:8083/connectors/inventory-connector/offsets
json
{"offsets":[{"partition":{"server":"dbserver1"},"offset":{"ts_sec":1794850317,"file":"mysql-bin.000003","pos":158}}]}

If the file is still listed, or the text in quotes is not one of those above, retention is not your problem.

Issue 1: A replica's position was purged​

The purged changes exist nowhere on the source, so the replica has to be loaded again. A dump taken with the position inside it lets replication continue from the exact point of the dump.

Without GTIDs, the dump carries the file name and position as a CHANGE statement. With GTIDs, the dump sets gtid_purged on the replica, which needs the replica's own GTID state cleared first. The statements and the dump option differ by version:

Without GTIDs:

bash
mysql -h replica -e "STOP SLAVE;"
mysqldump -h source --databases inventory --single-transaction --master-data=1 | mysql -h replica
mysql -h replica -e "START SLAVE;"

With GTIDs:

bash
mysql -h replica -e "STOP SLAVE; RESET MASTER;"
mysqldump -h source --databases inventory --single-transaction --set-gtid-purged=ON | mysql -h replica
mysql -h replica -e "START SLAVE;"

With GTIDs, mysqldump also prints Warning: A partial dump from a server that has GTIDs will by default include the GTIDs of all transactions, even those that changed suppressed parts of the database. The rebuild worked with that warning on all three versions.

In the run both threads returned to Yes on all three versions, in both modes. The source and the replica each held 8 customers, and CHECKSUM TABLE gave the same value on both servers for both tables.

Skipping the reset fails at once. MySQL 8.0.46 and 8.4.13 answered ERROR 3546 (HY000) at line 24: @@GLOBAL.GTID_PURGED cannot be changed: the added gtid set must not overlap with @@GLOBAL.GTID_EXECUTED, and 5.7.44 answered ERROR 1840 (HY000) at line 87: @@GLOBAL.GTID_PURGED can only be set when @@GLOBAL.GTID_EXECUTED is empty.

Do not skip over the gap​

The common shortcut is to point the replica at the oldest file the source still has, or to tell it that it already has the purged GTIDs. Both make the error go away.

sql
-- Unsafe without GTIDs
CHANGE REPLICATION SOURCE TO SOURCE_LOG_FILE = 'mysql-bin.000019', SOURCE_LOG_POS = 4;
-- Unsafe with GTIDs
RESET BINARY LOGS AND GTIDS; SET GLOBAL gtid_purged = '<the gtid_purged of the source>';

In the run replication then reported both threads as Yes and 0 seconds behind, while the source had 7 customers and the replica 4. An order changed during the outage still had its old quantity on the replica.

The damage showed later. The source updated one of the rows the replica never received, and the replica stopped:

Last_SQL_Errno: 1032
[ERROR] [MY-010584] [Repl] Replica SQL for channel '': Worker 1 failed executing transaction 'ANONYMOUS' at source log mysql-bin.000019, end_log_pos 531; Could not execute Update_rows event on table inventory.customers; Can't find record in 'customers', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's source log mysql-bin.000019, end_log_pos 531, Error_code: MY-001032

Issue 2: A Debezium connector's position was purged​

Set snapshot.mode to when_needed and restart the connector. The Debezium documentation says this mode takes a snapshot when "A previously recorded offset specifies a binlog position or GTID that is not available on the server."

This is a setting of the Debezium connector on Kafka Connect. Flink CDC did not act on it, and AWS Database Migration Service (DMS) has reload-target in its place: see The same condition in other tools.

A PUT to /config replaces the whole configuration, so send every existing setting along with the changed one.

bash
curl -X PUT -H 'Content-Type: application/json' localhost:8083/connectors/inventory-connector/config \
--data '{ "...": "your existing settings", "snapshot.mode": "when_needed" }'

The log confirms it on 3.0.8 and 3.7.1. Debezium 1.9.7 words it as Forcing the snapshot execution as it is allowed by the configuration.

WARN Last recorded offset is no longer available on the server. [io.debezium.connector.common.BaseSourceTask]
INFO The last recorded offset is no longer available but we are in when_needed snapshot mode. Attempting to snapshot data to fill the gap. [io.debezium.connector.common.BaseSourceTask]

In the run the outage had added 3 customers, changed 1 order and deleted 1 order. After the fix the topics held these events on all three Debezium versions, and a new insert was then streamed as a normal event:

TopicEvents before the outageRows in the table after the outageEvents after the new snapshot
customers4711: the first 4, and all 7 rows read again (op=r)
orders437: the first 4, and all 3 rows read again, with no delete event

Two things follow from those numbers.

  • Every row arrives again. All 7 customers and 3 orders were written once more as read events (op=r). Whatever consumes the topics has to treat a repeated key as an update.
  • Deletes during the outage are lost. The orders topic got no delete event for the order that was deleted. A consumer keeps that row until it is rebuilt or the row is removed by hand.

If you leave when_needed on​

The mode stays active after the fix. In the run the same outage was repeated with when_needed still set, and the task did not fail. The connector read all 11 customers again by itself, and the customers topic went from 12 events to 23.

That is the trade. With when_needed a lost position costs a full reload and no alert. With initial it costs a failed task that someone has to fix.

The other way: clear the offsets​

You can also keep snapshot.mode=initial and clear the stored position. The endpoint that resets offsets is in the Kafka Connect documentation from 3.6.

bash
curl -X PUT localhost:8083/connectors/inventory-connector/stop
curl -X DELETE localhost:8083/connectors/inventory-connector/offsets
kafka-topics.sh --bootstrap-server kafka:9092 --delete --topic schemahistory.inventory
curl -X PUT localhost:8083/connectors/inventory-connector/resume

Kafka Connect 4.3.1 answered "The Connect framework-managed offsets for this connector have been reset successfully." The connector then took a snapshot with the same counts as above. The documentation of Kafka Connect 3.2.0, which the Debezium 1.9.7 image runs, lists neither endpoint.

Issue 3: A connector on a quiet database falls behind​

A stored position can also fall behind while the reader runs. In the run a Debezium 3.7.1 connector captured one database while writes went to another. Its stored offset stayed on mysql-bin.000005, the server expired that file, and the next task restart failed with the message of Issue 2.

The fix is a heartbeat. For Debezium, set heartbeat.interval.ms. Its default is 0, which sends no heartbeats.

In the run, with heartbeat.interval.ms=2000, the same writes to the uncaptured database moved the stored offset to the newest file, mysql-bin.000011. The task restart that had failed before stayed RUNNING and took no snapshot.

Prevent it​

How long to keep binary logs​

Keep them longer than the longest outage you want to survive without a reload: a weekend, a failed deploy, a paused pipeline. Then check that the disk holds that many days of files.

sql
SET GLOBAL binlog_expire_logs_seconds = 604800; -- MySQL 8.0 and 8.4: 7 days
SET GLOBAL expire_logs_days = 7; -- MySQL 5.7

SET GLOBAL changes the running server. The MySQL manual describes two ways to keep the value across restarts, SET PERSIST and the option file. Those were not run here.

On MySQL 5.7 the default of 0 never removes a file, which protects readers and fills disks. Set a value there too, and size it the same way.

SHOW BINARY LOGS gives the size of each file, and the file times on disk show how many hours the list covers. Retention goes by those file times: the back-dated file in the run was treated as two days old.

Purge binary logs safely​

The MySQL manual gives the procedure: find the file each replica is reading, take the earliest of those, and "Purge all log files up to but not including the target file." Readers that are not replicas, such as CDC connectors, belong on that list too.

sql
SHOW REPLICA STATUS\G -- on each replica: Relay_Source_Log_File (5.7: SHOW SLAVE STATUS, Relay_Master_Log_File)
SHOW BINARY LOGS; -- on the source
PURGE BINARY LOGS TO 'mysql-bin.000012'; -- the earliest file still needed
PURGE BINARY LOGS BEFORE NOW() - INTERVAL 1 DAY; -- or by age

In the run the replica was on mysql-bin.000012. PURGE BINARY LOGS BEFORE NOW() - INTERVAL 1 DAY removed the two files last written three days earlier, PURGE BINARY LOGS TO 'mysql-bin.000012' removed the rest, and the replica kept running.

MySQL protects a reader only while it is connected. The replica was frozen in the middle of a 48 MB file, and a purge past that file was refused on all three versions:

Warning | 1867 | file ./mysql-bin.000012 was not purged because it was being read by 1 thread(s), purged only 0 out of 2 files.

The same purge with the replica stopped removed the file without a warning. That is the case behind error 1236.

Do not remove binlog files with rm. After a file was deleted by hand, SHOW BINARY LOGS still listed it with a size of 0.

The manual says a later purge fails in that state. In the run it completed on all three versions with warning 1612, Being purged log ./mysql-bin.000013 was not found.

Watch for it​

  • Alert when a reader's file is close to the oldest file in SHOW BINARY LOGS, not only when the reader fails.
  • On MySQL 8.0.33 and later, match Last_IO_Errno = 13114 as well as 1236.
  • On Debezium 2.6 to 3.1, alert on the log text. The task state stayed RUNNING in the 3.0.8 run.

The same condition in other tools​

AWS DMS, Airbyte's MySQL source connector and Flink CDC were each stopped while the binary log file they needed was removed, on 23 November 2026. The versions are in the box at the end of the page. None of the three behaves like a Debezium connector on Kafka Connect, although two of them carry Debezium inside.

AWS DMS​

AWS DMS 3.6.1 read Amazon RDS for MySQL 8.4.13 with a full-load-and-CDC task. The task was stopped, RDS removed the file of its checkpoint 8 minutes 47 seconds later, and the task was resumed. The task log then had 11 lines ending in try to reconnect, 5 seconds apart, and these two:

[SOURCE_CAPTURE ]E: Error 1236 reading binlog, exit after 11 retries [1020493] (mysql_endpoint_capture.c:1509)
[SOURCE_CAPTURE ]E: Error 1236 (Could not find first log file name in binary log index file) reading binlog [1020493] (mysql_endpoint_capture.c:1511)

The status did not follow at once. It still read running 1 minute 43 seconds after those lines, and then failed with the stop reason Last Error Error 1236 reading binary log. Stop Reason FATAL_ERROR Error Level FATAL. No row reached the target in between.

The AWS Knowledge Center article says: "To resolve the error, check the binary log retention period on the source MySQL database. If needed, then increase the retention period. Restart the AWS DMS task to run the full-load phase again." The run agrees. A second resume-processing failed in the same way, and reload-target dropped the target table and loaded it again.

After the reload, source and target had the same 25 rows and the same checksum. The row deleted during the outage was gone from the target as well, which a Debezium snapshot does not give you.

The DMS guide for MySQL sources recommends binlog_expire_logs_seconds of "86400 seconds (1 day) or greater" on MySQL 8.0 and later. On RDS that variable cannot be set, and the hours of the next section take its place.

Airbyte​

Airbyte's MySQL source connector 3.53.10 was run directly, with the Airbyte protocol commands and without the platform around it. It carries Debezium 3.4.3.Final, and by default it fails. The setting is Invalid CDC Position Behavior (Advanced), with the values Fail sync, the default, and Re-sync data.

With the default, the sync ended after 3 to 4 seconds with a configuration error and no records:

Incumbent CDC state is invalid, reason: Saved offset no longer present on the server, please reset the connection, and then increase binlog retention and/or increase sync frequency. Connector last known binlog file mysql-bin.000003 is not found in the server. Server has [mysql-bin.000005].

A second sync gave the same error. With Re-sync data the first sync also ended with an error, Triggering reset. Incumbent CDC state is invalid, and saved the current position. The sync after that read every row of both tables again, with no delete record for the order that had been deleted.

Airbyte's troubleshooting page still quotes an older log line, Saved offset no longer present on the server, Airbyte is going to trigger a sync from scratch (checked Nov 2026). The second half of that line is in none of the 153 jar files of the 3.53.10 image. The same page recommends "a time period of 7 days" for binlog_expire_logs_seconds.

Flink CDC 3.7.0 ran on Flink 2.2.1. Its MySQL connector carries Debezium 1.9.8.Final, so a job restored from its savepoint printed the Debezium 1.9 wording:

java.lang.IllegalStateException: The connector is trying to read binlog starting at Struct{version=1.9.8.Final,connector=mysql,name=mysql_binlog_source,ts_ms=...,db=,server_id=0,file=mysql-bin.000003,pos=158,row=0}, but this is no longer available on the server. Reconfigure the connector to use a snapshot when needed.

The job did not fail. No restart strategy was set, so Flink chose its exponential-delay strategy, and the job was RESTARTING at every one of 19 readings over 90 seconds without ever reaching FAILED. With restart-strategy.type set to none it was FAILED at the first reading.

The advice in the message did not work here. With 'debezium.snapshot.mode' = 'when_needed' in the table options, the restored job threw the same exception and kept restarting. Two other starts ran, with different results:

How the job was startedResult
A new job without the savepointRUNNING. It read every row of both tables as it was then. No delete arrived for the order deleted during the outage
A new job with 'scan.startup.mode' = 'latest-offset'RUNNING. It printed only rows written after it started. Every change of the outage was skipped without a message

The Flink CDC FAQ explains the error: "This error occurs because the binlog file being read by the job has been cleaned up on the MySQL server." Its fix is set global expire_logs_days=7;. In the lab of this page that statement returned ERROR 3683 on MySQL 8.0.46 with default settings and ERROR 1193 on 8.4.13, so use binlog_expire_logs_seconds there.

Amazon RDS and Aurora​

Amazon RDS for MySQL 8.4.13 and Aurora MySQL 3.14.0 were run on 23 November 2026, each with a MySQL 8.4.13 replica as the reader. On these services a stored procedure sets retention, in hours:

sql
CALL mysql.rds_set_configuration('binlog retention hours', 24);
CALL mysql.rds_show_configuration;

The statements of the self-hosted sections were refused on both:

SET GLOBAL binlog_expire_logs_seconds = 604800;
ERROR 1227 (42000): Access denied; you need (at least one of) the SUPER or SYSTEM_VARIABLES_ADMIN privilege(s) for this operation
PURGE BINARY LOGS BEFORE NOW();
ERROR 1227 (42000): Access denied; you need (at least one of) the SUPER or BINLOG_ADMIN privilege(s) for this operation

Do not read retention from binlog_expire_logs_seconds either. On RDS it stayed at 2592000 whatever the hours were, and on Aurora it read 0.

Amazon RDS for MySQL​

The RDS documentation says: "The default value of binlog retention hours is NULL. For RDS for MySQL, NULL means binary logs aren't retained (0 hours)." The run put a number on that. With the default, files left SHOW BINARY LOGS in rounds five minutes apart, and the file of a stopped reader was gone about 9 minutes after the reader stopped.

The replica then stopped as a replica of a self-hosted source does:

Last_IO_Errno: 13114
Last_IO_Error: Got fatal error 1236 from source when reading data from binary log: 'Could not find first log file name in binary log index file'

With 24 hours set, a reader stopped for 22 minutes lost no file and read on from its position. The maximum is 168 hours (7 days), and 169 answered ERROR 1644 (45000): For binlog retention hours the value must be between 1 and 168 inclusive or be NULL.

A replica outside RDS meets one more thing. RDS writes a row to mysql.rds_heartbeat2 at the start of each new file, and the replica's SQL thread stopped on it with error 1146 until the filter REPLICATE_WILD_IGNORE_TABLE = ('mysql.%') was set.

Aurora MySQL​

A new cluster has no binary log: SHOW BINARY LOGS answered ERROR 1381 (HY000): You are not using binary logging. It came with binlog_format = ROW in the DB cluster parameter group and a reboot of the writer.

The Aurora documentation says that NULL "means binary logs are cleaned up lazily", and that binary logs "might remain in the system for a certain period, which is usually not longer than a day." In the run no file was removed in 68 minutes with NULL. Once retention was set to 1 hour, the files closed more than an hour before were gone about three minutes later, and the stopped reader got the same error 1236.

For version 2.11.0 and higher and for version 3 the documented maximum is 2160 hours (90 days). The cluster accepted 2160, and it stored 2161 as 2160 without an error.

With the default, a CDC reader therefore has no retention to rely on, on either service. Set the hours before the first sync.

How OLake Go handles this

OLake Go reads the same binary log and has the same limit. Its MySQL connector saves the binlog position as state, and the next CDC sync looks for that position, so the server has to keep the log for at least the pause between two syncs.

The connector's connection check includes an optional binlog_retention check with a recommended value of 7 days or more. Its description reads: "If a sync is paused longer than the retention window, the logs it needs are purged and a full resync is required."

On Amazon RDS and Aurora the check reads the retention hours from mysql.rds_configuration, which needs a SELECT grant on that table (RDS guide, Aurora guide).

References​