| 1 |
/***************************************************************************** |
| 2 |
|
| 3 |
Copyright (c) 2011, 2026, Oracle and/or its affiliates. |
| 4 |
|
| 5 |
This program is free software; you can redistribute it and/or modify it under |
| 6 |
the terms of the GNU General Public License, version 2.0, as published by the |
| 7 |
Free Software Foundation. |
| 8 |
|
| 9 |
This program is designed to work with certain software (including |
| 10 |
but not limited to OpenSSL) that is licensed under separate terms, |
| 11 |
as designated in a particular file or component or in included license |
| 12 |
documentation. The authors of MySQL hereby grant you an additional |
| 13 |
permission to link the program and your derivative works with the |
| 14 |
separately licensed software that they have either included with |
| 15 |
the program or referenced in the documentation. |
| 16 |
|
| 17 |
This program is distributed in the hope that it will be useful, but WITHOUT |
| 18 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 19 |
FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0, |
| 20 |
for more details. |
| 21 |
|
| 22 |
You should have received a copy of the GNU General Public License along with |
| 23 |
this program; if not, write to the Free Software Foundation, Inc., |
| 24 |
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 25 |
|
| 26 |
*****************************************************************************/ |
| 27 |
|
| 28 |
/** @file include/row0log.ic |
| 29 |
Modification log for online index creation and online table rebuild |
| 30 |
|
| 31 |
Created 2012-10-18 Marko Makela |
| 32 |
*******************************************************/ |
| 33 |
|
| 34 |
#include "dict0dict.h" |
| 35 |
|
| 36 |
#ifndef UNIV_HOTBACKUP |
| 37 |
/** Free the row log for an index on which online creation was aborted. */ |
| 38 |
static inline void row_log_abort_sec( |
| 39 |
dict_index_t *index) /*!< in/out: index (x-latched) */ |
| 40 |
{ |
| 41 |
ut_ad(rw_lock_own(dict_index_get_lock(index), RW_LOCK_X)); |
| 42 |
|
| 43 |
ut_ad(!index->is_clustered()); |
| 44 |
dict_index_set_online_status(index, ONLINE_INDEX_ABORTED); |
| 45 |
row_log_free(index->online_log); |
| 46 |
} |
| 47 |
|
| 48 |
static inline bool row_log_online_op_try(dict_index_t *index, |
| 49 |
const dtuple_t *tuple, |
| 50 |
trx_id_t trx_id) { |
| 51 |
ut_ad(rw_lock_own_flagged(dict_index_get_lock(index), |
| 52 |
RW_LOCK_FLAG_S | RW_LOCK_FLAG_X | RW_LOCK_FLAG_SX)); |
| 53 |
|
| 54 |
switch (dict_index_get_online_status(index)) { |
| 55 |
case ONLINE_INDEX_COMPLETE: |
| 56 |
/* This is a normal index. Do not log anything. |
| 57 |
The caller must perform the operation on the |
| 58 |
index tree directly. */ |
| 59 |
return (false); |
| 60 |
case ONLINE_INDEX_CREATION: |
| 61 |
/* The index is being created online. Log the |
| 62 |
operation. */ |
| 63 |
row_log_online_op(index, tuple, trx_id); |
| 64 |
break; |
| 65 |
case ONLINE_INDEX_ABORTED: |
| 66 |
case ONLINE_INDEX_ABORTED_DROPPED: |
| 67 |
/* The index was created online, but the operation was |
| 68 |
aborted. Do not log the operation and tell the caller |
| 69 |
to skip the operation. */ |
| 70 |
break; |
| 71 |
} |
| 72 |
|
| 73 |
return (true); |
| 74 |
} |
| 75 |
#endif /* !UNIV_HOTBACKUP */ |