Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.apache.hugegraph.store.HgOwnerKey;
import org.apache.hugegraph.store.HgPageSize;
import org.apache.hugegraph.store.HgSeekAble;
import org.apache.hugegraph.store.client.HgStoreNodeManager;
import org.apache.hugegraph.store.client.HgStoreNodeSession;
import org.apache.hugegraph.store.client.util.HgBufferProxy;
import org.apache.hugegraph.store.client.util.HgStoreClientConfig;
Expand All @@ -50,6 +51,7 @@

import com.google.protobuf.ByteString;

import io.grpc.Status;
import io.grpc.stub.StreamObserver;
import lombok.extern.slf4j.Slf4j;

Expand Down Expand Up @@ -174,7 +176,7 @@ private void init() {

private void serverScan() {
if (this.completed.get()) {
this.proxy.close();
// The response callback closes the buffer after publishing its final page or error.
return;
}
if (this.proxy.isClosed()) {
Expand Down Expand Up @@ -303,7 +305,11 @@ public void onNext(KvPageRes value) {
}
if (value.getOver()) {
completed.set(true);
observer.onCompleted();
try {
observer.onCompleted();
} catch (Exception e) {
log.warn("failed to invoke requestObserver.onCompleted(), reason: {}", e.getMessage());
}
}
proxy.send(value.getDataList());
if (completed.get()) {
Expand All @@ -319,6 +325,13 @@ public void onError(Throwable t) {
} catch (Exception e) {
log.warn("failed to invoke requestObserver.onCompleted(), reason:", e.getMessage());
}
// Retire the failed pool before publishing the original iterator error,
// so immediate retries cannot reuse it. Cancellation or protocol errors
// must not evict healthy nodes, and stale notices preserve replacements.
if (Status.fromThrowable(t).getCode() == Status.Code.UNAVAILABLE) {
new NotifyingExecutor(session.getGraphName(),
HgStoreNodeManager.getInstance(), session).handleErr(t);
Comment thread
imbajin marked this conversation as resolved.
Resolved
}
proxy.setError(t);
proxy.close();
log.error("failed to complete scan of session: " + session, t);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ <T> Optional<T> invoke(Supplier<FeedbackRes> supplier, Function<FeedbackRes, T>
return option;
}

private void handleErr(Throwable t) {
void handleErr(Throwable t) {
try {
notifyErrConsumer(HgNodeStatus.NOT_WORK).accept(t);
} catch (Throwable tt) {
Expand Down
Loading
Loading