~ubuntu-branches/ubuntu/trusty/mysql-5.6/trusty

« back to all changes in this revision

Viewing changes to storage/innobase/include/row0log.ic

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-02-12 11:54:27 UTC
  • Revision ID: package-import@ubuntu.com-20140212115427-oq6tfsqxl1wuwehi
Tags: upstream-5.6.15
ImportĀ upstreamĀ versionĀ 5.6.15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************************
 
2
 
 
3
Copyright (c) 2011, 2012, Oracle and/or its affiliates. All Rights Reserved.
 
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 as published by the Free Software
 
7
Foundation; version 2 of the License.
 
8
 
 
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.
 
12
 
 
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
 
16
 
 
17
*****************************************************************************/
 
18
 
 
19
/**************************************************//**
 
20
@file include/row0log.ic
 
21
Modification log for online index creation and online table rebuild
 
22
 
 
23
Created 2012-10-18 Marko Makela
 
24
*******************************************************/
 
25
 
 
26
#include "dict0dict.h"
 
27
 
 
28
/******************************************************//**
 
29
Free the row log for an index on which online creation was aborted. */
 
30
UNIV_INLINE
 
31
void
 
32
row_log_abort_sec(
 
33
/*===============*/
 
34
        dict_index_t*   index)  /*!< in/out: index (x-latched) */
 
35
{
 
36
#ifdef UNIV_SYNC_DEBUG
 
37
        ut_ad(rw_lock_own(dict_index_get_lock(index), RW_LOCK_EX));
 
38
#endif /* UNIV_SYNC_DEBUG */
 
39
 
 
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);
 
43
}
 
44
 
 
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 */
 
50
UNIV_INLINE
 
51
bool
 
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,
 
57
                                or 0 for delete */
 
58
{
 
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 */
 
63
 
 
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. */
 
69
                return(false);
 
70
        case ONLINE_INDEX_CREATION:
 
71
                /* The index is being created online. Log the
 
72
                operation. */
 
73
                row_log_online_op(index, tuple, trx_id);
 
74
                break;
 
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. */
 
80
                break;
 
81
        }
 
82
 
 
83
        return(true);
 
84
}