Bug #100076 Missing db name when alter current db -break slave

Submitted: 2 Jul 2020 8:03 Modified: 3 Jul 2020 6:53
Reporter: Cai Minshen Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.6, 5.7, 5.7.30, 8.0.20 OS:Any
Assigned to: CPU Architecture:Any

[2 Jul 2020 8:03] Cai Minshen
Description:
Binlog is written incorrectly, thus slave dies: with error 1046: No database selected 

How to repeat:
set binlog_format=row;
create database;
use test00;
ALTER DATABASE CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

I check the related binary log. It is as the below. The database name test00 is missing in context about altering db:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
/*!*/;
# at 2444
#200702 13:26:33 server id 3093588238  end_log_pos 2544 CRC32 0x72e02a4c        Query   thread_id=614   exec_time=0
        error_code=0
SET TIMESTAMP=1593667593/*!*/;
/*!\C gbk *//*!*/;
SET @@session.character_set_client=28,@@session.collation_connection=28,@@session.collation_server=8/*!*/;
create database test00
/*!*/;
# at 2544
#200702 13:27:29 server id 3093588238  end_log_pos 2676 CRC32 0x7144d1e7        Query   thread_id=614   exec_time=0
        error_code=0
SET TIMESTAMP=1593667649/*!*/;
ALTER DATABASE CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
/*!*/;
[3 Jul 2020 6:53] MySQL Verification Team
Hello Cai Vincent,

Thank you for the report and test case.
Observed that 5.7.30 build is affected.

Thanks,
Umesh

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.