From d305efcb5251c32f543ea9aa2dda33a8ba59bce4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=99=9F=20Wu=20Sheng?= Date: Tue, 16 Jun 2020 08:06:02 +0800 Subject: [PATCH] In no-init mode, should only check the index existence. (#4929) --- .../plugin/elasticsearch/base/StorageEsInstaller.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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 2a131601e..143d095bd 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 @@ -53,11 +53,12 @@ public class StorageEsInstaller extends ModelInstaller { protected boolean isExists(Model model) throws StorageException { ElasticSearchClient esClient = (ElasticSearchClient) client; try { - String timeSeriesIndexName = - model.isTimeSeries() ? - TimeSeriesUtils.latestWriteIndexName(model) : - model.getName(); - return esClient.isExistsTemplate(model.getName()) && esClient.isExistsIndex(timeSeriesIndexName); + if (model.isTimeSeries()) { + return esClient.isExistsTemplate(model.getName()) && esClient.isExistsIndex( + TimeSeriesUtils.latestWriteIndexName(model)); + } else { + return esClient.isExistsIndex(model.getName()); + } } catch (IOException e) { throw new StorageException(e.getMessage()); }