You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2022/04/27 16:15:55 UTC
[skywalking] branch master updated: fix bug: Even after a rerun of init mode job, TimeSeriesTable ES index not created. (#8958)
This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git
The following commit(s) were added to refs/heads/master by this push:
new 8170177900 fix bug: Even after a rerun of init mode job, TimeSeriesTable ES index not created. (#8958)
8170177900 is described below
commit 81701779005a4ed0f2c7f313aabca3ff2cae7214
Author: longmountain <95...@users.noreply.github.com>
AuthorDate: Thu Apr 28 00:15:42 2022 +0800
fix bug: Even after a rerun of init mode job, TimeSeriesTable ES index not created. (#8958)
Co-authored-by: maxiaoguang <xi...@bianli24.com>
---
docs/en/changes/changes.md | 1 +
.../elasticsearch/base/StorageEsInstaller.java | 36 +++++++++++-----------
2 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md
index 139229e277..1a7093b9be 100644
--- a/docs/en/changes/changes.md
+++ b/docs/en/changes/changes.md
@@ -29,6 +29,7 @@
* Remove build time from the OAP version.
* Add data-generator module to run OAP in testing mode, generating mock data for testing.
* Support receive Kubernetes processes from gRPC protocol.
+* Fix the problem that es index(TimeSeriesTable, eg. endpoint_traffic, alarm_record) didn't create even after rerun with init-mode. This problem caused the OAP server to fail to start when the OAP server was down for more than a day.
#### UI
diff --git a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/base/StorageEsInstaller.java b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/base/StorageEsInstaller.java
index 3e59f249ec..1256f3fea3 100644
--- a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/base/StorageEsInstaller.java
+++ b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/base/StorageEsInstaller.java
@@ -153,28 +153,28 @@ public class StorageEsInstaller extends ModelInstaller {
if (!isAcknowledged) {
throw new IOException("create " + tableName + " index template failure, ");
}
+ }
- if (esClient.isExistsIndex(indexName)) {
- Mappings historyMapping = esClient.getIndex(indexName)
- .map(Index::getMappings)
- .orElseGet(Mappings::new);
- Mappings appendMapping = structures.diffStructure(tableName, historyMapping);
- if (appendMapping.getProperties() != null && !appendMapping.getProperties().isEmpty()) {
- isAcknowledged = esClient.updateIndexMapping(indexName, appendMapping);
- log.info("update {} index finished, isAcknowledged: {}, append mappings: {}", indexName,
- isAcknowledged, appendMapping
- );
- if (!isAcknowledged) {
- throw new StorageException("update " + indexName + " time series index failure");
- }
- }
- } else {
- isAcknowledged = esClient.createIndex(indexName);
- log.info("create {} index finished, isAcknowledged: {}", indexName, isAcknowledged);
+ if (esClient.isExistsIndex(indexName)) {
+ Mappings historyMapping = esClient.getIndex(indexName)
+ .map(Index::getMappings)
+ .orElseGet(Mappings::new);
+ Mappings appendMapping = structures.diffStructure(tableName, historyMapping);
+ if (appendMapping.getProperties() != null && !appendMapping.getProperties().isEmpty()) {
+ boolean isAcknowledged = esClient.updateIndexMapping(indexName, appendMapping);
+ log.info("update {} index finished, isAcknowledged: {}, append mappings: {}", indexName,
+ isAcknowledged, appendMapping
+ );
if (!isAcknowledged) {
- throw new StorageException("create " + indexName + " time series index failure");
+ throw new StorageException("update " + indexName + " time series index failure");
}
}
+ } else {
+ boolean isAcknowledged = esClient.createIndex(indexName);
+ log.info("create {} index finished, isAcknowledged: {}", indexName, isAcknowledged);
+ if (!isAcknowledged) {
+ throw new StorageException("create " + indexName + " time series index failure");
+ }
}
} catch (IOException e) {
throw new StorageException("cannot create " + tableName + " index template", e);