Conversation
fulghum
left a comment
There was a problem hiding this comment.
Just one code comment on matching the sys var type from MySQL closer.
It is a little odd that the value of @@server_uuid will change when the sql-server restarts, but I think this is still a good step forward and should resolve the immediate customer issue. Persisted system variables will be stored to the ~/.dolt directory when they are set by a user and all servers on the same host will use that same persisted value, but I don't think we'll automatically write that default value to ~/.dolt.
There may be some interaction with binlog replication, since the UUID is used as an identifier for the host in some cases. We use @@server_id in our code where Dolt works as a replica for a MySQL server. From a quick look, I think @@server_uuid may be more important on the source MySQL server, since the GTIDs for that host include the UUID, so since we only implement the replica side of replication currently, we may not run into any issues right now.
So... we may end up needing to revisit this if we hit issues with replication, but I think this looks like a good step forward.
sql/variables/system_variables.go
Outdated
| Scope: sql.SystemVariableScope_Persist, | ||
| Dynamic: false, | ||
| SetVarHintApplies: false, | ||
| Type: types.Blob, |
There was a problem hiding this comment.
Looks like MySQL actually returns this as a string, and not as binary data:
mysql -e "select @@server_uuid" --column-type-info -uroot
Field 1: `@@server_uuid`
Catalog: `def`
Database: ``
Table: ``
Org_table: ``
Type: VAR_STRING
Collation: utf8mb4_0900_ai_ci (255)
Length: 87380
Max_length: 36
Decimals: 31
Flags:
+--------------------------------------+
| @@server_uuid |
+--------------------------------------+
| 85716002-48f5-11ee-bff9-e71bd3cf9371 |
+--------------------------------------+
This PR adds support for the
@@server_uuidsystem variable.However, this just generates a random UUID on server start, and does not persist it to a file.
MySQL Docs:
https://dev.mysql.com/doc/refman/8.0/en/replication-options.html#sysvar_server_uuid
Fixes dolthub/dolt#7431