[MDEV-19866] With a Spider table, a SELECT with WHERE involving primary key breaks following SELECTs Created: 2019-06-26  Updated: 2021-10-18  Resolved: 2019-07-06

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - Spider
Affects Version/s: 10.4.6, 10.3, 10.4
Fix Version/s: 10.4.7

Type: Bug Priority: Critical
Reporter: Leandro Pacheco (Inactive) Assignee: Kentoku Shiba (Inactive)
Resolution: Fixed Votes: 1
Labels: None
Environment:

Ubuntu 18.4 on x86_64


Attachments: File my.cnf     File node1.cnf     File node2.cnf     File spider.cnf    
Issue Links:
Duplicate
is duplicated by MDEV-26333 Resullt of SELECT from partitioned Sp... Closed

 Description   

Doing a SELECT WHERE including the primary key of a partitioned table causes the following SELECTs to behave incorrectly.
Essentially the following behaviour:

INSERT INTO foo VALUES (1, '1'),(2, '2'),(3, '3'),(4, '4');
– ok, check directly on backend nodes and values are split between them
SELECT * FROM foo;
– ok, returns all entries
SELECT * FROM foo WHERE id=1;
– ok, returns previously inserted row
SELECT * FROM foo;
– broken! returns only entries from the partition containing id=1!
SELECT * FROM foo WHERE id=2;
– ok, returns previously inserted row
SELECT * FROM foo;
– broken! returns only entries from the partition containing id=2!

Note that this happens even when the SELECT's are done from different connections in spider.

The setup is very simple, running locally, with:

  • 1 spider node
  • 2 datanodes (node1 and node2)

No changes to spider variables, everything is default.

I'm using the following table, partitioned BY KEY(id) in spider:

CREATE TABLE foo
(
id int(10) NOT NULL,
val varchar(50) NOT NULL,
PRIMARY KEY(id)
)
ENGINE=spider
COMMENT='wrapper "mysql", table "foo"'
PARTITION BY KEY (id)
(
PARTITION p1 COMMENT = 'srv "node1"',
PARTITION p2 COMMENT = 'srv "node2"'
);

This problem also happens with RANGE/HASH partitioned tables.
Also, if the primary key is composite, say (id, val), then the select must include both columns for the problematic behavior to happen.



 Comments   
Comment by Kentoku Shiba (Inactive) [ 2019-06-28 ]

lpacheco
Thank you for reporting the issue. I could reproduce and fixed.

9c08370

Comment by Kentoku Shiba (Inactive) [ 2019-07-02 ]

willhan
Would you please check it?

Comment by willhan [ 2019-07-05 ]

kentoku
it's ok

Comment by Kentoku Shiba (Inactive) [ 2019-07-06 ]

Thank you for checking this.
It's merged.

Generated at Thu Feb 08 08:54:58 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.