diff options
author | Monty <monty@mariadb.org> | 2020-12-04 18:23:40 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2021-05-19 22:54:12 +0200 |
commit | e3cfb7c8034f4281029f81996cff8d938f06ec67 (patch) | |
tree | 18eecbcece583810c839a2ac5e51957913995aeb /sql/log.cc | |
parent | 47010ccffa8db1b88883314932e1a0f33ec32bc0 (diff) | |
download | mariadb-git-e3cfb7c8034f4281029f81996cff8d938f06ec67.tar.gz |
MDEV-23844 Atomic DROP TABLE (single table)
Logging logic:
- Log tables, just before they are dropped, to the ddl log
- After the last table for the statement is dropped, log an xid for the
whole ddl log event
In case of crash:
- Remove first any active DROP TABLE events from the ddl log that matches
xids found in binary log (this mean the drop was successful and was
propery logged).
- Loop over all active DROP TABLE events
- Ensure that the table is completely dropped
- Write a DROP TABLE entry to the binary log with the dropped tables.
Other things:
- Added code to ha_drop_table() to be able to tell the difference if
a get_new_handler() failed because of out-of-memory or because the
handler refused/was not able to create a a handler. This was needed
to get sequences to work as sequences needs a share object to be passed
to get_new_handler()
- TC_LOG_BINLOG::recover() was changed to always collect Xid's from the
binary log and always call ddl_log_close_binlogged_events(). This was
needed to be able to collect DROP TABLE events with embedded Xid's
(used by ddl log).
- Added a new variable "$grep_script" to binlog filter to be able to find
only rows that matches a regexp.
- Had to adjust some test that changed because drop statements are a bit
larger in the binary log than before (as we have to store the xid)
Other things:
- MDEV-25588 Atomic DDL: Binlog query event written upon recovery is corrupt
fixed (in the original commit).
Diffstat (limited to 'sql/log.cc')
-rw-r--r-- | sql/log.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sql/log.cc b/sql/log.cc index 519dc3e63b3..f1fef44e05f 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -9982,6 +9982,7 @@ int TC_LOG::using_heuristic_recover() int TC_LOG_BINLOG::open(const char *opt_name) { int error= 1; + DBUG_ENTER("TC_LOG_BINLOG::open"); DBUG_ASSERT(total_ha_2pc > 1); DBUG_ASSERT(opt_name); @@ -9991,7 +9992,7 @@ int TC_LOG_BINLOG::open(const char *opt_name) { /* There was a failure to open the index file, can't open the binlog */ cleanup(); - return 1; + DBUG_RETURN(1); } if (using_heuristic_recover()) @@ -10001,12 +10002,12 @@ int TC_LOG_BINLOG::open(const char *opt_name) open(opt_name, 0, 0, WRITE_CACHE, max_binlog_size, 0, TRUE); mysql_mutex_unlock(&LOCK_log); cleanup(); - return 1; + DBUG_RETURN(1); } error= do_binlog_recovery(opt_name, true); binlog_state_recover_done= true; - return error; + DBUG_RETURN(error); } /** This is called on shutdown, after ha_panic. */ @@ -10536,6 +10537,7 @@ int TC_LOG_BINLOG::recover(LOG_INFO *linfo, const char *last_log_name, Query_log_event *query_ev= (Query_log_event*) ev; if (query_ev->xid) { + DBUG_PRINT("QQ", ("xid: %llu xid")); DBUG_ASSERT(sizeof(query_ev->xid) == sizeof(my_xid)); uchar *x= (uchar *) memdup_root(&mem_root, (uchar*) &query_ev->xid, |