Skip to content

[Improvement] Re-register HStore schema cache clear listener after a Meta reconnect #3036

@dpol1

Description

@dpol1

That PR made CachedSchemaTransactionV2 listen for schema-cache-clear meta
events and drop the matching local V2 caches, so a schema change on one server
no longer leaves other nodes serving stale schema in HStore / multi-server mode.

The catch is the listener registers exactly once per JVM. The gRPC watch behind
it is process-wide and there is no unlisten. If the Meta transport reconnects
and the old watch gets dropped, the listener goes deaf and nothing brings it
back. There is already a manual recovery hook,
resetMetaListenerForReconnect(), but nothing calls it, because Meta exposes no
reconnect signal to hang it on.

The two halves of the gap, both in CachedSchemaTransactionV2:

What should happen

After the Meta transport reconnects, the JVM-wide schema-cache-clear listener
comes back on its own and keeps delivering events for every graph. No operator
action.

What happens now

MetaManager / MetaDriver expose listen and keepAlive but no reconnect
callback. A dropped watch goes unnoticed, events stop arriving, and the node can
keep serving stale schema until someone calls resetMetaListenerForReconnect()
by hand. Nothing does.

Proposed fix

Two parts, same theme, easiest to do in one go:

  1. Give MetaManager / MetaDriver a reconnect callback (something like
    listenReconnect / onTransportReconnect) that fires when the transport
    reconnects and the previous watch is gone.
  2. Point CachedSchemaTransactionV2 at that callback so it re-registers the
    listener. resetMetaListenerForReconnect() stops being a manual entry point
    and becomes the callback target.

How to verify

Two servers against HStore/Meta. Force a Meta reconnect (restart Meta or kill
the connection), then change a schema on server A and assert server B clears its
V2 caches and stops returning stale schema.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions