[MDEV-16743] Error creating sharded partitioned table Created: 2018-07-12 Updated: 2018-10-18 Resolved: 2018-07-30 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - Spider |
| Affects Version/s: | 10.3.8 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Minor |
| Reporter: | Dermot Brereton | Assignee: | Jacob Mathew (Inactive) |
| Resolution: | Cannot Reproduce | Votes: | 1 |
| Labels: | None | ||
| Environment: |
Ubuntu 16.04.4 LTS |
||
| Description |
|
Step 1). Create users for spider to connect to backend servers. ssh root@maria-shard1 ssh root@maria-shard2 Step 2.) Verfify connections from the spider node (maria-dba). mysql -u spider_user -p -h 10.4.21.76 test Step 3) Define server entries on the spider node (maria-dba). CREATE SERVER shard1 FOREIGN DATA WRAPPER MYSQL OPTIONS CREATE SERVER shard2 FOREIGN DATA WRAPPER MYSQL OPTIONS 4.) Create Partitioned table on spider node (maria-dba); CREATE TABLE opportunities ( *ERROR 1062 (23000): Duplicate entry 'test-opportunities#P#pt1-0' for key 'PRIMARY'* |
| Comments |
| Comment by Dermot Brereton [ 2018-07-18 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
For clarification there is no data contained in the tables. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Dermot Brereton [ 2018-07-18 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Is it a bug ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jacob Mathew (Inactive) [ 2018-07-19 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I am unable to reproduce the problem. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Dermot Brereton [ 2018-07-24 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
MariaDB version 10.3.8 was installed on the spider node. Could you please confirm if your environment is similar? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jacob Mathew (Inactive) [ 2018-07-24 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
My original attempts to reproduce the problem used MariaDB 10.3 on all nodes, as it was not explained in the bug description that a different version was used on the data nodes. I have retried using version 10.3.8 on the Spider node and version 10.2.16 on the data nodes. Once again, I am unable to reproduce the problem. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Ivan Tyagov [ 2018-07-25 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi, === -> id int, -> accountName varchar(20), -> name varchar(128), -> owner varchar(7), -> amount decimal(10,2), -> closeDate date, -> stageName varchar(11), -> primary key (id), -> key (accountName) -> ) engine=spider COMMENT='wrapper "mysql", table "opportunities"' -> PARTITION BY HASH (id) -> ( -> PARTITION pt1 COMMENT = 'srv "backend1"', -> PARTITION pt2 COMMENT = 'srv "backend2"' -> ) ; Query OK, 0 rows affected (0.004 sec) Then trying to insert a row: node1 [localhost] {msandbox} (test) > insert into opportunities values(1, "test", "test", "test", 10, "01/01/2018", "test"); node1 [localhost] {msandbox} (test) > show table status \G*************************** 1. row *************************** Name: opportunities Engine: NULL Version: NULL Row_format: NULL Rows: NULL Avg_row_length: NULL Data_length: NULL Max_data_length: NULL Index_length: NULL Data_free: NULL Auto_increment: NULL Create_time: NULL Update_time: NULL Check_time: NULL Collation: NULL Checksum: NULL Create_options: NULL Comment: Table 'test.opportunities' doesn't exist in engine Max_index_length: NULL Temporary: NULL 1 row in set, 1 warning (0.001 sec) I tried to remove table: node1 [localhost] {msandbox} (test) > drop table opportunities; node1 [localhost] {msandbox} (test) > show warnings;-------- | Level | Code | Message | -------- | Warning | 1932 | Table 'test.opportunities' doesn't exist in engine | -------- 1 row in set (0.000 sec) node1 [localhost] {msandbox} (test) > show tables; node1 [localhost] {msandbox} (test) > create table opportunities (-> id int, -> accountName varchar(20), -> name varchar(128), -> owner varchar(7), -> amount decimal(10,2), -> closeDate date, -> stageName varchar(11), -> primary key (id), -> key (accountName) -> ) engine=spider COMMENT='wrapper "mysql", table "opportunities"' -> PARTITION BY HASH (id) -> ( -> PARTITION pt1 COMMENT = 'srv "backend1"', -> PARTITION pt2 COMMENT = 'srv "backend2"' -> ) ; ERROR 1062 (23000): Duplicate entry 'test-opportunities#P#pt1-0' for key 'PRIMARY' node1 [localhost] {msandbox} (test) > show engines;
-------------------
------------------- Maybe this helps you debug? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Ivan Tyagov [ 2018-07-25 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I investigated more. It turned out to be an issue with connectivity between "spider" node and backedn1 and backedn2 nodes. So it should rather display a more meaningful message and / or warn for connectivity issues (no idea if possible) during "spider" table creation. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jacob Mathew (Inactive) [ 2018-07-25 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Something I failed to notice earlier is that in the steps to reproduce the problem you did not issue CREATE TABLE statements on the data nodes (shards). Spider does not push DDL statements to the data nodes. You must issue DDL statements separately on every node in the Spider cluster. This is explained in the following knowledge base page:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Ivan Tyagov [ 2018-07-26 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Yes, on my side I consider this issue a misconfiguration except fact that it is not very intuitive message to user. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Dermot Brereton [ 2018-07-26 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The CREATE TABLE statements were originally executed on the data noes (shards). The DML was not included in the above steps to reduce noise. #On both shard nodes. DROP TABLE IF EXISTS opportunities; #On spider node. DROP TABLE IF EXISTS opportunities; *ERROR 1062 (23000): Duplicate entry 'test-opportunities#P#pt1-0' for key 'PRIMARY'* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Dermot Brereton [ 2018-07-26 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Also note the spider engine is NOT INSTALLED on the shard nodes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Dermot Brereton [ 2018-07-27 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Column "k" is an INT datatype. Please insert a numeric value or leave blank and the default value (0) will be inserted. INSERT INTO opportunities (name,owner,amount,closedate,stagename) VALUES ('another','Test',10.2,"2018-07-12",'Test'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jacob Mathew (Inactive) [ 2018-07-27 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Precisely following your steps to reproduce, including your latest revision, there are no errors:
Here is my Ubuntu version information:
I cannot reproduce the reported errors. Unless you have any further information for reproducing the errors, I will need to close the bug as unreproducible. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jacob Mathew (Inactive) [ 2018-07-30 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Cannot reproduce the reported errors. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Dermot Brereton [ 2018-10-18 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Error was related to the DDL used to create the table on the sharded nodes; Shard#1: Create table with partition 1. Shard#2: Create table with partition 2. DROP TABLE IF EXISTS opportunities; Query OK, 0 rows affected (0.03 sec) |