-
I'm having trouble deciphering how to generate the key needed to invalidate an entry in the index store if I don't have a specific InternalRelation that I can call getIndexUpdates() for. If I only know the vertex id that I want to be cleared from the index store, is it currently possible to generate relevant index keys? If so, how can I do that? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
No, it's not possible to generate index keys knowing only vertex or edge id. Instead you need to know properties and their values which you want to expire in the index store. You can check a test method to see an example on how to generate relevant index keys using property name / values in the test class: In case you are interested to invalidate vertices / edges on all JanusGraph instances on their update or removal then you could implement it using a TransactionLog (https://docs.janusgraph.org/advanced-topics/transaction-log/). It will collect all relevant elements (with their properties) during add / update / remove operations and send them to that log. All interested JanusGraph instances could subscribe to that Change events, convert those Change events to relevant edge key (i.e. vertexId) and index keys (i.e. property name / values) and invalidate relevant edge and index store entries on each JanusGraph node.
I guess other log implementations could be done using better fitted storages for that (like Kafka or similar). At least I had this implementation idea for #3155 but didn't have a chance to work on that. |
Beta Was this translation helpful? Give feedback.
-
hey @porunov, this is working well so far! I just want to clarify which log sub-namespace I should be setting ttl for. Based on the transaction log documentation, it seems like it should be |
Beta Was this translation helpful? Give feedback.
No, it's not possible to generate index keys knowing only vertex or edge id. Instead you need to know properties and their values which you want to expire in the index store.
I guess it could be possible to scan all index store values and invalidate related keys, but that would require quite a long scanning (depending on the index store size). Thus, I wasn't taking effort to implement that.
Instead you could call
clearIndexStoreCache()
as for now to fully invalidate all index store keys.You can check a test method to see an exa…