Skip to content

Commit a8cc40d

Browse files
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.
1 parent 142851f commit a8cc40d

File tree

4 files changed

+36
-2
lines changed

4 files changed

+36
-2
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
for master_1
2+
for child2
3+
for child3
4+
CREATE SERVER s FOREIGN DATA WRAPPER mysql OPTIONS(HOST '1');
5+
CREATE TABLE t(c INT)ENGINE=Spider COMMENT='WRAPPER "mysql",SRV "s",TABLE "foo"';
6+
INSERT INTO t VALUES(1);
7+
ERROR HY000: Unable to connect to foreign data source: s
8+
INSERT INTO t VALUES(1);
9+
ERROR HY000: Unable to connect to foreign data source: s
10+
drop table t;
11+
drop server s;
12+
for master_1
13+
for child2
14+
for child3
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--disable_query_log
2+
--disable_result_log
3+
--source ../../t/test_init.inc
4+
--enable_result_log
5+
--enable_query_log
6+
7+
CREATE SERVER s FOREIGN DATA WRAPPER mysql OPTIONS(HOST '1');
8+
CREATE TABLE t(c INT)ENGINE=Spider COMMENT='WRAPPER "mysql",SRV "s",TABLE "foo"';
9+
--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
10+
INSERT INTO t VALUES(1);
11+
--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
12+
INSERT INTO t VALUES(1); # Hangs
13+
drop table t;
14+
drop server s;
15+
16+
--disable_query_log
17+
--disable_result_log
18+
--source ../../t/test_deinit.inc
19+
--enable_result_log
20+
--enable_query_log

storage/spider/spd_db_mysql.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2042,7 +2042,7 @@ int spider_db_mbase::connect(
20422042
DBUG_RETURN(ER_CONNECT_TO_FOREIGN_DATA_SOURCE);
20432043
}
20442044
connect_retry_count--;
2045-
my_sleep((ulong) connect_retry_interval);
2045+
my_sleep((ulong) connect_retry_interval * 1000);
20462046
} else {
20472047
db_conn->net.thd = NULL;
20482048
if (connect_mutex)

storage/spider/spd_param.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1803,7 +1803,7 @@ static MYSQL_THDVAR_INT(
18031803
"Connect retry count", /* comment */
18041804
NULL, /* check */
18051805
NULL, /* update */
1806-
1000, /* def */
1806+
2, /* def */
18071807
0, /* min */
18081808
2147483647, /* max */
18091809
0 /* blk */

0 commit comments

Comments
 (0)