summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Erickson <michae2@mariadb.com>2020-03-06 16:10:36 -0800
committerSergei Petrunia <psergey@askmonty.org>2020-03-10 11:22:33 +0300
commit76b4f4d3593ce31e9ee205ce8dfcc61fc53d7b4c (patch)
tree8cbb08a01d21a758b2cc01501ffa00d41e23c58a
parentcd2da606414e5d336cdb6b3911e78a649533f3c2 (diff)
downloadmariadb-git-76b4f4d3593ce31e9ee205ce8dfcc61fc53d7b4c.tar.gz
make table discovery work
-rw-r--r--storage/xpand/ha_xpand.cc12
-rw-r--r--storage/xpand/xpand_connection.cc9
2 files changed, 12 insertions, 9 deletions
diff --git a/storage/xpand/ha_xpand.cc b/storage/xpand/ha_xpand.cc
index 6bc516d05f0..42596b7af53 100644
--- a/storage/xpand/ha_xpand.cc
+++ b/storage/xpand/ha_xpand.cc
@@ -1467,10 +1467,13 @@ static int xpand_discover_table_names(handlerton *hton, LEX_CSTRING *db,
{
xpand_connection *xpand_net = new xpand_connection();
int error_code = xpand_net->connect();
- if (error_code)
+ if (error_code) {
+ if (error_code == HA_ERR_NO_CONNECTION)
+ error_code = 0;
goto err;
+ }
- xpand_net->populate_table_list(db, result);
+ error_code = xpand_net->populate_table_list(db, result);
err:
delete xpand_net;
@@ -1481,8 +1484,11 @@ int xpand_discover_table(handlerton *hton, THD *thd, TABLE_SHARE *share)
{
xpand_connection *xpand_net = new xpand_connection();
int error_code = xpand_net->connect();
- if (error_code)
+ if (error_code) {
+ if (error_code == HA_ERR_NO_CONNECTION)
+ error_code = HA_ERR_NO_SUCH_TABLE;
goto err;
+ }
error_code = xpand_net->discover_table_details(&share->db, &share->table_name,
thd, share);
diff --git a/storage/xpand/xpand_connection.cc b/storage/xpand/xpand_connection.cc
index eb3cfb20d26..21f2e0b40ed 100644
--- a/storage/xpand/xpand_connection.cc
+++ b/storage/xpand/xpand_connection.cc
@@ -141,7 +141,7 @@ int xpand_connection::connect()
mysql_rwlock_rdlock(&xpand_hosts_lock);
//search for available host
- int error_code = ER_BAD_HOST_ERROR;
+ int error_code = HA_ERR_NO_CONNECTION;
for (int i = 0; i < xpand_hosts->hosts_len; i++) {
char *host = xpand_hosts->hosts[(start + i) % xpand_hosts->hosts_len];
error_code = connect_direct(host);
@@ -196,12 +196,9 @@ int xpand_connection::connect_direct(char *host)
NULL, xpand_port, xpand_socket,
CLIENT_MULTI_STATEMENTS))
{
- error_code = mysql_errno(&xpand_net);
+ sql_print_error("Error connecting to xpand: %s", mysql_error(&xpand_net));
disconnect();
- }
-
- if (error_code && error_code != ER_CON_COUNT_ERROR) {
- error_code = ER_CONNECT_TO_FOREIGN_DATA_SOURCE;
+ error_code = HA_ERR_NO_CONNECTION;
}
DBUG_RETURN(error_code);