facebook / rocksdb

A library that provides an embeddable, persistent key-value store for fast storage.
http://rocksdb.org
GNU General Public License v2.0
27.83k stars 6.2k forks source link

Potential concurrency problem #12833

Open wqshr12345 opened 2 days ago

wqshr12345 commented 2 days ago

Note: Please use Issues only for bug reports. For questions, discussions, feature requests, etc. post to dev group: https://groups.google.com/forum/#!forum/rocksdb or https://www.facebook.com/groups/rocksdb.dev

When using HistogramStat in a multithreaded environment, where the cumulative percentage exceeded 100%.

image

I suspect this is related to the Add logic in HistogramStat.

image

In a multithreaded scenario, could this lead to incorrect updates of variables like num and sum? Should we replace it with fetch_add?