pallavithegod commented on code in PR #3362:
URL: https://github.com/apache/hugegraph/pull/3362#discussion_r4295180749
##########
hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/HeartbeatService.java:
##########
@@ -415,6 +442,29 @@ public void shutdown() {
}
}
+ private void reportOffline() {
+ if (fatalExitRequested.get() || storeInfo == null) {
+ return;
+ }
+ storeInfo.setState(Metapb.StoreState.Offline);
+ if (storeInfo.getId() == 0 || pdProvider == null ||
+ pdProvider.getPDClient() == null) {
+ return;
+ }
+ try {
+ // Preserve PD's current metadata, and never use Exiting for a
temporary restart.
+ var client = pdProvider.getPDClient();
+ client.getCache().removeStore(storeInfo.getId());
+ Metapb.Store current = client.getStore(storeInfo.getId());
+ if (current.getState() == Metapb.StoreState.Up) {
+
client.updateStore(current.toBuilder().setState(Metapb.StoreState.Offline).build());
Review Comment:
Fixed in 9c08bf6fb. Temporary Offline updates and restore registrations
retain the existing keepalive entry without renewing it. PD still records
Offline immediately, and normal expiry applies if the Store does not return.
Two StoreRestoreRegistrationTest cases use three Stores with min count three:
another Store heartbeat remains Cluster_OK after either Offline path, then
becomes Cluster_Not_Ready when the retained entry expires. Neither path removes
or renews that entry. RAT, repository Checkstyle, clean compilation, and all
four focused test classes pass.
##########
hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/HeartbeatService.java:
##########
@@ -200,10 +200,36 @@ protected void registerStore() {
this.storeInfo.setStoreAddress(IpUtil.getNearestAddress(options.getGrpcAddress()));
this.storeInfo.setRaftAddress(IpUtil.getNearestAddress(options.getRaftAddress()));
+ // Obtain the identity needed by partition recovery without
advertising this Store Up.
+ this.storeInfo.setState(Metapb.StoreState.Offline);
Review Comment:
Fixed in 9c08bf6fb. A process-local restored flag is set after successful
local recovery. Later stream reconnects request only Up and do not call
stateChanged for another restore.
StoreRegistrationTest.testReconnectRegistersUpWithoutRestoringAgain verifies
the Offline/Up initial handshake followed by a single Up registration after
onStateChanged(Offline). testFailedUpRegistrationRetriesWithoutRestoringAgain
also covers a failed final registration without repeating a completed restore.
##########
hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/HgStoreEngine.java:
##########
@@ -296,13 +291,13 @@ public void restoreLocalPartitionEngine() {
try {
createPartitionEngine(p);
} catch (Exception e) {
- log.error("Partition {}-{} restore exception {}",
p.getGraphName(),
- p.getId(), e);
+ throw new IllegalStateException("Failed to restore
partition " +
Review Comment:
Fixed in 9c08bf6fb. restoreLocalPartitionEngine attempts every local
partition, collects contextual failures, and throws one aggregate exception
with suppressed causes after the loop.
StoreRegistrationTest.testRestoreAttemptsHealthyPartitionAfterFailure puts the
failed partition first in an ordered map and verifies the healthy second
partition is attempted before the aggregate failure is returned. The Store
remains Offline when any restore fails. The regression and existing shutdown
tests pass.
--
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]