[orientdb] OServerAdmin.createDatabase(iDatabaseType,iStorageMode) does not work as expected

420 views
Skip to first unread message

Salvatore Piccione

unread,
Mar 14, 2012, 11:25:13 AM3/14/12
to OrientDB ML
Hello,

I'm working with the latest OrientDB 1.0rc9-SNAPSHOT and I've noticed a strange behaviour of OServerAdmin.createDatabase(iDatabaseType,iStorageMode).
In the Javadoc, you state that iDatabaseType must be either graph or document but if I pass one of those values as argument(e.g. OServerAdmin.createDatabase("graph","local")), I get the following exception trace:

GRAVE: Cannot create the remote storage: corenet-partner-search-test
java.lang.IllegalArgumentException: Cannot create database: storage mode 'graph' is not supported.
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinary.createException(OChannelBinary.java:396)
    at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinary.handleStatus(OChannelBinary.java:349)
    at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryAsynch.beginResponse(OChannelBinaryAsynch.java:126)
    at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryAsynch.beginResponse(OChannelBinaryAsynch.java:58)
    at com.orientechnologies.orient.client.remote.OStorageRemote.beginResponse(OStorageRemote.java:1412)
    at com.orientechnologies.orient.client.remote.OStorageRemote.getResponse(OStorageRemote.java:1434)
    at com.orientechnologies.orient.client.remote.OServerAdmin.createDatabase(OServerAdmin.java:183)
    at it.txt.graph.OrientGraphCreator.createGraphDatabase(OrientGraphCreator.java:56)
    at it.txt.graph.OrientGraphCreator.main(OrientGraphCreator.java:97)
com.orientechnologies.orient.core.exception.OStorageException: Cannot create the remote storage: corenet-partner-search-test
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at com.orientechnologies.common.log.OLogManager.error(OLogManager.java:117)
    at com.orientechnologies.orient.client.remote.OServerAdmin.createDatabase(OServerAdmin.java:188)
    at it.txt.graph.OrientGraphCreator.createGraphDatabase(OrientGraphCreator.java:56)
    at it.txt.graph.OrientGraphCreator.main(OrientGraphCreator.java:97)
Caused by: java.lang.IllegalArgumentException: Cannot create database: storage mode 'graph' is not supported.
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinary.createException(OChannelBinary.java:396)
    at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinary.handleStatus(OChannelBinary.java:349)
    at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryAsynch.beginResponse(OChannelBinaryAsynch.java:126)
    at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryAsynch.beginResponse(OChannelBinaryAsynch.java:58)
    at com.orientechnologies.orient.client.remote.OStorageRemote.beginResponse(OStorageRemote.java:1412)
    at com.orientechnologies.orient.client.remote.OStorageRemote.getResponse(OStorageRemote.java:1434)
    at com.orientechnologies.orient.client.remote.OServerAdmin.createDatabase(OServerAdmin.java:183)
    ... 2 more

The method works fine only if I pass as iDatabaseType a valid engine type (i.e. remote, local, or memory). What is wrong here: the name of the parameter and its Javadoc or the checks performed on that parameters (i.e. iDatabaseType is considered as an engine type rather than a database type)?

TIA,

Salvatore

Salvatore Piccione

unread,
Mar 14, 2012, 1:49:59 PM3/14/12
to OrientDB ML
This issue seems to have the same cause of the issue I described here: http://groups.google.com/group/orient-database/browse_thread/thread/63bae199df5c7b7f/7daaccf0a2731d2b.

In fact, the following snippet of code works fine if the database I'm going to create does not exist.

    OServerAdmin adminTool = new OServerAdmin(db_URL).connect(admin_usr,admin_pwd);
    System.out.println("Successful connection to " + db_URL);
    if (adminTool.existsDatabase()) {
      System.out.println("The database already exists. It will be deleted and created again.");
      adminTool.dropDatabase();
    }
    System.out.println("The database is going to be created.");
    adminTool.createDatabase("graph", "local");
    adminTool.close();

If the database exists already, then an IllegalArgumentException is thrown (see my previous e-mail - java.lang.IllegalArgumentException: Cannot create database: storage mode 'graph' is not supported.) and I have to change "graph" into "remote"|"local"|"memory" to run the code without exceptions. Could this be caused by the execution of OServerAdmin.dropDatabase() as you pointed out?

Cheers,

Salvatore

2012/3/14 Salvatore Piccione <salvo...@gmail.com>

Luca Garulli

unread,
Mar 14, 2012, 4:46:51 PM3/14/12
to orient-...@googlegroups.com
Hi Salvatore,
it's exactly the same problem. While I was working on it I discovered some points needed to be handled in better way. This is the reason why it is taking so much time.

Hope to fix it tomorrow morning.

Lvc@

Luca Garulli

unread,
Mar 15, 2012, 5:24:33 AM3/15/12
to orient-...@googlegroups.com
Fixed in SVN r4982.
Lvc@

Salvatore Piccione

unread,
Mar 19, 2012, 5:17:11 AM3/19/12
to orient-...@googlegroups.com
Hello,

I've downloaded and tested the latest snapshot (orientdb-1.0rc9-20120316.125248-22-distribution) and I can confirm that the problem has been fixed. Thanks Luca!

2012/3/15 Luca Garulli <l.ga...@gmail.com>

Luca Garulli

unread,
Mar 19, 2012, 5:20:49 AM3/19/12
to orient-...@googlegroups.com
Double Great!
Reply all
Reply to author
Forward
0 new messages