1
1
/* ****************************************************************************
2
2
3
- Copyright (c) 2009, 2014 , Oracle and/or its affiliates. All Rights Reserved.
3
+ Copyright (c) 2009, 2015 , Oracle and/or its affiliates. All Rights Reserved.
4
4
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
@@ -1434,16 +1434,14 @@ on the leaf page.
1434
1434
when comparing records
1435
1435
@param[out] n_diff number of distinct records
1436
1436
@param[out] n_external_pages number of external pages
1437
- @param[in,out] mtr mini-transaction
1438
1437
@return number of distinct records on the leaf page */
1439
1438
static
1440
1439
void
1441
1440
dict_stats_analyze_index_below_cur (
1442
1441
const btr_cur_t * cur,
1443
1442
ulint n_prefix,
1444
1443
ib_uint64_t * n_diff,
1445
- ib_uint64_t * n_external_pages,
1446
- mtr_t * mtr)
1444
+ ib_uint64_t * n_external_pages)
1447
1445
{
1448
1446
dict_index_t * index;
1449
1447
ulint space;
@@ -1457,6 +1455,7 @@ dict_stats_analyze_index_below_cur(
1457
1455
ulint* offsets2;
1458
1456
ulint* offsets_rec;
1459
1457
ulint size;
1458
+ mtr_t mtr;
1460
1459
1461
1460
index = btr_cur_get_index (cur);
1462
1461
@@ -1495,12 +1494,14 @@ dict_stats_analyze_index_below_cur(
1495
1494
function without analyzing any leaf pages */
1496
1495
*n_external_pages = 0 ;
1497
1496
1497
+ mtr_start (&mtr);
1498
+
1498
1499
/* descend to the leaf level on the B-tree */
1499
1500
for (;;) {
1500
1501
1501
1502
block = buf_page_get_gen (space, zip_size, page_no, RW_S_LATCH,
1502
1503
NULL /* no guessed block */ ,
1503
- BUF_GET, __FILE__, __LINE__, mtr);
1504
+ BUF_GET, __FILE__, __LINE__, & mtr);
1504
1505
1505
1506
page = buf_block_get_frame (block);
1506
1507
@@ -1522,6 +1523,8 @@ dict_stats_analyze_index_below_cur(
1522
1523
ut_a (*n_diff > 0 );
1523
1524
1524
1525
if (*n_diff == 1 ) {
1526
+ mtr_commit (&mtr);
1527
+
1525
1528
/* page has all keys equal and the end of the page
1526
1529
was reached by dict_stats_scan_page(), no need to
1527
1530
descend to the leaf level */
@@ -1546,7 +1549,7 @@ dict_stats_analyze_index_below_cur(
1546
1549
}
1547
1550
1548
1551
/* make sure we got a leaf page as a result from the above loop */
1549
- ut_ad (btr_page_get_level (page, mtr) == 0 );
1552
+ ut_ad (btr_page_get_level (page, & mtr) == 0 );
1550
1553
1551
1554
/* scan the leaf page and find the number of distinct keys,
1552
1555
when looking only at the first n_prefix columns; also estimate
@@ -1563,6 +1566,7 @@ dict_stats_analyze_index_below_cur(
1563
1566
__func__, page_no, n_diff);
1564
1567
#endif
1565
1568
1569
+ mtr_commit (&mtr);
1566
1570
mem_heap_free (heap);
1567
1571
}
1568
1572
@@ -1772,8 +1776,7 @@ dict_stats_analyze_index_for_n_prefix(
1772
1776
dict_stats_analyze_index_below_cur (btr_pcur_get_btr_cur (&pcur),
1773
1777
n_prefix,
1774
1778
&n_diff_on_leaf_page,
1775
- &n_external_pages,
1776
- mtr);
1779
+ &n_external_pages);
1777
1780
1778
1781
/* We adjust n_diff_on_leaf_page here to avoid counting
1779
1782
one record twice - once as the last on some page and once
0 commit comments