greptimedb icon indicating copy to clipboard operation
greptimedb copied to clipboard

Consider refactoring LruCacheLayer with `list_with_metakey` and `concurrent_stat_in_list`

Open WenyXu opened this issue 1 year ago • 3 comments

Consider refactoring it with list_with_metakey and concurrent_stat_in_list

Originally posted by @WenyXu in https://github.com/GreptimeTeam/greptimedb/pull/3058#discussion_r1438831103

https://github.com/GreptimeTeam/greptimedb/blob/2f98fa0d97195c4818a9db52032924700ca49577/src/object-store/src/layers/lru_cache/read_cache.rs#L135-L157

WenyXu avatar Dec 31 '23 07:12 WenyXu

I want to try this. Please assign it to me. 😊

suyanhanx avatar Feb 08 '24 15:02 suyanhanx

@suyanhanx Welcome! You're assigned and feel free to leave a comment here to share updates; or ping me as a reviewer if the patch is submitted.

tisonkun avatar Feb 08 '24 15:02 tisonkun

I checked the current implementation and it currently calls mainly on the Accessor. If we want to refactor it with the new methods list_with_metakey and concurrent_stat_in_list, I think we may need to change it to Operator instead. This will remove the trait currently relied upon here and its upstream since Operator is not a trait. https://github.com/GreptimeTeam/greptimedb/blob/2f98fa0d97195c4818a9db52032924700ca49577/src/object-store/src/layers/lru_cache/read_cache.rs#L72-L110

suyanhanx avatar Mar 15 '24 14:03 suyanhanx

Hi,Can I give it a try?

ozewr avatar Aug 20 '24 08:08 ozewr

Hi,Can I give it a try?

Have fun

WenyXu avatar Aug 20 '24 08:08 WenyXu

Can I replace Access trait to Accessdyntrait?

/opendal/src/raw/accessor.rs:398 /// AccessDyn is the dyn version of [Access] make it possible to use as /// Box<dyn AccessDyn>.

The Operator struct can build from dyn AccessDyn.
This way, I can construct the Operator in the recover_cache function, and then use list_with_metakey and concurrent_stat_in_list.

ozewr avatar Aug 20 '24 09:08 ozewr

Can I replace Access trait to Accessdyntrait?

/opendal/src/raw/accessor.rs:398 /// AccessDyn is the dyn version of [Access] make it possible to use as /// Box<dyn AccessDyn>.

The Operator struct can build from dyn AccessDyn. This way, I can construct the Operator in the recover_cache function, and then use list_with_metakey and concurrent_stat_in_list.

Yes, I think we should.

WenyXu avatar Aug 20 '24 09:08 WenyXu