Details
-
Bug
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
10.6, 10.11, 11.4, 12.0(EOL), 11.8
-
None
Description
Note that while it may seem obvious that something goes wrong here already upon INSERT which inserts duplicate values into the primary key field, after reading the Connect engine documentation I'm not so sure anymore. At the time of writing this, it says the following:
Handling index errors
The way CONNECT handles indexing is very specific. All table modifications are
done regardless of indexing. Only after a table has been modified, or when anOPTIMIZE TABLE command is sent are the indexes made. If an error occurs,
the corresponding index is not made. However, CONNECT being a non-transactional
engine, it is unable to roll back the changes made to the table. The main
causes of indexing errors are:Trying to index a nullable column. In this case, you can alter the table to
declare the column as not nullable or, if the column is nullable indeed, make
it not indexed.Entering duplicate values in a column indexed by a unique index. In this
case, if the index was wrongly declared as unique, alter is declaration to
reflect this. If the column should really contain unique values, you must
manually remove or update the duplicate values.In both cases, after correcting the error, remake the indexes with the OPTIMIZE TABLE command.
I cannot really parse it with certainty, but I think at least one interpretation can be that Connect allows inserting anything into anything, and it's up to the user to fix the mess afterwards.
INSTALL SONAME 'ha_connect'; |
|
|
CREATE TABLE t (id INT NOT NULL PRIMARY KEY, k INT NOT NULL, KEY (k)) ENGINE=Connect TABLE_TYPE=FIX; |
INSERT INTO t VALUES (1,10),(1,20); |
ANALYZE TABLE t PERSISTENT FOR ALL; |
|
|
DROP TABLE t; |
UNINSTALL SONAME 'ha_connect'; |
|
main 823a3a258f03037fea0995a9b70e43acebec7006 |
CREATE TABLE t (id INT NOT NULL PRIMARY KEY, k INT NOT NULL, KEY (k)) ENGINE=Connect TABLE_TYPE=FIX;
|
Warnings:
|
Warning 1105 No file name. Table will use t.fix
|
INSERT INTO t VALUES (1,10),(1,20);
|
Warnings:
|
Warning 1105 Index is not unique
|
ANALYZE TABLE t PERSISTENT FOR ALL;
|
bug.913-34a [ fail ]
|
Test ended at 2025-07-28 18:04:29
|
|
|
CURRENT_TEST: bug.913-34a
|
mysqltest: At line 5: query 'ANALYZE TABLE t PERSISTENT FOR ALL' failed: <Unknown> (2013): Lost connection to server during query
|
|
|
index_init CONNECT: Open error 2 in mode rb on /dev/shm/var_auto_crnI/mysqld.1/data/./test/t.fnx: No such file or directory
|
mariadbd: /data/bld/main-asan-ubsan/sql/handler.cc:3992: int handler::ha_index_first(uchar*): Assertion `inited==INDEX' failed.
|
250728 18:04:28 [ERROR] /share8t/bld/main-asan-ubsan/sql/mariadbd got signal 6 ;
|
|
|
#10 0x00007f7b6aa53eb2 in __GI___assert_fail (assertion=0x56344b954ca0 "inited==INDEX", file=0x56344b952e60 "/data/bld/main-asan-ubsan/sql/handler.cc", line=3992, function=0x56344b95a520 "int handler::ha_index_first(uchar*)") at ./assert/assert.c:101
|
#11 0x0000563448e4efd4 in handler::ha_index_first (this=this@entry=0x625000262148, buf=<optimized out>) at /data/bld/main-asan-ubsan/sql/handler.cc:3992
|
#12 0x0000563447eaefe8 in collect_statistics_for_index (thd=thd@entry=0x62c0000c0218, table=table@entry=0x61900005a098, index=<optimized out>) at /data/bld/main-asan-ubsan/sql/sql_statistics.cc:2678
|
#13 0x0000563447eb0fbf in collect_statistics_for_table (thd=thd@entry=0x62c0000c0218, table=table@entry=0x61900005a098) at /data/bld/main-asan-ubsan/sql/sql_statistics.cc:2862
|
#14 0x00005634482fe98a in mysql_admin_table (thd=thd@entry=0x62c0000c0218, tables=tables@entry=0x62d0000f0550, check_opt=check_opt@entry=0x62c0000c5b88, operator_name=operator_name@entry=0x56344c45d280 <msg_analyze>, lock_type=lock_type@entry=TL_READ_NO_INSERT, org_open_for_modify=org_open_for_modify@entry=true, no_errors_from_open=<optimized out>, extra_open_options=<optimized out>, prepare_func=<optimized out>, operator_func=<optimized out>, view_operator_func=<optimized out>, is_cmd_replicated=<optimized out>) at /data/bld/main-asan-ubsan/sql/sql_admin.cc:1103
|
#15 0x0000563448307225 in Sql_cmd_analyze_table::execute (this=<optimized out>, thd=0x62c0000c0218) at /data/bld/main-asan-ubsan/sql/sql_admin.cc:1651
|
#16 0x0000563447a26ec9 in mysql_execute_command (thd=thd@entry=0x62c0000c0218, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /data/bld/main-asan-ubsan/sql/sql_parse.cc:5861
|
#17 0x0000563447a2b96c in mysql_parse (thd=thd@entry=0x62c0000c0218, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7f7b5e057a10) at /data/bld/main-asan-ubsan/sql/sql_parse.cc:7882
|
#18 0x0000563447a349a9 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x62c0000c0218, packet=packet@entry=0x6290002b2219 "", packet_length=packet_length@entry=34, blocking=blocking@entry=true) at /data/bld/main-asan-ubsan/sql/sql_parse.cc:1877
|
#19 0x0000563447a41895 in do_command (thd=thd@entry=0x62c0000c0218, blocking=blocking@entry=true) at /data/bld/main-asan-ubsan/sql/sql_parse.cc:1416
|
#20 0x000056344828bd1a in do_handle_one_connection (connect=<optimized out>, connect@entry=0x6080000082b8, put_in_cache=put_in_cache@entry=true) at /data/bld/main-asan-ubsan/sql/sql_connect.cc:1414
|
#21 0x000056344828ce83 in handle_one_connection (arg=0x6080000082b8) at /data/bld/main-asan-ubsan/sql/sql_connect.cc:1326
|
#22 0x0000563449db04b1 in pfs_spawn_thread (arg=0x617000005f18) at /data/bld/main-asan-ubsan/storage/perfschema/pfs.cc:2198
|
#23 0x00007f7b6aaa81c4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
|
#24 0x00007f7b6ab2885c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
|
A non-debug build survives the ANALYZE, but so do the duplicate primary keys, which I suppose it won't lead to anything good at the end.
|
main 823a3a258f03037fea0995a9b70e43acebec7006 non-debug |
CREATE TABLE t (id INT NOT NULL PRIMARY KEY, k INT NOT NULL, KEY (k)) ENGINE=Connect TABLE_TYPE=FIX; |
Warnings:
|
Warning 1105 No file name. Table will use t.fix |
INSERT INTO t VALUES (1,10),(1,20); |
Warnings:
|
Warning 1105 Index is not unique |
ANALYZE TABLE t PERSISTENT FOR ALL; |
Table Op Msg_type Msg_text |
test.t analyze status Engine-independent statistics collected |
test.t analyze note The storage engine for the table doesn't support analyze |
OPTIMIZE TABLE t; |
Table Op Msg_type Msg_text |
test.t optimize Error Index is not unique |
test.t optimize error Unknown - internal error 145 during operation
|
SELECT * FROM t; |
id k
|
1 10
|
1 20
|
DROP TABLE t; |