@@ -1296,13 +1296,6 @@ void buf_pool_t::close()
1296
1296
ut_free (chunks);
1297
1297
chunks= nullptr ;
1298
1298
page_hash.free ();
1299
- while (page_hash_table *old_page_hash= freed_page_hash)
1300
- {
1301
- freed_page_hash= static_cast <page_hash_table*>
1302
- (old_page_hash->array [1 ].node );
1303
- old_page_hash->free ();
1304
- UT_DELETE (old_page_hash);
1305
- }
1306
1299
zip_hash.free ();
1307
1300
1308
1301
io_buf.close ();
@@ -1581,57 +1574,6 @@ inline bool buf_pool_t::withdraw_blocks()
1581
1574
return (false );
1582
1575
}
1583
1576
1584
- /* * resize page_hash and zip_hash */
1585
- inline void buf_pool_t::resize_hash ()
1586
- {
1587
- page_hash_table *new_page_hash= UT_NEW_NOKEY (page_hash_table ());
1588
- new_page_hash->create (2 * buf_pool.curr_size );
1589
- new_page_hash->write_lock_all ();
1590
-
1591
- for (auto i= page_hash.pad (page_hash.n_cells ); i--; )
1592
- {
1593
- static_assert (!((page_hash_table::ELEMENTS_PER_LATCH + 1 ) &
1594
- page_hash_table::ELEMENTS_PER_LATCH),
1595
- " must be one less than a power of 2" );
1596
- if (!(i & page_hash_table::ELEMENTS_PER_LATCH))
1597
- {
1598
- ut_ad (reinterpret_cast <page_hash_latch*>
1599
- (&page_hash.array [i])->is_write_locked ());
1600
- continue ;
1601
- }
1602
- while (buf_page_t *bpage= static_cast <buf_page_t *>
1603
- (page_hash.array [i].node ))
1604
- {
1605
- ut_ad (bpage->in_page_hash );
1606
- const ulint fold= bpage->id ().fold ();
1607
- HASH_DELETE (buf_page_t , hash, &buf_pool.page_hash , fold, bpage);
1608
- HASH_INSERT (buf_page_t , hash, new_page_hash, fold, bpage);
1609
- }
1610
- }
1611
-
1612
- buf_pool.page_hash .array [1 ].node = freed_page_hash;
1613
- std::swap (buf_pool.page_hash , *new_page_hash);
1614
- freed_page_hash= new_page_hash;
1615
-
1616
- /* recreate zip_hash */
1617
- hash_table_t new_hash;
1618
- new_hash.create (2 * buf_pool.curr_size );
1619
-
1620
- for (ulint i= 0 ; i < buf_pool.zip_hash .n_cells ; i++)
1621
- {
1622
- while (buf_page_t *bpage= static_cast <buf_page_t *>
1623
- (HASH_GET_FIRST (&buf_pool.zip_hash , i)))
1624
- {
1625
- const ulint fold= BUF_POOL_ZIP_FOLD_BPAGE (bpage);
1626
- HASH_DELETE (buf_page_t , hash, &buf_pool.zip_hash , fold, bpage);
1627
- HASH_INSERT (buf_page_t , hash, &new_hash, fold, bpage);
1628
- }
1629
- }
1630
-
1631
- std::swap (buf_pool.zip_hash .array , new_hash.array );
1632
- buf_pool.zip_hash .n_cells = new_hash.n_cells ;
1633
- new_hash.free ();
1634
- }
1635
1577
1636
1578
1637
1579
inline void buf_pool_t::page_hash_table::write_lock_all ()
@@ -1656,26 +1598,6 @@ inline void buf_pool_t::page_hash_table::write_unlock_all()
1656
1598
}
1657
1599
1658
1600
1659
- inline void buf_pool_t::write_lock_all_page_hash ()
1660
- {
1661
- mysql_mutex_assert_owner (&mutex);
1662
- page_hash.write_lock_all ();
1663
- for (page_hash_table *old_page_hash= freed_page_hash; old_page_hash;
1664
- old_page_hash= static_cast <page_hash_table*>
1665
- (old_page_hash->array [1 ].node ))
1666
- old_page_hash->write_lock_all ();
1667
- }
1668
-
1669
-
1670
- inline void buf_pool_t::write_unlock_all_page_hash ()
1671
- {
1672
- page_hash.write_unlock_all ();
1673
- for (page_hash_table *old_page_hash= freed_page_hash; old_page_hash;
1674
- old_page_hash= static_cast <page_hash_table*>
1675
- (old_page_hash->array [1 ].node ))
1676
- old_page_hash->write_unlock_all ();
1677
- }
1678
-
1679
1601
namespace
1680
1602
{
1681
1603
@@ -1848,7 +1770,7 @@ inline void buf_pool_t::resize()
1848
1770
resizing.store (true , std::memory_order_relaxed);
1849
1771
1850
1772
mysql_mutex_lock (&mutex);
1851
- write_lock_all_page_hash ();
1773
+ page_hash. write_lock_all ();
1852
1774
1853
1775
chunk_t ::map_reg = UT_NEW_NOKEY (chunk_t::map ());
1854
1776
@@ -2004,16 +1926,8 @@ inline void buf_pool_t::resize()
2004
1926
= srv_buf_pool_base_size > srv_buf_pool_size * 2
2005
1927
|| srv_buf_pool_base_size * 2 < srv_buf_pool_size;
2006
1928
2007
- /* Normalize page_hash and zip_hash,
2008
- if the new size is too different */
2009
- if (!warning && new_size_too_diff) {
2010
- buf_resize_status (" Resizing hash table" );
2011
- resize_hash ();
2012
- ib::info () << " hash tables were resized" ;
2013
- }
2014
-
2015
1929
mysql_mutex_unlock (&mutex);
2016
- write_unlock_all_page_hash ();
1930
+ page_hash. write_unlock_all ();
2017
1931
2018
1932
UT_DELETE (chunk_map_old);
2019
1933
0 commit comments