Skip to content

Commit

Permalink
MSQ WorkerImpl: Ignore ServiceClosedException on postCounters. (apach…
Browse files Browse the repository at this point in the history
…e#14707)

* MSQ WorkerImpl: Ignore ServiceClosedException on postCounters.

A race can happen where postCounters is in flight while the controller
goes offline. When this happens, we should ignore the ServiceClosedException
and continue without posting counters.

* Fix style and logic.
  • Loading branch information
gianm authored Aug 2, 2023
1 parent 4a31ae2 commit 72c151a
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
import org.apache.druid.query.PrioritizedRunnable;
import org.apache.druid.query.QueryContext;
import org.apache.druid.query.QueryProcessingPool;
import org.apache.druid.rpc.ServiceClosedException;
import org.apache.druid.server.DruidNode;

import javax.annotation.Nullable;
Expand Down Expand Up @@ -850,7 +851,17 @@ private void postCountersToController() throws IOException
final CounterSnapshotsTree snapshotsTree = getCounters();

if (controllerAlive && !snapshotsTree.isEmpty()) {
controllerClient.postCounters(id(), snapshotsTree);
try {
controllerClient.postCounters(id(), snapshotsTree);
}
catch (IOException e) {
if (e.getCause() instanceof ServiceClosedException) {
// Suppress. This can happen if the controller goes away while a postCounters call is in flight.
log.debug(e, "Ignoring failure on postCounters, because controller has gone away.");
} else {
throw e;
}
}
}
}

Expand Down

0 comments on commit 72c151a

Please sign in to comment.