~ubuntu-branches/ubuntu/maverick/mysql-5.1/maverick-proposed

« back to all changes in this revision

Viewing changes to storage/innodb_plugin/sync/sync0sync.c

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 14:16:05 UTC
  • mto: This revision was merged to the branch mainline in revision 20.
  • Revision ID: package-import@ubuntu.com-20120222141605-nxlu9yzc6attylc2
Tags: upstream-5.1.61
ImportĀ upstreamĀ versionĀ 5.1.61

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
 
3
Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
4
4
Copyright (c) 2008, Google Inc.
5
5
 
6
6
Portions of this file contain modifications contributed and copyrighted by
656
656
        ut_ad(mutex);
657
657
        ut_ad(file_name);
658
658
 
659
 
        sync_thread_add_level(mutex, mutex->level);
 
659
        sync_thread_add_level(mutex, mutex->level, FALSE);
660
660
 
661
661
        mutex->file_name = file_name;
662
662
        mutex->line      = line;
1083
1083
sync_thread_add_level(
1084
1084
/*==================*/
1085
1085
        void*   latch,  /*!< in: pointer to a mutex or an rw-lock */
1086
 
        ulint   level)  /*!< in: level in the latching order; if
 
1086
        ulint   level,  /*!< in: level in the latching order; if
1087
1087
                        SYNC_LEVEL_VARYING, nothing is done */
 
1088
        ibool   relock) /*!< in: TRUE if re-entering an x-lock */
1088
1089
{
1089
1090
        sync_level_t*   array;
1090
1091
        sync_level_t*   slot;
1132
1133
 
1133
1134
        array = thread_slot->levels;
1134
1135
 
 
1136
        if (relock) {
 
1137
                goto levels_ok;
 
1138
        }
 
1139
 
1135
1140
        /* NOTE that there is a problem with _NODE and _LEAF levels: if the
1136
1141
        B-tree height changes, then a leaf can change to an internal node
1137
1142
        or the other way around. We do not know at present if this can cause
1155
1160
        case SYNC_DOUBLEWRITE:
1156
1161
        case SYNC_BUF_POOL:
1157
1162
        case SYNC_SEARCH_SYS:
1158
 
        case SYNC_SEARCH_SYS_CONF:
1159
1163
        case SYNC_TRX_LOCK_HEAP:
1160
1164
        case SYNC_KERNEL:
1161
1165
        case SYNC_IBUF_BITMAP_MUTEX:
1168
1172
        case SYNC_DICT_HEADER:
1169
1173
        case SYNC_TRX_I_S_RWLOCK:
1170
1174
        case SYNC_TRX_I_S_LAST_READ:
 
1175
        case SYNC_IBUF_MUTEX:
1171
1176
                if (!sync_thread_levels_g(array, level, TRUE)) {
1172
1177
                        fprintf(stderr,
1173
1178
                                "InnoDB: sync_thread_levels_g(array, %lu)"
1231
1236
                     || sync_thread_levels_g(array, SYNC_TREE_NODE - 1, TRUE));
1232
1237
                break;
1233
1238
        case SYNC_TREE_NODE_NEW:
1234
 
                ut_a(sync_thread_levels_contain(array, SYNC_FSP_PAGE)
1235
 
                     || sync_thread_levels_contain(array, SYNC_IBUF_MUTEX));
 
1239
                ut_a(sync_thread_levels_contain(array, SYNC_FSP_PAGE));
1236
1240
                break;
1237
1241
        case SYNC_INDEX_TREE:
1238
 
                if (sync_thread_levels_contain(array, SYNC_IBUF_MUTEX)
1239
 
                    && sync_thread_levels_contain(array, SYNC_FSP)) {
1240
 
                        ut_a(sync_thread_levels_g(array, SYNC_FSP_PAGE - 1,
1241
 
                                                  TRUE));
 
1242
                ut_a(sync_thread_levels_g(array, SYNC_TREE_NODE - 1, TRUE));
 
1243
                break;
 
1244
        case SYNC_IBUF_TREE_NODE:
 
1245
                ut_a(sync_thread_levels_contain(array, SYNC_IBUF_INDEX_TREE)
 
1246
                     || sync_thread_levels_g(array, SYNC_IBUF_TREE_NODE - 1,
 
1247
                                             TRUE));
 
1248
                break;
 
1249
        case SYNC_IBUF_TREE_NODE_NEW:
 
1250
                /* ibuf_add_free_page() allocates new pages for the
 
1251
                change buffer while only holding the tablespace
 
1252
                x-latch. These pre-allocated new pages may only be
 
1253
                taken in use while holding ibuf_mutex, in
 
1254
                btr_page_alloc_for_ibuf(). */
 
1255
                ut_a(sync_thread_levels_contain(array, SYNC_IBUF_MUTEX)
 
1256
                     || sync_thread_levels_contain(array, SYNC_FSP));
 
1257
                break;
 
1258
        case SYNC_IBUF_INDEX_TREE:
 
1259
                if (sync_thread_levels_contain(array, SYNC_FSP)) {
 
1260
                        ut_a(sync_thread_levels_g(array, level - 1, TRUE));
1242
1261
                } else {
1243
 
                        ut_a(sync_thread_levels_g(array, SYNC_TREE_NODE - 1,
1244
 
                                                  TRUE));
 
1262
                        ut_a(sync_thread_levels_g(
 
1263
                                     array, SYNC_IBUF_TREE_NODE - 1, TRUE));
1245
1264
                }
1246
1265
                break;
1247
 
        case SYNC_IBUF_MUTEX:
1248
 
                ut_a(sync_thread_levels_g(array, SYNC_FSP_PAGE - 1, TRUE));
1249
 
                break;
1250
1266
        case SYNC_IBUF_PESS_INSERT_MUTEX:
1251
1267
                ut_a(sync_thread_levels_g(array, SYNC_FSP - 1, TRUE));
1252
1268
                ut_a(!sync_thread_levels_contain(array, SYNC_IBUF_MUTEX));
1269
1285
                ut_error;
1270
1286
        }
1271
1287
 
 
1288
levels_ok:
1272
1289
        for (i = 0; i < SYNC_THREAD_N_LEVELS; i++) {
1273
1290
 
1274
1291
                slot = sync_thread_levels_get_nth(array, i);