Skip to content

Commit beef815

Browse files
committed
docs(cache): clarify schema-cache reconnect lifecycle and legacy event compat
- CachedSchemaTransactionV2: state explicitly that resetMetaListenerForReconnect() is a manual hook, not wired to a MetaManager/MetaDriver reconnect callback in this PR. - MetaManager.SchemaCacheClearEvent.fromValue: document the legacy plain-string branch as a rolling-upgrade compatibility path.
1 parent f2706d0 commit beef815

2 files changed

Lines changed: 15 additions & 8 deletions

File tree

hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/CachedSchemaTransactionV2.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@ public class CachedSchemaTransactionV2 extends SchemaTransactionV2 {
5252

5353
// MetaDriver doesn't expose unlisten, register the meta listener once.
5454
// Lifecycle: this JVM-global flag is intentionally never reset by
55-
// unlistenChanges() (the underlying gRPC watch is process-wide), but IS
56-
// reset on transport reconnect via resetMetaListenerForReconnect() so a
57-
// new watch is installed after the old one was silently dropped.
55+
// unlistenChanges() (the underlying gRPC watch is process-wide). If that
56+
// watch is silently dropped after a transport reconnect, recovery is not
57+
// automatic; resetMetaListenerForReconnect() is only a manual hook to let
58+
// the next schema operation install a fresh watch.
5859
private static final AtomicBoolean metaEventListenerRegistered =
5960
new AtomicBoolean(false);
6061

@@ -251,11 +252,13 @@ static <T> void handleSchemaCacheClearEvent(T response) {
251252
}
252253

253254
/**
254-
* Reset the JVM-global meta listener flag after a MetaManager transport
255-
* reconnect. The underlying gRPC watch is silently dropped on reconnect;
256-
* without this reset {@link #metaEventListenerRegistered} would stay
257-
* {@code true} forever and this JVM would stop receiving cross-node
258-
* schema cache clear events with no error or warning.
255+
* Manually reset the JVM-global meta listener flag after detecting that
256+
* the MetaManager transport reconnected and dropped the underlying gRPC
257+
* watch. This method is not wired to a MetaManager/MetaDriver reconnect
258+
* callback today; callers must invoke it explicitly after detecting that
259+
* condition. Without such a manual reset {@link #metaEventListenerRegistered}
260+
* would stay {@code true} forever and this JVM would stop receiving
261+
* cross-node schema cache clear events with no error or warning.
259262
*
260263
* <p>TODO: wire this into MetaManager once it exposes a transport
261264
* reconnect callback (e.g. {@code listenReconnect} /

hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/meta/MetaManager.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,6 +1350,10 @@ static SchemaCacheClearEvent fromValue(String value) {
13501350
if (StringUtils.isEmpty(value)) {
13511351
return null;
13521352
}
1353+
// Compatibility: events published before source-id support stored
1354+
// only the graph name as a plain string. Keep accepting that format
1355+
// so mixed-version clusters can consume old/new schema-cache-clear
1356+
// events during rolling upgrades.
13531357
if (value.charAt(0) != '{') {
13541358
return new SchemaCacheClearEvent(value, null);
13551359
}

0 commit comments

Comments
 (0)