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

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 0b29d4d369e [opt](variable) add a new variable tag REMOVED (#35902)
0b29d4d369e is described below

commit 0b29d4d369ef2be26793253241576d17c0023aa3
Author: morrySnow <[email protected]>
AuthorDate: Thu Jun 6 10:29:41 2024 +0800

    [opt](variable) add a new variable tag REMOVED (#35902)
    
    variable taged with REMOVED will not show in show variables statement.
    but it could be set successful for backward compatibility.
---
 .../apache/doris/common/VariableAnnotation.java    |  6 ++++--
 .../java/org/apache/doris/qe/SessionVariable.java  |  2 +-
 .../main/java/org/apache/doris/qe/VariableMgr.java |  5 +++++
 .../correctness/test_removed_session_var.groovy    | 24 +++++-----------------
 4 files changed, 15 insertions(+), 22 deletions(-)

diff --git 
a/fe/fe-common/src/main/java/org/apache/doris/common/VariableAnnotation.java 
b/fe/fe-common/src/main/java/org/apache/doris/common/VariableAnnotation.java
index 1f8c1f3a991..a813856d62e 100644
--- a/fe/fe-common/src/main/java/org/apache/doris/common/VariableAnnotation.java
+++ b/fe/fe-common/src/main/java/org/apache/doris/common/VariableAnnotation.java
@@ -27,8 +27,10 @@ public enum VariableAnnotation {
     // A previous experimental item but now it is GA.
     // it will be shown without `experimental_` prefix.
     // But user can set it with or without `experimental_` prefix, for 
compatibility.
-    EXPERIMENTAL_ONLINE("");
-    private String prefix = "experimental_";
+    EXPERIMENTAL_ONLINE(""),
+    // A removed item, not show in variable list, but not throw exception when 
user call set for it.
+    REMOVED("");
+    private final String prefix;
 
     VariableAnnotation(String prefix) {
         this.prefix = prefix;
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
index ab412b7dd08..be209c6686f 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
@@ -933,7 +933,7 @@ public class SessionVariable implements Serializable, 
Writable {
     @VariableMgr.VarAttr(name = ENABLE_STRICT_CONSISTENCY_DML, needForward = 
true)
     public boolean enableStrictConsistencyDml = true;
 
-    @VariableMgr.VarAttr(name = ENABLE_VECTORIZED_ENGINE, varType = 
VariableAnnotation.EXPERIMENTAL_ONLINE)
+    @VariableMgr.VarAttr(name = ENABLE_VECTORIZED_ENGINE, varType = 
VariableAnnotation.REMOVED)
     public boolean enableVectorizedEngine = true;
 
     @VariableMgr.VarAttr(name = ENABLE_PIPELINE_ENGINE, fuzzy = true, 
needForward = true,
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java
index 38a8b5239d3..1b1a317f5f0 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/VariableMgr.java
@@ -728,6 +728,11 @@ public class VariableMgr {
         rlock.lock();
         try {
             for (Map.Entry<String, VarContext> entry : 
ctxByDisplayVarName.entrySet()) {
+                // not show removed variables
+                VarAttr varAttr = 
entry.getValue().getField().getAnnotation(VarAttr.class);
+                if (VariableAnnotation.REMOVED.equals(varAttr.varType())) {
+                    continue;
+                }
                 // Filter variable not match to the regex.
                 if (matcher != null && !matcher.match(entry.getKey())) {
                     continue;
diff --git 
a/fe/fe-common/src/main/java/org/apache/doris/common/VariableAnnotation.java 
b/regression-test/suites/correctness/test_removed_session_var.groovy
similarity index 52%
copy from 
fe/fe-common/src/main/java/org/apache/doris/common/VariableAnnotation.java
copy to regression-test/suites/correctness/test_removed_session_var.groovy
index 1f8c1f3a991..9e6a5bc0016 100644
--- a/fe/fe-common/src/main/java/org/apache/doris/common/VariableAnnotation.java
+++ b/regression-test/suites/correctness/test_removed_session_var.groovy
@@ -15,26 +15,12 @@
 // specific language governing permissions and limitations
 // under the License.
 
-package org.apache.doris.common;
+suite("test_removed_session_var") {
 
-public enum VariableAnnotation {
-    NONE(""),
-    // A deprecated item and it will be deleted in future
-    DEPRECATED("deprecated_"),
-    // An experimental item, it will be shown with `experimental_` prefix
-    // And user can set it with or without `experimental_` prefix.
-    EXPERIMENTAL("experimental_"),
-    // A previous experimental item but now it is GA.
-    // it will be shown without `experimental_` prefix.
-    // But user can set it with or without `experimental_` prefix, for 
compatibility.
-    EXPERIMENTAL_ONLINE("");
-    private String prefix = "experimental_";
+    sql "set enable_vectorized_engine = true";
 
-    VariableAnnotation(String prefix) {
-        this.prefix = prefix;
-    }
-
-    public String getPrefix() {
-        return prefix;
+    test {
+        sql """ show session variables like '%enable_vectorized_engine%' """
+        rowNum 0
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to