diff --git a/test/tap/tests/fast_forward_grace_close.cpp b/test/tap/tests/fast_forward_grace_close.cpp index 341c135fe..c88d709d1 100644 --- a/test/tap/tests/fast_forward_grace_close.cpp +++ b/test/tap/tests/fast_forward_grace_close.cpp @@ -59,10 +59,16 @@ int main() { MYSQL_QUERY(proxysql_conn, "CREATE DATABASE IF NOT EXISTS test"); MYSQL_QUERY(proxysql_conn, "USE test"); MYSQL_QUERY(proxysql_conn, "CREATE TABLE IF NOT EXISTS dummy_log_table (id INT PRIMARY KEY AUTO_INCREMENT, data LONGTEXT)"); - // Generate enough binlog data so that throttled reads at target_time=20s - // actually take longer than the 8s grace close period. Each INSERT creates - // a ~50KB binlog event; we need many events so the per-event sleep adds up. - for (int i = 0; i < 50; i++) { + // Generate enough binlog data that the client's kernel recv buffer can + // hold only a small fraction of it. For target_time > 8s, grace close + // must fire before the full binlog (including the empty-event EOF marker) + // has been delivered to the client's socket — otherwise the client sees + // EOF anyway and the "expected FALSE" assertions flake. With autotuned + // recv buffers that can grow to several MB on some kernels/runners, a + // small binlog lets the EOF marker slip through during the 8s grace + // window. 1000 x 50 KB = ~50 MB gives a comfortable multiple of any + // realistic recv buffer. + for (int i = 0; i < 1000; i++) { MYSQL_QUERY(proxysql_conn, "INSERT INTO dummy_log_table (data) VALUES (REPEAT('a', 1024*50))"); } int rc = mysql_query(proxysql_conn, "FLUSH LOGS");