Re: 5102d86beae: MDEV-30164 System variable for default collations
Hi, Alexander, Looks good, thanks. ok to push. a couple of comments below - but really, on remnants of the previous version of the commit. On Jul 17, Alexander Barkov wrote:
revision-id: 5102d86beae (mariadb-10.11.2-47-g5102d86beae) parent(s): 3430767e006 author: Alexander Barkov committer: Alexander Barkov timestamp: 2023-07-10 13:17:45 +0400 message:
MDEV-30164 System variable for default collations
This patch adds a way to override default collations (or "character set collations") for desired character sets.
diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result index 77df8536fa2..5c361e3da88 100644 --- a/mysql-test/main/mysqld--help.result +++ b/mysql-test/main/mysqld--help.result @@ -144,6 +144,8 @@ The following specify which files/extra groups are read (specified before remain Don't ignore client side character set value sent during handshake. (Defaults to on; use --skip-character-set-client-handshake to disable.) + --character-set-collations=name + Set default collations for character sets.
shouldn't it say "overrides"?
--character-set-filesystem=name Set the filesystem character set. -C, --character-set-server=name diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 607877dfb83..d35869e7e39 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -6061,6 +6061,32 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt) } thd->reset_kill_query(); } + + /* + Binary logging is now done. Unset the "used" flags to avoid + flags leaking to the next event (and to the COMMIT statement + in the end of the current event). + + Example: + + Suppose a non-default collation (in @@character_set_collations) + was used during the statement, the mysqlbinlog output for + the current statement will contain a sequence like this: + + SET character_set_collations='utf8mb3=utf8mb3_bin'; + INSERT INTO t1 VALUES (_utf8mb3'test'); + COMMIT; + + The statment (INSERT in this example) is already in binlog at this point, and the + and the "SET character_set_collations" is written inside a + Q_CHARACTER_SET_COLLATIONS chunk in its log entry header. + The flag CHARACTER_SET_COLLATIONS_USED is not needed any more. + The COMMIT can be printed without "SET character_set_collations". + + The same logic applies to the other _USED flags.
That's a bit too verbose in my opinion. The example was good in the previous version of the patch, but now the first paragraph of the comment pretty much explains it all. but do it as you prefer.
+ */ + thd->used= 0; + if (unlikely(thd->is_error()) || (thd->variables.option_bits & OPTION_MASTER_SQL_ERROR)) {
Regards, Sergei VP of MariaDB Server Engineering and security@mariadb.org
participants (1)
-
Sergei Golubchik