facebook / mysql-5.6

Facebook's branch of the Oracle MySQL database. This includes MyRocks.
http://myrocks.io
Other
2.46k stars 711 forks source link

Replace the global MyRocks transaction multiset with an intrusive doubly linked list #1471

Open laurynas-biveinis opened 1 week ago

laurynas-biveinis commented 1 week ago

Previously, the data structure used for the global MyRocks transaction list was std::multiset. It was not optimal, for instance, it did not need to be sorted nor multi-. Replace it with an intrusive doubly linked list. The list pointers are stored directly in the transaction object, which has the advantage that adding and removing the transaction from the global list does not need to maintain any extra nodes on heap, shortening the code path and improving the data locality even if the latter still remains poor due to linked list data structure. This change also improves the complexity of insertion and removal operations from logarithmic to constant.

At the same time split out the global list methods and fields from Rdb_transaction class to a new Rdb_transaction_list class.