[improvement](session variable)Add enable_file_cache session variable (#16268)

Add enable_file_cache session variable, so that we can close file cache without restart BE.
This commit is contained in:
Jibing-Li
2023-02-01 18:15:03 +08:00
committed by GitHub
parent 4e92f63d7b
commit d224624bbe
7 changed files with 32 additions and 3 deletions

View File

@ -259,6 +259,7 @@ public class SessionVariable implements Serializable, Writable {
public static final String ENABLE_TWO_PHASE_READ_OPT = "enable_two_phase_read_opt";
public static final String TWO_PHASE_READ_OPT_LIMIT_THRESHOLD = "two_phase_read_opt_limit_threshold";
public static final String ENABLE_FILE_CACHE = "enable_file_cache";
public static final String GROUP_BY_AND_HAVING_USE_ALIAS_FIRST = "group_by_and_having_use_alias_first";
@ -686,6 +687,10 @@ public class SessionVariable implements Serializable, Writable {
@VariableMgr.VarAttr(name = GROUP_BY_AND_HAVING_USE_ALIAS_FIRST)
public boolean groupByAndHavingUseAliasFirst = false;
// Whether enable block file cache. Only take effect when BE config item enable_file_cache is true.
@VariableMgr.VarAttr(name = ENABLE_FILE_CACHE, needForward = true)
public boolean enableFileCache = true;
// If this fe is in fuzzy mode, then will use initFuzzyModeVariables to generate some variables,
// not the default value set in the code.
public void initFuzzyModeVariables() {
@ -1388,6 +1393,14 @@ public class SessionVariable implements Serializable, Writable {
}
}
public boolean isEnableFileCache() {
return enableFileCache;
}
public void setEnableFileCache(boolean enableFileCache) {
this.enableFileCache = enableFileCache;
}
/**
* Serialize to thrift object.
* Used for rest api.
@ -1450,6 +1463,8 @@ public class SessionVariable implements Serializable, Writable {
tResult.setExternalSortBytesThreshold(externalSortBytesThreshold);
tResult.setEnableFileCache(enableFileCache);
return tResult;
}