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

Rdb_iterator_base::next_with_direction: too many compares for eof check #1438

Open rockeet opened 3 months ago

rockeet commented 3 months ago

in Rdb_iterator_base::next_with_direction, it checks prefix and lower bound and upper bound, this consuming too many cpu in our cases, when running tpcc, the flame graph showing these 3 compare takes up to 3% cpu time, which is ~10% of myrocks::Rdb_iterator_base::next_with_direction.

MyRocks use [Reverse]BytewiseComparator, so the optimal should be just 1 compare in scanning, I have tried to improve this way, it is ok in most cases but failed some mtr tests. I am expecting an official fix for this issue.

luqun commented 3 months ago

Thanks for reporting. if you are using new rocksdb version(>=8.8.0), then you can try to disable iterator bound check(rocksdb_check_iterate_bounds = 0);

rockeet commented 3 months ago

Thanks for reporting. if you are using new rocksdb version(>=8.8.0), then you can try to disable iterator bound check(rocksdb_check_iterate_bounds = 0);

Very thanks!