IMHO, an index should not prevent a query to work. Moreover the result of a query should not depends of backends (storage and index). If an index backend cannot process a predicate, the predicate should be be executed as if index wasn't present.
To clarify, below is a sample of code. The same query works without index (line 13) and fails with index (line 31).
Regards,
Toom.
I have also encountered this problem, but I have found a reliable way to reproduce.
The following query works perfectly in the gremlin console (both server and client from Janusgraph 0.6.0 distribution)
In Java this query fails with the same exception as in your trace, if I pass offset = 0 (zero) it seems to work sometimes fiddling with the offset (3,5,10 and so on)
return traversal.V().has(VertexType.COMPANY.name(), CompanyWrapper.PROP_COMPANY_ID, companyId)
.out(EdgeType.EMPLOYS.name())
.has(WorkerWrapper.PROP_STATUS, WORKER_STATUS_APPROVED)
.skip(offset)
.limit(limit)
.elementMap(properties)
.toStream()
.map(WorkerWrapper::of);
To make the query succeed I have to either remove the skip() and limit() or order the results before skipping and limiting i.e.
return traversal.V().has(VertexType.COMPANY.name(), CompanyWrapper.PROP_COMPANY_ID, companyId)
.out(EdgeType.EMPLOYS.name())
.has(WorkerWrapper.PROP_STATUS, WORKER_STATUS_APPROVED)
.order()
.by(WorkerWrapper.PROP_LAST_NAME).by(WorkerWrapper.PROP_FIRST_NAME)
.skip(offset)
.limit(limit)
.elementMap(properties)
.toStream()
.map(WorkerWrapper::of);
See, https://docs.janusgraph.org/index-backend/text-search/#full-text-search_1
Indeed, the negative text predicates are only available to Elasticsearch (and, apparently as you say, to the CompositeIndex).
Best wishes, Marc
With JanusGraph 0.6.0 and Lucene index backend, queries fail if they contain predicate like textNotPrefix, textNotContains:
If ElasticSearch is used or if there is no index backend, the same query work.
I'm not sure Lucene index can be used for negated queries but the queries should not fails. How can I transform my query to make it work ?
Regards,
Toom.
Mobile +1-847-848-7388
http://in.linkedin.com/in/vivekraghuwanshi
Paging with range can only work with a vertex centric index, otherwise the vertex table is scanned for every page. If you just want all results, the alternative is to forget about the range() step and iterate over the query result.
Marc
Does the problem also occur if you replace v() with V().limit(1) inside your query?
If not, at what result size does your issue start to occur?
Btw, your post has a typo: "user" and "uidx" should be the same, but I assume it stems from anonymizing your query.
Marc
I have some performance issue extacting nodes attached to a node with pagination
I have a simple graph with CompositeIndex on property name (Please find schema definition in attachments).
The graph has three a 3 genre nodes:
- "action" node has 20K attached movies with value="a" and 20K attached movies with value="b".
- "drama" node has 10K attached movies with value="b"
- "comedy" node has 10K attached movies with value="c"
Our goal is given a genre to extract the 20K movies attached to "action" that has value="a", this should be done iteratively limiting the chunk of data extracted at each execution (e.g. We paginate the query using range).
I'm using janus 0.6.0 with cassandra 3.11.6. Please find attached the docker compose I've used to create the janus+cassandra environment and also the janus and gremlin configurations.
This is the query that we use to extract a page:
g.V().has("name", "action").to(Direction.IN, "has_genre").has("value", "a").range(skip, limit).valueMap("id").next();
Here the results of the extraction with different page size:
- page size 100 read 200 pages in 591453 ms - average elapsed per page 2957.265 ms - min 284 ms - max 11618 ms
- page size 1000 read 20 pages in 62293 ms - average elapsed per page 3114.65 ms - min 632 ms - max 9712 ms
It seems that the condition has("value", "a") is evaluated reading each of the attached nodes one by one and than evaluating the filter, is this the expected behaviour and performance? Is there any possible optimization in the interaction between Janus and Cassandra (For example read attached nodes in bulk)?
We have verified that activating db-cache (cache.db-cache=true) has a huge impact on perfomance but this is not easly applicable on our real scenario because we have multiple janus nodes (to support the scaling of the system) and with the cache active we have the risk of read stale data (The data are updated frequently and changes must be read by other services in our processing pipeline).
Hi
You are suggesting above experiment for isolating the issue right ?
I thought about not using the CQL executor service but we are in primary stage have not done any workload tests to figure out the correct CQL driver config params.
So will prefer to have a safety net of executor service which will prevent too many parallel call to CQL driver.
And looks like someone also faced similar issue.
Thanks,
Sujay Bothe
Hi Tanroop,
I have also faced same issue and have posted a query about it on this channel 'GraphTraversal Thread Stuck'.
Did you found the root cause of above issue ?
Thanks,
Sujay Bothe
OK, I did a small upgrade session myself and did not encounter any issues (apart from having to set numTokens: 4 in conf/cassandra.yaml).
This is what I did:
- Start from a fresh janusgraph-full-0.5.3 distribution (so, with an empty db folder)
- Run bin/janusgraph.sh start
- Run bin/gremlin.sh and
graph = JanusGraphFactory.open('conf/janusgraph-cql-es.properties')
GraphOfTheGodsFactory.load(graph)
:q - Run bin/janusgraph.sh stop
- Start from a fresh janusgraph-full-0.6.0 distribution (so, with an empty db folder)
- Copy the db folder from janusgraph-full-0.5.3/db to janusgraph-full-0.6.0
- Set set numTokens: 4 in conf/cassandra.yaml
- Run bin/janusgraph.sh start
- Run bin/gremlin.sh and
graph = JanusGraphFactory.open('conf/janusgraph-cql-es.properties')
graph.traversal().V()
Best wishes, Marc
But an example would greatly help (btw, we develop mostly in Python).
Is there a way to add custom property types to JanusGraph (similar to RelationIdentifier / Geoshape) to be later used by the
GraphSON serializer? Ideally without re-building JanusGraph.
Due to some downstream limitations, we sometimes can't serialize Python datetime objects. It would be great if we could somehow add a custom step such that .values("date-field").as_iso() would return the field in ISO 8601.
Many thanks!
Hi Pawan,
It seems I miss the practical experience, but it seems you have to set graph.allow-upgrade=true (although it is not clear whether this applies to all version changes or only to "storage version" changes)
https://docs.janusgraph.org/v0.6/configs/configuration-reference/
If this is the solution, the error message is certainly not helpful and the upgrade docs incomplete.
Best wishes, Marc
PAWAN SHRIWAS
It seems I miss the practical experience, but it seems you have to set graph.allow-upgrade=true (although it is not clear whether this applies to all version changes or only to "storage version" changes)
https://docs.janusgraph.org/v0.6/configs/configuration-reference/
If this is the solution, the error message is certainly not helpful and the upgrade docs incomplete.
Best wishes, Marc
Hi Pawan,
Caused by: com.datastax.oss.driver.api.core.servererrors.UnauthorizedException: Unauthorized. User graph_user has no CREATE permission on <all keyspaces> or any of its parentsThis part of your stacktrace suggests that something changed on your Cassandra cluster or with the graph_user. So, check the CREATE permission, with your admin or try to create a keyspace with nodetool.
CREATE KEYSPACE IF NOT EXISTS graphDataTable WITH replication={'replication_factor':1,'class':'SimpleStrategy'}
Also note that a few changes in cql properties had to be made (but probably not related):
https://docs.janusgraph.org/v0.6/changelog/
Best wishes, Marc
PAWAN SHRIWAS
Caused by: com.datastax.oss.driver.api.core.servererrors.UnauthorizedException: Unauthorized. User graph_user has no CREATE permission on <all keyspaces> or any of its parentsThis part of your stacktrace suggests that something changed on your Cassandra cluster or with the graph_user. So, check the CREATE permission, with your admin or try to create a keyspace with nodetool.
CREATE KEYSPACE IF NOT EXISTS graphDataTable WITH replication={'replication_factor':1,'class':'SimpleStrategy'}
Also note that a few changes in cql properties had to be made (but probably not related):
https://docs.janusgraph.org/v0.6/changelog/
Best wishes, Marc
I am not sure about the root cause (it might be a JanusGraph bug or a Datastax CQL driver bug), but you could try the JanusGraph 0.6.0 version and disable the `storage.cql.executor-service.enabled` option (https://docs.janusgraph.org/configs/configuration-reference/#storagecqlexecutor-service), which does not use an internal thread pool for CQLStoreManager as opposed to 0.5.3. If the problem still exists, I would argue it is more likely to be a bug with the Datastax CQL driver.
Best,
Boxuan
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:502)
at io.vavr.concurrent.FutureImpl$$Lambda$226/250860313.run(Unknown Source)
at io.vavr.control.Try.run(Try.java:105)
at io.vavr.concurrent.FutureImpl.await(FutureImpl.java:114)
- locked <0x00000000c42f2e60> (a java.lang.Object)
at org.janusgraph.diskstorage.cql.CQLKeyColumnValueStore.interruptibleWait(CQLKeyColumnValueStore.java:308)
at org.janusgraph.diskstorage.cql.CQLKeyColumnValueStore.getSlice(CQLKeyColumnValueStore.java:289)
at org.janusgraph.diskstorage.keycolumnvalue.KCVSProxy.getSlice(KCVSProxy.java:76)
at org.janusgraph.diskstorage.configuration.backend.KCVSConfiguration$1.call(KCVSConfiguration.java:97)
at org.janusgraph.diskstorage.configuration.backend.KCVSConfiguration$1.call(KCVSConfiguration.java:94)
at org.janusgraph.diskstorage.util.BackendOperation.execute(BackendOperation.java:147)
at org.janusgraph.diskstorage.util.BackendOperation$1.call(BackendOperation.java:161)
at org.janusgraph.diskstorage.util.BackendOperation.executeDirect(BackendOperation.java:68)
at org.janusgraph.diskstorage.util.BackendOperation.execute(BackendOperation.java:54)
at org.janusgraph.diskstorage.util.BackendOperation.execute(BackendOperation.java:158)
at org.janusgraph.diskstorage.configuration.backend.KCVSConfiguration.get(KCVSConfiguration.java:94)
at org.janusgraph.graphdb.tinkerpop.JanusGraphVariables.get(JanusGraphVariables.java:46)
at MyObjectStrategy.apply(MyObjectStrategy.java:411)
at org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalStrategies.applyStrategies(DefaultTraversalStrategies.java:88)
at org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal.applyStrategies(DefaultTraversal.java:124)
at org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal.hasNext(DefaultTraversal.java:196)
at MyTraversal.get(MyTraversal.java:300)
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000000c3c26ff8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
and the traversal was failing with TemporaryBackendException (Enough replicas not available) .
java.lang.RuntimeException: GraphFactory could not instantiate this Graph implementation [class org.janusgraph.core.JanusGraphFactory]
at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:84)
at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:72)
at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:106)
at org.apache.tinkerpop.gremlin.server.util.DefaultGraphManager.addGraph(DefaultGraphManager.java:63)
at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
at org.apache.tinkerpop.gremlin.server.util.DefaultGraphManager.<init>(DefaultGraphManager.java:58)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor.<init>(ServerGremlinExecutor.java:84)
at org.apache.tinkerpop.gremlin.server.GremlinServer.<init>(GremlinServer.java:124)
at org.apache.tinkerpop.gremlin.server.GremlinServer.<init>(GremlinServer.java:87)
at org.janusgraph.graphdb.server.JanusGraphServer.start(JanusGraphServer.java:85)
at org.janusgraph.graphdb.server.JanusGraphServer.main(JanusGraphServer.java:53)
Caused by: java.lang.reflect.InvocationTargetException
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.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:80)
... 14 more
Caused by: java.lang.IllegalArgumentException: Could not instantiate implementation: org.janusgraph.diskstorage.cql.CQLStoreManager
at org.janusgraph.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:79)
at org.janusgraph.diskstorage.Backend.getImplementationClass(Backend.java:525)
at org.janusgraph.diskstorage.Backend.getStorageManager(Backend.java:489)
at org.janusgraph.graphdb.configuration.builder.GraphDatabaseConfigurationBuilder.build(GraphDatabaseConfigurationBuilder.java:64)
at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:176)
at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:147)
at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:127)
... 19 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.janusgraph.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:73)
... 25 more
Caused by: org.janusgraph.diskstorage.PermanentBackendException: Couldn't initialize CQLStoreManager
at org.janusgraph.diskstorage.cql.CQLStoreManager.<init>(CQLStoreManager.java:155)
at org.janusgraph.diskstorage.cql.CQLStoreManager.<init>(CQLStoreManager.java:116)
... 30 more
Caused by: com.datastax.oss.driver.api.core.servererrors.UnauthorizedException: Unauthorized. User graph_user has no CREATE permission on <all keyspaces> or any of its parents
CREATE KEYSPACE IF NOT EXISTS graphDataTable WITH replication={'replication_factor':1,'class':'SimpleStrategy'}
^^^^^^
(ql error -4)
at com.datastax.oss.driver.api.core.servererrors.UnauthorizedException.copy(UnauthorizedException.java:49)
at com.datastax.oss.driver.internal.core.util.concurrent.CompletableFutures.getUninterruptibly(CompletableFutures.java:149)
at com.datastax.oss.driver.internal.core.cql.CqlRequestSyncProcessor.process(CqlRequestSyncProcessor.java:53)
at com.datastax.oss.driver.internal.core.cql.CqlRequestSyncProcessor.process(CqlRequestSyncProcessor.java:30)
at com.datastax.oss.driver.internal.core.session.DefaultSession.execute(DefaultSession.java:230)
at com.datastax.oss.driver.api.core.cql.SyncCqlSession.execute(SyncCqlSession.java:54)
at org.janusgraph.diskstorage.cql.CQLStoreManager.initializeKeyspace(CQLStoreManager.java:191)
at org.janusgraph.diskstorage.cql.CQLStoreManager.<init>(CQLStoreManager.java:142)
... 31 more