JanusGraph / JanusGraph/janusgraph
Cached schema not updated when using management.addProperties, management.addConnection
- Dominant language
- Java
- Stars
- 5.8k
- Forks
- 1.2k
- Avg merge
- 13h 53m
- Merged PRs (30d)
- 6
Description
We're currently building out a schema and testing how to update that schema in the future. We want to use `management.addProperties()` to map properties to vertices and `management.addConnection()` to map which vertices can be connected via which edges as seen in the [docs](https://docs.janusgraph.org/latest/schema.html#schema-constraints). This works fine for the initial schema commit. We can see the changes immediately. However, if we do another schema commit where we create a new PropertyKey and map it to an existing VertexLabel via addProperties (after data has been added to the graph), then the changes to the schema are not immediately seen.
As an example, let's say we have a "animal" VertexLabel initially mapped to a "name" PropertyKey. This is committed and working well. We create an animal vertex. Then we create a new PropertyKey called "color" and map it to the "animal" VertexLabel with a `management.addProperties(animal, color);` call. Once this has been committed, we can see the new "color" PropertyKey immediately, but it is not mapped to the "animal" VertexLabel until we restart the JanusGraph server.
We're currently running JanusGraph in server mode, connecting to it remotely via a java app. We are running the schema updates when the java app starts via a call to `client.submit()`, connecting via a Cluster object.
Error received when trying to update the animal vertex with new property:
`org.apache.tinkerpop.gremlin.driver.exception.ResponseException: Property Key constraint does not exist for given Vertex Label [animal] and property key [color].`
**The error above goes away once the JanusGraph server is restarted.**
The same behavior is seen when adding new connections via `management.addConnection()`.
Problem was originally discussed [on janusgraph-users ](https://groups.google.com/forum/#!topic/janusgraph-users/b0udAgILS84).
Please let me know if any additional information is needed.
Contributor guide
Research direction
Reproduce this in JanusGraph server mode using a remote Java client and Cluster: commit an initial schema, add a PropertyKey with management.addProperties or management.addConnection, then use the updated schema before and after a server restart. Start with the schema-management request path reached by client.submit(). Done means new property and connection constraints are recognized without restarting the server.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100