~gl-az/percona-server/5.5.18_19_merge

« back to all changes in this revision

Viewing changes to patches/innodb_split_buf_pool_mutex.patch

  • Committer: Stewart Smith
  • Date: 2011-11-17 00:21:45 UTC
  • mfrom: (190.2.9 merge)
  • Revision ID: stewart@flamingspork.com-20111117002145-6180fuj12147yk9i
merge 5.5.17 port

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
# should be done or reviewed by the maintainer!
8
8
--- a/storage/innobase/btr/btr0cur.c
9
9
+++ b/storage/innobase/btr/btr0cur.c
10
 
@@ -4142,7 +4142,8 @@
 
10
@@ -4091,7 +4091,8 @@
11
11
 
12
12
        mtr_commit(mtr);
13
13
 
17
17
        mutex_enter(&block->mutex);
18
18
 
19
19
        /* Only free the block if it is still allocated to
20
 
@@ -4153,16 +4154,21 @@
 
20
@@ -4102,16 +4103,21 @@
21
21
            && buf_block_get_space(block) == space
22
22
            && buf_block_get_page_no(block) == page_no) {
23
23
 
45
45
 
46
46
--- a/storage/innobase/btr/btr0sea.c
47
47
+++ b/storage/innobase/btr/btr0sea.c
48
 
@@ -1943,7 +1943,7 @@
 
48
@@ -1944,7 +1944,7 @@
49
49
        rec_offs_init(offsets_);
50
50
 
51
51
        rw_lock_x_lock(&btr_search_latch);
54
54
 
55
55
        cell_count = hash_get_n_cells(btr_search_sys->hash_index);
56
56
 
57
 
@@ -1951,11 +1951,11 @@
 
57
@@ -1952,11 +1952,11 @@
58
58
                /* We release btr_search_latch every once in a while to
59
59
                give other queries a chance to run. */
60
60
                if ((i != 0) && ((i % chunk_size) == 0)) {
68
68
                }
69
69
 
70
70
                node = hash_get_nth_cell(btr_search_sys->hash_index, i)->node;
71
 
@@ -2066,11 +2066,11 @@
 
71
@@ -2067,11 +2067,11 @@
72
72
                /* We release btr_search_latch every once in a while to
73
73
                give other queries a chance to run. */
74
74
                if (i != 0) {
82
82
                }
83
83
 
84
84
                if (!ha_validate(btr_search_sys->hash_index, i, end_index)) {
85
 
@@ -2078,7 +2078,7 @@
 
85
@@ -2079,7 +2079,7 @@
86
86
                }
87
87
        }
88
88
 
283
283
 {
284
284
        buf_page_t*     bpage;
285
285
        const ulint     size    = BUF_BUDDY_LOW << i;
286
 
@@ -335,13 +362,20 @@
 
286
@@ -334,13 +361,20 @@
287
287
        ulint           space;
288
288
        ulint           page_no;
289
289
 
305
305
        /* We assume that all memory from buf_buddy_alloc()
306
306
        is used for compressed page frames. */
307
307
 
308
 
@@ -375,6 +409,11 @@
 
308
@@ -374,6 +408,11 @@
309
309
                added to buf_pool->page_hash yet.  Obviously,
310
310
                it cannot be relocated. */
311
311
 
317
317
                return(FALSE);
318
318
        }
319
319
 
320
 
@@ -384,18 +423,27 @@
 
320
@@ -383,18 +422,27 @@
321
321
                For the sake of simplicity, give up. */
322
322
                ut_ad(page_zip_get_size(&bpage->zip) < size);
323
323
 
346
346
-       if (buf_page_can_relocate(bpage)) {
347
347
+       if (mutex && buf_page_can_relocate(bpage)) {
348
348
                /* Relocate the compressed page. */
 
349
                ullint  usec    = ut_time_us(NULL);
349
350
                ut_a(bpage->zip.data == src);
350
 
                memcpy(dst, src, size);
351
351
@@ -409,10 +457,22 @@
352
352
                        buddy_stat->relocated_usec
353
353
                                += ut_time_us(NULL) - usec;
1249
1249
 
1250
1250
 #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
1251
1251
        ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
1252
 
@@ -3030,7 +3187,10 @@
 
1252
@@ -3031,7 +3188,10 @@
1253
1253
        buf_page_t*     hash_page;
1254
 
        buf_pool_t*     buf_pool = buf_pool_get(space, offset);
1255
1254
 
 
1255
        ut_ad(buf_pool == buf_pool_get(space, offset));
1256
1256
-       ut_ad(buf_pool_mutex_own(buf_pool));
1257
1257
+       //ut_ad(buf_pool_mutex_own(buf_pool));
1258
1258
+#ifdef UNIV_SYNC_DEBUG
1261
1261
        ut_ad(mutex_own(&(block->mutex)));
1262
1262
        ut_a(buf_block_get_state(block) != BUF_BLOCK_FILE_PAGE);
1263
1263
 
1264
 
@@ -3059,11 +3219,14 @@
 
1264
@@ -3060,11 +3220,14 @@
1265
1265
        if (UNIV_LIKELY(!hash_page)) {
1266
1266
        } else if (buf_pool_watch_is_sentinel(buf_pool, hash_page)) {
1267
1267
                /* Preserve the reference count. */
1277
1277
        } else {
1278
1278
                fprintf(stderr,
1279
1279
                        "InnoDB: Error: page %lu %lu already found"
1280
 
@@ -3073,7 +3236,8 @@
 
1280
@@ -3074,7 +3237,8 @@
1281
1281
                        (const void*) hash_page, (const void*) block);
1282
1282
 #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
1283
1283
                mutex_exit(&block->mutex);
1287
1287
                buf_print();
1288
1288
                buf_LRU_print();
1289
1289
                buf_validate();
1290
 
@@ -3156,7 +3320,9 @@
 
1290
@@ -3157,7 +3321,9 @@
1291
1291
 
1292
1292
        fold = buf_page_address_fold(space, offset);
1293
1293
 
1298
1298
 
1299
1299
        watch_page = buf_page_hash_get_low(buf_pool, space, offset, fold);
1300
1300
        if (watch_page && !buf_pool_watch_is_sentinel(buf_pool, watch_page)) {
1301
 
@@ -3165,9 +3331,15 @@
 
1301
@@ -3166,9 +3332,15 @@
1302
1302
 err_exit:
1303
1303
                if (block) {
1304
1304
                        mutex_enter(&block->mutex);
1315
1315
 
1316
1316
                bpage = NULL;
1317
1317
                goto func_exit;
1318
 
@@ -3190,6 +3362,8 @@
 
1318
@@ -3191,6 +3363,8 @@
1319
1319
 
1320
 
                buf_page_init(space, offset, fold, block);
 
1320
                buf_page_init(buf_pool, space, offset, fold, block);
1321
1321
 
1322
1322
+               rw_lock_x_unlock(&buf_pool->page_hash_latch);
1323
1323
+
1324
1324
                /* The block must be put to the LRU list, to the old blocks */
1325
1325
                buf_LRU_add_block(bpage, TRUE/* to old blocks */);
1326
1326
 
1327
 
@@ -3217,7 +3391,7 @@
 
1327
@@ -3218,7 +3392,7 @@
1328
1328
                        been added to buf_pool->LRU and
1329
1329
                        buf_pool->page_hash. */
1330
1330
                        mutex_exit(&block->mutex);
1333
1333
                        mutex_enter(&block->mutex);
1334
1334
                        block->page.zip.data = data;
1335
1335
 
1336
 
@@ -3230,13 +3404,14 @@
 
1336
@@ -3231,13 +3405,14 @@
1337
1337
                        buf_unzip_LRU_add_block(block, TRUE);
1338
1338
                }
1339
1339
 
1349
1349
 
1350
1350
                /* If buf_buddy_alloc() allocated storage from the LRU list,
1351
1351
                it released and reacquired buf_pool->mutex.  Thus, we must
1352
 
@@ -3252,7 +3427,10 @@
 
1352
@@ -3253,7 +3428,10 @@
1353
1353
 
1354
1354
                                /* The block was added by some other thread. */
1355
1355
                                watch_page = NULL;
1361
1361
 
1362
1362
                                bpage = NULL;
1363
1363
                                goto func_exit;
1364
 
@@ -3300,20 +3478,26 @@
 
1364
@@ -3301,20 +3479,26 @@
1365
1365
                HASH_INSERT(buf_page_t, hash, buf_pool->page_hash, fold,
1366
1366
                            bpage);
1367
1367
 
1389
1389
 
1390
1390
        if (mode == BUF_READ_IBUF_PAGES_ONLY) {
1391
1391
 
1392
 
@@ -3355,7 +3539,9 @@
 
1392
@@ -3356,7 +3540,9 @@
1393
1393
 
1394
1394
        fold = buf_page_address_fold(space, offset);
1395
1395
 
1400
1400
 
1401
1401
        block = (buf_block_t*) buf_page_hash_get_low(
1402
1402
                buf_pool, space, offset, fold);
1403
 
@@ -3371,7 +3557,9 @@
 
1403
@@ -3372,7 +3558,9 @@
1404
1404
 #endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */
1405
1405
 
1406
1406
                /* Page can be found in buf_pool */
1411
1411
 
1412
1412
                buf_block_free(free_block);
1413
1413
 
1414
 
@@ -3393,6 +3581,7 @@
 
1414
@@ -3394,6 +3582,7 @@
1415
1415
        mutex_enter(&block->mutex);
1416
1416
 
1417
 
        buf_page_init(space, offset, fold, block);
 
1417
        buf_page_init(buf_pool, space, offset, fold, block);
1418
1418
+       rw_lock_x_unlock(&buf_pool->page_hash_latch);
1419
1419
 
1420
1420
        /* The block must be put to the LRU list */
1421
1421
        buf_LRU_add_block(&block->page, FALSE);
1422
 
@@ -3419,7 +3608,7 @@
 
1422
@@ -3420,7 +3609,7 @@
1423
1423
                the reacquisition of buf_pool->mutex.  We also must
1424
1424
                defer this operation until after the block descriptor
1425
1425
                has been added to buf_pool->LRU and buf_pool->page_hash. */
1428
1428
                mutex_enter(&block->mutex);
1429
1429
                block->page.zip.data = data;
1430
1430
 
1431
 
@@ -3437,7 +3626,8 @@
 
1431
@@ -3438,7 +3627,8 @@
1432
1432
 
1433
1433
        buf_page_set_accessed(&block->page, time_ms);
1434
1434
 
1438
1438
 
1439
1439
        mtr_memo_push(mtr, block, MTR_MEMO_BUF_FIX);
1440
1440
 
1441
 
@@ -3488,6 +3678,8 @@
 
1441
@@ -3493,7 +3683,9 @@
 
1442
        ibool           ret = TRUE;
 
1443
 
 
1444
        /* First unfix and release lock on the bpage */
 
1445
-       buf_pool_mutex_enter(buf_pool);
 
1446
+       //buf_pool_mutex_enter(buf_pool);
 
1447
+       mutex_enter(&buf_pool->LRU_list_mutex);
 
1448
+       rw_lock_x_lock(&buf_pool->page_hash_latch);
 
1449
        mutex_enter(buf_page_get_mutex(bpage));
 
1450
        ut_ad(buf_page_get_io_fix(bpage) == BUF_IO_READ);
 
1451
        ut_ad(bpage->buf_fix_count == 0);
 
1452
@@ -3514,11 +3706,15 @@
 
1453
                ret = FALSE;
 
1454
        }
 
1455
 
 
1456
+       buf_pool_mutex_enter(buf_pool);
 
1457
        ut_ad(buf_pool->n_pend_reads > 0);
 
1458
        buf_pool->n_pend_reads--;
 
1459
+       buf_pool_mutex_exit(buf_pool);
 
1460
 
 
1461
        mutex_exit(buf_page_get_mutex(bpage));
 
1462
-       buf_pool_mutex_exit(buf_pool);
 
1463
+       //buf_pool_mutex_exit(buf_pool);
 
1464
+       mutex_exit(&buf_pool->LRU_list_mutex);
 
1465
+       rw_lock_x_unlock(&buf_pool->page_hash_latch);
 
1466
 
 
1467
        return(ret);
 
1468
 }
 
1469
@@ -3536,6 +3732,8 @@
1442
1470
        buf_pool_t*     buf_pool = buf_pool_from_bpage(bpage);
1443
1471
        const ibool     uncompressed = (buf_page_get_state(bpage)
1444
1472
                                        == BUF_BLOCK_FILE_PAGE);
1447
1475
 
1448
1476
        ut_a(buf_page_in_file(bpage));
1449
1477
 
1450
 
@@ -3621,8 +3813,26 @@
 
1478
@@ -3678,8 +3876,26 @@
1451
1479
                }
1452
1480
        }
1453
1481
 
1475
1503
 
1476
1504
 #ifdef UNIV_IBUF_COUNT_DEBUG
1477
1505
        if (io_type == BUF_IO_WRITE || uncompressed) {
1478
 
@@ -3645,6 +3855,7 @@
 
1506
@@ -3702,6 +3918,7 @@
1479
1507
                the x-latch to this OS thread: do not let this confuse you in
1480
1508
                debugging! */
1481
1509
 
1483
1511
                ut_ad(buf_pool->n_pend_reads > 0);
1484
1512
                buf_pool->n_pend_reads--;
1485
1513
                buf_pool->stat.n_pages_read++;
1486
 
@@ -3662,6 +3873,9 @@
 
1514
@@ -3719,6 +3936,9 @@
1487
1515
 
1488
1516
                buf_flush_write_complete(bpage);
1489
1517
 
1493
1521
                if (uncompressed) {
1494
1522
                        rw_lock_s_unlock_gen(&((buf_block_t*) bpage)->lock,
1495
1523
                                             BUF_IO_WRITE);
1496
 
@@ -3684,8 +3898,8 @@
 
1524
@@ -3741,8 +3961,8 @@
1497
1525
        }
1498
1526
 #endif /* UNIV_DEBUG */
1499
1527
 
1503
1531
 }
1504
1532
 
1505
1533
 /*********************************************************************//**
1506
 
@@ -3702,7 +3916,9 @@
 
1534
@@ -3759,7 +3979,9 @@
1507
1535
 
1508
1536
        ut_ad(buf_pool);
1509
1537
 
1514
1542
 
1515
1543
        chunk = buf_pool->chunks;
1516
1544
 
1517
 
@@ -3719,7 +3935,9 @@
 
1545
@@ -3776,7 +3998,9 @@
1518
1546
                }
1519
1547
        }
1520
1548
 
1525
1553
 
1526
1554
        return(TRUE);
1527
1555
 }
1528
 
@@ -3767,7 +3985,8 @@
 
1556
@@ -3824,7 +4048,8 @@
1529
1557
                freed = buf_LRU_search_and_free_block(buf_pool, 100);
1530
1558
        }
1531
1559
 
1535
1563
 
1536
1564
        ut_ad(UT_LIST_GET_LEN(buf_pool->LRU) == 0);
1537
1565
        ut_ad(UT_LIST_GET_LEN(buf_pool->unzip_LRU) == 0);
1538
 
@@ -3780,7 +3999,8 @@
 
1566
@@ -3837,7 +4062,8 @@
1539
1567
        memset(&buf_pool->stat, 0x00, sizeof(buf_pool->stat));
1540
1568
        buf_refresh_io_stats(buf_pool);
1541
1569
 
1545
1573
 }
1546
1574
 
1547
1575
 /*********************************************************************//**
1548
 
@@ -3822,7 +4042,10 @@
 
1576
@@ -3879,7 +4105,10 @@
1549
1577
 
1550
1578
        ut_ad(buf_pool);
1551
1579
 
1557
1585
 
1558
1586
        chunk = buf_pool->chunks;
1559
1587
 
1560
 
@@ -3917,7 +4140,7 @@
 
1588
@@ -3974,7 +4203,7 @@
1561
1589
        /* Check clean compressed-only blocks. */
1562
1590
 
1563
1591
        for (b = UT_LIST_GET_FIRST(buf_pool->zip_clean); b;
1566
1594
                ut_a(buf_page_get_state(b) == BUF_BLOCK_ZIP_PAGE);
1567
1595
                switch (buf_page_get_io_fix(b)) {
1568
1596
                case BUF_IO_NONE:
1569
 
@@ -3948,7 +4171,7 @@
 
1597
@@ -4005,7 +4234,7 @@
1570
1598
 
1571
1599
        buf_flush_list_mutex_enter(buf_pool);
1572
1600
        for (b = UT_LIST_GET_FIRST(buf_pool->flush_list); b;
1575
1603
                ut_ad(b->in_flush_list);
1576
1604
                ut_a(b->oldest_modification);
1577
1605
                n_flush++;
1578
 
@@ -4007,6 +4230,8 @@
 
1606
@@ -4064,6 +4293,8 @@
1579
1607
        }
1580
1608
 
1581
1609
        ut_a(UT_LIST_GET_LEN(buf_pool->LRU) == n_lru);
1584
1612
        if (UT_LIST_GET_LEN(buf_pool->free) != n_free) {
1585
1613
                fprintf(stderr, "Free list len %lu, free blocks %lu\n",
1586
1614
                        (ulong) UT_LIST_GET_LEN(buf_pool->free),
1587
 
@@ -4017,8 +4242,11 @@
 
1615
@@ -4074,8 +4305,11 @@
1588
1616
        ut_a(buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE] == n_single_flush);
1589
1617
        ut_a(buf_pool->n_flush[BUF_FLUSH_LIST] == n_list_flush);
1590
1618
        ut_a(buf_pool->n_flush[BUF_FLUSH_LRU] == n_lru_flush);
1597
1625
 
1598
1626
        ut_a(buf_LRU_validate());
1599
1627
        ut_a(buf_flush_validate(buf_pool));
1600
 
@@ -4074,7 +4302,9 @@
 
1628
@@ -4131,7 +4365,9 @@
1601
1629
        index_ids = mem_alloc(size * sizeof *index_ids);
1602
1630
        counts = mem_alloc(sizeof(ulint) * size);
1603
1631
 
1608
1636
        buf_flush_list_mutex_enter(buf_pool);
1609
1637
 
1610
1638
        fprintf(stderr,
1611
 
@@ -4143,7 +4373,9 @@
 
1639
@@ -4200,7 +4436,9 @@
1612
1640
                }
1613
1641
        }
1614
1642
 
1619
1647
 
1620
1648
        for (i = 0; i < n_found; i++) {
1621
1649
                index = dict_index_get_if_in_cache(index_ids[i]);
1622
 
@@ -4200,7 +4432,7 @@
 
1650
@@ -4257,7 +4495,7 @@
1623
1651
        buf_chunk_t*    chunk;
1624
1652
        ulint           fixed_pages_number = 0;
1625
1653
 
1628
1656
 
1629
1657
        chunk = buf_pool->chunks;
1630
1658
 
1631
 
@@ -4234,7 +4466,7 @@
 
1659
@@ -4291,7 +4529,7 @@
1632
1660
        /* Traverse the lists of clean and dirty compressed-only blocks. */
1633
1661
 
1634
1662
        for (b = UT_LIST_GET_FIRST(buf_pool->zip_clean); b;
1637
1665
                ut_a(buf_page_get_state(b) == BUF_BLOCK_ZIP_PAGE);
1638
1666
                ut_a(buf_page_get_io_fix(b) != BUF_IO_WRITE);
1639
1667
 
1640
 
@@ -4246,7 +4478,7 @@
 
1668
@@ -4303,7 +4541,7 @@
1641
1669
 
1642
1670
        buf_flush_list_mutex_enter(buf_pool);
1643
1671
        for (b = UT_LIST_GET_FIRST(buf_pool->flush_list); b;
1646
1674
                ut_ad(b->in_flush_list);
1647
1675
 
1648
1676
                switch (buf_page_get_state(b)) {
1649
 
@@ -4272,7 +4504,7 @@
 
1677
@@ -4329,7 +4567,7 @@
1650
1678
 
1651
1679
        buf_flush_list_mutex_exit(buf_pool);
1652
1680
        mutex_exit(&buf_pool->zip_mutex);
1655
1683
 
1656
1684
        return(fixed_pages_number);
1657
1685
 }
1658
 
@@ -4430,6 +4662,8 @@
 
1686
@@ -4487,6 +4725,8 @@
1659
1687
        /* Find appropriate pool_info to store stats for this buffer pool */
1660
1688
        pool_info = &all_pool_info[pool_id];
1661
1689
 
1664
1692
        buf_pool_mutex_enter(buf_pool);
1665
1693
        buf_flush_list_mutex_enter(buf_pool);
1666
1694
 
1667
 
@@ -4545,6 +4779,8 @@
 
1695
@@ -4602,6 +4842,8 @@
1668
1696
        pool_info->unzip_cur = buf_LRU_stat_cur.unzip;
1669
1697
 
1670
1698
        buf_refresh_io_stats(buf_pool);
1673
1701
        buf_pool_mutex_exit(buf_pool);
1674
1702
 }
1675
1703
 
1676
 
@@ -4789,11 +5025,13 @@
 
1704
@@ -4846,11 +5088,13 @@
1677
1705
 {
1678
1706
        ulint   len;
1679
1707
 
2953
2981
+       buf_LRU_block_free_non_file_page(block, have_page_hash_mutex);
2954
2982
 }
2955
2983
 
2956
 
 /**********************************************************************//**
2957
 
@@ -1909,7 +2063,8 @@
 
2984
 /******************************************************************//**
 
2985
@@ -1897,7 +2051,7 @@
 
2986
 {
 
2987
        if (buf_LRU_block_remove_hashed_page(bpage, TRUE)
 
2988
            != BUF_BLOCK_ZIP_FREE) {
 
2989
-               buf_LRU_block_free_hashed_page((buf_block_t*) bpage);
 
2990
+               buf_LRU_block_free_hashed_page((buf_block_t*) bpage, TRUE);
 
2991
        }
 
2992
 }
 
2993
 
 
2994
@@ -1925,7 +2079,8 @@
2958
2995
        }
2959
2996
 
2960
2997
        if (adjust) {
2964
3001
 
2965
3002
                if (ratio != buf_pool->LRU_old_ratio) {
2966
3003
                        buf_pool->LRU_old_ratio = ratio;
2967
 
@@ -1921,7 +2076,8 @@
 
3004
@@ -1937,7 +2092,8 @@
2968
3005
                        }
2969
3006
                }
2970
3007
 
2974
3011
        } else {
2975
3012
                buf_pool->LRU_old_ratio = ratio;
2976
3013
        }
2977
 
@@ -2026,7 +2182,8 @@
 
3014
@@ -2042,7 +2198,8 @@
2978
3015
        ulint           new_len;
2979
3016
 
2980
3017
        ut_ad(buf_pool);
2984
3021
 
2985
3022
        if (UT_LIST_GET_LEN(buf_pool->LRU) >= BUF_LRU_OLD_MIN_LEN) {
2986
3023
 
2987
 
@@ -2087,16 +2244,22 @@
 
3024
@@ -2103,16 +2260,22 @@
2988
3025
 
2989
3026
        ut_a(buf_pool->LRU_old_len == old_len);
2990
3027
 
3009
3046
        UT_LIST_VALIDATE(unzip_LRU, buf_block_t, buf_pool->unzip_LRU,
3010
3047
                         ut_ad(ut_list_node_313->in_unzip_LRU_list
3011
3048
                               && ut_list_node_313->page.in_LRU_list));
3012
 
@@ -2110,7 +2273,8 @@
 
3049
@@ -2126,7 +2289,8 @@
3013
3050
                ut_a(buf_page_belongs_to_unzip_LRU(&block->page));
3014
3051
        }
3015
3052
 
3019
3056
 }
3020
3057
 
3021
3058
 /**********************************************************************//**
3022
 
@@ -2146,7 +2310,8 @@
 
3059
@@ -2162,7 +2326,8 @@
3023
3060
        const buf_page_t*       bpage;
3024
3061
 
3025
3062
        ut_ad(buf_pool);
3029
3066
 
3030
3067
        bpage = UT_LIST_GET_FIRST(buf_pool->LRU);
3031
3068
 
3032
 
@@ -2203,7 +2368,8 @@
 
3069
@@ -2219,7 +2384,8 @@
3033
3070
                bpage = UT_LIST_GET_NEXT(LRU, bpage);
3034
3071
        }
3035
3072
 
3279
3316
 Creates the buffer pool.
3280
3317
 @return        own: buf_pool object, NULL if not enough memory or error */
3281
3318
 UNIV_INTERN
3282
 
@@ -889,6 +903,15 @@
 
3319
@@ -864,6 +878,15 @@
3283
3320
        const buf_page_t*       bpage)  /*!< in: pointer to control block */
3284
3321
        __attribute__((pure));
3285
3322
 
3295
3332
 /*********************************************************************//**
3296
3333
 Get the flush type of a page.
3297
3334
 @return        flush type */
3298
 
@@ -1370,7 +1393,7 @@
 
3335
@@ -1345,7 +1368,7 @@
3299
3336
        All these are protected by buf_pool->mutex. */
3300
3337
        /* @{ */
3301
3338
 
3304
3341
                                        /*!< based on state, this is a
3305
3342
                                        list node, protected either by
3306
3343
                                        buf_pool->mutex or by
3307
 
@@ -1398,6 +1421,10 @@
 
3344
@@ -1373,6 +1396,10 @@
3308
3345
                                        BUF_BLOCK_REMOVE_HASH or
3309
3346
                                        BUF_BLOCK_READY_IN_USE. */
3310
3347
 
3315
3352
 #ifdef UNIV_DEBUG
3316
3353
        ibool           in_flush_list;  /*!< TRUE if in buf_pool->flush_list;
3317
3354
                                        when buf_pool->flush_list_mutex is
3318
 
@@ -1490,11 +1517,11 @@
 
3355
@@ -1465,11 +1492,11 @@
3319
3356
                                        a block is in the unzip_LRU list
3320
3357
                                        if page.state == BUF_BLOCK_FILE_PAGE
3321
3358
                                        and page.zip.data != NULL */
3329
3366
        mutex_t         mutex;          /*!< mutex protecting this block:
3330
3367
                                        state (also protected by the buffer
3331
3368
                                        pool mutex), io_fix, buf_fix_count,
3332
 
@@ -1671,6 +1698,11 @@
 
3369
@@ -1646,6 +1673,11 @@
3333
3370
                                        pool instance, protects compressed
3334
3371
                                        only pages (of type buf_page_t, not
3335
3372
                                        buf_block_t */
3341
3378
        ulint           instance_no;    /*!< Array index of this buffer
3342
3379
                                        pool instance */
3343
3380
        ulint           old_pool_size;  /*!< Old pool size in bytes */
3344
 
@@ -1824,8 +1856,8 @@
 
3381
@@ -1799,8 +1831,8 @@
3345
3382
 /** Test if a buffer pool mutex is owned. */
3346
3383
 #define buf_pool_mutex_own(b) mutex_own(&b->mutex)
3347
3384
 /** Acquire a buffer pool mutex. */
3529
3566
               && (block->page.buf_fix_count == 0))
3530
3567
              || rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
3531
3568
 #endif /* UNIV_SYNC_DEBUG */
3532
 
@@ -1013,7 +1044,11 @@
 
3569
@@ -1026,7 +1057,11 @@
3533
3570
        buf_page_t*     bpage;
3534
3571
 
3535
3572
        ut_ad(buf_pool);
3542
3579
        ut_ad(fold == buf_page_address_fold(space, offset));
3543
3580
 
3544
3581
        /* Look for the page in the hash table */
3545
 
@@ -1098,11 +1133,13 @@
 
3582
@@ -1111,11 +1146,13 @@
3546
3583
        const buf_page_t*       bpage;
3547
3584
        buf_pool_t*             buf_pool = buf_pool_get(space, offset);
3548
3585
 
3558
3595
 
3559
3596
        return(bpage != NULL);
3560
3597
 }
3561
 
@@ -1230,4 +1267,38 @@
 
3598
@@ -1243,4 +1280,38 @@
3562
3599
                buf_pool_mutex_exit(buf_pool);
3563
3600
        }
3564
3601
 }
3643
3680
 extern mysql_pfs_key_t cache_last_read_mutex_key;
3644
3681
 extern mysql_pfs_key_t dict_foreign_err_mutex_key;
3645
3682
 extern mysql_pfs_key_t dict_sys_mutex_key;
3646
 
@@ -670,7 +674,7 @@
 
3683
@@ -667,7 +671,7 @@
3647
3684
 #define SYNC_TRX_SYS_HEADER    290
3648
3685
 #define        SYNC_PURGE_QUEUE        200
3649
3686
 #define SYNC_LOG               170
3652
3689
 #define SYNC_RECV              168
3653
3690
 #define        SYNC_WORK_QUEUE         162
3654
3691
 #define        SYNC_SEARCH_SYS_CONF    161     /* for assigning btr_search_enabled */
3655
 
@@ -680,8 +684,13 @@
 
3692
@@ -677,8 +681,13 @@
3656
3693
                                        SYNC_SEARCH_SYS, as memory allocation
3657
3694
                                        can call routines there! Otherwise
3658
3695
                                        the level is SYNC_MEM_HASH. */
3667
3704
 #define        SYNC_BUF_FLUSH_LIST     145     /* Buffer flush list mutex */
3668
3705
 #define SYNC_DOUBLEWRITE       140
3669
3706
 #define        SYNC_ANY_LATCH          135
3670
 
@@ -713,7 +722,7 @@
 
3707
@@ -709,7 +718,7 @@
3671
3708
                os_fast_mutex;  /*!< We use this OS mutex in place of lock_word
3672
3709
                                when atomic operations are not enabled */
3673
3710
 #endif
3731
3768
 }
3732
3769
 
3733
3770
 /******************************************************************//**
3734
 
@@ -1239,7 +1249,12 @@
 
3771
@@ -1234,7 +1244,12 @@
3735
3772
                        ut_error;
3736
3773
                }
3737
3774
                break;
3744
3781
        case SYNC_BUF_POOL:
3745
3782
                /* We can have multiple mutexes of this type therefore we
3746
3783
                can only check whether the greater than condition holds. */
3747
 
@@ -1257,7 +1272,8 @@
 
3784
@@ -1252,7 +1267,8 @@
3748
3785
                buffer block (block->mutex or buf_pool->zip_mutex). */
3749
3786
                if (!sync_thread_levels_g(array, level, FALSE)) {
3750
3787
                        ut_a(sync_thread_levels_g(array, level - 1, TRUE));