Commit 1c9833c5 authored by Marko Mäkelä's avatar Marko Mäkelä

Cleanup: row_log_free()

The nonnull attribute is not applicable to parameters that are
passed by reference, at least not in the Intel compiler.
Let us remove the reference indirection, which was only there
so that the pointer could be assigned to NULL, and let the
callers perform that task.

row_log_allocate(): Fix a bug in out-of-memory error handling
that would leave a pointer to freed memory.
parent fa6d710b
......@@ -2215,6 +2215,7 @@ dict_index_remove_from_cache_low(
if (index->online_log) {
ut_ad(index->online_status == ONLINE_INDEX_CREATION);
row_log_free(index->online_log);
index->online_log = NULL;
}
/* Remove the index from the list of indexes of the table */
......
......@@ -6395,6 +6395,7 @@ innobase_online_rebuild_log_free(
== ONLINE_INDEX_CREATION);
clust_index->online_status = ONLINE_INDEX_COMPLETE;
row_log_free(clust_index->online_log);
clust_index->online_log = NULL;
DEBUG_SYNC_C("innodb_online_rebuild_log_free_aborted");
}
......
/*****************************************************************************
Copyright (c) 2011, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
Copyright (c) 2017, 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 the Free Software
......@@ -65,7 +65,7 @@ Free the row log for an index that was being created online. */
void
row_log_free(
/*=========*/
row_log_t*& log) /*!< in,own: row log */
row_log_t* log) /*!< in,own: row log */
MY_ATTRIBUTE((nonnull));
/******************************************************//**
......
/*****************************************************************************
Copyright (c) 2011, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 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 the Free Software
......@@ -38,6 +39,7 @@ row_log_abort_sec(
ut_ad(!dict_index_is_clust(index));
dict_index_set_online_status(index, ONLINE_INDEX_ABORTED);
row_log_free(index->online_log);
index->online_log = NULL;
}
/******************************************************//**
......
......@@ -3001,7 +3001,6 @@ row_log_allocate(
log->path = path;
dict_index_set_online_status(index, ONLINE_INDEX_CREATION);
index->online_log = log;
if (log_tmp_is_encrypted()) {
ulint size = srv_sort_buf_size;
......@@ -3014,6 +3013,7 @@ row_log_allocate(
}
}
index->online_log = log;
/* While we might be holding an exclusive data dictionary lock
here, in row_log_abort_sec() we will not always be holding it. Use
atomic operations in both cases. */
......@@ -3027,7 +3027,7 @@ Free the row log for an index that was being created online. */
void
row_log_free(
/*=========*/
row_log_t*& log) /*!< in,own: row log */
row_log_t* log) /*!< in,own: row log */
{
MONITOR_ATOMIC_DEC(MONITOR_ONLINE_CREATE_INDEX);
......@@ -3046,7 +3046,6 @@ row_log_free(
mutex_free(&log->mutex);
ut_free(log);
log = NULL;
}
/******************************************************//**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment