[MDEV-27400] Spider attempts localhost TCP/IP connection, even when none is specified. Created: 2022-01-01  Updated: 2023-05-23

Status: Confirmed
Project: MariaDB Server
Component/s: Storage Engine - Spider
Affects Version/s: 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8
Fix Version/s: 10.4, 10.5, 10.6

Type: Bug Priority: Major
Reporter: Roel Van de Paar Assignee: Yuchen Pei
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-27106 Spider: specify connection to data no... Closed

 Description   

Execute on first instance:

INSTALL PLUGIN spider SONAME 'ha_spider.so';
CREATE TABLE t (c INT) ENGINE=SPIDER COMMENT='WRAPPER "mariadb",  TABLE "t", SOCKET "/your_path/socket.sock"';
INSERT INTO t VALUES (1);

Then, if the table t on the secondary instance is SPIDER, the result will be:

10.8.0 ccdf5711a8fff0cd610a91fdcf37c8ff1182878c (Optimized)

10.8.0-opt>INSERT INTO t3 VALUES (1);
ERROR 1429 (HY000): Unable to connect to foreign data source: localhost

Note that it is trying to make a TCP/IP connection to localhost rather than using the socket.

The same happens when using CREATE SERVER with SOCKET specified.

10.2, 10.3 Presumed affected. Tested 10.4 and 10.8, same result.



 Comments   
Comment by Roel Van de Paar [ 2022-01-01 ]

Found a repeatable single-server testcase and the cause. The issue only happens if the target table is SPIDER also.

Using a single server only, this will fail:

INSTALL PLUGIN spider SONAME 'ha_spider.so';
SET SESSION spider_same_server_link=ON;
CREATE TABLE t1 (c INT) ENGINE=SPIDER;
CREATE TABLE t2 (c INT) ENGINE=SPIDER COMMENT='WRAPPER "mariadb", TABLE "t1", SOCKET "/your_same_server_path/socket.sock"';
INSERT INTO t2 VALUES (1);

With ERROR 1429 (HY000): Unable to connect to foreign data source: localhost.

If table t1 is changed to InnoDB, it works fine.

Comment by Nayuta Yanagisawa (Inactive) [ 2022-01-06 ]

Spider tends not to do validation before actual querying. This is a typical example. I will add some validation.

Generated at Thu Feb 08 09:52:38 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.