mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Bug#36540: CREATE EVENT and ALTER EVENT statements fail with large server_id
The problem is that creating a event could fail if the value of the variable server_id didn't fit in the originator column of the event system table. The cause is two-fold: it was possible to set server_id to a value outside the documented range (from 0 to 2^32-1) and the originator column of the event table didn't have enough room for values in this range. The log tables (general_log and slow_log) also don't have a proper column type to store the server_id and having a large server_id value could prevent queries from being logged. The solution is to ensure that all system tables that store the server_id value have a proper column type (int unsigned) and that the variable can't be set to a value that is not within the range.
This commit is contained in:
@@ -1426,4 +1426,32 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
|
||||
def @@storage_engine 253 6 6 N 1 31 8
|
||||
@@storage_engine
|
||||
MyISAM
|
||||
SET @old_server_id = @@GLOBAL.server_id;
|
||||
SET GLOBAL server_id = (1 << 32) - 1;
|
||||
SELECT @@GLOBAL.server_id;
|
||||
@@GLOBAL.server_id
|
||||
4294967295
|
||||
SET GLOBAL server_id = (1 << 32);
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect server-id value: '4294967296'
|
||||
SELECT @@GLOBAL.server_id;
|
||||
@@GLOBAL.server_id
|
||||
4294967295
|
||||
SET GLOBAL server_id = (1 << 60);
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect server-id value: '1152921504606846976'
|
||||
SELECT @@GLOBAL.server_id;
|
||||
@@GLOBAL.server_id
|
||||
4294967295
|
||||
SET GLOBAL server_id = 0;
|
||||
SELECT @@GLOBAL.server_id;
|
||||
@@GLOBAL.server_id
|
||||
0
|
||||
SET GLOBAL server_id = -1;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect server_id value: '-1'
|
||||
SELECT @@GLOBAL.server_id;
|
||||
@@GLOBAL.server_id
|
||||
0
|
||||
SET GLOBAL server_id = @old_server_id;
|
||||
End of 5.1 tests
|
||||
|
Reference in New Issue
Block a user