dpol1 opened a new pull request, #3062:
URL: https://github.com/apache/hugegraph/pull/3062

   ## Purpose of the PR
   
     - close #3036
   
     `CachedSchemaTransactionV2` registers a JVM-global watch on the meta store 
so that a
     schema change on one node clears the schema cache on the other nodes. That 
watch goes
     through `EtcdMetaDriver.listen` / `listenPrefix`, which handed jetcd the 
bare
     `Consumer<WatchResponse>` overload. That overload drops `onError` and 
`onCompleted`, so
     when jetcd ends a watch (for example after a transport reconnect tears 
down the gRPC
     stream) the listener stopped receiving events with no log line and no 
exception. The node
     kept serving stale schema and nothing reported it. `PdMetaDriver` does not 
have this
     problem because its `KvClient` already re-subscribes on error.
   
     ## Main Changes
   
     - `EtcdMetaDriver.listen` / `listenPrefix` now register a `Watch.Listener` 
instead of the
       bare `Consumer` overload. On `onError` or `onCompleted` the driver 
re-subscribes after a
       1s backoff on a daemon thread, which is the same recovery `PdMetaDriver` 
gets through
       `KvClient`. A `WARN` is logged before each re-subscribe, so the failure 
is now visible.
     - Removed `CachedSchemaTransactionV2.resetMetaListenerForReconnect()`. It 
was a manual
       stopgap added in #3011 with no callers, and it never shipped in a tagged 
release. Now
       that the driver recovers on its own, the JVM-global register-once flag 
is correct to stay
       set, so the manual reset has nothing left to do. The lifecycle comment on
       `metaEventListenerRegistered` is updated to describe the self-heal 
behavior.
     - The `MetaDriver` interface is unchanged, so neither implementor needs 
edits beyond
       `EtcdMetaDriver`.
   
     Known limitation: the re-subscribe opens a fresh watch without a stored 
revision, so any
     cache-clear events emitted during the short reconnect window are not 
replayed. This is the
     same behavior as `PdMetaDriver` / `KvClient`. The change removes the 
permanent silent
     failure. It does not add gap replay.
   
     ## Verifying these changes
   
     - [x] Need tests and can be verified as follows:
         - New `EtcdMetaDriverTest` (JUnit + Mockito) mocks the jetcd 
`Client`/`Watch`, captures
           the registered `Watch.Listener`, and asserts that both `onError` and 
`onCompleted`
           trigger a re-subscribe (a second `watch(...)` call), and that 
`onNext` still reaches
           the consumer.
         - Local run: `EtcdMetaDriverTest` 4/4, `CachedSchemaTransactionTest` 
18/18, and
           `MetaManagerSchemaCacheClearEventTest` 6/6 after the stopgap removal.
         - Red-green: commenting out the re-subscribe makes the three recovery 
tests fail;
           restoring it makes them pass.
   
     ## Does this PR potentially affect the following parts?
   
     - [ ]  Dependencies
     - [ ]  Modify configurations
     - [ ]  The public API
     - [ ]  Other affects (typed here)
     - [x]  Nope
   
     ## Documentation Status
   
     - [ ]  `Doc - TODO`
     - [ ]  `Doc - Done`
     - [x]  `Doc - No Need`
   


-- 
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]

Reply via email to