Skip to content

Edge indexes become invalid in certain scenario #3091

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions