Repository navigation
Closed
Milestone
Description
ArcadeDB version: 25.12.1-SNAPSHOT, 25.10.2-java17
Steps to reproduce: execute next chunks of SQL commands in separate transactions:
- transaction №1
CREATE VERTEX TYPE duct;
CREATE VERTEX TYPE trs;
CREATE PROPERTY duct.id STRING;
CREATE INDEX ON duct (id) UNIQUE;
CREATE PROPERTY trs.id STRING;
CREATE INDEX ON trs (id) UNIQUE;
CREATE EDGE TYPE trs_duct;
CREATE PROPERTY trs_duct.from_id STRING;
CREATE INDEX ON trs_duct (from_id) NOTUNIQUE;
CREATE PROPERTY trs_duct.to_id STRING;
CREATE INDEX ON trs_duct (to_id) NOTUNIQUE;
CREATE PROPERTY trs_duct.swap STRING;
CREATE PROPERTY trs_duct.order_number INTEGER;
CREATE INDEX ON trs_duct (from_id,to_id,swap,order_number) UNIQUE;
- transaction №2
INSERT INTO duct (id) VALUES ('duct_1');
INSERT INTO trs (id) VALUES ('trs_1');
CREATE EDGE trs_duct from #4:0 to #1:0 SET from_id='trs_1', to_id='duct_1', swap='N', order_number=1;
- transaction №3
INSERT INTO trs (id) VALUES ('trs_2');
DELETE FROM trs_duct WHERE (from_id='trs_2') AND (to_id='duct_1') AND (swap='N') AND (order_number=1);
DELETE FROM trs_duct WHERE (from_id='trs_1') AND (to_id='duct_1') AND (swap='N') AND (order_number=1);
CREATE EDGE trs_duct from #4:1 to #1:0 SET from_id='trs_2', to_id='duct_1', swap='N', order_number=1;
CREATE EDGE trs_duct from #4:0 to #1:0 SET from_id='trs_1', to_id='duct_1', swap='N', order_number=1;
at this point indexes for edge trs_duct are broken.
The query select from trs_duct where from_id='trs_1' and to_id='duct_1' will return two results but it should return only one.
And if you execute these commands:
- transaction №4
DELETE FROM trs_duct WHERE (from_id='trs_1') AND (to_id='duct_1') AND (swap='N') AND (order_number=1);
CREATE EDGE trs_duct from #4:0 to #1:0 SET from_id='trs_1', to_id='duct_1', swap='N', order_number=1;
you will get DuplicatedKeyException because edge wasn't properly deleted.
Expected behavior:
- After executing
transaction №1,transaction №2andtransaction №3the queryselect from trs_duct where from_id='trs_1' and to_id='duct_1'should return only one edge. - After executing
transaction №4there should be noDuplicatedKeyExceptionerror.
Activity
[-]Indexes become invalid in certain scenario[/-][+]Edge indexes become invalid in certain scenario[/+]fix: avoid reuse of deleted record in same tx
lvca commentedon Jan 6, 2026
Reproduced. The issue is the reuse of the same RID that has been deleted in the very same transaction. The easiest solution is avoiding to recycle the RID in the same TX.
lvca commentedon Jan 6, 2026
Fixed on main branch.
fix: avoid reuse of deleted record in same tx
fix: avoid reuse of deleted record in same tx