forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix GeoIpDownloader startup during rolling upgrade (elastic#84000)
If rolling upgrade was used from version prior GeoIPv2 (<`7.14`) then geoip downloader wouldn't be started so no new databases were downloaded. This is especially troubling in `8.x` as we no longer provide default databases inside ES so after upgrade no geoip enrichment can take place until downloader is started with workaround (setting `ingest.geoip.downloader.enabled` to `false` and `true` again). This is because logic that was used to lower number of requests / cluster update listeners at the startup was too optimistic about order of actions / who can be elected master at what time. This change fixes that and also cleans up logs when there are some ignorable errors and adds debug logging on start and stop of the task to ease up troubleshooting. It also adds rolling upgrade test to make sure the fix works.
- Loading branch information
1 parent
003facf
commit 4ad8028
Showing
5 changed files
with
81 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pr: 84000 | ||
summary: Fix `GeoIpDownloader` startup during rolling upgrade | ||
area: Ingest | ||
type: bug | ||
issues: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
x-pack/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/GeoIpUpgradeIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.upgrades; | ||
|
||
import org.apache.http.util.EntityUtils; | ||
import org.elasticsearch.client.Request; | ||
import org.elasticsearch.client.Response; | ||
import org.hamcrest.Matchers; | ||
|
||
import java.nio.charset.StandardCharsets; | ||
|
||
public class GeoIpUpgradeIT extends AbstractUpgradeTestCase { | ||
|
||
public void testGeoIpDownloader() throws Exception { | ||
if (CLUSTER_TYPE == ClusterType.UPGRADED) { | ||
assertBusy(() -> { | ||
Response response = client().performRequest(new Request("GET", "_cat/tasks")); | ||
String tasks = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8); | ||
assertThat(tasks, Matchers.containsString("geoip-downloader")); | ||
}); | ||
assertBusy(() -> { | ||
Response response = client().performRequest(new Request("GET", "_ingest/geoip/stats")); | ||
String tasks = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8); | ||
assertThat(tasks, Matchers.containsString("failed_downloads\":1")); | ||
}); | ||
} | ||
} | ||
} |