JanusGraph / JanusGraph/janusgraph
Vertex TTL update doesn't apply to prior vertexes
- Dominant language
- Java
- Stars
- 5.8k
- Forks
- 1.2k
- Avg merge
- 13h 53m
- Merged PRs (30d)
- 6
Description
http://docs.janusgraph.org/latest/advanced-schema.html
> Vertex TTL is defined on a per-vertex label basis, meaning that **all** vertices of that label have the **same** time-to-live. [...]
>
> Note, that the TTL of a vertex label can be modified but it might take some time for this change to propagate [...]
I read that as: if the TTL is updated then the new TTL would apply to any and all existing vertexes. It makes sense that it wouldn't propagate to existing vertexes because some process would have to iterate over all vertexes of that label and update the TTL. The documentation should make that clarification.
The documentation should also **WARN** that static vertexes created without TTL are immutable and will remain forever.
Ideally, there should be a way to unshoot one's foot if a vertex is made and ttl never set (never expires).
Create vertex with no TTL (forever)
```
gremlin> g.tx().rollback()
gremlin> mgmt = graph.openManagement()
gremlin> tweet = mgmt.makeVertexLabel('tweet').setStatic().make()
gremlin> mgmt.commit()
gremlin> g.addV('tweet')
==>v[4164]
gremlin> g.tx().commit()
gremlin> g.V().hasLabel('tweet')
==>v[4164]
```
Modify TTL to 5s and add new vertex:
```
gremlin> g.tx().rollback()
gremlin> mgmt = graph.openManagement()
gremlin> tweet = mgmt.getVertexLabel("tweet")
gremlin> mgmt.setTTL(tweet, Duration.ofSeconds(5L))
gremlin> mgmt.commit()
gremlin> g.addV('tweet')
==>v[4292]
gremlin> g.tx().commit()
gremlin> g.V().hasLabel('tweet')
==>v[4164]
==>v[4292]
```
Wait 6 seconds:
```
gremlin> g.tx().rollback()
gremlin> g.V().hasLabel('tweet')
==>v[4164]
```
Original vertex remains (forever)
Verify current TTL on label:
```
gremlin> mgmt = graph.openManagement()
==>org.janusgraph.graphdb.database.management.ManagementSystem@6046fba0
gremlin> tweet = mgmt.getVertexLabel("tweet")
==>tweet
gremlin> mgmt.getTTL(tweet)
==>PT5S
gremlin> mgmt.commit()
==>null
```
Contributor guide
Research direction
Start with the Vertex TTL section at docs.janusgraph.org/latest/advanced-schema.html and review the behavior shown in the issue's Gremlin examples. Update the documentation to clarify that changing a label TTL does not affect prior vertices and warn that static vertices created without a TTL remain indefinitely; the possible recovery mechanism is a separate feature consideration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- databases, documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100