[MDEV-32097] Assertion `inited==RND' failed in handler::ha_rnd_end on DELETE from partition spider table with read_only_mode=1 Created: 2023-09-05  Updated: 2023-11-28

Status: Confirmed
Project: MariaDB Server
Component/s: Partitioning, Storage Engine - Spider
Affects Version/s: 10.4, 10.5, 10.6, 10.9, 10.10, 10.11, 11.0, 11.1, 11.2, 11.3
Fix Version/s: 10.4, 10.5, 10.6, 10.11, 11.0, 11.1, 11.2

Type: Bug Priority: Major
Reporter: Yuchen Pei Assignee: Yuchen Pei
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-26540 Spider: Assertion `inited==RND' faile... Confirmed

 Description   

May be related to MDEV-26540, but different arrangements of
read_only_mode cause different results, so it is different from that
ticket.

At 11.2 e81fa345020ec6a067583db6a7019d6404b26f93

--echo #
--echo # test delete_read_only_parts
--echo #
 
--disable_query_log
--disable_result_log
--source ../../t/test_init.inc
--enable_result_log
--enable_query_log
 
set session spider_read_only_mode=-1;
evalp CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
 
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT);
CREATE TABLE t (a INT) ENGINE=Spider
COMMENT='wrapper "mysql", table "t1", srv "srv"'
PARTITION BY RANGE (a) (
  PARTITION p1 VALUES LESS THAN (3) COMMENT='read_only_mode "0"',
  PARTITION p2 VALUES LESS THAN MAXVALUE COMMENT='read_only_mode "1"'
);
# INSERT INTO t VALUES (1), (2);
DELETE FROM t;
DROP TABLE t, t1, t2;
drop server srv;
 
--disable_query_log
--disable_result_log
--source ../t/test_deinit.inc
--enable_result_log
--enable_query_log
 
--echo #
--echo # end of test delete_read_only_parts
--echo #

Variants:

  • Removing p1 partition: same failure
  • Change read_only_mode to 0 for p2: pass
  • Set table level read_only_mode to 1 and leave partition level
    comments empty: same failure
  • Set table level read_only_mode to 0 and leave partition level
    comments empty: pass
  • Set table level read_only_mode to 0 and remove partitions: pass
  • Set table level read_only_mode to 1 and remove partitions: fail with
    (12518): Table 'test.t' is read only, which makes sense

I think the expected behaviour should be a failure 12518 when at least
one partition has read_only_mode equal 1.



 Comments   
Comment by Yuchen Pei [ 2023-09-05 ]

Here's another case, where one partition misses the remote table

--echo #
--echo # test part_missing_table
--echo #
 
--disable_query_log
--disable_result_log
--source ../../t/test_init.inc
--enable_result_log
--enable_query_log
 
set session spider_read_only_mode=-1;
evalp CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
 
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT);
CREATE TABLE t (a INT) ENGINE=Spider
COMMENT='wrapper "mysql"'
PARTITION BY RANGE (a) (
  PARTITION p1 VALUES LESS THAN (3) COMMENT='tbl "t1", srv "srv"',
  PARTITION p2 VALUES LESS THAN MAXVALUE COMMENT='srv "srv"'
);
 
# If we remove the following two lines, then we'd get 12702 for the
# DELETE statement
--error 12702
INSERT INTO t VALUES (1, "aaa"), (2, "bbb"), (3, "ccc"), (4, "ddd");
 
DELETE FROM t;
DROP TABLE t, t1, t2;
drop server srv;
 
--disable_query_log
--disable_result_log
--source ../t/test_deinit.inc
--enable_result_log
--enable_query_log
 
--echo #
--echo # end of test part_missing_table
--echo #

Comment by Roel Van de Paar [ 2023-09-09 ]

Confirmed in 10.4 to 11.3, debug builds.

Generated at Thu Feb 08 10:28:48 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.