orientechnologies / orientdb

OrientDB is the most versatile DBMS supporting Graph, Document, Reactive, Full-Text and Geospatial models in one Multi-Model product. OrientDB can run distributed (Multi-Master), supports SQL, ACID Transactions, Full-Text indexing and Reactive Queries.
https://orientdb.dev
Apache License 2.0
4.72k stars 870 forks source link

database.ocf (Access is denied) when creating schema #10204

Open robert-andrei opened 3 months ago

robert-andrei commented 3 months ago

OrientDB Version: 2.2.37

Java Version: 11.0.13 OpenJDK

OS: Windows server 2019

I have a Java program which is creating the database schema executing the following commands from a script:

create class Uses extends E
create class UsesInternal extends Uses CLUSTERS 1
create class UsesSub extends UsesInternal CLUSTERS 1

Execution is like this:

graph.command(new OCommandScript("sql", scriptContent)).execute();

Expected behavior

Successfully create the schema every single time.

Actual behavior

Sometimes, a command execution fails with the following error:

com.orientechnologies.orient.core.exception.OPaginatedClusterException: Error during creation of cluster with name usesinternal
[...]
    at com.orientechnologies.orient.core.storage.impl.local.paginated.OPaginatedCluster.create(OPaginatedCluster.java:196) ~
Caused by: com.orientechnologies.orient.core.exception.OSerializationException: Error on update storage configuration
[...]
com.orientechnologies.orient.core.storage.impl.local.OStorageConfigurationSegment.update(OStorageConfigurationSegment.java:232)
Caused by: java.io.FileNotFoundException: C:\Program Files\Local Test\data\tmp\gdb\gdb-test\database.ocf (Access is denied)
    at java.io.RandomAccessFile.open0(Native Method) ~[?:?]
    at java.io.RandomAccessFile.open(Unknown Source) ~[?:?]
    at java.io.RandomAccessFile.<init>(Unknown Source) ~[?:?]
    at java.io.RandomAccessFile.<init>(Unknown Source) ~[?:?]
    at com.orientechnologies.orient.core.storage.impl.local.OStorageConfigurationSegment.update(OStorageConfigurationSegment.java:220)

Steps to reproduce

The issue is very inconsistent and only shows up from time to time. Didn't manage to pick up on a specific scenario. I'm not sure how the database.ocf file is used in Orient DB, is there something locking it?