Skip to content

Commit

Permalink
GeoIP tasks should wait longer for master (elastic#108410)
Browse files Browse the repository at this point in the history
Today when creating or removing the GeoIP downloader tasks we use the
default 30s master-node timeout. Yet, for these internal tasks we should
wait forever. This commit extends the timeout.
  • Loading branch information
DaveCTurner authored May 13, 2024
1 parent a46cef4 commit 56c2835
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions docs/changelog/108410.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 108410
summary: GeoIP tasks should wait longer for master
area: Ingest Node
type: bug
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.gateway.GatewayService;
import org.elasticsearch.index.Index;
import org.elasticsearch.index.IndexSettings;
Expand Down Expand Up @@ -341,12 +342,15 @@ && hasAtLeastOneGeoipProcessor(
);
}

@UpdateForV9 // use MINUS_ONE once that means no timeout
private static final TimeValue MASTER_TIMEOUT = TimeValue.MAX_VALUE;

private void startTask(Runnable onFailure) {
persistentTasksService.sendStartRequest(
GEOIP_DOWNLOADER,
GEOIP_DOWNLOADER,
new GeoIpTaskParams(),
null,
MASTER_TIMEOUT,
ActionListener.wrap(r -> logger.debug("Started geoip downloader task"), e -> {
Throwable t = e instanceof RemoteTransportException ? ExceptionsHelper.unwrapCause(e) : e;
if (t instanceof ResourceAlreadyExistsException == false) {
Expand All @@ -368,7 +372,7 @@ private void stopTask(Runnable onFailure) {
}
}
);
persistentTasksService.sendRemoveRequest(GEOIP_DOWNLOADER, null, ActionListener.runAfter(listener, () -> {
persistentTasksService.sendRemoveRequest(GEOIP_DOWNLOADER, MASTER_TIMEOUT, ActionListener.runAfter(listener, () -> {
IndexAbstraction databasesAbstraction = clusterService.state().metadata().getIndicesLookup().get(DATABASES_INDEX);
if (databasesAbstraction != null) {
// regardless of whether DATABASES_INDEX is an alias, resolve it to a concrete index
Expand Down

0 comments on commit 56c2835

Please sign in to comment.