Merge pull request #72455 from Algunenano/rename_setting

Rename allowed_feature_tier to allow_feature_tier
This commit is contained in:
Raúl Marín 2024-11-26 15:54:01 +00:00 committed by GitHub
commit dd092411ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 22 additions and 22 deletions

View File

@ -26,7 +26,7 @@
* When retrieving data directly from a dictionary using Dictionary storage, dictionary table function, or direct SELECT from the dictionary itself, it is now enough to have `SELECT` permission or `dictGet` permission for the dictionary. This aligns with previous attempts to prevent ACL bypasses: https://github.com/ClickHouse/ClickHouse/pull/57362 and https://github.com/ClickHouse/ClickHouse/pull/65359. It also makes the latter one backward compatible. [#72051](https://github.com/ClickHouse/ClickHouse/pull/72051) ([Nikita Mikhaylov](https://github.com/nikitamikhaylov)).
#### Experimental feature
* Implement `allowed_feature_tier` as a global switch to disable all experimental / beta features. [#71841](https://github.com/ClickHouse/ClickHouse/pull/71841) [#71145](https://github.com/ClickHouse/ClickHouse/pull/71145) ([Raúl Marín](https://github.com/Algunenano)).
* Implement `allow_feature_tier` as a global switch to disable all experimental / beta features. [#71841](https://github.com/ClickHouse/ClickHouse/pull/71841) [#71145](https://github.com/ClickHouse/ClickHouse/pull/71145) ([Raúl Marín](https://github.com/Algunenano)).
* Fix possible error `No such file or directory` due to unescaped special symbols in files for JSON subcolumns. [#71182](https://github.com/ClickHouse/ClickHouse/pull/71182) ([Pavel Kruglov](https://github.com/Avogar)).
* Support alter from String to JSON. This PR also changes the serialization of JSON and Dynamic types to new version V2. Old version V1 can be still used by enabling setting `merge_tree_use_v1_object_and_dynamic_serialization` (can be used during upgrade to be able to rollback the version without issues). [#70442](https://github.com/ClickHouse/ClickHouse/pull/70442) ([Pavel Kruglov](https://github.com/Avogar)).
* Implement simple CAST from Map/Tuple/Object to new JSON through serialization/deserialization from JSON string. [#71320](https://github.com/ClickHouse/ClickHouse/pull/71320) ([Pavel Kruglov](https://github.com/Avogar)).

View File

@ -3287,7 +3287,7 @@ Type: Bool
Default value: `true`.
## allowed_feature_tier
## allow_feature_tier
Controls if the user can change settings related to the different feature tiers.
0 - Changes to any setting are allowed (experimental, beta, production).

View File

@ -79,7 +79,7 @@ namespace Setting
namespace ServerSetting
{
extern const ServerSettingsUInt32 allowed_feature_tier;
extern const ServerSettingsUInt32 allow_feature_tier;
extern const ServerSettingsDouble cache_size_to_ram_max_ratio;
extern const ServerSettingsUInt64 compiled_expression_cache_elements_size;
extern const ServerSettingsUInt64 compiled_expression_cache_size;
@ -804,7 +804,7 @@ void LocalServer::processConfig()
global_context->setQueryCache(0, 0, 0, 0);
/// Initialize allowed tiers
global_context->getAccessControl().setAllowTierSettings(server_settings[ServerSetting::allowed_feature_tier]);
global_context->getAccessControl().setAllowTierSettings(server_settings[ServerSetting::allow_feature_tier]);
#if USE_EMBEDDED_COMPILER
size_t compiled_expression_cache_max_size_in_bytes = server_settings[ServerSetting::compiled_expression_cache_size];

View File

@ -166,7 +166,7 @@ namespace MergeTreeSetting
namespace ServerSetting
{
extern const ServerSettingsUInt32 allowed_feature_tier;
extern const ServerSettingsUInt32 allow_feature_tier;
extern const ServerSettingsUInt32 asynchronous_heavy_metrics_update_period_s;
extern const ServerSettingsUInt32 asynchronous_metrics_update_period_s;
extern const ServerSettingsBool asynchronous_metrics_enable_heavy_metrics;
@ -1785,7 +1785,7 @@ try
global_context->setMaxDictionaryNumToWarn(new_server_settings[ServerSetting::max_dictionary_num_to_warn]);
global_context->setMaxDatabaseNumToWarn(new_server_settings[ServerSetting::max_database_num_to_warn]);
global_context->setMaxPartNumToWarn(new_server_settings[ServerSetting::max_part_num_to_warn]);
global_context->getAccessControl().setAllowTierSettings(new_server_settings[ServerSetting::allowed_feature_tier]);
global_context->getAccessControl().setAllowTierSettings(new_server_settings[ServerSetting::allow_feature_tier]);
/// Only for system.server_settings
global_context->setConfigReloaderInterval(new_server_settings[ServerSetting::config_reload_interval_ms]);

View File

@ -414,13 +414,13 @@ SettingsConstraints::Checker SettingsConstraints::getChecker(const Settings & cu
if (setting_tier == SettingsTierType::EXPERIMENTAL && !allowed_experimental)
return Checker(
PreformattedMessage::create(
"Cannot modify setting '{}'. Changes to EXPERIMENTAL settings are disabled in the server config ('allowed_feature_tier')",
"Cannot modify setting '{}'. Changes to EXPERIMENTAL settings are disabled in the server config ('allow_feature_tier')",
setting_name),
ErrorCodes::READONLY);
if (setting_tier == SettingsTierType::BETA && !allowed_beta)
return Checker(
PreformattedMessage::create(
"Cannot modify setting '{}'. Changes to BETA settings are disabled in the server config ('allowed_feature_tier')",
"Cannot modify setting '{}'. Changes to BETA settings are disabled in the server config ('allow_feature_tier')",
setting_name),
ErrorCodes::READONLY);
}

View File

@ -209,7 +209,7 @@ namespace DB
DECLARE(UInt64, load_marks_threadpool_queue_size, 1000000, "Number of tasks which is possible to push into prefetches pool", 0) \
DECLARE(UInt64, threadpool_writer_pool_size, 100, "Size of background pool for write requests to object storages", 0) \
DECLARE(UInt64, threadpool_writer_queue_size, 1000000, "Number of tasks which is possible to push into background pool for write requests to object storages", 0) \
DECLARE(UInt32, allowed_feature_tier, 0, "0 - All feature tiers allowed (experimental, beta, production). 1 - Only beta and production feature tiers allowed. 2 - Only production feature tier allowed", 0) \
DECLARE(UInt32, allow_feature_tier, 0, "0 - All feature tiers allowed (experimental, beta, production). 1 - Only beta and production feature tiers allowed. 2 - Only production feature tier allowed", 0) \
// clang-format on
@ -328,7 +328,7 @@ void ServerSettings::dumpToSystemServerSettingsColumns(ServerSettingColumnsParam
{"mutation_workload", {context->getMutationWorkload(), ChangeableWithoutRestart::Yes}},
{"config_reload_interval_ms", {std::to_string(context->getConfigReloaderInterval()), ChangeableWithoutRestart::Yes}},
{"allowed_feature_tier",
{"allow_feature_tier",
{std::to_string(context->getAccessControl().getAllowTierSettings()), ChangeableWithoutRestart::Yes}},
};

View File

@ -5032,7 +5032,7 @@ void Context::setDefaultProfiles(const Poco::Util::AbstractConfiguration & confi
/// Don't check for constraints on first load. This makes the default profile consistent with other users, where
/// the default value set in the config might be outside of the constraints range
/// It makes it possible to change the value of experimental settings with `allowed_feature_tier` != 2
/// It makes it possible to change the value of experimental settings with `allow_feature_tier` != 2
bool check_constraints = false;
setCurrentProfile(shared->system_profile_name, check_constraints);

View File

@ -396,14 +396,14 @@ void MergeTreeSettingsImpl::sanityCheck(size_t background_pool_tasks, bool allow
throw Exception(
ErrorCodes::READONLY,
"Cannot modify setting '{}'. Changes to EXPERIMENTAL settings are disabled in the server config "
"('allowed_feature_tier')",
"('allow_feature_tier')",
setting.getName());
}
if (!allow_beta && tier == BETA)
{
throw Exception(
ErrorCodes::READONLY,
"Cannot modify setting '{}'. Changes to BETA settings are disabled in the server config ('allowed_feature_tier')",
"Cannot modify setting '{}'. Changes to BETA settings are disabled in the server config ('allow_feature_tier')",
setting.getName());
}
}

View File

@ -0,0 +1,3 @@
<clickhouse>
<allow_feature_tier>0</allow_feature_tier>
</clickhouse>

View File

@ -5,14 +5,14 @@ from helpers.cluster import ClickHouseCluster
cluster = ClickHouseCluster(__file__)
instance = cluster.add_instance(
"instance",
main_configs=["configs/allowed_feature_tier.xml"],
main_configs=["configs/allow_feature_tier.xml"],
user_configs=[
"configs/users.d/users.xml",
],
stay_alive=True,
)
feature_tier_path = "/etc/clickhouse-server/config.d/allowed_feature_tier.xml"
feature_tier_path = "/etc/clickhouse-server/config.d/allow_feature_tier.xml"
@pytest.fixture(scope="module")
@ -26,12 +26,12 @@ def start_cluster():
def get_current_tier_value(instance):
query_with_current_tier_value = (
"SELECT value FROM system.server_settings where name = 'allowed_feature_tier'"
"SELECT value FROM system.server_settings where name = 'allow_feature_tier'"
)
return instance.query(query_with_current_tier_value).strip()
def test_allowed_feature_tier_in_general_settings(start_cluster):
def test_allow_feature_tier_in_general_settings(start_cluster):
# We use these settings as an example. If it fails in the future because you've changed the tier of the setting
# please change it to another setting in the same tier. If there is none, feel free to comment out the test for that tier
query_with_experimental_setting = (
@ -82,7 +82,7 @@ def test_allowed_feature_tier_in_general_settings(start_cluster):
assert "0" == get_current_tier_value(instance)
def test_allowed_feature_tier_in_mergetree_settings(start_cluster):
def test_allow_feature_tier_in_mergetree_settings(start_cluster):
assert "0" == get_current_tier_value(instance)
instance.query("DROP TABLE IF EXISTS test_experimental")
@ -170,7 +170,7 @@ def test_allowed_feature_tier_in_mergetree_settings(start_cluster):
instance.query("DROP TABLE IF EXISTS test_experimental")
def test_allowed_feature_tier_in_user(start_cluster):
def test_allow_feature_tier_in_user(start_cluster):
instance.query("DROP USER IF EXISTS user_experimental")
assert "0" == get_current_tier_value(instance)

View File

@ -1,3 +0,0 @@
<clickhouse>
<allowed_feature_tier>0</allowed_feature_tier>
</clickhouse>