1
/*****************************************************************************
3
Copyright (c) 2011, 2012, Oracle and/or its affiliates. All Rights Reserved.
5
This program is free software; you can redistribute it and/or modify it under
6
the terms of the GNU General Public License as published by the Free Software
7
Foundation; version 2 of the License.
9
This program is distributed in the hope that it will be useful, but WITHOUT
10
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
You should have received a copy of the GNU General Public License along with
14
this program; if not, write to the Free Software Foundation, Inc.,
15
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
17
*****************************************************************************/
19
/**************************************************//**
20
@file include/row0log.ic
21
Modification log for online index creation and online table rebuild
23
Created 2012-10-18 Marko Makela
24
*******************************************************/
26
#include "dict0dict.h"
28
/******************************************************//**
29
Free the row log for an index on which online creation was aborted. */
34
dict_index_t* index) /*!< in/out: index (x-latched) */
36
#ifdef UNIV_SYNC_DEBUG
37
ut_ad(rw_lock_own(dict_index_get_lock(index), RW_LOCK_EX));
38
#endif /* UNIV_SYNC_DEBUG */
40
ut_ad(!dict_index_is_clust(index));
41
dict_index_set_online_status(index, ONLINE_INDEX_ABORTED);
42
row_log_free(index->online_log);
45
/******************************************************//**
46
Try to log an operation to a secondary index that is
47
(or was) being created.
48
@retval true if the operation was logged or can be ignored
49
@retval false if online index creation is not taking place */
52
row_log_online_op_try(
53
/*==================*/
54
dict_index_t* index, /*!< in/out: index, S or X latched */
55
const dtuple_t* tuple, /*!< in: index tuple */
56
trx_id_t trx_id) /*!< in: transaction ID for insert,
59
#ifdef UNIV_SYNC_DEBUG
60
ut_ad(rw_lock_own(dict_index_get_lock(index), RW_LOCK_SHARED)
61
|| rw_lock_own(dict_index_get_lock(index), RW_LOCK_EX));
62
#endif /* UNIV_SYNC_DEBUG */
64
switch (dict_index_get_online_status(index)) {
65
case ONLINE_INDEX_COMPLETE:
66
/* This is a normal index. Do not log anything.
67
The caller must perform the operation on the
68
index tree directly. */
70
case ONLINE_INDEX_CREATION:
71
/* The index is being created online. Log the
73
row_log_online_op(index, tuple, trx_id);
75
case ONLINE_INDEX_ABORTED:
76
case ONLINE_INDEX_ABORTED_DROPPED:
77
/* The index was created online, but the operation was
78
aborted. Do not log the operation and tell the caller
79
to skip the operation. */