1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-35064 Reduce the default spider connect retry counts to 2

The existing default value 1000 is too big and could result in
"hanging" when failing to connect a remote server. Three tries in
total is a more sensible default.
This commit is contained in:
Yuchen Pei
2024-10-04 16:49:53 +10:00
parent 142851f120
commit a8cc40d9a4
4 changed files with 36 additions and 2 deletions

View File

@@ -0,0 +1,14 @@
for master_1
for child2
for child3
CREATE SERVER s FOREIGN DATA WRAPPER mysql OPTIONS(HOST '1');
CREATE TABLE t(c INT)ENGINE=Spider COMMENT='WRAPPER "mysql",SRV "s",TABLE "foo"';
INSERT INTO t VALUES(1);
ERROR HY000: Unable to connect to foreign data source: s
INSERT INTO t VALUES(1);
ERROR HY000: Unable to connect to foreign data source: s
drop table t;
drop server s;
for master_1
for child2
for child3

View File

@@ -0,0 +1,20 @@
--disable_query_log
--disable_result_log
--source ../../t/test_init.inc
--enable_result_log
--enable_query_log
CREATE SERVER s FOREIGN DATA WRAPPER mysql OPTIONS(HOST '1');
CREATE TABLE t(c INT)ENGINE=Spider COMMENT='WRAPPER "mysql",SRV "s",TABLE "foo"';
--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
INSERT INTO t VALUES(1);
--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
INSERT INTO t VALUES(1); # Hangs
drop table t;
drop server s;
--disable_query_log
--disable_result_log
--source ../../t/test_deinit.inc
--enable_result_log
--enable_query_log

View File

@@ -2042,7 +2042,7 @@ int spider_db_mbase::connect(
DBUG_RETURN(ER_CONNECT_TO_FOREIGN_DATA_SOURCE); DBUG_RETURN(ER_CONNECT_TO_FOREIGN_DATA_SOURCE);
} }
connect_retry_count--; connect_retry_count--;
my_sleep((ulong) connect_retry_interval); my_sleep((ulong) connect_retry_interval * 1000);
} else { } else {
db_conn->net.thd = NULL; db_conn->net.thd = NULL;
if (connect_mutex) if (connect_mutex)

View File

@@ -1803,7 +1803,7 @@ static MYSQL_THDVAR_INT(
"Connect retry count", /* comment */ "Connect retry count", /* comment */
NULL, /* check */ NULL, /* check */
NULL, /* update */ NULL, /* update */
1000, /* def */ 2, /* def */
0, /* min */ 0, /* min */
2147483647, /* max */ 2147483647, /* max */
0 /* blk */ 0 /* blk */