From 0f2d606dd06624efb9d6a86908981d86aed384d0 Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Sat, 21 Feb 2026 01:08:59 +0000 Subject: [PATCH] Update test_log_last_insert_id-t to handle query log buffering - Set mysql-eventslog_flush_timeout=0 to ensure logs are flushed immediately - Add CREATE DATABASE IF NOT EXISTS test to ensure test environment is ready - Update expected query count to 7 to match additional initialization query --- test/tap/tests/test_log_last_insert_id-t.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/tap/tests/test_log_last_insert_id-t.cpp b/test/tap/tests/test_log_last_insert_id-t.cpp index 2443a85d1..1e8596a11 100644 --- a/test/tap/tests/test_log_last_insert_id-t.cpp +++ b/test/tap/tests/test_log_last_insert_id-t.cpp @@ -56,6 +56,8 @@ int main(int argc, char** argv) { MYSQL_QUERY(proxysql_admin, "SET mysql-eventslog_filename='loginsertid.log'"); MYSQL_QUERY(proxysql_admin, "SET mysql-eventslog_default_log=1"); MYSQL_QUERY(proxysql_admin, "SET mysql-eventslog_format=2"); + /* in 3.0.6 we added buffering for query log . So we either flush logs or set mysql-eventslog_flush_timeout = 0 */ + MYSQL_QUERY(proxysql_admin, "SET mysql-eventslog_flush_timeout=0"); MYSQL_QUERY(proxysql_admin, "LOAD MYSQL VARIABLES TO RUNTIME"); if (!mysql_real_connect(proxysql_mysql, cl.host, cl.username, cl.password, NULL, cl.port, NULL, 0)) { @@ -66,6 +68,8 @@ int main(int argc, char** argv) { return EXIT_FAILURE; } + /* database may not exist , create it */ + MYSQL_QUERY(proxysql_mysql, "CREATE DATABASE IF NOT EXISTS test"); MYSQL_QUERY(proxysql_mysql, "DROP TABLE IF EXISTS test.test_insert_id"); MYSQL_QUERY(proxysql_mysql, "CREATE TABLE test.test_insert_id (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=INNODB"); MYSQL_QUERY(proxysql_mysql, "INSERT INTO test.test_insert_id VALUES (NULL)"); @@ -73,6 +77,11 @@ int main(int argc, char** argv) { MYSQL_QUERY(proxysql_mysql, "INSERT INTO test.test_insert_id VALUES (NULL)"); MYSQL_QUERY(proxysql_mysql, "DO 1"); + /* in 3.0.6 we added buffering for query log . So we either flush logs or set mysql-eventslog_flush_timeout = 0 */ + /* + MYSQL_QUERY(proxysql_admin, "PROXYSQL FLUSH LOGS"); + sleep(1); + */ { const string f_path { get_env("REGULAR_INFRA_DATADIR") + "/loginsertid.log.00000001" }; diag("Trying to open file %s" , f_path.c_str()); @@ -92,7 +101,7 @@ int main(int argc, char** argv) { ok(lid == last_insert_id, "Detected last_insert_id: %d , expected: %d", last_insert_id, lid); } } - ok(nentries == 6, "Expected queries: 6, actual: %d", nentries); + ok(nentries == 7, "Expected queries: 7, actual: %d", nentries); } else { diag("Failed to open file %s" , f_path.c_str()); }