Skip to content
  • Sachin Agarwal's avatar
    12a14d66
    Bug #29009092 NOOP UPDATE QUERY IS LOGGED TO BINLOG AFTER · 12a14d66
    Sachin Agarwal authored
    READ_ONLY FLAG IS SET
    
    Problem:
    In SBR, noop update query is logged into binlog even if the
    read_only mode is set.
    
    Analysis:
    For noop update query, server itself identifies that there is
    nothing to update. So this query doesn't go to SE and we don't mark
    this statement trx as read_write.
    As per the existing implementation for SBR, In case of
    super_read_only mode, At the time of commit in "ha_commit_trans()"
    if a read_write transaction is found, we are checking if this
    transaction is coming from a handler other than binlog_handler. This
    will ensure that there is a genuine read_write transaction being
    sent by the engine apart from binlog_handler and only then it is
    blocked.
    For no operation UPDATE query, SE handler does not set statement
    transaction as read-write. And if this transaction doesn't contains
    any other genuine read_write statement transaction then at the time
    of commit in "ha_commit_trans()", this transaction is considered as
    non read-write transaction and it is not blocked.
    
    Fix:
    To make the binlogging consistent in read_only mode, Mark the
    statement trx noop_read_write if it's not marked read_write in SE
    handler. Then at the time of commit in "ha_commit_trans()", if the
    transaction has noop read-write transaction then it is blocked.
    
    Note:
    In 8.0, it's impossible to set the super_read_only variable when a
    transaction is active. So this fix is applicate only for 5.7.
    
    RB: 21936
    Reviewed by: Pedro Figueiredo <pedro.figueiredo@oracle.com>,
    Bill Qu <bill.qu@oracle.com>
    12a14d66
    Bug #29009092 NOOP UPDATE QUERY IS LOGGED TO BINLOG AFTER
    Sachin Agarwal authored
    READ_ONLY FLAG IS SET
    
    Problem:
    In SBR, noop update query is logged into binlog even if the
    read_only mode is set.
    
    Analysis:
    For noop update query, server itself identifies that there is
    nothing to update. So this query doesn't go to SE and we don't mark
    this statement trx as read_write.
    As per the existing implementation for SBR, In case of
    super_read_only mode, At the time of commit in "ha_commit_trans()"
    if a read_write transaction is found, we are checking if this
    transaction is coming from a handler other than binlog_handler. This
    will ensure that there is a genuine read_write transaction being
    sent by the engine apart from binlog_handler and only then it is
    blocked.
    For no operation UPDATE query, SE handler does not set statement
    transaction as read-write. And if this transaction doesn't contains
    any other genuine read_write statement transaction then at the time
    of commit in "ha_commit_trans()", this transaction is considered as
    non read-write transaction and it is not blocked.
    
    Fix:
    To make the binlogging consistent in read_only mode, Mark the
    statement trx noop_read_write if it's not marked read_write in SE
    handler. Then at the time of commit in "ha_commit_trans()", if the
    transaction has noop read-write transaction then it is blocked.
    
    Note:
    In 8.0, it's impossible to set the super_read_only variable when a
    transaction is active. So this fix is applicate only for 5.7.
    
    RB: 21936
    Reviewed by: Pedro Figueiredo <pedro.figueiredo@oracle.com>,
    Bill Qu <bill.qu@oracle.com>
Loading