mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-17 20:02:05 +00:00
Test and fix reload of default profile with allowed experimental settings from config
This commit is contained in:
parent
268b823010
commit
ec0bdcc1cb
@ -289,7 +289,10 @@ BlockIO InterpreterSystemQuery::execute()
|
||||
|
||||
/// Use global context with fresh system profile settings
|
||||
auto system_context = Context::createCopy(getContext()->getGlobalContext());
|
||||
system_context->setSetting("profile", getContext()->getSystemProfileName());
|
||||
/// Don't check for constraints when changing profile. It was accepted before (for example it might include
|
||||
/// some experimental settings)
|
||||
bool check_constraints = false;
|
||||
system_context->setCurrentProfile(getContext()->getSystemProfileName(), check_constraints);
|
||||
|
||||
/// Make canonical query for simpler processing
|
||||
if (query.type == Type::RELOAD_DICTIONARY)
|
||||
|
@ -0,0 +1,17 @@
|
||||
<clickhouse>
|
||||
<profiles>
|
||||
<default>
|
||||
<allow_experimental_time_series_table>0</allow_experimental_time_series_table>
|
||||
</default>
|
||||
</profiles>
|
||||
<users>
|
||||
<default>
|
||||
<password></password>
|
||||
<profile>default</profile>
|
||||
<quota>default</quota>
|
||||
<named_collection_control>1</named_collection_control>
|
||||
<show_named_collections>1</show_named_collections>
|
||||
<show_named_collections_secrets>1</show_named_collections_secrets>
|
||||
</default>
|
||||
</users>
|
||||
</clickhouse>
|
@ -6,6 +6,9 @@ cluster = ClickHouseCluster(__file__)
|
||||
instance = cluster.add_instance(
|
||||
"instance",
|
||||
main_configs=["configs/allowed_feature_tier.xml"],
|
||||
user_configs=[
|
||||
"configs/users.d/users.xml",
|
||||
],
|
||||
stay_alive=True,
|
||||
)
|
||||
|
||||
@ -252,3 +255,43 @@ def test_allowed_feature_tier_in_user(start_cluster):
|
||||
instance.query("SYSTEM RELOAD CONFIG")
|
||||
assert "0" == get_current_tier_value(instance)
|
||||
instance.query("DROP USER IF EXISTS user_experimental")
|
||||
|
||||
|
||||
def test_it_is_possible_to_enable_experimental_settings_in_default_profile(
|
||||
start_cluster,
|
||||
):
|
||||
# You can disable changing experimental settings but changing the default value via global config file is ok
|
||||
# It will just make the default value different and block changes
|
||||
instance.replace_in_config(config_path, "0", "2")
|
||||
|
||||
# Change default user config
|
||||
instance.replace_in_config(
|
||||
"/etc/clickhouse-server/users.d/users.xml",
|
||||
"allow_experimental_time_series_table>.",
|
||||
"allow_experimental_time_series_table>1",
|
||||
)
|
||||
|
||||
instance.query("SYSTEM RELOAD CONFIG")
|
||||
assert "2" == get_current_tier_value(instance)
|
||||
output, error = instance.query_and_get_answer_with_error(
|
||||
"SELECT value FROM system.settings WHERE name = 'allow_experimental_time_series_table'"
|
||||
)
|
||||
assert output.strip() == "1"
|
||||
assert error == ""
|
||||
|
||||
# But it won't be possible to change it
|
||||
output, error = instance.query_and_get_answer_with_error(
|
||||
"SELECT 1 SETTINGS allow_experimental_time_series_table=0"
|
||||
)
|
||||
assert output == ""
|
||||
assert "Changes to EXPERIMENTAL settings are disabled" in error
|
||||
|
||||
instance.replace_in_config(config_path, "2", "0")
|
||||
instance.replace_in_config(
|
||||
"/etc/clickhouse-server/users.d/users.xml",
|
||||
"allow_experimental_time_series_table>.",
|
||||
"allow_experimental_time_series_table>0",
|
||||
)
|
||||
|
||||
instance.query("SYSTEM RELOAD CONFIG")
|
||||
assert "0" == get_current_tier_value(instance)
|
||||
|
Loading…
Reference in New Issue
Block a user