Skip to content

Commit

Permalink
[Enhancement] Add enable_tde global var (StarRocks#51329)
Browse files Browse the repository at this point in the history
## Why I'm doing:

It hard for user to know if cluster is configed with TDE

## What I'm doing:

Add a enable_tde global var to show if cluste is configed with TDE

Signed-off-by: Binglin Chang <[email protected]>
  • Loading branch information
decster authored Sep 24, 2024
1 parent 1ab795f commit 8a0d67d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fe/fe-core/src/main/java/com/starrocks/encryption/KeyMgr.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()) {
Expand Down
5 changes: 5 additions & 0 deletions fe/fe-core/src/main/java/com/starrocks/qe/GlobalVariable.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 8a0d67d

Please sign in to comment.