summaryrefslogtreecommitdiff
path: root/sql/log.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-01-31 11:37:12 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2020-01-31 11:37:12 +0200
commit5ff66fb0b97fa3f8ecc453c48bac48ceae76bdea (patch)
treeb33d1e67c5a03abd85abe023f078d0201b12adeb /sql/log.cc
parentdbbe9961a53cad97544499c3187771df64f25b18 (diff)
parent256994ef7469fc4c62d5b271a6557ad729380f0e (diff)
downloadmariadb-git-5ff66fb0b97fa3f8ecc453c48bac48ceae76bdea.tar.gz
Merge 10.2 into 10.3
Diffstat (limited to 'sql/log.cc')
-rw-r--r--sql/log.cc34
1 files changed, 14 insertions, 20 deletions
diff --git a/sql/log.cc b/sql/log.cc
index 0aac2ee61fb..bde301452be 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2018, Oracle and/or its affiliates.
- Copyright (c) 2009, 2019, MariaDB Corporation
+ Copyright (c) 2009, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -3264,7 +3264,7 @@ void MYSQL_BIN_LOG::cleanup()
DBUG_ASSERT(!binlog_xid_count_list.head());
WSREP_XID_LIST_ENTRY("MYSQL_BIN_LOG::cleanup(): Removing xid_list_entry "
"for %s (%lu)", b);
- my_free(b);
+ delete b;
}
mysql_mutex_destroy(&LOCK_log);
@@ -3629,19 +3629,10 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
know from where to start recovery.
*/
size_t off= dirname_length(log_file_name);
- size_t len= strlen(log_file_name) - off;
- char *entry_mem, *name_mem;
- if (!(new_xid_list_entry = (xid_count_per_binlog *)
- my_multi_malloc(MYF(MY_WME),
- &entry_mem, sizeof(xid_count_per_binlog),
- &name_mem, len,
- NULL)))
+ uint len= static_cast<uint>(strlen(log_file_name) - off);
+ new_xid_list_entry= new xid_count_per_binlog(log_file_name+off, len);
+ if (!new_xid_list_entry)
goto err;
- memcpy(name_mem, log_file_name+off, len);
- new_xid_list_entry->binlog_name= name_mem;
- new_xid_list_entry->binlog_name_len= (int)len;
- new_xid_list_entry->xid_count= 0;
- new_xid_list_entry->notify_count= 0;
/*
Find the name for the Initial binlog checkpoint.
@@ -3658,8 +3649,11 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
mysql_mutex_unlock(&LOCK_xid_list);
if (!b)
b= new_xid_list_entry;
- strmake(buf, b->binlog_name, b->binlog_name_len);
- Binlog_checkpoint_log_event ev(buf, (uint)len);
+ if (b->binlog_name)
+ strmake(buf, b->binlog_name, b->binlog_name_len);
+ else
+ goto err;
+ Binlog_checkpoint_log_event ev(buf, len);
DBUG_EXECUTE_IF("crash_before_write_checkpoint_event",
flush_io_cache(&log_file);
mysql_file_sync(log_file.file, MYF(MY_WME));
@@ -3762,7 +3756,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
{
WSREP_XID_LIST_ENTRY("MYSQL_BIN_LOG::open(): Removing xid_list_entry for "
"%s (%lu)", b);
- my_free(binlog_xid_count_list.get());
+ delete binlog_xid_count_list.get();
}
mysql_cond_broadcast(&COND_xid_list);
WSREP_XID_LIST_ENTRY("MYSQL_BIN_LOG::open(): Adding new xid_list_entry for "
@@ -3812,7 +3806,7 @@ err:
#endif
sql_print_error(fatal_log_error, name, tmp_errno);
if (new_xid_list_entry)
- my_free(new_xid_list_entry);
+ delete new_xid_list_entry;
if (file >= 0)
mysql_file_close(file, MYF(0));
close(LOG_CLOSE_INDEX);
@@ -4298,7 +4292,7 @@ err:
DBUG_ASSERT(b->xid_count == 0);
WSREP_XID_LIST_ENTRY("MYSQL_BIN_LOG::reset_logs(): Removing "
"xid_list_entry for %s (%lu)", b);
- my_free(binlog_xid_count_list.get());
+ delete binlog_xid_count_list.get();
}
mysql_cond_broadcast(&COND_xid_list);
reset_master_pending--;
@@ -9833,7 +9827,7 @@ TC_LOG_BINLOG::mark_xid_done(ulong binlog_id, bool write_checkpoint)
break;
WSREP_XID_LIST_ENTRY("TC_LOG_BINLOG::mark_xid_done(): Removing "
"xid_list_entry for %s (%lu)", b);
- my_free(binlog_xid_count_list.get());
+ delete binlog_xid_count_list.get();
}
mysql_mutex_unlock(&LOCK_xid_list);