mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-28 02:21:59 +00:00
Merge pull request #48516 from MikhailBurdukov/mburdukov_multi_settings
"changed" flag in system.settings is calculated incorrectly for settings with multiple values
This commit is contained in:
commit
8ebad126e2
@ -453,8 +453,8 @@ struct SettingFieldMultiEnum
|
||||
explicit operator StorageType() const { return value.getValue(); }
|
||||
explicit operator Field() const { return toString(); }
|
||||
|
||||
SettingFieldMultiEnum & operator= (StorageType x) { changed = x != value.getValue(); value.setValue(x); return *this; }
|
||||
SettingFieldMultiEnum & operator= (ValueType x) { changed = !(x == value); value = x; return *this; }
|
||||
SettingFieldMultiEnum & operator= (StorageType x) { changed = true; value.setValue(x); return *this; }
|
||||
SettingFieldMultiEnum & operator= (ValueType x) { changed = true; value = x; return *this; }
|
||||
SettingFieldMultiEnum & operator= (const Field & x) { parseFromString(x.safeGet<const String &>()); return *this; }
|
||||
|
||||
String toString() const
|
||||
|
@ -122,7 +122,7 @@ GTEST_TEST(SettingMySQLDataTypesSupport, SetString)
|
||||
|
||||
// comma with spaces
|
||||
setting = " datetime64 , decimal ";
|
||||
ASSERT_FALSE(setting.changed); // false since value is the same as previous one.
|
||||
ASSERT_TRUE(setting.changed);
|
||||
ASSERT_TRUE(setting.value.isSet(MySQLDataTypesSupport::DECIMAL));
|
||||
ASSERT_TRUE(setting.value.isSet(MySQLDataTypesSupport::DATETIME64));
|
||||
ASSERT_EQ("decimal,datetime64", setting.toString());
|
||||
@ -136,7 +136,7 @@ GTEST_TEST(SettingMySQLDataTypesSupport, SetString)
|
||||
ASSERT_EQ(Field("decimal"), setting);
|
||||
|
||||
setting = String(",decimal,decimal,decimal,decimal,decimal,decimal,decimal,decimal,decimal,");
|
||||
ASSERT_FALSE(setting.changed); //since previous value was DECIMAL
|
||||
ASSERT_TRUE(setting.changed); //since previous value was DECIMAL
|
||||
ASSERT_TRUE(setting.value.isSet(MySQLDataTypesSupport::DECIMAL));
|
||||
ASSERT_FALSE(setting.value.isSet(MySQLDataTypesSupport::DATETIME64));
|
||||
ASSERT_EQ("decimal", setting.toString());
|
||||
@ -163,7 +163,7 @@ GTEST_TEST(SettingMySQLDataTypesSupport, SetInvalidString)
|
||||
ASSERT_EQ(0, setting.value.getValue());
|
||||
|
||||
EXPECT_NO_THROW(setting = String(", "));
|
||||
ASSERT_FALSE(setting.changed);
|
||||
ASSERT_TRUE(setting.changed);
|
||||
ASSERT_EQ(0, setting.value.getValue());
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,32 @@
|
||||
0
|
||||
1
|
||||
1
|
||||
1
|
||||
0
|
||||
1
|
||||
1
|
||||
1
|
||||
0
|
||||
1
|
||||
1
|
||||
1
|
||||
0
|
||||
1
|
||||
1
|
||||
1
|
||||
0
|
||||
1
|
||||
1
|
||||
1
|
||||
0
|
||||
1
|
||||
1
|
||||
1
|
||||
0
|
||||
1
|
||||
1
|
||||
1
|
||||
0
|
||||
1
|
||||
1
|
||||
1
|
@ -0,0 +1,82 @@
|
||||
---SettingFieldNumber
|
||||
SELECT changed from system.settings where name = 'mysql_max_rows_to_insert';
|
||||
SET mysql_max_rows_to_insert = 123123;
|
||||
|
||||
select changed from system.settings where name = 'mysql_max_rows_to_insert';
|
||||
set mysql_max_rows_to_insert = 123123;
|
||||
select changed from system.settings where name = 'mysql_max_rows_to_insert';
|
||||
set mysql_max_rows_to_insert = 65536;
|
||||
select changed from system.settings where name = 'mysql_max_rows_to_insert';
|
||||
|
||||
---SettingAutoWrapper
|
||||
|
||||
select changed from system.settings where name = 'insert_quorum';
|
||||
set insert_quorum = 123123;
|
||||
select changed from system.settings where name = 'insert_quorum';
|
||||
set insert_quorum = 123123;
|
||||
select changed from system.settings where name = 'insert_quorum';
|
||||
set insert_quorum = 0;
|
||||
select changed from system.settings where name = 'insert_quorum';
|
||||
|
||||
---SettingFieldMaxThreads
|
||||
|
||||
select changed from system.settings where name = 'max_alter_threads';
|
||||
set max_alter_threads = 123123;
|
||||
select changed from system.settings where name = 'max_alter_threads';
|
||||
set max_alter_threads = 123123;
|
||||
select changed from system.settings where name = 'max_alter_threads';
|
||||
set max_alter_threads = 0;
|
||||
select changed from system.settings where name = 'max_alter_threads';
|
||||
|
||||
---SettingFieldTimespanUnit
|
||||
|
||||
select changed from system.settings where name = 'drain_timeout';
|
||||
set drain_timeout = 123123;
|
||||
select changed from system.settings where name = 'drain_timeout';
|
||||
set drain_timeout = 123123;
|
||||
select changed from system.settings where name = 'drain_timeout';
|
||||
set drain_timeout = 3;
|
||||
select changed from system.settings where name = 'drain_timeout';
|
||||
|
||||
|
||||
---SettingFieldChar
|
||||
|
||||
select changed from system.settings where name = 'format_csv_delimiter';
|
||||
set format_csv_delimiter = ',';
|
||||
select changed from system.settings where name = 'format_csv_delimiter';
|
||||
set format_csv_delimiter = ',';
|
||||
select changed from system.settings where name = 'format_csv_delimiter';
|
||||
set format_csv_delimiter = ',';
|
||||
select changed from system.settings where name = 'format_csv_delimiter';
|
||||
|
||||
|
||||
---SettingFieldURI
|
||||
|
||||
select changed from system.settings where name = 'format_avro_schema_registry_url';
|
||||
set format_avro_schema_registry_url = 'https://github.com/ClickHouse/ClickHouse/tree/master/src/Core';
|
||||
select changed from system.settings where name = 'format_avro_schema_registry_url';
|
||||
set format_avro_schema_registry_url = 'https://github.com/ClickHouse/ClickHouse/tree/master/src/Core';
|
||||
select changed from system.settings where name = 'format_avro_schema_registry_url';
|
||||
set format_avro_schema_registry_url = '';
|
||||
select changed from system.settings where name = 'format_avro_schema_registry_url';
|
||||
|
||||
|
||||
--- SettingFieldEnum
|
||||
|
||||
select changed from system.settings where name = 'output_format_orc_compression_method';
|
||||
set output_format_orc_compression_method = 'none';
|
||||
select changed from system.settings where name = 'output_format_orc_compression_method';
|
||||
set output_format_orc_compression_method = 'none';
|
||||
select changed from system.settings where name = 'output_format_orc_compression_method';
|
||||
set output_format_orc_compression_method = 'lz4';
|
||||
select changed from system.settings where name = 'output_format_orc_compression_method';
|
||||
|
||||
--- SettingFieldMultiEnum
|
||||
|
||||
select changed from system.settings where name = 'join_algorithm';
|
||||
set join_algorithm = 'auto,direct';
|
||||
select changed from system.settings where name = 'join_algorithm';
|
||||
set join_algorithm = 'auto,direct';
|
||||
select changed from system.settings where name = 'join_algorithm';
|
||||
set join_algorithm = 'default';
|
||||
select changed from system.settings where name = 'join_algorithm';
|
Loading…
Reference in New Issue
Block a user