pallavithegod commented on code in PR #3362:
URL: https://github.com/apache/hugegraph/pull/3362#discussion_r4306779620


##########
hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/HeartbeatService.java:
##########
@@ -200,10 +201,44 @@ protected void registerStore() {
             
this.storeInfo.setStoreAddress(IpUtil.getNearestAddress(options.getGrpcAddress()));
             
this.storeInfo.setRaftAddress(IpUtil.getNearestAddress(options.getRaftAddress()));
 
-            long storeId = pdProvider.registerStore(this.storeInfo);
+            // Recovery is needed once per process, not when an established 
stream reconnects.
+            boolean restoring = !restored;
+            this.storeInfo.setState(restoring ? Metapb.StoreState.Offline : 
Metapb.StoreState.Up);
+            long storeId;
+            try {
+                storeId = pdProvider.registerStore(this.storeInfo);
+            } finally {
+                // Retry registration after a failure instead of heartbeating 
an unregistered Store.
+                this.storeInfo.setState(Metapb.StoreState.Offline);
+            }
             if (storeId != 0) {
                 storeInfo.setId(storeId);
                 storeMetadata.save(storeInfo);
+                if (restoring && storeEngine != null) {
+                    try {
+                        storeEngine.stateChanged(storeInfo, 
Metapb.StoreState.Offline, Metapb.StoreState.Up);

Review Comment:
   Partition pulses now wait until the stream starts, and disconnect clears the 
connected flag. The blocked-restore regression verifies that no partition 
heartbeat is attempted before that point.



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