Lucene index inconsistency


inverseintegral42@...
 

Hey everyone,

I'm currently running janusgraph-inmemory with janusgraph-lucence both version 0.6.2
And I'm experiencing strange behaviour when creating an index that contains an underscore in its name.
Whenever I run the following code:
PropertiesConfiguration conf = ConfigurationUtil.loadPropertiesConfig("conf/test.properties");
JanusGraph graph = JanusGraphFactory.open(conf);
String name = "some_name";

graph.tx().rollback();
JanusGraphManagement management = graph.openManagement();

management.makePropertyKey("name").dataType(String.class).make();
management.commit();

management = graph.openManagement();

management.buildIndex(name, Vertex.class)
.addKey(management.getPropertyKey("name"))
.buildMixedIndex("search");
management.commit();

ManagementSystem.awaitGraphIndexStatus(graph, name).
status(SchemaStatus.REGISTERED)
.call();

management = graph.openManagement();
management.updateIndex(management.getGraphIndex(name), SchemaAction.REINDEX).get();
management.commit();

management = graph.openManagement();
System.out.println(management.printIndexes());

graph.traversal().addV().property("name", "Test").next();
graph.tx().commit();
I get the following output:
I get the following output:

INFO  o.j.g.d.management.ManagementSystem - Index update job successful for [some_name]
------------------------------------------------------------------------------------------------
Graph Index (Vertex)           | Type        | Unique    | Backing        | Key:           Status |
---------------------------------------------------------------------------------------------------
some_name                      | Mixed       | false     | search         | name:         ENABLED |
---------------------------------------------------------------------------------------------------
Graph Index (Edge)             | Type        | Unique    | Backing        | Key:           Status |
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
Relation Index (VCI)           | Type        | Direction | Sort Key       | Order    |     Status |
---------------------------------------------------------------------------------------------------

ERROR o.j.g.database.StandardJanusGraph - Error while committing index mutations for transaction [5] on index: search
org.janusgraph.core.JanusGraphException: Could not execute operation due to backend exception
at org.janusgraph.diskstorage.util.BackendOperation.execute(BackendOperation.java:54)
at org.janusgraph.diskstorage.indexing.IndexTransaction.flushInternal(IndexTransaction.java:158)
at org.janusgraph.diskstorage.indexing.IndexTransaction.commit(IndexTransaction.java:139)
at org.janusgraph.diskstorage.BackendTransaction.commitIndexes(BackendTransaction.java:143)
at org.janusgraph.graphdb.database.StandardJanusGraph.commit(StandardJanusGraph.java:804)
at org.janusgraph.graphdb.transaction.StandardJanusGraphTx.commit(StandardJanusGraphTx.java:1525)
at org.janusgraph.graphdb.tinkerpop.JanusGraphBlueprintsGraph$GraphTransaction.doCommit(JanusGraphBlueprintsGraph.java:322)
at org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.commit(AbstractTransaction.java:104)
at org.janusgraph.graphdb.tinkerpop.JanusGraphBlueprintsGraph$GraphTransaction.commit(JanusGraphBlueprintsGraph.java:300)
at Scratch.main(scratch.java:48)
Caused by: org.janusgraph.diskstorage.PermanentBackendException: Permanent exception while executing backend operation IndexMutation
at org.janusgraph.diskstorage.util.BackendOperation.executeDirect(BackendOperation.java:79)
at org.janusgraph.diskstorage.util.BackendOperation.execute(BackendOperation.java:52)
... 9 common frames omitted
Caused by: java.lang.IllegalArgumentException: Invalid store name: some_name
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:217)
at org.janusgraph.diskstorage.lucene.LuceneIndex.getStoreDirectory(LuceneIndex.java:194)
at org.janusgraph.diskstorage.lucene.LuceneIndex.getWriter(LuceneIndex.java:216)
at org.janusgraph.diskstorage.lucene.LuceneIndex.mutateStores(LuceneIndex.java:289)
at org.janusgraph.diskstorage.lucene.LuceneIndex.mutate(LuceneIndex.java:275)
at org.janusgraph.diskstorage.indexing.IndexTransaction$1.call(IndexTransaction.java:161)
at org.janusgraph.diskstorage.indexing.IndexTransaction$1.call(IndexTransaction.java:158)
at org.janusgraph.diskstorage.util.BackendOperation.executeDirect(BackendOperation.java:66)
... 10 common frames omitted

Wouldn't it be better to disallow the creation of the index in the first place? After the creation all queries seem to fail with the same PermanentBackendException.
Also I don't quite understand why underscores are not allowed in index names. Maybe this is a limitation of Lucene
 



hadoopmarc@...
 

I agree. If you start out with an empty graph, the Lucene index is not created until you add the first vertex. It is not easy to find why Lucene would only allow alphanumeric characters for names of indices (implicit assumption in the JanusGraph Preconditions check) and whether this still holds for the currently used version of Lucene.

If you want, you can create an issue for it or even provide a PR.

Best wishes,    Marc


On Fri, Jul 15, 2022 at 12:43 PM, @inverseintegral wrote:
Invalid store name