Bug #93771 Contribution: Add log_bin_implicit_delete setting
Submitted: 31 Dec 2018 16:07 Modified: 27 Jun 2019 19:15
Reporter: OCA Admin (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[31 Dec 2018 16:07] OCA Admin
Description:
This bug tracks a contribution by Daniël van Eeden (Github user: dveeden) as described in http://github.com/mysql/mysql-server/pull/237

How to repeat:
See description

Suggested fix:
See contribution code attached
[31 Dec 2018 16:07] OCA Admin
Contribution submitted via Github - Add log_bin_implicit_delete setting 
(*) Contribution by Daniël van Eeden (Github dveeden, mysql-server/pull/237#issuecomment-450643252): I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: git_patch_241492290.txt (text/plain), 4.24 KiB.

[31 Dec 2018 21:07] MySQL Verification Team
Thank you for the contribution.
[27 Jun 2019 19:15] Margaret Fisher
Posted by developer:
 
Changelog entry added for MySQL 8.0.17 and 5.7.27:

When a MEMORY table is implicitly deleted on a master following a server restart, the master writes a DELETE statement to the binary log so that slaves also empty the table. This generated event now includes a comment in the binary log so that the reason for the DELETE statement is easy to identify. Thanks to Daniël van Eeden for the contribution. 

Added to https://dev.mysql.com/doc/refman/8.0/en/replication-features-memory.html
and https://dev.mysql.com/doc/refman/5.7/en/replication-features-memory.html

This generated event is identifiable by a comment in the binary log, and if GTIDs are in use on the server, it has a GTID assigned.
[23 Jul 2019 8:54] Daniël van Eeden
commit cc4d8f98eea12feeff4af2e87613c7f3a4e9f49c
Author: Venkatesh Venugopal <venkatesh.venugopal@oracle.com>
Date:   Mon May 20 11:35:32 2019 +0530

    Bug#29157796: CONTRIBUTION: ADD LOG_BIN_IMPLICIT_DELETE SETTING
    
    Memory table's data will be lost after server restart. To
    keep the data consistency between master and slave, master
    binlogs 'DELETE FROM `db`.`table_name`' when the memory
    table is locked first time.
    
    This patch adds a comment to the DELETE to hint the user why
    the DELETE was logged.
    
    RB:22030

diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 24a591400d9..1180102f202 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -4416,6 +4416,7 @@ static bool open_table_entry_fini(THD *thd, TABLE_SHARE *share, TABLE *entry)
       error= temp_buf.append(".");
       append_identifier(thd, &temp_buf, share->table_name.str,
                         strlen(share->table_name.str));
+      error= temp_buf.append(" /* generated by server, implicitly emptying in-memory table */");
       if (mysql_bin_log.write_dml_directly(thd, temp_buf.c_ptr_safe(),
                                            temp_buf.length()))
         return TRUE;
[23 Jul 2019 8:55] Daniël van Eeden
Commit cc4d8f98eea12feeff4af2e87613c7f3a4e9f49c only adds the comment, it doesn't add the log_bin_implicit_delete setting.