Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropping or rebuilding an empty index not possible anymore - NotEmptyComponentCanNotBeRemovedException #9914

Closed
jacquipre opened this issue Jan 25, 2023 · 3 comments
Labels
Milestone

Comments

@jacquipre
Copy link

OrientDB Version: 3.2.14

Java Version: 17.0.5+8

OS: Windows 10

Expected behavior

It is possible to drop or rebuild an index that is obviously empty.

Actual behavior

We updated our OrientDB version from 3.2.6 to 3.2.14 having problems to create new vertices because of many changes (refactorings) in the index transaction parts (see commits in the diff from August and December 2022).
What was our problem: during a database transaction we are creating a vertex and in further steps request those vertex by using an automatic index of that vertex type. After upgrading to from 3.2.6 to 3.2.14 that index request does not work anymore because of this code in class OIndexOneValue

OIndexOneValue

As you can see in the marked lines, if nothing found in the storage AND the apiVersion of the index == 0 an emtpy stream is returned!

Why was this change made?

(Before that change in case of a not found storage entry, the code "looks" into the current transaction index changes and returns the correct index entry).

So we decided to rebuild our index to get the apiVersion == 1. If you look at the code: if apiVersion==1 the code "looks" into the storage and - if nothing found - goes further to get the index entry from the current transaction index changes (which is the wished behaviour).

BUT:
We cannot drop the index, because we always get a:
com.orientechnologies.orient.core.exception.NotEmptyComponentCanNotBeRemovedException: <our_index> : Not empty index can not be deleted. Index has 110 records at com.orientechnologies.orient.core.storage.index.sbtree.local.v1.OSBTreeV1.lambda$delete$4(OSBTreeV1.java:512) ~[orientdb-core-3.2.14.jar:3.2.14] at com.orientechnologies.orient.core.storage.impl.local.paginated.atomicoperations.OAtomicOperationsManager.executeInsideComponentOperation(OAtomicOperationsManager.java:165) ~[orientdb-core-3.2.14.jar:3.2.14] at com.orientechnologies.orient.core.storage.impl.local.paginated.atomicoperations.OAtomicOperationsManager.executeInsideComponentOperation(OAtomicOperationsManager.java:157) ~[orientdb-core-3.2.14.jar:3.2.14] at com.orientechnologies.orient.core.storage.impl.local.paginated.base.ODurableComponent.executeInsideComponentOperation(ODurableComponent.java:102) ~[orientdb-core-3.2.14.jar:3.2.14] at com.orientechnologies.orient.core.storage.index.sbtree.local.v1.OSBTreeV1.delete(OSBTreeV1.java:504) ~[orientdb-core-3.2.14.jar:3.2.14] at com.orientechnologies.orient.core.storage.index.engine.OSBTreeIndexEngine.delete(OSBTreeIndexEngine.java:134) ~[orientdb-core-3.2.14.jar:3.2.14] at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.deleteIndexEngineInternal(OAbstractPaginatedStorage.java:2930) ~[orientdb-core-3.2.14.jar:3.2.14] at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.lambda$deleteIndexEngine$14(OAbstractPaginatedStorage.java:2893) ~[orientdb-core-3.2.14.jar:3.2.14] at com.orientechnologies.orient.core.storage.impl.local.paginated.atomicoperations.OAtomicOperationsManager.executeInsideAtomicOperation(OAtomicOperationsManager.java:140) ~[orientdb-core-3.2.14.jar:3.2.14] at com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.deleteIndexEngine(OAbstractPaginatedStorage.java:2889) ~[orientdb-core-3.2.14.jar:3.2.14] at com.orientechnologies.orient.core.index.OIndexAbstract.doDelete(OIndexAbstract.java:698) ~[orientdb-core-3.2.14.jar:3.2.14] at com.orientechnologies.orient.core.index.OIndexAbstract.delete(OIndexAbstract.java:661) ~[orientdb-core-3.2.14.jar:3.2.14] at com.orientechnologies.orient.core.index.OIndexAbstract.delete(OIndexAbstract.java:76) ~[orientdb-core-3.2.14.jar:3.2.14] at com.orientechnologies.orient.core.index.OIndexManagerShared.dropIndex(OIndexManagerShared.java:869) ~[orientdb-core-3.2.14.jar:3.2.14]

which is not true.

We cleared the index before dropping it. Before clearing we have over 6 million entries (using index.getSize()), after clearing it the size is 0 (due to index.getSize()) - but dropping is impossible!

So how can we solve this problem? ATM we are not able to upgrade to a newer OrientDB version to benefit from the bug fix #9821 from 3.2.14 because of the index behaviour changes.

Thanks,
J.

@tglman tglman added the bug label Jan 25, 2023
@tglman tglman added this to the 3.2.x milestone Jan 25, 2023
@tglman
Copy link
Member

tglman commented Jan 25, 2023

Hi,

Thanks for the detailed report, will check for both cases.

Regards

tglman added a commit that referenced this issue Jan 25, 2023
@tglman
Copy link
Member

tglman commented Feb 8, 2023

Hi,

This should be resolved in the 3.2.16 just released, could you please verify ?

Regards

@tglman tglman modified the milestones: 3.2.x, 3.2.16 Feb 8, 2023
@jacquipre
Copy link
Author

Tried it. No need to rebuild the indices anymore. So this is fixed for us.

@tglman tglman closed this as completed Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants