imbajin commented on PR #3011:
URL: https://github.com/apache/hugegraph/pull/3011#issuecomment-4334909444
> Producers emit past-tense actions: `Cache.ACTION_INVALIDED` /
`Cache.ACTION_CLEARED`
> Listeners only match the present-tense ones: `Cache.ACTION_INVALID` /
`Cache.ACTION_CLEAR`
> So those events look like they get dropped silently.
Good catch @dpol1 — I dug into the code and confirmed the mismatch is real.
**How the current architecture handles it**
`StandardHugeGraph.AbstractCacheNotifier` acts as a bridge: it listens for
`\"invalided\"`/`\"cleared\"` on the local EventHub and forwards them to remote
nodes via RPC (`proxy.invalid/clear()`). The remote node then calls
`AbstractCacheNotifier.invalid/clear()`, which re-emits
`\"invalid\"`/`\"clear\"` on the remote hub — which local listeners *do* catch.
```
Local transaction commits
→ notifyChanges(\"invalided\") on local schemaEventHub
→ AbstractCacheNotifier.listener catches \"invalided\"
→ proxy.invalid(type, id) ← RPC to remote nodes only
→ Remote: AbstractCacheNotifier.invalid() emits \"invalid\" on remote hub
→ Remote CachedSchemaTransaction.listener catches \"invalid\" ✓
```
So in a healthy multi-node setup the events are not truly lost — they just
take a round-trip through the RPC layer.
**Where it can silently drop**
The bridge **only routes outward via RPC**. The local node never re-emits
`\"invalid\"` after publishing `\"invalided\"`, which creates risk in at least
two cases:
- **Single-node / no-RPC** deployments: `proxy` is a no-op; the
`\"invalided\"` event is consumed by `AbstractCacheNotifier` and disappears.
Local consistency is currently saved by the direct `updateCache()` call inside
each transaction, but any future consumer that relies solely on the EventHub
will be silently starved.
- **Misconfigured or unavailable RPC proxy**: the event is swallowed with no
error or fallback.
Worth noting: `RaftContext` already uses the present-tense constants
(`ACTION_INVALID`, `ACTION_CLEAR`) everywhere, so unifying on present-tense
across the board looks like the cleanest fix.
Opened #3012 to track this separately — feel free to take it or I can look
at it after #3011 lands.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]