bug: index name collision crashes instance
version: picodata 24.3.0-121-g226c5f1fa
repro:
- create two tables:
create table t (a int not null, b int, primary key (a))
distributed by (b)
option (timeout = 3)
create table t2 (a int not null, b int, primary key (a))
distributed by (b)
option (timeout = 3)
- create index with arbitrary name on t, then with the same name on t2:
create index no_matter on t (a) option (timeout = 3)
create index no_matter on t2 (a) option (timeout = 3)
- log after last sql query:
[42603] main/113/governor_loop I> applying pending schema change
2024-05-08 15:17:53.782 [42603] main/113/governor_loop I> calling proc_apply_schema_change, instance_id: i1
2024-05-08 15:17:53.783 [42603] main/113/governor_loop I> applied schema change on instance, instance_id: i1
2024-05-08 15:17:53.783 [42603] main/113/governor_loop I> finalizing schema change, op: DdlCommit
2024-05-08 15:17:53.784 [42603] main/113/governor_loop I> nothing to do, waiting for events to handle
thread 'main' panicked at src/traft/node.rs:1706:22:
storage shouldn't fail: Tarantool(BoxError { code: 3, message: Some("Duplicate key exists in unique index \"_pico_index_name\" in space \"_pico_index\" with old tuple - [1025, 2, \"NO_MATTER\", \"tree\", [{\"unique\": false}], [[0, \"integer\", null, false, null]], true, 3, 1] and new tuple - [1026, 2, \"NO_MATTER\", \"tree\", [{\"unique\": false}], [[0, \"integer\", null, false, null]], false, 4, 1]"), error_type: Some("ClientError"), errno: None, file: Some("./src/box/memtx_tree.cc"), line: Some(1133), fields: {}, cause: None })
backtrace:
stack backtrace:
0: rust_begin_unwind
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
1: core::panicking::panic_fmt
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
2: core::result::unwrap_failed
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/result.rs:1649:5
3: core::result::Result<T,E>::expect
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/result.rs:1030:23
4: picodata::traft::node::NodeImpl::apply_op_ddl_prepare
at ./src/traft/node.rs:1703:17
5: picodata::traft::node::NodeImpl::handle_committed_normal_entry
at ./src/traft/node.rs:1004:17
6: picodata::traft::node::NodeImpl::handle_committed_entries::{{closure}}
at ./src/traft/node.rs:703:46
7: tarantool::transaction::transaction
at ./tarantool/tarantool/src/transaction.rs:67:18
8: picodata::traft::node::NodeImpl::handle_committed_entries
at ./src/traft/node.rs:697:13
9: picodata::traft::node::NodeImpl::advance
at ./src/traft/node.rs:2276:23
10: picodata::traft::node::MainLoop::iter_fn::{{closure}}
at ./src/traft/node.rs:2399:19
11: picodata::traft::node::MainLoop::start::{{closure}}::{{closure}}
at ./src/loop.rs:12:51
12: tarantool::fiber::async::block_on
at ./tarantool/tarantool/src/fiber/async.rs:253:33
13: picodata::traft::node::MainLoop::start::{{closure}}
at ./src/loop.rs:8:17
14: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/alloc/src/boxed.rs:2015:9
15: tarantool::fiber::Fyber<F,T>::trampoline_for_ffi
at ./tarantool/tarantool/src/fiber.rs:821:17
16: fiber_cxx_invoke
at ./tarantool-sys/src/lib/core/fiber.h:1283:11
17: fiber_loop
at ./tarantool-sys/src/lib/core/fiber.c:1085:18
18: coro_init
at ./tarantool-sys/third_party/coro/coro.c:108:3