innodb 樂觀插入因空間不夠導致失敗,進入悲觀插入階段,這個空間的限制大小,innodb階段

來源:互聯網
上載者:User

innodb 樂觀插入因空間不夠導致失敗,進入悲觀插入階段,這個空間的限制大小,innodb階段

btr_cur_optimistic_insert{

...

/*檢查分裂頁時是否有足夠的空間預留給未來記錄的update*/

if (leaf && !zip_size && dict_index_is_clust(index)

             && page_get_n_recs(page) >= 2

             && dict_index_get_space_reserve()+ rec_size > max_size

             &&(btr_page_get_split_rec_to_right(cursor, &dummy)

                   ||btr_page_get_split_rec_to_left(cursor, &dummy))) {

                   gotofail;

         }

...

}


dict_index_get_space_reserve()+ rec_size > max_size

dict_index_get_space_reserve()=1024,即當1024+記錄大小rec_size大於當前page空閑空間max_size時,樂觀插入失敗,進入悲觀插入階段,發生B+分裂

著作權聲明:本文為博主原創文章,未經博主允許不得轉載。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.