Log error on creating two tables with same format
Repro:
- Create two tables with the same format. For example:
CREATE TABLE "characters" (
"id" INTEGER NOT NULL,
"name" TEXT NOT NULL,
"year" INTEGER,
PRIMARY KEY ("id")
)
USING MEMTX DISTRIBUTED BY ("id")
OPTION (TIMEOUT = 3.0);
CREATE TABLE "routers" (
"id" INTEGER NOT NULL,
"name" TEXT NOT NULL,
"year" INTEGER,
PRIMARY KEY ("id")
)
USING MEMTX DISTRIBUTED BY ("id")
OPTION (TIMEOUT = 3.0);
- Find in log:
main/112/raft_main_loop node.rs:1641 W> failed creating index 'bucket_id': box error: TupleFound: Duplicate key exists in unique index "_pico_index_name" in space "_pico_index" with old tuple - [1025, 1, "bucket_id", "tree", [{"unique": false}], [[1, "unsigned", null, false, null]], true, 1, 1] and new tuple - [1026, 1, "bucket_id", "tree", [{"unique": false}], [[1, "unsigned", null, false, null]], false, 2, 1]
-
_pico_index
content:
|----------+----+--------------+--------+--------------+--------------+----------+-------------+-------|
| 1025 | 0 | "characters_ | "tree" | [{"unique": | [[0, | true | 1 | 1 |
| | | pkey" | | true}] | "integer", | | | |
| | | | | | nil, false, | | | |
| | | | | | nil]] | | | |
|----------+----+--------------+--------+--------------+--------------+----------+-------------+-------|
| 1025 | 1 | "bucket_id" | "tree" | [{"unique": | [[1, | true | 1 | 1 |
| | | | | false}] | "unsigned", | | | |
| | | | | | nil, false, | | | |
| | | | | | nil]] | | | |
|----------+----+--------------+--------+--------------+--------------+----------+-------------+-------|
| 1026 | 0 | "routers_pke | "tree" | [{"unique": | [[0, | true | 2 | 1 |
| | | y" | | true}] | "integer", | | | |
| | | | | | nil, false, | | | |
| | | | | | nil]] | | | |
+----------+----+--------------+--------+--------------+--------------+----------+-------------+-------+
No bucket_id index for routers table.
Log message from https://git.picodata.io/picodata/picodata/picodata/-/blob/master/src/traft/node.rs#L1643