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/12 01:04:42 UTC

[skywalking] branch polish created (now d740b846b4)

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

wusheng pushed a change to branch polish
in repository https://gitbox.apache.org/repos/asf/skywalking.git


      at d740b846b4 Add ModelColumn#shouldIndex method

This branch includes the following new commits:

     new d740b846b4 Add ModelColumn#shouldIndex method

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[skywalking] 01/01: Add ModelColumn#shouldIndex method

Posted by wu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch polish
in repository https://gitbox.apache.org/repos/asf/skywalking.git

commit d740b846b49c8c060d00def11b0be7f8248778b5
Author: Wu Sheng <wu...@foxmail.com>
AuthorDate: Tue Apr 12 09:04:32 2022 +0800

    Add ModelColumn#shouldIndex method
---
 .../skywalking/oap/server/core/storage/annotation/Column.java     | 8 +++-----
 .../skywalking/oap/server/core/storage/model/ModelColumn.java     | 7 +++++++
 .../oap/server/storage/plugin/jdbc/mysql/MySQLTableInstaller.java | 2 +-
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/annotation/Column.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/annotation/Column.java
index 44d2305024..604e19e028 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/annotation/Column.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/annotation/Column.java
@@ -49,15 +49,13 @@ public @interface Column {
     int defaultValue() default 0;
 
     /**
-     * The column is just saved, never used in query.
+     * The column is just saved, never used as a query condition.
      */
     boolean storageOnly() default false;
 
     /**
-     * The column(field) is just indexed, never stored. Note: this feature only supported by elasticsearch and don't
-     * support mappings update due to ElasticSearch server's limitation.
-     *
-     * NOTICE, metrics should not use this, as the OAP core merges indices of metrics automatically.
+     * The column(field) is just indexed, never stored(not available in query projection).
+     * Note: this feature only supported by elasticsearch.
      */
     boolean indexOnly() default false;
 
diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/model/ModelColumn.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/model/ModelColumn.java
index b5dbfbe739..6110254568 100644
--- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/model/ModelColumn.java
+++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/storage/model/ModelColumn.java
@@ -99,4 +99,11 @@ public class ModelColumn {
         this.indexOnly = indexOnly;
         this.banyanDBExtension = banyanDBExtension;
     }
+
+    /**
+     * @return true means this column should be indexed, as it would be a query condition.
+     */
+    public boolean shouldIndex() {
+        return !storageOnly;
+    }
 }
diff --git a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/mysql/MySQLTableInstaller.java b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/mysql/MySQLTableInstaller.java
index cd4b4da0d7..f37c7a7e8b 100644
--- a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/mysql/MySQLTableInstaller.java
+++ b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/mysql/MySQLTableInstaller.java
@@ -76,7 +76,7 @@ public class MySQLTableInstaller extends H2TableInstaller {
                                       Model model) throws JDBCClientException {
         int indexSeq = 0;
         for (final ModelColumn modelColumn : model.getColumns()) {
-            if (!modelColumn.isStorageOnly() && modelColumn.getLength() < 256) {
+            if (modelColumn.shouldIndex() && modelColumn.getLength() < 256) {
                 final Class<?> type = modelColumn.getType();
                 if (List.class.isAssignableFrom(type)) {
                     for (int i = 0; i < maxSizeOfArrayColumn; i++) {