diff --git a/CHANGELOG.md b/CHANGELOG.md index 5dfc32d2821..a915b9be7d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)). diff --git a/docs/en/operations/server-configuration-parameters/settings.md b/docs/en/operations/server-configuration-parameters/settings.md index ee5e365481e..044a650744b 100644 --- a/docs/en/operations/server-configuration-parameters/settings.md +++ b/docs/en/operations/server-configuration-parameters/settings.md @@ -3277,7 +3277,7 @@ Type: UInt64 Default value: 100 -## 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). diff --git a/programs/local/LocalServer.cpp b/programs/local/LocalServer.cpp index 11ea64c6400..7ba59b81d34 100644 --- a/programs/local/LocalServer.cpp +++ b/programs/local/LocalServer.cpp @@ -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; @@ -803,7 +803,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]; diff --git a/programs/server/Server.cpp b/programs/server/Server.cpp index 78b87c175b2..7d98178e096 100644 --- a/programs/server/Server.cpp +++ b/programs/server/Server.cpp @@ -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; @@ -1784,7 +1784,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]); diff --git a/src/Access/SettingsConstraints.cpp b/src/Access/SettingsConstraints.cpp index cb1d433766a..67f13f8430a 100644 --- a/src/Access/SettingsConstraints.cpp +++ b/src/Access/SettingsConstraints.cpp @@ -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); } diff --git a/src/Core/ServerSettings.cpp b/src/Core/ServerSettings.cpp index 6c327291f84..3c1dea18259 100644 --- a/src/Core/ServerSettings.cpp +++ b/src/Core/ServerSettings.cpp @@ -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}}, }; diff --git a/src/Interpreters/Context.cpp b/src/Interpreters/Context.cpp index 66e8eff64bb..1366995f1c3 100644 --- a/src/Interpreters/Context.cpp +++ b/src/Interpreters/Context.cpp @@ -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); diff --git a/src/Interpreters/HashJoin/ScatteredBlock.h b/src/Interpreters/HashJoin/ScatteredBlock.h index 729377f6758..31ff773d04d 100644 --- a/src/Interpreters/HashJoin/ScatteredBlock.h +++ b/src/Interpreters/HashJoin/ScatteredBlock.h @@ -302,10 +302,11 @@ struct ScatteredBlock : private boost::noncopyable /// Cut first `num_rows` rows from `block` in place and returns block with remaining rows ScatteredBlock cut(size_t num_rows) { - SCOPE_EXIT(filterBySelector()); - if (num_rows >= rows()) + { + filterBySelector(); return ScatteredBlock{Block{}}; + } chassert(block); @@ -314,6 +315,7 @@ struct ScatteredBlock : private boost::noncopyable auto remaining = ScatteredBlock{block, std::move(remaining_selector)}; selector = std::move(first_num_rows); + filterBySelector(); return remaining; } diff --git a/src/Storages/MergeTree/MergeTreeSettings.cpp b/src/Storages/MergeTree/MergeTreeSettings.cpp index ae8baf1dae5..f62c7e53a46 100644 --- a/src/Storages/MergeTree/MergeTreeSettings.cpp +++ b/src/Storages/MergeTree/MergeTreeSettings.cpp @@ -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()); } } diff --git a/tests/integration/test_allowed_feature_tier/__init__.py b/tests/integration/test_allow_feature_tier/__init__.py similarity index 100% rename from tests/integration/test_allowed_feature_tier/__init__.py rename to tests/integration/test_allow_feature_tier/__init__.py diff --git a/tests/integration/test_allow_feature_tier/configs/allow_feature_tier.xml b/tests/integration/test_allow_feature_tier/configs/allow_feature_tier.xml new file mode 100644 index 00000000000..a0bd0fa6c24 --- /dev/null +++ b/tests/integration/test_allow_feature_tier/configs/allow_feature_tier.xml @@ -0,0 +1,3 @@ + + 0 + diff --git a/tests/integration/test_allowed_feature_tier/configs/users.d/users.xml b/tests/integration/test_allow_feature_tier/configs/users.d/users.xml similarity index 100% rename from tests/integration/test_allowed_feature_tier/configs/users.d/users.xml rename to tests/integration/test_allow_feature_tier/configs/users.d/users.xml diff --git a/tests/integration/test_allowed_feature_tier/test.py b/tests/integration/test_allow_feature_tier/test.py similarity index 96% rename from tests/integration/test_allowed_feature_tier/test.py rename to tests/integration/test_allow_feature_tier/test.py index fff1ff76906..dd649a68a93 100644 --- a/tests/integration/test_allowed_feature_tier/test.py +++ b/tests/integration/test_allow_feature_tier/test.py @@ -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) diff --git a/tests/integration/test_allowed_feature_tier/configs/allowed_feature_tier.xml b/tests/integration/test_allowed_feature_tier/configs/allowed_feature_tier.xml deleted file mode 100644 index f24c54711f4..00000000000 --- a/tests/integration/test_allowed_feature_tier/configs/allowed_feature_tier.xml +++ /dev/null @@ -1,3 +0,0 @@ - - 0 -