opencurve / curve

Curve is a sandbox project hosted by the CNCF Foundation. It's cloud-native, high-performance, and easy to operate. Curve is an open-source distributed storage system for block and shared file storage.
https://opencurve.io
Apache License 2.0
2.32k stars 521 forks source link

[BUG](common): ARCCache's param `c` means cache capacity #2952

Closed zztaki closed 9 months ago

zztaki commented 9 months ago

Describe the bug (描述bug) ARCCache's param c means cache capacity, but in the code, it is not. So this will cause ARCCache's real capacity will be maxCount/2.

To Reproduce (复现方法)

Expected behavior (期望行为)

Versions (各种版本) OS: Compiler: branch: commit id:

Additional context/screenshots (更多上下文/截图)

zztaki commented 9 months ago

If you think this makes sense, I am glad to submit a PR and add some tests for ARCCache :)

zztaki commented 9 months ago

image

zztaki commented 9 months ago

Maybe you consider BList overhead. But in fact, BList doesn't store Value and only stores some indexes, which represent some recently visited objects that may be frequent. :) https://github.com/opencurve/curve/blob/bfd5acbf1bfc24047af857be7218c76cfe27c8e2/src/common/arc_cache.h#L90-L92

wuhongsong commented 9 months ago

https://github.com/opencurve/curve/pull/2852 @zztaki this pr will be ok.may reopen it later.

skypexu commented 9 months ago

2962