JanusGraph / JanusGraph/janusgraph

document index name restrictions

Open
#544 0 comments 1 reaction 0 assignees View on GitHub
area/docs index/solr
Dominant language
Java
Stars
5.8k
Forks
1.2k
Avg merge
13h 53m
Merged PRs (30d)
6

Description

From [janusgraph-users](https://groups.google.com/d/msg/janusgraph-users/wWUu6Y6CKAY/QVDt6XwsBAAJ):

> Can you try again with only alphanumeric characters? Only the elasticsearch section states that 'index names contain only alphanumeric lowercase characters and hyphens'. From experience, I know lucene accepts only alphanumeric characters, not hyphens. I don't know what solr accepts.

At least need to update the documentation for all supported indexing backends.

It would be even better if we could catch this during the index definition. Currently, the user can define an index successfully with invalid characters in the name, and the error won't pop up until after data is added.

```
gremlin> graph = JanusGraphFactory.build().set('storage.backend', 'inmemory').set('index.search.backend', 'lucene').set('index.search.directory', '/tmp/foo_bar_1').open()
==>standardjanusgraph[inmemory:[127.0.0.1]]
gremlin> mgmt = graph.openManagement()
==>org.janusgraph.graphdb.database.management.ManagementSystem@1cd3b138
gremlin> name = mgmt.makePropertyKey("name").dataType(String.class).make()
==>name
gremlin> nameIndex = mgmt.buildIndex("name_index-1", Vertex.class).addKey(name).buildMixedIndex("search")
==>name_index-1
gremlin> mgmt.commit()
==>null
gremlin> graph.addVertex('name', 'foo bar bla')
==>v[4328]
gremlin> graph.tx().commit()
11:51:32 ERROR org.janusgraph.graphdb.database.StandardJanusGraph - Error while commiting index mutations for transaction [2] on index: search
org.janusgraph.core.JanusGraphException: Could not execute operation due to backend exception
at org.janusgraph.diskstorage.util.BackendOperation.execute(BackendOperation.java:57)
at org.janusgraph.diskstorage.indexing.IndexTransaction.flushInternal(IndexTransaction.java:157)
at org.janusgraph.diskstorage.indexing.IndexTransaction.commit(IndexTransaction.java:138)
at org.janusgraph.diskstorage.BackendTransaction.commitIndexes(BackendTransaction.java:141)
at org.janusgraph.graphdb.database.StandardJanusGraph.commit(StandardJanusGraph.java:745)
at org.janusgraph.graphdb.transaction.StandardJanusGraphTx.commit(StandardJanusGraphTx.java:1379)
at org.janusgraph.graphdb.tinkerpop.JanusGraphBlueprintsGraph$GraphTransaction.doCommit(JanusGraphBlueprintsGraph.java:272)
at org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.commit(AbstractTransaction.java:105)
at org.apache.tinkerpop.gremlin.structure.Transaction$commit.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
at groovysh_evaluate.run(groovysh_evaluate:3)
at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:232)
at org.codehaus.groovy.tools.shell.Interpreter.evaluate(Interpreter.groovy:70)
at org.codehaus.groovy.tools.shell.Groovysh.execute(Groovysh.groovy:191)
at org.apache.tinkerpop.gremlin.console.GremlinGroovysh.super$3$execute(GremlinGroovysh.groovy)
at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:132)
at org.apache.tinkerpop.gremlin.console.GremlinGroovysh.execute(GremlinGroovysh.groovy:72)
at org.codehaus.groovy.tools.shell.Shell.leftShift(Shell.groovy:122)
at org.codehaus.groovy.tools.shell.ShellRunner.work(ShellRunner.groovy:95)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.super$2$work(InteractiveShellRunner.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:132)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java:152)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.work(InteractiveShellRunner.groovy:124)
at org.codehaus.groovy.tools.shell.ShellRunner.run(ShellRunner.groovy:59)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.super$2$run(InteractiveShellRunner.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:132)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java:152)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.run(InteractiveShellRunner.groovy:83)
at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:232)
at org.apache.tinkerpop.gremlin.console.Console.(Console.groovy:166)
at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:232)
at org.apache.tinkerpop.gremlin.console.Console.main(Console.groovy:478)
Caused by: org.janusgraph.diskstorage.PermanentBackendException: Permanent exception while executing backend operation IndexMutation
at org.janusgraph.diskstorage.util.BackendOperation.executeDirect(BackendOperation.java:82)
at org.janusgraph.diskstorage.util.BackendOperation.execute(BackendOperation.java:55)
... 53 more
Caused by: java.lang.IllegalArgumentException: Invalid store name: name_index-1
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145)
at org.janusgraph.diskstorage.lucene.LuceneIndex.getStoreDirectory(LuceneIndex.java:132)
at org.janusgraph.diskstorage.lucene.LuceneIndex.getWriter(LuceneIndex.java:153)
at org.janusgraph.diskstorage.lucene.LuceneIndex.mutateStores(LuceneIndex.java:224)
at org.janusgraph.diskstorage.lucene.LuceneIndex.mutate(LuceneIndex.java:210)
at org.janusgraph.diskstorage.indexing.IndexTransaction$1.call(IndexTransaction.java:160)
at org.janusgraph.diskstorage.indexing.IndexTransaction$1.call(IndexTransaction.java:157)
at org.janusgraph.diskstorage.util.BackendOperation.executeDirect(BackendOperation.java:69)
... 54 more
==>null
```

Contributor guide

Open the contributing guide

Research direction

Start with the documented indexing-backend sections and trace the index-definition flow from mgmt.buildIndex; LuceneIndex.java is the concrete failure point shown in the report. Done means the supported backends document their index-name restrictions consistently, with validation behavior considered at definition time rather than only when data is committed.

Written by the indexing model from the issue text.

Assessment

Tech stack
elasticsearch, java
Domain
databases, documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.