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

dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new cff79f2e3f5 branch-3.0: [Enhancement](systable)add information_schema 
backend_configuration table (#51542)
cff79f2e3f5 is described below

commit cff79f2e3f57f63ea122ac97544ca51c1b58ea41
Author: koarz <[email protected]>
AuthorDate: Mon Jun 9 17:28:32 2025 +0800

    branch-3.0: [Enhancement](systable)add information_schema 
backend_configuration table (#51542)
    
    https://github.com/apache/doris/pull/51024
---
 be/src/exec/schema_scanner.cpp                     |   3 +
 .../schema_backend_configuration_scanner.cpp       | 104 +++++++++++++++++++++
 .../schema_backend_configuration_scanner.h         |  47 ++++++++++
 .../org/apache/doris/analysis/SchemaTableType.java |   2 +
 .../java/org/apache/doris/catalog/SchemaTable.java |   8 ++
 .../planner/BackendPartitionedSchemaScanNode.java  |   1 +
 gensrc/thrift/Descriptors.thrift                   |   5 +-
 .../test_backend_configuration.groovy              |  39 ++++++++
 8 files changed, 207 insertions(+), 2 deletions(-)

diff --git a/be/src/exec/schema_scanner.cpp b/be/src/exec/schema_scanner.cpp
index 5bf990e7c55..e9d068baca6 100644
--- a/be/src/exec/schema_scanner.cpp
+++ b/be/src/exec/schema_scanner.cpp
@@ -28,6 +28,7 @@
 
 #include "exec/schema_scanner/schema_active_queries_scanner.h"
 #include "exec/schema_scanner/schema_backend_active_tasks.h"
+#include "exec/schema_scanner/schema_backend_configuration_scanner.h"
 #include "exec/schema_scanner/schema_catalog_meta_cache_stats_scanner.h"
 #include "exec/schema_scanner/schema_charsets_scanner.h"
 #include "exec/schema_scanner/schema_collations_scanner.h"
@@ -210,6 +211,8 @@ std::unique_ptr<SchemaScanner> 
SchemaScanner::create(TSchemaTableType::type type
         return SchemaFilesScanner::create_unique();
     case TSchemaTableType::SCH_PARTITIONS:
         return SchemaPartitionsScanner::create_unique();
+    case TSchemaTableType::SCH_BACKEND_CONFIGURATION:
+        return SchemaBackendConfigurationScanner::create_unique();
     case TSchemaTableType::SCH_ROWSETS:
         return SchemaRowsetsScanner::create_unique();
     case TSchemaTableType::SCH_METADATA_NAME_IDS:
diff --git 
a/be/src/exec/schema_scanner/schema_backend_configuration_scanner.cpp 
b/be/src/exec/schema_scanner/schema_backend_configuration_scanner.cpp
new file mode 100644
index 00000000000..931425a9f26
--- /dev/null
+++ b/be/src/exec/schema_scanner/schema_backend_configuration_scanner.cpp
@@ -0,0 +1,104 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "exec/schema_scanner/schema_backend_configuration_scanner.h"
+
+#include <gen_cpp/Descriptors_types.h>
+
+#include <string>
+
+#include "runtime/define_primitive_type.h"
+#include "runtime/exec_env.h"
+#include "runtime/runtime_state.h"
+#include "vec/common/string_ref.h"
+#include "vec/core/block.h"
+
+namespace doris {
+
+std::vector<SchemaScanner::ColumnDesc> 
SchemaBackendConfigurationScanner::_s_tbls_columns = {
+        //   name,       type,          size,     is_null
+        {"BE_ID", TYPE_BIGINT, sizeof(int64_t), true},
+        {"CONFIG_NAME", TYPE_STRING, sizeof(StringRef), true},
+        {"CONFIG_TYPE", TYPE_STRING, sizeof(StringRef), true},
+        {"CONFIG_VALUE", TYPE_STRING, sizeof(StringRef), true},
+        {"IS_MUTABLE", TYPE_BOOLEAN, sizeof(bool), true}};
+
+SchemaBackendConfigurationScanner::SchemaBackendConfigurationScanner()
+        : SchemaScanner(_s_tbls_columns, 
TSchemaTableType::SCH_BACKEND_CONFIGURATION),
+          _backend_id(ExecEnv::GetInstance()->cluster_info()->backend_id) {}
+
+SchemaBackendConfigurationScanner::~SchemaBackendConfigurationScanner() = 
default;
+
+Status SchemaBackendConfigurationScanner::start(doris::RuntimeState* state) {
+    _config_infos = config::get_config_info();
+    return Status::OK();
+}
+
+Status 
SchemaBackendConfigurationScanner::get_next_block_internal(vectorized::Block* 
block,
+                                                                  bool* eos) {
+    if (!_is_init) {
+        return Status::InternalError("Used before initialized.");
+    }
+
+    if (nullptr == block || nullptr == eos) {
+        return Status::InternalError("input pointer is nullptr.");
+    }
+
+    *eos = true;
+    if (_config_infos.empty()) {
+        return Status::OK();
+    }
+
+    for (size_t col_idx = 0; col_idx < _s_tbls_columns.size(); ++col_idx) {
+        size_t row_num = _config_infos.size();
+        std::vector<StringRef> str_refs(row_num);
+        std::vector<int8_t> bool_vals(row_num);
+        std::vector<void*> datas(row_num);
+        std::vector<std::string> column_values(row_num);
+
+        for (size_t row_idx = 0; row_idx < row_num; ++row_idx) {
+            // be_id
+            if (col_idx == 0) {
+                datas[row_idx] = &_backend_id;
+            } else {
+                // config
+                const auto& row = _config_infos[row_idx];
+                if (row.size() != _s_tbls_columns.size() - 1) {
+                    return Status::InternalError(
+                            "backend configs info meet invalid schema, 
schema_size={}, "
+                            "input_data_size={}",
+                            _config_infos.size(), row.size());
+                }
+
+                std::string& column_value =
+                        column_values[row_idx]; // Reference to the actual 
string in the vector
+                column_value = row[col_idx - 1];
+                if (_s_tbls_columns[col_idx].type == TYPE_BOOLEAN) {
+                    bool_vals[row_idx] = column_value == "true" ? 1 : 0;
+                    datas[row_idx] = &bool_vals[row_idx];
+                } else {
+                    str_refs[row_idx] =
+                            StringRef(column_values[row_idx].data(), 
column_values[row_idx].size());
+                    datas[row_idx] = &str_refs[row_idx];
+                }
+            }
+        }
+        RETURN_IF_ERROR(fill_dest_column_for_range(block, col_idx, datas));
+    }
+    return Status::OK();
+}
+} // namespace doris
diff --git a/be/src/exec/schema_scanner/schema_backend_configuration_scanner.h 
b/be/src/exec/schema_scanner/schema_backend_configuration_scanner.h
new file mode 100644
index 00000000000..b29d5f60724
--- /dev/null
+++ b/be/src/exec/schema_scanner/schema_backend_configuration_scanner.h
@@ -0,0 +1,47 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include <vector>
+
+#include "common/status.h"
+#include "exec/schema_scanner.h"
+
+namespace doris {
+class RuntimeState;
+namespace vectorized {
+class Block;
+} // namespace vectorized
+
+class SchemaBackendConfigurationScanner : public SchemaScanner {
+    ENABLE_FACTORY_CREATOR(SchemaBackendConfigurationScanner);
+
+public:
+    SchemaBackendConfigurationScanner();
+    ~SchemaBackendConfigurationScanner() override;
+
+    Status start(RuntimeState* state) override;
+    Status get_next_block_internal(vectorized::Block* block, bool* eos) 
override;
+
+    static std::vector<SchemaScanner::ColumnDesc> _s_tbls_columns;
+
+private:
+    int64_t _backend_id;
+    std::vector<std::vector<std::string>> _config_infos;
+};
+} // namespace doris
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/SchemaTableType.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/SchemaTableType.java
index f8fcfe19b04..0ec8f6b851f 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/SchemaTableType.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/SchemaTableType.java
@@ -89,6 +89,8 @@ public enum SchemaTableType {
             TSchemaTableType.SCH_FILE_CACHE_STATISTICS),
     SCH_CATALOG_META_CACHE_STATISTICS("CATALOG_META_CACHE_STATISTICS", 
"CATALOG_META_CACHE_STATISTICS",
             TSchemaTableType.SCH_CATALOG_META_CACHE_STATISTICS),
+    SCH_BACKEND_CONFIGURATION("BACKEND_CONFIGURATION", "BACKEND_CONFIGURATION",
+            TSchemaTableType.SCH_BACKEND_CONFIGURATION),
     SCH_ROUTINE_LOAD_JOBS("ROUTINE_LOAD_JOBS", "ROUTINE_LOAD_JOBS",
             TSchemaTableType.SCH_ROUTINE_LOAD_JOBS);
 
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/SchemaTable.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/SchemaTable.java
index 898b10ed973..94a82a422b8 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/SchemaTable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/SchemaTable.java
@@ -493,6 +493,14 @@ public class SchemaTable extends Table {
                             .column("READ_BYTES_PER_SECOND", 
ScalarType.createType(PrimitiveType.BIGINT))
                             .column("REMOTE_READ_BYTES_PER_SECOND", 
ScalarType.createType(PrimitiveType.BIGINT))
                             .build()))
+            .put("backend_configuration",
+                    new SchemaTable(SystemIdGenerator.getNextId(), 
"backend_configuration", TableType.SCHEMA,
+                            builder().column("BE_ID", 
ScalarType.createType(PrimitiveType.BIGINT))
+                                    .column("CONFIG_NAME", 
ScalarType.createStringType())
+                                    .column("CONFIG_TYPE", 
ScalarType.createStringType())
+                                    .column("CONFIG_VALUE", 
ScalarType.createStringType())
+                                    .column("IS_MUTABLE", 
ScalarType.createType(PrimitiveType.BOOLEAN))
+                                    .build()))
             .put("processlist",
                     new SchemaTable(SystemIdGenerator.getNextId(), 
"processlist", TableType.SCHEMA,
                             builder().column("CURRENT_CONNECTED", 
ScalarType.createVarchar(16))
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/planner/BackendPartitionedSchemaScanNode.java
 
b/fe/fe-core/src/main/java/org/apache/doris/planner/BackendPartitionedSchemaScanNode.java
index 74030bd2190..bc73cd8ce1b 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/planner/BackendPartitionedSchemaScanNode.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/planner/BackendPartitionedSchemaScanNode.java
@@ -70,6 +70,7 @@ public class BackendPartitionedSchemaScanNode extends 
SchemaScanNode {
         BEACKEND_ID_COLUMN_SET.add("be_id");
 
         BACKEND_TABLE.add("file_cache_statistics");
+        BACKEND_TABLE.add("backend_configuration");
     }
 
     public static boolean isBackendPartitionedSchemaTable(String tableName) {
diff --git a/gensrc/thrift/Descriptors.thrift b/gensrc/thrift/Descriptors.thrift
index d95f4150a76..9c5e6f075b9 100644
--- a/gensrc/thrift/Descriptors.thrift
+++ b/gensrc/thrift/Descriptors.thrift
@@ -121,7 +121,7 @@ enum TSchemaTableType {
     SCH_VARIABLES = 32,
     SCH_VIEWS = 33,
     SCH_INVALID = 34,
-    SCH_ROWSETS = 35
+    SCH_ROWSETS = 35,
     SCH_BACKENDS = 36,
     SCH_COLUMN_STATISTICS = 37,
     SCH_PARAMETERS = 38,
@@ -140,7 +140,8 @@ enum TSchemaTableType {
     SCH_FILE_CACHE_STATISTICS = 51,
     SCH_CATALOG_META_CACHE_STATISTICS = 52;
     // consistent with the master
-    SCH_ROUTINE_LOAD_JOBS = 54;
+    SCH_ROUTINE_LOAD_JOBS = 54,
+    SCH_BACKEND_CONFIGURATION=55;
 }
 
 enum THdfsCompression {
diff --git 
a/regression-test/suites/external_table_p0/info_schema_db/test_backend_configuration.groovy
 
b/regression-test/suites/external_table_p0/info_schema_db/test_backend_configuration.groovy
new file mode 100644
index 00000000000..704135cb888
--- /dev/null
+++ 
b/regression-test/suites/external_table_p0/info_schema_db/test_backend_configuration.groovy
@@ -0,0 +1,39 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+import org.apache.doris.regression.suite.ClusterOptions
+
+suite("test_backend_configuration", "docker, p0, 
external_table,information_schema,backend_configuration") {
+    def options = new ClusterOptions()
+    options.setFeNum(1)
+    options.setBeNum(3)
+    docker(options) {
+          // dont select be_id
+          def res = sql """ SHOW BACKENDS """
+
+          assertTrue(res.size() == 3)
+
+          sql """ 
+               select CONFIG_NAME, CONFIG_TYPE, CONFIG_VALUE, IS_MUTABLE from 
information_schema.backend_configuration where CONFIGURATION = 
"disable_auto_compaction";
+          """
+          assertTrue(res.size() == 3)
+
+          res = sql """ 
+               select CONFIG_NAME, CONFIG_TYPE, CONFIG_VALUE, IS_MUTABLE from 
information_schema.backend_configuration where CONFIGURATION = 
"LZ4_HC_compression_level";
+          """
+          assertTrue(res.size() == 3)
+    }
+}


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

Reply via email to