Skip to content
  • Joao Gramacho's avatar
    54c70769
    BUG#26128931 USE `DATABASE` STATEMENT FAILS INSIDE GTID SKIPPED · 54c70769
    Joao Gramacho authored
                 TRANSACTION
    
    Problem
    -------
    
    When GTID skipping transactions using mysql client program, when the
    transaction contains a binary log dump including "use `<DATABASE>`"
    statements, the "use" statement is failing accusing:
    
    USE must be followed by a database name
    ERROR 1046 (3D000) at line ...: No database selected
    
    Analysis
    --------
    
    When the USE statement has quotes, the mysql client program asks the
    server to translate the database name, issuing two statements to the
    server:
    1. USE `database`
    2. SELECT DATABASE();
    
    When GTID skipping a transaction, the USE `database` is taking no
    effect, leading to SELECT DATABASE() to return NULL.
    
    Fix
    ---
    
    Made SQLCOM_CHANGE_DB also an "innocent" statement from the GTID skip
    point of view. In this way, the USE `database` will take effect and the
    SELECT DATABASE() should not return NULL anymore.
    54c70769
    BUG#26128931 USE `DATABASE` STATEMENT FAILS INSIDE GTID SKIPPED
    Joao Gramacho authored
                 TRANSACTION
    
    Problem
    -------
    
    When GTID skipping transactions using mysql client program, when the
    transaction contains a binary log dump including "use `<DATABASE>`"
    statements, the "use" statement is failing accusing:
    
    USE must be followed by a database name
    ERROR 1046 (3D000) at line ...: No database selected
    
    Analysis
    --------
    
    When the USE statement has quotes, the mysql client program asks the
    server to translate the database name, issuing two statements to the
    server:
    1. USE `database`
    2. SELECT DATABASE();
    
    When GTID skipping a transaction, the USE `database` is taking no
    effect, leading to SELECT DATABASE() to return NULL.
    
    Fix
    ---
    
    Made SQLCOM_CHANGE_DB also an "innocent" statement from the GTID skip
    point of view. In this way, the USE `database` will take effect and the
    SELECT DATABASE() should not return NULL anymore.
Loading