WL#2284: Increase the length of a user name

Status: Complete

MySQL will increase the length of a user name to 32 characters.

User Documentation
==================

http://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-8.html
http://dev.mysql.com/doc/refman/5.7/en/grant-table-structure.html
http://dev.mysql.com/doc/refman/5.7/en/user-names.html
http://dev.mysql.com/doc/refman/5.7/en/downgrading-to-previous-series.html
http://dev.mysql.com/doc/refman/5.7/en/replication-features-user-names.html
F-1: CREATE USER should work with username of length less or equal to 32 
characters.
F-2: DROP USER should work with username of length less or equal to 32 characters.
F-3: GRANT statement should work with username of length less or equal to 32 
characters.
F-4: REVOKE statement should work with username of length less or equal to 32 
characters.
F-5: SHOW GRANTS should work with username of length less or equal to 32 
characters.
F-6: CREATE PROCEDURE should work with DEFINER of length less or equal to 32 
characters.
F-7: CREATE FUNCTION should work with DEFINER of length less or equal to 32 
characters.
F-8: CHANGE MASTER should work with user names of length less or equal to 32 
characters.
F-9: FEDERATED storage engine should work with user names of length less or equal 
to 32 characters. 
F-10: Server upgrade should be possible without any special options specified.
F-11: Server downgrade will be only possible when no user name stored in the 
database is of length greater then 16 characters, otherwise downgrade fails.
F-12. Client should be able to communicate with server which does not support 
username with 32 characters.
F-13. Master server should work with slave server which does not support username 
with 32 characters as long as the master does not creates user names of length 
greater than 16 characters.
F-14. libmysqlclient and all of the command line tools should work with user names 
of length less or equal 32 characters.
F-15. Connectors should work with user name of length less or equal to 32 
characters.
Increase the length of "User" in all privilege-related      
tables to 32 characters.

This worklog needs to cover the following areas:
1) General change : Change macros (USERNAME_LENGTH, MYSQL_USERNAME_LENGTH, ...) 
and cover system tables, scripts, ps tables, ...
2) Upgrade : Script changes
3) Downgrade : Script changes + Conditional (fails in case user with length 
<=16)

There will not be any changes in:
1) Clients: The server-client communication does not depend on the username's 
length. The user name is send in the packets as \0 terminated string. As the 
result the user name in the packet is already a field of variadic length. The 32 
characters client will be able to communicate with 16 characters server. The 
server will take out the whole user name till the termination mark(\0) from the 
net buffer and use only the fist 16 characters as the user name. This is the 
current behavior and thus there is no need for formal protocol change (see  
http://dev.mysql.com/doc/internals/en/connection-phase-
packets.html#packet-Protocol::HandshakeResponse defining username as a null-
terminated string).
2) Replication: We do not need extra work when 32 characters master is working 
with 16 characters slave(s). We only support this scenario in case when 'newer' 
master uses only features which exist on 'old' slave(s). As the result as long 
as 'new' master use only user names of length <= 16 this replication scenario 
should work.