Skip to content

Edge indexes become invalid in certain scenario #3091

Closed

Description

@ruslan-butyk-fntext

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:

  1. After executing transaction №1, transaction №2 and transaction №3 the query select from trs_duct where from_id='trs_1' and to_id='duct_1' should return only one edge.
  2. After executing transaction №4 there should be no DuplicatedKeyException error.

Activity

  1. changed the title [-]Indexes become invalid in certain scenario[/-] [+]Edge indexes become invalid in certain scenario[/+] on Jan 5, 2026
  2. self-assigned this
    on Jan 6, 2026
  3. added this to the 25.12.1 milestone on Jan 6, 2026
  4. added theissue type on Jan 6, 2026
  5. lvca commented on Jan 6, 2026

    @lvca
    Member

    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.

  6. lvca commented on Jan 6, 2026

    @lvca
    Member

    Fixed on main branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions