~percona-core/percona-server/5.5

« back to all changes in this revision

Viewing changes to Percona-Server/storage/innobase/srv/srv0srv.c

  • Committer: Laurynas Biveinis
  • Date: 2013-09-06 13:24:59 UTC
  • mfrom: (558.8.3 5.5)
  • Revision ID: laurynas.biveinis@percona.com-20130906132459-jfaquw8dbwluzbsl
MergeĀ lp:~akopytov/percona-server/ahi-fixes-5.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
1275
1275
                os_thread_yield();
1276
1276
                goto retry;
1277
1277
        }
1278
 
        if (trx->has_search_latch
1279
 
            || NULL != UT_LIST_GET_FIRST(trx->trx_locks)) {
 
1278
 
 
1279
        ut_ad(!trx->has_search_latch);
 
1280
 
 
1281
        if (NULL != UT_LIST_GET_FIRST(trx->trx_locks)) {
1280
1282
 
1281
1283
                conc_n_threads = os_atomic_increment_lint(&srv_conc_n_threads, 1);
1282
1284
                enter_innodb_with_tickets(trx);
1319
1321
        ulint                   sec;
1320
1322
        ulint                   ms;
1321
1323
 
 
1324
        ut_ad(!trx->has_search_latch);
1322
1325
#ifdef UNIV_SYNC_DEBUG
 
1326
        ut_ad(!btr_search_own_any());
1323
1327
        ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
1324
1328
#endif /* UNIV_SYNC_DEBUG */
1325
1329
 
1379
1383
        /* If the transaction is not holding resources, let it sleep
1380
1384
        for SRV_THREAD_SLEEP_DELAY microseconds, and try again then */
1381
1385
 
1382
 
        if (!has_slept && !trx->has_search_latch
 
1386
        ut_ad(!trx->has_search_latch);
 
1387
 
 
1388
        if (!has_slept
1383
1389
            && NULL == UT_LIST_GET_FIRST(trx->trx_locks)) {
1384
1390
 
1385
1391
                has_slept = TRUE; /* We let it sleep only once to avoid
1434
1440
                return;
1435
1441
        }
1436
1442
 
1437
 
        /* Release possible search system latch this thread has */
1438
 
        if (trx->has_search_latch) {
1439
 
                trx_search_latch_release_if_reserved(trx);
1440
 
        }
 
1443
        /* No-op for XtraDB. */
 
1444
        trx_search_latch_release_if_reserved(trx);
1441
1445
 
1442
1446
        /* Add to the queue */
1443
1447
        slot->reserved = TRUE;
1456
1460
 
1457
1461
        ut_ad(!trx->has_search_latch);
1458
1462
#ifdef UNIV_SYNC_DEBUG
 
1463
        ut_ad(!btr_search_own_any());
1459
1464
        ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
1460
1465
#endif /* UNIV_SYNC_DEBUG */
1461
1466
 
1507
1512
        trx_t*  trx)    /*!< in: transaction object associated with the
1508
1513
                        thread */
1509
1514
{
 
1515
        ut_ad(!trx->has_search_latch);
1510
1516
#ifdef UNIV_SYNC_DEBUG
 
1517
        ut_ad(!btr_search_own_any());
1511
1518
        ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
1512
1519
#endif /* UNIV_SYNC_DEBUG */
1513
1520
 
1598
1605
                os_event_set(slot->event);
1599
1606
        }
1600
1607
 
 
1608
        ut_ad(!trx->has_search_latch);
1601
1609
#ifdef UNIV_SYNC_DEBUG
 
1610
        ut_ad(!btr_search_own_any());
1602
1611
        ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
1603
1612
#endif /* UNIV_SYNC_DEBUG */
1604
1613
}
1612
1621
        trx_t*  trx)    /*!< in: transaction object associated with the
1613
1622
                        thread */
1614
1623
{
 
1624
        ut_ad(!trx->has_search_latch);
1615
1625
#ifdef UNIV_SYNC_DEBUG
 
1626
        ut_ad(!btr_search_own_any());
1616
1627
        ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
1617
1628
#endif /* UNIV_SYNC_DEBUG */
1618
1629
 
1885
1896
        os_event_wait(event);
1886
1897
        thd_wait_end(trx->mysql_thd);
1887
1898
 
 
1899
        ut_ad(!trx->has_search_latch);
1888
1900
#ifdef UNIV_SYNC_DEBUG
 
1901
        ut_ad(!btr_search_own_any());
1889
1902
        ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
1890
1903
#endif /* UNIV_SYNC_DEBUG */
1891
1904
 
2047
2060
        ulint   n_reserved;
2048
2061
        ibool   ret;
2049
2062
 
2050
 
        ulint   btr_search_sys_subtotal;
 
2063
        ulong   btr_search_sys_constant;
 
2064
        ulong   btr_search_sys_variable;
2051
2065
        ulint   lock_sys_subtotal;
2052
2066
        ulint   recv_sys_subtotal;
2053
2067
 
2113
2127
        ibuf_print(file);
2114
2128
 
2115
2129
        for (i = 0; i < btr_search_index_num; i++) {
2116
 
                ha_print_info(file, btr_search_get_hash_index((index_id_t)i));
 
2130
                ha_print_info(file, btr_search_sys->hash_tables[i]);
2117
2131
        }
2118
2132
 
2119
2133
        fprintf(file,
2141
2155
        fprintf(file,
2142
2156
                "Total memory allocated by read views " ULINTPF "\n",
2143
2157
                srv_read_views_memory);
2144
 
        /* Calcurate reserved memories */
2145
 
        if (btr_search_sys && btr_search_sys->hash_index[0]->heap) {
2146
 
                btr_search_sys_subtotal = mem_heap_get_size(btr_search_sys->hash_index[0]->heap);
2147
 
        } else {
2148
 
                btr_search_sys_subtotal = 0;
2149
 
                for (i=0; i < btr_search_sys->hash_index[0]->n_mutexes; i++) {
2150
 
                        btr_search_sys_subtotal += mem_heap_get_size(btr_search_sys->hash_index[0]->heaps[i]);
2151
 
                }
 
2158
 
 
2159
        /* Calculate AHI constant and variable memory allocations */
 
2160
 
 
2161
        btr_search_sys_constant = 0;
 
2162
        btr_search_sys_variable = 0;
 
2163
 
 
2164
        ut_ad(btr_search_sys->hash_tables);
 
2165
 
 
2166
        for (i = 0; i < btr_search_index_num; i++) {
 
2167
                hash_table_t* ht = btr_search_sys->hash_tables[i];
 
2168
 
 
2169
                ut_ad(ht);
 
2170
                ut_ad(ht->heap);
 
2171
 
 
2172
                /* Multiple mutexes/heaps are currently never used for adaptive
 
2173
                hash index tables. */
 
2174
                ut_ad(!ht->n_mutexes);
 
2175
                ut_ad(!ht->heaps);
 
2176
 
 
2177
                btr_search_sys_variable += mem_heap_get_size(ht->heap);
 
2178
                btr_search_sys_constant += ht->n_cells * sizeof(hash_cell_t);
2152
2179
        }
2153
 
        btr_search_sys_subtotal *= btr_search_index_num;
2154
2180
 
2155
2181
        lock_sys_subtotal = 0;
2156
2182
        if (trx_sys) {
2175
2201
                        "    Lock system         %lu \t(%lu + %lu)\n"
2176
2202
                        "    Recovery system     %lu \t(%lu + %lu)\n",
2177
2203
 
2178
 
                        (ulong) (btr_search_sys
2179
 
                                ? (btr_search_sys->hash_index[0]->n_cells * btr_search_index_num * sizeof(hash_cell_t)) : 0)
2180
 
                        + btr_search_sys_subtotal,
2181
 
                        (ulong) (btr_search_sys
2182
 
                                ? (btr_search_sys->hash_index[0]->n_cells * btr_search_index_num * sizeof(hash_cell_t)) : 0),
2183
 
                        (ulong) btr_search_sys_subtotal,
 
2204
                        btr_search_sys_constant + btr_search_sys_variable,
 
2205
                        btr_search_sys_constant,
 
2206
                        btr_search_sys_variable,
2184
2207
 
2185
2208
                        (ulong) (buf_pool_from_array(0)->page_hash->n_cells * sizeof(hash_cell_t)),
2186
2209
 
2342
2365
        buf_get_total_list_len(&LRU_len, &free_len, &flush_list_len);
2343
2366
        buf_get_total_list_size_in_bytes(&buf_pools_list_size);
2344
2367
 
2345
 
        if (btr_search_sys && btr_search_sys->hash_index[0]->heap) {
2346
 
                mem_adaptive_hash = mem_heap_get_size(btr_search_sys->hash_index[0]->heap);
2347
 
        } else {
2348
 
                mem_adaptive_hash = 0;
2349
 
                for (i=0; i < btr_search_sys->hash_index[0]->n_mutexes; i++) {
2350
 
                        mem_adaptive_hash += mem_heap_get_size(btr_search_sys->hash_index[0]->heaps[i]);
2351
 
                }
2352
 
        }
2353
 
        mem_adaptive_hash *= btr_search_index_num;
2354
 
        if (btr_search_sys) {
2355
 
                mem_adaptive_hash += (btr_search_sys->hash_index[0]->n_cells * btr_search_index_num * sizeof(hash_cell_t));
 
2368
        mem_adaptive_hash = 0;
 
2369
 
 
2370
        ut_ad(btr_search_sys->hash_tables);
 
2371
 
 
2372
        for (i = 0; i < btr_search_index_num; i++) {
 
2373
                hash_table_t*   ht = btr_search_sys->hash_tables[i];
 
2374
 
 
2375
                ut_ad(ht);
 
2376
                ut_ad(ht->heap);
 
2377
                /* Multiple mutexes/heaps are currently never used for adaptive
 
2378
                hash index tables. */
 
2379
                ut_ad(!ht->n_mutexes);
 
2380
                ut_ad(!ht->heaps);
 
2381
 
 
2382
                mem_adaptive_hash += mem_heap_get_size(ht->heap);
 
2383
                mem_adaptive_hash += ht->n_cells * sizeof(hash_cell_t);
2356
2384
        }
2357
2385
 
2358
2386
        mem_dictionary = (dict_sys ? ((dict_sys->table_hash->n_cells
2365
2393
        export_vars.innodb_adaptive_hash_cells = 0;
2366
2394
        export_vars.innodb_adaptive_hash_heap_buffers = 0;
2367
2395
        for (i = 0; i < btr_search_index_num; i++) {
2368
 
                hash_table_t*   table = btr_search_get_hash_index((index_id_t)i);
 
2396
                hash_table_t*   table = btr_search_sys->hash_tables[i];
2369
2397
 
2370
2398
                export_vars.innodb_adaptive_hash_cells
2371
2399
                        += hash_get_n_cells(table);