diff --git a/fe/fe-core/src/main/java/com/starrocks/encryption/KeyMgr.java b/fe/fe-core/src/main/java/com/starrocks/encryption/KeyMgr.java index a15e7cafedb4e..8905f6742650d 100644 --- a/fe/fe-core/src/main/java/com/starrocks/encryption/KeyMgr.java +++ b/fe/fe-core/src/main/java/com/starrocks/encryption/KeyMgr.java @@ -27,6 +27,7 @@ import com.starrocks.persist.metablock.SRMetaBlockWriter; import com.starrocks.proto.EncryptionKeyPB; import com.starrocks.proto.EncryptionMetaPB; +import com.starrocks.qe.GlobalVariable; import com.starrocks.server.GlobalStateMgr; import com.starrocks.thrift.TGetKeysRequest; import com.starrocks.thrift.TGetKeysResponse; @@ -102,6 +103,7 @@ protected EncryptionKey generateNewKEK() { public void initDefaultMasterKey() { String defaultMasterKeySpec = Config.default_master_key; + GlobalVariable.enableTde = isEncrypted(); keysLock.writeLock().lock(); try { if (defaultMasterKeySpec.isEmpty()) { diff --git a/fe/fe-core/src/main/java/com/starrocks/qe/GlobalVariable.java b/fe/fe-core/src/main/java/com/starrocks/qe/GlobalVariable.java index 88b65447e3d66..540f04eb39d03 100644 --- a/fe/fe-core/src/main/java/com/starrocks/qe/GlobalVariable.java +++ b/fe/fe-core/src/main/java/com/starrocks/qe/GlobalVariable.java @@ -38,6 +38,7 @@ import com.starrocks.common.Config; import com.starrocks.common.Version; import com.starrocks.common.util.TimeUtils; +import com.starrocks.encryption.KeyMgr; import com.starrocks.system.BackendResourceStat; import java.lang.reflect.Field; @@ -75,6 +76,7 @@ public final class GlobalVariable { public static final String QUERY_QUEUE_MAX_QUEUED_QUERIES = "query_queue_max_queued_queries"; public static final String ACTIVATE_ALL_ROLES_ON_LOGIN = "activate_all_roles_on_login"; public static final String ACTIVATE_ALL_ROLES_ON_LOGIN_V2 = "activate_all_roles_on_login_v2"; + public static final String ENABLE_TDE = "enable_tde"; @VariableMgr.VarAttr(name = VERSION_COMMENT, flag = VariableMgr.READ_ONLY) public static String versionComment = Version.STARROCKS_VERSION + "-" + Version.STARROCKS_COMMIT_HASH; @@ -173,6 +175,9 @@ public final class GlobalVariable { alias = ACTIVATE_ALL_ROLES_ON_LOGIN, show = ACTIVATE_ALL_ROLES_ON_LOGIN) private static boolean activateAllRolesOnLogin = false; + @VariableMgr.VarAttr(name = ENABLE_TDE, flag = VariableMgr.GLOBAL | VariableMgr.READ_ONLY) + public static boolean enableTde = KeyMgr.isEncrypted(); + public static boolean isEnableQueryQueueSelect() { return enableQueryQueueSelect; }