Skip to content

RemoteGraphBatch ignores unique edge constraint #4113

Description

@ruslan-butyk-fntext

ArcadeDB version: 26.4.2
Steps to reproduce:

  • Create a simple scheme with edge unique constraint:
CREATE VERTEX TYPE zone;
CREATE VERTEX TYPE device;
CREATE PROPERTY zone.id STRING;
CREATE PROPERTY device.id STRING;
CREATE EDGE TYPE zone_device;
CREATE PROPERTY zone_device.from_id STRING;
CREATE INDEX ON zone_device (from_id) NOTUNIQUE;
CREATE PROPERTY zone_device.to_id STRING;
CREATE INDEX ON zone_device (to_id) NOTUNIQUE;
CREATE INDEX ON zone_device (from_id,to_id) UNIQUE;
  • Using RemoteGraphBatch create two vertexes and the same edge twice:
try (RemoteGraphBatch batch = remoteDb.batch().build()) {
  String zoneId = "zone1";
  String deviceId = "device1";
  String from = batch.createVertex("zone", "id", zoneId);
  String to = batch.createVertex("device", "id", deviceId);
  batch.flush();
  batch.createEdge("zone_device", from, to, "from_id", zoneId, "to_id", deviceId);
  batch.createEdge("zone_device", from, to, "from_id", zoneId, "to_id", deviceId);
  batch.flush();
}

Actual behavior: Edge is successfully created twice.
Expected behavior: Edge should not be created the second time because it violates unique constraint [from_id,to_id]

P.S.
Also worth to mention that RemoteGraphBatch doesn't support RemoteDatabase transactions. I'm not sure if it should support it, but there might be some confusions since RemoteGraphBatch is created out of RemoteDatabase.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions