Somehow I got a test database into a state where the "OUser" class is missing. Luckily there is nothing I care about in the db, but it got me thinking about how I can defend against this in the field. Can I still get data out if there are no users? Can I add users back in? How are essential OrientDb classes protected against accidental deletes?
This is the error I see when trying to log into Orient Studio:
--> com.orientechnologies.orient.core.exception.OCommandExecutionException: Class 'OUSER' was not found in current database [ONetworkProtocolHttpDb]
2014-05-22 15:17:38:424 SEVE Internal server error: com.orientechnologies.orient.core.exception.OQueryParsingException: Error on parsing query at position #6: Error on parsing query
Query: OUser where name = 'admin' limit 1
-----------^
And this is the error I see when trying to write to the database in my Java code:
Error on parsing query at position #6: Error on parsing query
Query: OUser where name = 'admin' limit 1
-----------^
com.orientechnologies.orient.core.sql.filter.OSQLTarget.<init>(OSQLTarget.java:70)
com.orientechnologies.orient.core.sql.OSQLEngine.parseTarget(OSQLEngine.java:330)
com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.parse(OCommandExecutorSQLSelect.java:109)
com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.parse(OCommandExecutorSQLSelect.java:65)
com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.parse(OCommandExecutorSQLDelegate.java:49)
com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.parse(OCommandExecutorSQLDelegate.java:33)
com.orientechnologies.orient.core.storage.OStorageEmbedded.command(OStorageEmbedded.java:83)
com.orientechnologies.orient.core.sql.query.OSQLQuery.run(OSQLQuery.java:69)
com.orientechnologies.orient.core.sql.query.OSQLSynchQuery.run(OSQLSynchQuery.java:82)
com.orientechnologies.orient.core.query.OQueryAbstract.execute(OQueryAbstract.java:29)
com.orientechnologies.orient.core.metadata.security.OSecurityShared.getUser(OSecurityShared.java:179)
com.orientechnologies.orient.core.metadata.security.OSecurityShared.authenticate(OSecurityShared.java:148)
com.orientechnologies.orient.core.metadata.security.OSecurityProxy.authenticate(OSecurityProxy.java:83)
com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.open(ODatabaseRecordAbstract.java:166)
com.orientechnologies.orient.core.db.ODatabaseWrapperAbstract.open(ODatabaseWrapperAbstract.java:54)
com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.openOrCreate(OrientBaseGraph.java:878)
com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.<init>(OrientBaseGraph.java:134)
com.tinkerpop.blueprints.impls.orient.OrientTransactionalGraph.<init>(OrientTransactionalGraph.java:58)
com.tinkerpop.blueprints.impls.orient.OrientTransactionalGraph.<init>(OrientTransactionalGraph.java:54)
com.tinkerpop.blueprints.impls.orient.OrientGraph.<init>(OrientGraph.java:34)
...