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

MyRocks: remove some std::shared_ptr uses #1443

Closed laurynas-biveinis closed 3 months ago

laurynas-biveinis commented 3 months ago

std::shared_ptr should be stored and passed around in situations where the pointed-to object lifetime is unclear, when it has to be extended, or when forced to (i.e. RocksDB API returns it). Some of the uses in MyRocks do not fall under these categories and can be simplified to direct (constant) references.

This cleans up some low hanging fruit, focusing on Rdb_converter, Rdb_iterator_base, & Rdb_iterator_partial classes. Since these classes replace shared pointer fields with reference ones, make them non-copyable and non-moveable for safety, which matches their existing use. At the same time make Rdb_tbl_prop_coll::read_stats_from_tbl_prop return vector directly instead of using an output parameter.

facebook-github-bot commented 3 months ago

@luqun has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot commented 3 months ago

@luqun has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot commented 3 months ago

This pull request has been merged in facebook/mysql-5.6@f6ecdf715fc8d642a280420e6ba82b102a17f0d0.