GeezerVison is showing github.com — Delete of edge uses wrong index if many edges are present · Issue #2092 · ArcadeData/arcadedb
Delete of edge uses wrong index if many edges are present #2092DescriptionArcadeDBVersion: 25.3.1
Preconditions:
- Up and running ArcadeDB server with available empty database
Steps to reproduce:
-
create the following schema:
SQL: CREATE VERTEX TYPE zone if not exists;
SQL: CREATE PROPERTY zone.id if not exists STRING;
SQL: CREATE VERTEX TYPE device if not exists ;
SQL: CREATE PROPERTY device.id if not exists STRING;
SQL: CREATE EDGE TYPE zone_device if not exists ;
SQL: CREATE PROPERTY zone_device.from_id if not exists STRING;
SQL: CREATE PROPERTY zone_device.to_id if not exists STRING;
SQL: CREATE PROPERTY zone_device.status_action if not exists INTEGER;
SQL: CREATE INDEX if not exists ON zone_device (from_id, to_id,status_action) UNIQUE;
SQL: CREATE INDEX if not exists ON zone_device (from_id) NOTUNIQUE;
SQL: CREATE INDEX if not exists ON zone_device (to_id) NOTUNIQUE;
-
add about 1 million edges (not sure at which number it starts failing, works with 100.000)
-
try to delete one record via SQL :DELETE FROM zone_device WHERE from_id='zone1';
actual behaviour:
An exception occurs as the composite index seems to be used instead of the dedicated one
java.lang.IllegalArgumentException: key is composed of 1 items, while the index defined 3 items
at com.arcadedb.index.lsm.LSMTreeIndexAbstract.lookupInPage(LSMTreeIndexAbstract.java:261)
at com.arcadedb.index.lsm.LSMTreeIndexCompacted.newIterators(LSMTreeIndexCompacted.java:264)
at com.arcadedb.index.lsm.LSMTreeIndexCursor.(LSMTreeIndexCursor.java:90)
at com.arcadedb.index.lsm.LSMTreeIndexMutable.lambda$range$1(LSMTreeIndexMutable.java:202)
at com.arcadedb.utility.RWLockContext.executeInReadLock(RWLockContext.java:65)
at com.arcadedb.index.lsm.LSMTreeIndexMutable.range(LSMTreeIndexMutable.java:202)
at com.arcadedb.index.lsm.LSMTreeIndex.lambda$range$5(LSMTreeIndex.java:344)
at com.arcadedb.utility.RWLockContext.executeInReadLock(RWLockContext.java:65)
at com.arcadedb.index.lsm.LSMTreeIndex.range(LSMTreeIndex.java:344)
at com.arcadedb.index.TypeIndex.range(TypeIndex.java:91)
at com.arcadedb.query.sql.executor.FetchFromIndexStep.init(FetchFromIndexStep.java:342)
at com.arcadedb.query.sql.executor.FetchFromIndexStep.processAndBlock(FetchFromIndexStep.java:287)
at com.arcadedb.query.sql.executor.FetchFromIndexStep.init(FetchFromIndexStep.java:212)
at com.arcadedb.query.sql.executor.FetchFromIndexStep.init(FetchFromIndexStep.java:196)
at com.arcadedb.query.sql.executor.FetchFromIndexStep.syncPull(FetchFromIndexStep.java:84)
at com.arcadedb.query.sql.executor.GetValueFromIndexEntryStep$1.fetchNextItem(GetValueFromIndexEntryStep.java:98)
at com.arcadedb.query.sql.executor.GetValueFromIndexEntryStep$1.hasNext(GetValueFromIndexEntryStep.java:69)
at com.arcadedb.query.sql.executor.FilterByTypeStep$1.fetchNextItem(FilterByTypeStep.java:59)
at com.arcadedb.query.sql.executor.FilterByTypeStep$1.hasNext(FilterByTypeStep.java:97)
at com.arcadedb.query.sql.executor.SubQueryStep$1.hasNext(SubQueryStep.java:53)
at com.arcadedb.query.sql.executor.CheckSafeDeleteStep$1.hasNext(CheckSafeDeleteStep.java:47)
at com.arcadedb.query.sql.executor.DeleteStep$1.hasNext(DeleteStep.java:40)
at com.arcadedb.query.sql.executor.CountStep.syncPull(CountStep.java:52)
at com.arcadedb.query.sql.executor.SelectExecutionPlan.fetchNext(SelectExecutionPlan.java:44)
at com.arcadedb.query.sql.executor.UpdateExecutionPlan.executeInternal(UpdateExecutionPlan.java:64)
at com.arcadedb.query.sql.executor.ScriptLineStep.syncPull(ScriptLineStep.java:50)
at com.arcadedb.query.sql.executor.ScriptExecutionPlan.doExecute(ScriptExecutionPlan.java:101)
at com.arcadedb.query.sql.executor.ScriptExecutionPlan.fetchNext(ScriptExecutionPlan.java:62)
at com.arcadedb.query.sql.parser.LocalResultSet.fetchNext(LocalResultSet.java:44)
at com.arcadedb.query.sql.parser.LocalResultSet.(LocalResultSet.java:40)
at com.arcadedb.query.sql.SQLScriptQueryEngine.executeInternal(SQLScriptQueryEngine.java:220)
at com.arcadedb.query.sql.SQLScriptQueryEngine.command(SQLScriptQueryEngine.java:121)
at com.arcadedb.database.LocalDatabase.command(LocalDatabase.java:1324)
at ArcadeDBTest.lambda$0(ArcadeDBTest.java:37)
at com.arcadedb.database.LocalDatabase.transaction(LocalDatabase.java:1069)
at com.arcadedb.database.LocalDatabase.transaction(LocalDatabase.java:1034)
at ArcadeDBTest.main(ArcadeDBTest.java:36)
expected behaviour:
Delete is executed succesfully
Alternatively import the following data and try to execute the delete
generatedData.zip Reacted by Ruslan Butyk, Dominik Bergen and cindy-kuhn-fnt Activitylvca commented on Mar 26, 2025 lvca commented on Mar 26, 2025 I've pulled the most recent changes in the SQL engine from OrientDB (where the SQL engine was forged from). Now this test passes, but I'm fixing other test cases that are in error. Reacted by achim-haeberle-fnt and Ruslan Butyk lvca commented on Mar 27, 2025 This now works with the latest branch (25.4.1-SNAPSHOT) ruslan-butyk-fntext commented on Jan 26, 2026 This issue is reproducible again on the 26.1.1. I've imported the dump from attached zip and executed DELETE FROM zone_device WHERE from_id='zone1'; and got an error: ERROR: key is composed of 1 items, while the index defined 3 items.
@lvca please check it.
UPD: also reproducible on 25.10.1-SNAPSHOT - java17 branch
UPD: not reproducible on 26.2.1-SNAPSHOT lvca commented on Jan 28, 2026 ruslan-butyk-fntext commented on Jan 28, 2026 @lvca yes it was working fine on the 26.2.1-SNAPSHOT.
Worth to notice that command() method of Database that I've used to execute SQL on all mentioned ArcadeDB versions on 26.2.1-SNAPSHOT requires to start transaction explicitly but didn't require that in all other versions. Don't know if it's connected somehow to the issue. lvca commented on Jan 29, 2026 It should be managed by explicit transaction setting. If set to true, it should be able to do begin/commit atomicaly added a commit that references this issue on Jun 12, 2026fix: #4600 SQL planner prefers a full-key index over a partial-key sc… added a commit that references this issue on Aug 14, 2026fix: #4600 SQL planner prefers a full-key index over a partial-key sc…
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|