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

kxiao 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 e3ba453e9bc [feature](variable) add read_only and super_read_only 
(#33795)
e3ba453e9bc is described below

commit e3ba453e9bc9af21901a41cdd78e6810e95f9a6a
Author: Mingyu Chen <morning...@163.com>
AuthorDate: Thu Apr 18 23:56:19 2024 +0800

    [feature](variable) add read_only and super_read_only (#33795)
---
 .../java/org/apache/doris/qe/GlobalVariable.java   | 14 ++++++++++++-
 .../data/variable_p0/set_and_unset_variable.out    | 24 ++++++++++++++++++++++
 .../variable_p0/set_and_unset_variable.groovy      | 22 ++++++++++++++++++++
 3 files changed, 59 insertions(+), 1 deletion(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/GlobalVariable.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/GlobalVariable.java
index 30f91c6f8c1..15990e15ffe 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/GlobalVariable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/GlobalVariable.java
@@ -57,6 +57,8 @@ public final class GlobalVariable {
     public static final String AUDIT_PLUGIN_MAX_SQL_LENGTH = 
"audit_plugin_max_sql_length";
 
     public static final String ENABLE_GET_ROW_COUNT_FROM_FILE_LIST = 
"enable_get_row_count_from_file_list";
+    public static final String READ_ONLY = "read_only";
+    public static final String SUPER_READ_ONLY = "super_read_only";
 
     @VariableMgr.VarAttr(name = VERSION_COMMENT, flag = VariableMgr.READ_ONLY)
     public static String versionComment = "Doris version "
@@ -135,7 +137,17 @@ public final class GlobalVariable {
                             + "Getting file list may be a time-consuming 
operation. "
                             + "If you don't need to estimate the number of 
rows in the table "
                             + "or it affects performance, you can disable this 
feature."})
-    public static boolean enable_get_row_count_from_file_list = true;
+    public static boolean enable_get_row_count_from_file_list = false;
+
+    @VariableMgr.VarAttr(name = READ_ONLY, flag = VariableMgr.GLOBAL,
+            description = {"仅用于兼容MySQL生态,暂无实际意义",
+                    "Only for compatibility with MySQL ecosystem, no practical 
meaning"})
+    public static boolean read_only = true;
+
+    @VariableMgr.VarAttr(name = SUPER_READ_ONLY, flag = VariableMgr.GLOBAL,
+            description = {"仅用于兼容MySQL生态,暂无实际意义",
+                    "Only for compatibility with MySQL ecosystem, no practical 
meaning"})
+    public static boolean super_read_only = true;
 
     // Don't allow creating instance.
     private GlobalVariable() {
diff --git a/regression-test/data/variable_p0/set_and_unset_variable.out 
b/regression-test/data/variable_p0/set_and_unset_variable.out
index e7f0dc2fdf1..33dd8af7bc1 100644
--- a/regression-test/data/variable_p0/set_and_unset_variable.out
+++ b/regression-test/data/variable_p0/set_and_unset_variable.out
@@ -161,3 +161,27 @@ deprecated_enable_local_exchange   true    true    0
 -- !cmd --
 show_hidden_columns    false   false   0
 
+-- !cmd --
+read_only      true    true    0
+
+-- !cmd --
+0
+
+-- !cmd --
+read_only      true    true    0
+
+-- !cmd --
+read_only      true    true    0
+
+-- !cmd --
+super_read_only        true    true    0
+
+-- !cmd --
+0
+
+-- !cmd --
+super_read_only        true    true    0
+
+-- !cmd --
+super_read_only        true    true    0
+
diff --git a/regression-test/suites/variable_p0/set_and_unset_variable.groovy 
b/regression-test/suites/variable_p0/set_and_unset_variable.groovy
index 47749774336..c637d3ae223 100644
--- a/regression-test/suites/variable_p0/set_and_unset_variable.groovy
+++ b/regression-test/suites/variable_p0/set_and_unset_variable.groovy
@@ -83,4 +83,26 @@ suite("set_and_unset_variable") {
     qt_cmd """show global variables like 'experimental_enable_agg_state'"""
     qt_cmd """show global variables like 'deprecated_enable_local_exchange'"""
     qt_cmd """show global variables like 'show_hidden_columns'"""
+
+    // test read_only
+    qt_cmd """show variables like 'read_only'"""
+    test {
+        sql "set read_only=true"
+        exception "should be set with SET GLOBAL"
+    }
+    qt_cmd "set global read_only=true"
+    qt_cmd """show global variables like 'read_only'"""
+    qt_cmd """show variables like 'read_only'"""
+    sql "set global read_only=false"
+
+    // test super_read_only
+    qt_cmd """show variables like 'super_read_only'"""
+    test {
+        sql "set super_read_only=true"
+        exception "should be set with SET GLOBAL"
+    }
+    qt_cmd "set global super_read_only=true"
+    qt_cmd """show global variables like 'super_read_only'"""
+    qt_cmd """show variables like 'super_read_only'"""
+    sql "set global super_read_only=false"
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to