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

gavinchou 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 e45d72c5f22 [feature](tde) optimize TDE-related metadata (#55117)
e45d72c5f22 is described below

commit e45d72c5f22b8e7d2a853cce9880d0bacadfa73c
Author: Luwei <[email protected]>
AuthorDate: Fri Aug 22 22:08:27 2025 +0800

    [feature](tde) optimize TDE-related metadata (#55117)
    
    Co-authored-by: Siyang Tang <[email protected]>
---
 .../schema_encryption_keys_scanner.cpp             | 88 +++++++++++++++-------
 .../schema_encryption_keys_scanner.h               |  5 +-
 .../schema_encryption_keys_scanner_test.cpp        | 17 ++---
 .../org/apache/doris/encryption/EncryptionKey.java | 38 ----------
 .../org/apache/doris/encryption/KeyManager.java    | 37 ---------
 .../apache/doris/encryption/KeyManagerStore.java   | 24 +-----
 .../org/apache/doris/encryption/RootKeyInfo.java   |  3 +
 .../org/apache/doris/persist/KeyOperationInfo.java |  8 +-
 .../apache/doris/service/FrontendServiceImpl.java  | 49 +++++++++++-
 gensrc/proto/olap_file.proto                       | 31 ++++++++
 gensrc/thrift/AgentService.thrift                  |  6 ++
 gensrc/thrift/FrontendService.thrift               | 28 +++----
 .../query_p0/system/test_query_sys_tables.groovy   |  3 +
 13 files changed, 184 insertions(+), 153 deletions(-)

diff --git a/be/src/exec/schema_scanner/schema_encryption_keys_scanner.cpp 
b/be/src/exec/schema_scanner/schema_encryption_keys_scanner.cpp
index 011f30f3321..c6e3e9f6f01 100644
--- a/be/src/exec/schema_scanner/schema_encryption_keys_scanner.cpp
+++ b/be/src/exec/schema_scanner/schema_encryption_keys_scanner.cpp
@@ -20,10 +20,13 @@
 #include <gen_cpp/Descriptors_types.h>
 #include <gen_cpp/FrontendService_types.h>
 #include <gen_cpp/PlanNodes_types.h>
+#include <gen_cpp/olap_file.pb.h>
+#include <thrift/protocol/TDebugProtocol.h>
 
 #include <cstdint>
 #include <string>
 
+#include "common/status.h"
 #include "exec/schema_scanner/schema_helper.h"
 #include "runtime/define_primitive_type.h"
 #include "runtime/runtime_state.h"
@@ -63,8 +66,20 @@ Status SchemaEncryptionKeysScanner::start(RuntimeState* 
state) {
         return Status::InternalError("used before initialized.");
     }
     TGetEncryptionKeysRequest request;
+    TGetEncryptionKeysResult result;
     RETURN_IF_ERROR(SchemaHelper::get_master_keys(*(_param->common_param->ip),
-                                                  _param->common_param->port, 
request, &_result));
+                                                  _param->common_param->port, 
request, &result));
+    RETURN_IF_ERROR(Status::create(result.status));
+    _master_keys.reserve(result.master_keys.size());
+    for (const auto& tk : result.master_keys) {
+        EncryptionKeyPB pb;
+        if (!pb.ParseFromString(tk.key_pb)) {
+            return Status::InternalError("Parse master key error, master_key=",
+                                         
apache::thrift::ThriftDebugString(tk));
+        }
+        _master_keys.emplace_back(std::move(pb));
+    }
+
     return Status::OK();
 }
 
@@ -77,7 +92,7 @@ Status 
SchemaEncryptionKeysScanner::get_next_block_internal(vectorized::Block* b
     }
 
     *eos = true;
-    if (_result.master_keys.empty()) {
+    if (_master_keys.empty()) {
         return Status::OK();
     }
 
@@ -87,7 +102,7 @@ Status 
SchemaEncryptionKeysScanner::get_next_block_internal(vectorized::Block* b
 Status SchemaEncryptionKeysScanner::_fill_block_impl(vectorized::Block* block) 
{
     SCOPED_TIMER(_fill_block_timer);
 
-    const auto& encryption_keys = _result.master_keys;
+    const auto& encryption_keys = _master_keys;
     size_t row_num = encryption_keys.size();
     if (row_num == 0) {
         return Status::OK();
@@ -110,28 +125,48 @@ Status 
SchemaEncryptionKeysScanner::_fill_block_impl(vectorized::Block* block) {
 
             if (col_desc.type == TYPE_STRING) {
                 switch (col_idx) {
-                case 0: // ID
-                    column_value = encryption_key.__isset.id ? 
encryption_key.id : "";
+                case 0:
+                    column_value = encryption_key.has_id() ? 
encryption_key.id() : "";
                     break;
-                case 2: // VERSION
-                    column_value = encryption_key.__isset.parent_id ? 
encryption_key.parent_id : "";
+                case 2:
+                    column_value = encryption_key.has_parent_id() ? 
encryption_key.parent_id() : "";
                     break;
-                case 4: // CREATE_TIME
-                    column_value =
-                            encryption_key.__isset.type ? 
to_string(encryption_key.type) : "";
+                case 4:
+                    if (!encryption_key.has_type()) {
+                        break;
+                    }
+                    switch (encryption_key.type()) {
+                    case doris::EncryptionKeyTypePB::DATA_KEY:
+                        column_value = "DATA KEY";
+                        break;
+                    case doris::EncryptionKeyTypePB::MASTER_KEY:
+                        column_value = "MASTER KEY";
+                        break;
+                    }
                     break;
-                case 5: // PAUSE_TIME
-                    column_value = encryption_key.__isset.algorithm
-                                           ? 
to_string(encryption_key.algorithm)
-                                           : "";
+                case 5:
+                    if (!encryption_key.has_algorithm()) {
+                        break;
+                    }
+                    switch (encryption_key.algorithm()) {
+                    case doris::EncryptionAlgorithmPB::PLAINTEXT:
+                        column_value = "";
+                        break;
+                    case doris::EncryptionAlgorithmPB::AES_256_CTR:
+                        column_value = "AES_256_CTR";
+                        break;
+                    case doris::EncryptionAlgorithmPB::SM4_128_CTR:
+                        column_value = "SM4_128_CTR";
+                        break;
+                    }
                     break;
-                case 6: // END_TIME
-                    tmp_str = encryption_key.__isset.iv ? encryption_key.iv : 
"";
-                    base64_encode(tmp_str, &column_value);
+                case 6:
+                    column_value = encryption_key.has_iv_base64() ? 
encryption_key.iv_base64() : "";
                     break;
-                case 7: // DB_NAME
-                    tmp_str = encryption_key.__isset.ciphertext ? 
encryption_key.ciphertext : "";
-                    base64_encode(tmp_str, &column_value);
+                case 7:
+                    column_value = encryption_key.has_ciphertext_base64()
+                                           ? encryption_key.ciphertext_base64()
+                                           : "";
                     break;
                 }
 
@@ -141,25 +176,26 @@ Status 
SchemaEncryptionKeysScanner::_fill_block_impl(vectorized::Block* block) {
             } else if (col_desc.type == TYPE_INT) {
                 switch (col_idx) {
                 case 1:
-                    int_vals[row_idx] = encryption_key.__isset.version ? 
encryption_key.version : 0;
+                    int_vals[row_idx] =
+                            encryption_key.has_version() ? 
encryption_key.has_version() : 0;
                     break;
                 case 3:
-                    int_vals[row_idx] = encryption_key.__isset.parent_version
-                                                ? encryption_key.parent_version
+                    int_vals[row_idx] = encryption_key.has_parent_version()
+                                                ? 
encryption_key.parent_version()
                                                 : 0;
                     break;
                 case 8:
-                    int_vals[row_idx] = encryption_key.__isset.crc ? 
encryption_key.crc : 0;
+                    int_vals[row_idx] = encryption_key.has_crc32() ? 
encryption_key.crc32() : 0;
                     break;
                 }
                 datas[row_idx] = &int_vals[row_idx];
             } else if (col_desc.type == TYPE_DATETIMEV2) {
                 switch (col_idx) {
                 case 9:
-                    date_vals[row_idx].from_unixtime(encryption_key.ctime / 
1000, "UTC");
+                    date_vals[row_idx].from_unixtime(encryption_key.ctime() / 
1000, "UTC");
                     break;
                 case 10:
-                    date_vals[row_idx].from_unixtime(encryption_key.mtime / 
1000, "UTC");
+                    date_vals[row_idx].from_unixtime(encryption_key.mtime() / 
1000, "UTC");
                     break;
                 }
                 datas[row_idx] = &date_vals[row_idx];
diff --git a/be/src/exec/schema_scanner/schema_encryption_keys_scanner.h 
b/be/src/exec/schema_scanner/schema_encryption_keys_scanner.h
index 4f326d35e63..38a36c38fe4 100644
--- a/be/src/exec/schema_scanner/schema_encryption_keys_scanner.h
+++ b/be/src/exec/schema_scanner/schema_encryption_keys_scanner.h
@@ -18,6 +18,7 @@
 #pragma once
 
 #include <gen_cpp/FrontendService_types.h>
+#include <gen_cpp/olap_file.pb.h>
 
 #include <vector>
 
@@ -43,8 +44,8 @@ public:
 private:
     Status _fill_block_impl(vectorized::Block* block);
 
-    TGetEncryptionKeysResult _result;
+    std::vector<EncryptionKeyPB> _master_keys;
     static std::vector<SchemaScanner::ColumnDesc> _s_tbls_columns;
 };
 
-} // namespace doris
\ No newline at end of file
+} // namespace doris
diff --git 
a/be/test/exec/schema_scanner/schema_encryption_keys_scanner_test.cpp 
b/be/test/exec/schema_scanner/schema_encryption_keys_scanner_test.cpp
index 5efc54e3f5b..1b01d581fb8 100644
--- a/be/test/exec/schema_scanner/schema_encryption_keys_scanner_test.cpp
+++ b/be/test/exec/schema_scanner/schema_encryption_keys_scanner_test.cpp
@@ -18,6 +18,7 @@
 #include "exec/schema_scanner/schema_encryption_keys_scanner.h"
 
 #include <gen_cpp/FrontendService_types.h>
+#include <gen_cpp/olap_file.pb.h>
 #include <gtest/gtest.h>
 
 #include "vec/core/block.h"
@@ -30,17 +31,15 @@ class ScheamEncryptionKeysScannerTest : public 
testing::Test {
 };
 
 TEST_F(ScheamEncryptionKeysScannerTest, test_get_next_block_internal) {
-    TEncryptionKey t_key;
-    std::vector<TEncryptionKey> keys;
-    keys.push_back(t_key);
-
-    SchemaEncryptionKeysScanner scnanner;
-    scnanner._result.__set_master_keys(keys);
+    SchemaEncryptionKeysScanner scanner;
+    auto& keys = scanner._master_keys;
+    EncryptionKeyPB key;
+    keys.push_back(key);
 
     auto data_block = vectorized::Block::create_unique();
-    scnanner._init_block(data_block.get());
+    scanner._init_block(data_block.get());
 
-    auto st = scnanner._fill_block_impl(data_block.get());
+    auto st = scanner._fill_block_impl(data_block.get());
 }
 
-} // namespace doris
\ No newline at end of file
+} // namespace doris
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/encryption/EncryptionKey.java 
b/fe/fe-core/src/main/java/org/apache/doris/encryption/EncryptionKey.java
index 19608dae97e..b1663264cf3 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/encryption/EncryptionKey.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/encryption/EncryptionKey.java
@@ -17,10 +17,6 @@
 
 package org.apache.doris.encryption;
 
-import org.apache.doris.thrift.TEncryptionAlgorithm;
-import org.apache.doris.thrift.TEncryptionKey;
-import org.apache.doris.thrift.TEncryptionKeyType;
-
 import com.google.gson.annotations.SerializedName;
 
 public class EncryptionKey {
@@ -77,38 +73,4 @@ public class EncryptionKey {
             + ", ctime=" + ctime
             + ", mtime=" + mtime + '}';
     }
-
-    public TEncryptionKey toThrift() {
-        TEncryptionKey tKey = new TEncryptionKey();
-        tKey.setId(this.id);
-        tKey.setVersion(this.version);
-        tKey.setParentId(this.parentId);
-        tKey.setParentVersion(this.parentVersion);
-
-        // Convert algorithm enum
-        if (this.algorithm == EncryptionKey.Algorithm.AES256) {
-            tKey.setAlgorithm(TEncryptionAlgorithm.AES256);
-        } else if (this.algorithm == EncryptionKey.Algorithm.SM4) {
-            tKey.setAlgorithm(TEncryptionAlgorithm.SM4);
-        } else {
-            throw new IllegalArgumentException("Unknown algorithm: " + 
this.algorithm);
-        }
-
-        if (this.type == KeyType.MASTER_KEY) {
-            tKey.setType(TEncryptionKeyType.MASTER_KEY);
-        } else if (this.type == KeyType.DATA_KEY) {
-            tKey.setType(TEncryptionKeyType.DATA_KEY);
-        } else {
-            throw new IllegalArgumentException("Unknown key type: " + 
this.type);
-        }
-
-        tKey.setCiphertext(this.ciphertext);
-        tKey.setPlaintext(this.plaintext);
-        tKey.setIv(this.iv);
-        tKey.setCrc(this.crc);
-        tKey.setCtime(this.ctime);
-        tKey.setMtime(this.mtime);
-
-        return tKey;
-    }
 }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/encryption/KeyManager.java 
b/fe/fe-core/src/main/java/org/apache/doris/encryption/KeyManager.java
deleted file mode 100644
index 1a2bb90c497..00000000000
--- a/fe/fe-core/src/main/java/org/apache/doris/encryption/KeyManager.java
+++ /dev/null
@@ -1,37 +0,0 @@
-// 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.
-
-package org.apache.doris.encryption;
-
-import org.apache.doris.common.io.Text;
-import org.apache.doris.common.io.Writable;
-import org.apache.doris.persist.gson.GsonUtils;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-public class KeyManager implements Writable {
-    @Override
-    public void write(DataOutput out) throws IOException {
-        Text.writeString(out, GsonUtils.GSON.toJson(this));
-    }
-
-    public static KeyManager read(DataInput in) throws IOException {
-        return GsonUtils.GSON.fromJson(Text.readString(in), KeyManager.class);
-    }
-}
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/encryption/KeyManagerStore.java 
b/fe/fe-core/src/main/java/org/apache/doris/encryption/KeyManagerStore.java
index 53a88af532f..89ca1c3a6b7 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/encryption/KeyManagerStore.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/encryption/KeyManagerStore.java
@@ -32,7 +32,6 @@ import java.io.DataOutput;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.TreeMap;
 
 public class KeyManagerStore implements Writable {
     private static final Logger LOG = 
LogManager.getLogger(KeyManagerStore.class);
@@ -44,26 +43,11 @@ public class KeyManagerStore implements Writable {
 
     @Setter
     @Getter
-    @SerializedName(value = "masterKeyMap")
-    private TreeMap<Integer, EncryptionKey> masterKeyMap = new TreeMap<>();
+    @SerializedName(value = "masterKeys")
+    private List<EncryptionKey> masterKeys = new ArrayList<>();
 
-    public void writeRootKeyInfo(RootKeyInfo rootKeyInfo) {
-    }
-
-    public void setMasterKey(EncryptionKey masterKey) {
-        masterKeyMap.put(masterKey.version, masterKey);
-    }
-
-    public EncryptionKey getMaxVersionMasterKey() {
-        return masterKeyMap.lastEntry().getValue();
-    }
-
-    public List<EncryptionKey> getAllVersionMasterKey() {
-        return new ArrayList<>(masterKeyMap.values());
-    }
-
-    public EncryptionKey getMasterKey(int version) {
-        return masterKeyMap.get(version);
+    public void addMasterKey(EncryptionKey masterKey) {
+        masterKeys.add(masterKey);
     }
 
     @Override
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/encryption/RootKeyInfo.java 
b/fe/fe-core/src/main/java/org/apache/doris/encryption/RootKeyInfo.java
index c83132e110f..a379a125707 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/encryption/RootKeyInfo.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/encryption/RootKeyInfo.java
@@ -44,5 +44,8 @@ public class RootKeyInfo {
 
     @SerializedName(value = "sk")
     public String sk;
+
+    @SerializedName(value = "password")
+    public String password;
 }
 
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/persist/KeyOperationInfo.java 
b/fe/fe-core/src/main/java/org/apache/doris/persist/KeyOperationInfo.java
index b9724120c90..833b43c727a 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/persist/KeyOperationInfo.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/persist/KeyOperationInfo.java
@@ -30,6 +30,8 @@ import lombok.Setter;
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
 
 public class KeyOperationInfo implements Writable {
     public enum KeyOPType {
@@ -49,7 +51,11 @@ public class KeyOperationInfo implements Writable {
     @Setter
     @Getter
     @SerializedName(value = "masterKey")
-    private EncryptionKey masterKey;
+    private List<EncryptionKey> masterKeys = new ArrayList<>();
+
+    public void addMasterKey(EncryptionKey key) {
+        masterKeys.add(key);
+    }
 
     @Override
     public void write(DataOutput out) throws IOException {
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java 
b/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
index 84c7cdd3055..9b6f5c545e0 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
@@ -105,6 +105,10 @@ import org.apache.doris.planner.OlapTableSink;
 import org.apache.doris.plsql.metastore.PlsqlPackage;
 import org.apache.doris.plsql.metastore.PlsqlProcedureKey;
 import org.apache.doris.plsql.metastore.PlsqlStoredProcedure;
+import org.apache.doris.proto.OlapFile.EncryptionAlgorithmPB;
+import org.apache.doris.proto.OlapFile.EncryptionKeyPB;
+import org.apache.doris.proto.OlapFile.EncryptionKeyPB.Builder;
+import org.apache.doris.proto.OlapFile.EncryptionKeyTypePB;
 import org.apache.doris.qe.ConnectContext;
 import org.apache.doris.qe.ConnectContext.ConnectType;
 import org.apache.doris.qe.ConnectProcessor;
@@ -292,6 +296,7 @@ import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Multimap;
 import com.google.common.collect.Sets;
+import com.google.protobuf.ByteString;
 import com.google.protobuf.InvalidProtocolBufferException;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -1425,7 +1430,45 @@ public class FrontendServiceImpl implements 
FrontendService.Iface {
         return result;
     }
 
-    public TGetEncryptionKeysResult 
getEncryptionKeys(TGetEncryptionKeysRequest request) throws TException {
+    public TEncryptionKey encryptionKeyToThrift(EncryptionKey encryptionKey) {
+        Builder builder = EncryptionKeyPB.newBuilder();
+        builder.setId(encryptionKey.id);
+        builder.setVersion(encryptionKey.version);
+        builder.setParentId(encryptionKey.parentId);
+        builder.setParentVersion(encryptionKey.parentVersion);
+        switch (encryptionKey.algorithm) {
+            case AES256:
+                builder.setAlgorithm(EncryptionAlgorithmPB.AES_256_CTR);
+                break;
+            case SM4:
+                builder.setAlgorithm(EncryptionAlgorithmPB.SM4_128_CTR);
+                break;
+            default:
+                // do nothing
+        }
+        switch (encryptionKey.type) {
+            case DATA_KEY:
+                builder.setType(EncryptionKeyTypePB.DATA_KEY);
+                break;
+            case MASTER_KEY:
+                builder.setType(EncryptionKeyTypePB.MASTER_KEY);
+                break;
+            default:
+                // do nothing
+        }
+        builder.setCiphertextBase64(encryptionKey.ciphertext);
+        builder.setPlaintext(ByteString.copyFrom(encryptionKey.plaintext));
+        builder.setCrc32(encryptionKey.crc);
+        builder.setCtime(encryptionKey.ctime);
+        builder.setMtime(encryptionKey.mtime);
+        EncryptionKeyPB keyPB = builder.build();
+
+        TEncryptionKey tk = new TEncryptionKey();
+        tk.setKeyPb(keyPB.toByteArray());
+        return tk;
+    }
+
+    public TGetEncryptionKeysResult 
getEncryptionKeys(TGetEncryptionKeysRequest request) {
         String clientAddr = getClientAddrAsString();
         if (LOG.isDebugEnabled()) {
             LOG.debug("receive getDataKeys request: {}, backend: {}", request, 
clientAddr);
@@ -1442,10 +1485,10 @@ public class FrontendServiceImpl implements 
FrontendService.Iface {
             return result;
         }
         try {
-            List<TEncryptionKey> tKeys = new ArrayList<TEncryptionKey>();
+            List<TEncryptionKey> tKeys = new ArrayList<>();
             List<EncryptionKey> keys =  
Env.getCurrentEnv().getKeyManager().getAllMasterKeys();
             for (EncryptionKey key : keys) {
-                tKeys.add(key.toThrift());
+                tKeys.add(encryptionKeyToThrift(key));
             }
             result.setMasterKeys(tKeys);
         } catch (Exception e) {
diff --git a/gensrc/proto/olap_file.proto b/gensrc/proto/olap_file.proto
index 6e7dea46150..00d7d5384d8 100644
--- a/gensrc/proto/olap_file.proto
+++ b/gensrc/proto/olap_file.proto
@@ -688,3 +688,34 @@ message PartialUpdateInfoPB {
     optional UniqueKeyUpdateModePB partial_update_mode = 14 [default = UPSERT];
     optional PartialUpdateNewRowPolicyPB partial_update_new_key_policy = 15 
[default = APPEND];
 }
+
+message FileEncryptionInfoPB {
+    optional EncryptionKeyPB data_key_info = 1;
+    optional bytes data_iv_nonce = 2;
+}
+
+message EncryptionKeyPB {
+    optional string id = 1;
+    optional int32 version = 2;
+    optional string parent_id = 3;
+    optional int32 parent_version = 4;
+    optional EncryptionKeyTypePB type = 5;
+    optional EncryptionAlgorithmPB algorithm = 6;
+    optional string ciphertext_base64 = 7;
+    optional bytes plaintext = 8;
+    optional string iv_base64 = 9;
+    optional int64 crc32 = 10;
+    optional int64 ctime = 11;
+    optional int64 mtime = 12;
+}
+
+enum EncryptionKeyTypePB {
+    MASTER_KEY = 0;
+    DATA_KEY = 1;
+}
+
+enum EncryptionAlgorithmPB {
+    PLAINTEXT = 0;
+    AES_256_CTR = 1;
+    SM4_128_CTR = 2;
+}
diff --git a/gensrc/thrift/AgentService.thrift 
b/gensrc/thrift/AgentService.thrift
index 691aaad0c82..67427288a59 100644
--- a/gensrc/thrift/AgentService.thrift
+++ b/gensrc/thrift/AgentService.thrift
@@ -62,6 +62,12 @@ enum TStorageFormat {
     V2 = 2
 }
 
+enum TEncryptionAlgorithm {
+    PLAINTEXT = 0,
+    AES256 = 1,
+    SM4 = 2
+}
+
 enum TTabletType {
     TABLET_TYPE_DISK = 0,
     TABLET_TYPE_MEMORY = 1
diff --git a/gensrc/thrift/FrontendService.thrift 
b/gensrc/thrift/FrontendService.thrift
index 274b8fd11fd..9c9676d72b0 100644
--- a/gensrc/thrift/FrontendService.thrift
+++ b/gensrc/thrift/FrontendService.thrift
@@ -1614,29 +1614,13 @@ struct TPlanNodeRuntimeStatsItem {
     12: optional i32 instance_num
 }
 
-enum TEncryptionAlgorithm {
-    AES256 = 0,
-    SM4 = 1
-}
-
 enum TEncryptionKeyType {
     MASTER_KEY = 0,
     DATA_KEY = 1,
 }
 
 struct TEncryptionKey {
-    1: optional string id
-    2: optional i32 version
-    3: optional string parent_id
-    4: optional i32 parent_version
-    5: optional TEncryptionKeyType type
-    6: optional TEncryptionAlgorithm algorithm
-    7: optional string ciphertext
-    8: optional binary plaintext
-    9: optional string iv
-    10: optional i64 crc
-    11: optional i64 ctime
-    12: optional i64 mtime
+    1: optional binary key_pb;
 }
 
 struct TGetEncryptionKeysRequest {
@@ -1648,6 +1632,16 @@ struct TGetEncryptionKeysResult {
     2: optional list<TEncryptionKey> master_keys
 }
 
+struct TGetTableTDEInfoRequest {
+    1: optional i64 db_id
+    2: optional i64 table_id
+}
+
+struct TGetTableTDEInfoResult {
+    1: optional Status.TStatus status
+    2: optional AgentService.TEncryptionAlgorithm algorithm
+}
+
 service FrontendService {
     TGetDbsResult getDbNames(1: TGetDbsParams params)
     TGetTablesResult getTableNames(1: TGetTablesParams params)
diff --git 
a/regression-test/suites/query_p0/system/test_query_sys_tables.groovy 
b/regression-test/suites/query_p0/system/test_query_sys_tables.groovy
index 6dc8888921d..b603d03e9e4 100644
--- a/regression-test/suites/query_p0/system/test_query_sys_tables.groovy
+++ b/regression-test/suites/query_p0/system/test_query_sys_tables.groovy
@@ -258,6 +258,9 @@ suite("test_query_sys_tables", "query,p0") {
     String[][] systabs = sql "USE information_schema;show tables"
     System.out.println(systabs)
     for (String[] tab : systabs) {
+        if (tab[0].contains("encryption_keys")) {
+            continue
+        }
         sql "select * from ${tab[0]} limit 10"
     }
 }


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

Reply via email to