Hi, That is current disadvantage of remote storage but we will fix it https://github.com/orientechnologies/orientdb/issues/1894
On Fri, Mar 7, 2014 at 4:59 PM, Emanuele Milani < [email protected]> wrote: > Dear all, > > This same message is posted on both the OrientDB and Gremlin-users groups, > as I do not know whether this issue is related to Blueprints or OrientDB. > For quite some time I have been using KeyIndexes (as in KeyIndexableGraph) > with an embedded (database url starting with (p)local:) OrientDB instance. > When moving to an external OrientDB server (database url starting with > remote:...), it turned out that indexes are not updated on setProperty > invocations until a commit is issued. > As a result, queries for key/property pairs which are inserted after the > last commit do not return any vertex. > This behavior is not consistent with the embedded case, where properties > can be queried just after insertion. > > Please find attached a code snippet which demonstrates the issue. > > String dbURL = "remote:HOSTNAME/exampleDB"; > String storageEngine = "plocal"; > String dbUser = "admin"; > String dbPassword = "admin"; > > String indexedPropertyName = "foo"; > String indexedPropertyValue = "123"; > String nonIndexedPropertyName = "bar"; > String nonIndexedPropertyValue = "blue"; > > > OServerAdmin adminTool = new OServerAdmin(dbURL).connect(dbUser,dbPassword > ); > if (adminTool.existsDatabase(storageEngine)){ > System.out.println("Dropping db " + dbURL); > adminTool.dropDatabase(storageEngine); > System.out.println("Dropped " + dbURL); > } > adminTool.createDatabase(dbURL, storageEngine); > adminTool.close(); > > OrientGraph g = new OrientGraph(dbURL); > > g.createKeyIndex(indexedPropertyName, Vertex.class); > > Vertex v = g.addVertex(null); > v.setProperty(indexedPropertyName, indexedPropertyValue); > v.setProperty(nonIndexedPropertyName, nonIndexedPropertyValue); > > if (g.getVertex(v.getId()) != null) { > System.out.println("v can be retrieved by Id."); > } > > if (g.getVertices(nonIndexedPropertyName, nonIndexedPropertyValue). > iterator().hasNext()) { > System.out.println("v can be retrieved by non indexed property/value > pair."); > } > > if (!g.getVertices(indexedPropertyName,indexedPropertyValue).iterator(). > hasNext()) { > System.out.println("v cannot be retrieved by indexed property/value pair." > ); > } > > g.commit(); > > if (g.getVertices(indexedPropertyName,indexedPropertyValue).iterator(). > hasNext()) { > System.out.println("v can be retrieved by indexed property/value pair > AFTER commit."); > } > > The output of this code is: > Dropping db remote:HOSTNAME/exampleDB > Dropped remote:HOSTNAME/exampleDB > v can be retrieved by Id. > v can be retrieved by non indexed property/value pair. > v cannot be retrieved by indexed property/value pair. > v can be retrieved by indexed property/value pair AFTER commit. > > Could you suggest a way to fix this issue? > The software in use is Tinkerpop 2.5 (latest snapshot) and OrientDB 1.6.3 > . Running against 1.6.4 or 1.7-rc1 did produce the same output. > > Thanks and best regards. > > -- > > --- > You received this message because you are subscribed to the Google Groups > "OrientDB" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- Best regards, Andrey Lomakin. Orient Technologies the Company behind OrientDB -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
