You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2022/02/20 12:48:48 UTC

[skywalking] 01/01: Support ElasticSearch 8 and add it into E2E tests

This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch test/es8
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit 0d2c6bd543f5ee1aae53b59d7ddbcab599cf19a5
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Wed Feb 16 13:22:50 2022 +0800

    Support ElasticSearch 8 and add it into E2E tests
---
 .github/workflows/e2e.log.yaml                                   | 2 ++
 .github/workflows/e2e.storages.yaml                              | 3 ---
 CHANGES.md                                                       | 1 +
 .../skywalking/library/elasticsearch/ElasticSearchVersion.java   | 5 +++++
 .../storage/plugin/elasticsearch/base/StorageEsInstaller.java    | 9 ++++-----
 test/e2e-v2/cases/storage/es/docker-compose.yml                  | 1 +
 6 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/.github/workflows/e2e.log.yaml b/.github/workflows/e2e.log.yaml
index b42896d..55ccc27 100644
--- a/.github/workflows/e2e.log.yaml
+++ b/.github/workflows/e2e.log.yaml
@@ -58,6 +58,8 @@ jobs:
             config-file: log/es/e2e.yaml
           - es-version: 7.15.0
             config-file: log/es/e2e.yaml
+          - es-version: 8.0.0
+            config-file: log/es/e2e.yaml
 
           - es-version: 6.3.2
             config-file: log/fluent-bit/e2e.yaml
diff --git a/.github/workflows/e2e.storages.yaml b/.github/workflows/e2e.storages.yaml
index 13d8fa6..b35a092 100644
--- a/.github/workflows/e2e.storages.yaml
+++ b/.github/workflows/e2e.storages.yaml
@@ -17,9 +17,6 @@
 name: E2E
 
 on:
-  push:
-    branches:
-      - test/es8
   pull_request:
   schedule:
     - cron: '0 18 * * *'
diff --git a/CHANGES.md b/CHANGES.md
index 96911ef..69b4b25 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -61,6 +61,7 @@ Release Notes.
 * Support all metrics from MAL engine in alarm core, including Prometheus, OC receiver, meter receiver.
 * Allow updating non-metrics templates when structure changed.
 * Set default connection timeout of ElasticSearch to 3000 milliseconds.
+* Support ElasticSearch 8 and add it into E2E tests.
 
 #### UI
 
diff --git a/oap-server/server-library/library-elasticsearch-client/src/main/java/org/apache/skywalking/library/elasticsearch/ElasticSearchVersion.java b/oap-server/server-library/library-elasticsearch-client/src/main/java/org/apache/skywalking/library/elasticsearch/ElasticSearchVersion.java
index 5e78d34..4f51773 100644
--- a/oap-server/server-library/library-elasticsearch-client/src/main/java/org/apache/skywalking/library/elasticsearch/ElasticSearchVersion.java
+++ b/oap-server/server-library/library-elasticsearch-client/src/main/java/org/apache/skywalking/library/elasticsearch/ElasticSearchVersion.java
@@ -63,6 +63,11 @@ public final class ElasticSearchVersion {
                 }
                 return;
             }
+            if (major == 8) {
+                requestFactory = new V78RequestFactory(this);
+                codec = V78Codec.INSTANCE;
+                return;
+            }
         }
         throw new UnsupportedOperationException("Unsupported version: " + this);
     }
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 478e5ea..9960910 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
@@ -200,12 +200,12 @@ public class StorageEsInstaller extends ModelInstaller {
     protected Mappings createMapping(Model model) {
         Map<String, Object> properties = new HashMap<>();
         for (ModelColumn columnDefine : model.getColumns()) {
+            final String type = columnTypeEsMapping.transform(columnDefine.getType(), columnDefine.getGenericType());
             if (columnDefine.isMatchQuery()) {
                 String matchCName = MatchCNameBuilder.INSTANCE.build(columnDefine.getColumnName().getName());
 
                 Map<String, Object> originalColumn = new HashMap<>();
-                originalColumn.put(
-                    "type", columnTypeEsMapping.transform(columnDefine.getType(), columnDefine.getGenericType()));
+                originalColumn.put("type", type);
                 originalColumn.put("copy_to", matchCName);
                 properties.put(columnDefine.getColumnName().getName(), originalColumn);
 
@@ -215,9 +215,8 @@ public class StorageEsInstaller extends ModelInstaller {
                 properties.put(matchCName, matchColumn);
             } else {
                 Map<String, Object> column = new HashMap<>();
-                column.put(
-                    "type", columnTypeEsMapping.transform(columnDefine.getType(), columnDefine.getGenericType()));
-                if (columnDefine.isStorageOnly()) {
+                column.put("type", type);
+                if (columnDefine.isStorageOnly() && !"binary".equals(type)) {
                     column.put("index", false);
                 }
                 properties.put(columnDefine.getColumnName().getName(), column);
diff --git a/test/e2e-v2/cases/storage/es/docker-compose.yml b/test/e2e-v2/cases/storage/es/docker-compose.yml
index d1881bd..221d427 100644
--- a/test/e2e-v2/cases/storage/es/docker-compose.yml
+++ b/test/e2e-v2/cases/storage/es/docker-compose.yml
@@ -25,6 +25,7 @@ services:
     environment:
       - discovery.type=single-node
       - cluster.routing.allocation.disk.threshold_enabled=false
+      - xpack.security.enabled=false
     healthcheck:
       test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/9200"]
       interval: 5s