Decoupling local cache function and cache algorithm#38048
Decoupling local cache function and cache algorithm#38048kssenii merged 18 commits intoClickHouse:masterfrom
Conversation
788aa1c to
0c76d56
Compare
26cab54 to
59489e7
Compare
6d23d8c to
b498a1b
Compare
src/Common/IFileCachePriority.h
Outdated
There was a problem hiding this comment.
may be unique_ptr? or it is shared somewhere?
There was a problem hiding this comment.
ReadIterator can be unique_ptr. But for WriteIterator, I don't know if it should be set to unique_ptr, because it may be copied with the FileSegment, do we need to invalidate the iterator before copying?
There was a problem hiding this comment.
because it may be copied with the FileSegment, do we need to invalidate the iterator before copying?
but file segment cannot be copied
There was a problem hiding this comment.
It looks like this, I tried to modify it, but sometimes we need to use a temporary pointer to keep some code readable, such as the following cases, so I think it may be better to keep it as it is, what do you think?
auto priority_iter = record->second;
priority_iter->use(cache_lock);
result_state = priority_iter->hits() >= enable_cache_hits_threshold ? FileSegment::State::EMPTY : FileSegment::State::SKIP_CACHE;
There was a problem hiding this comment.
but looks like here auto & is possible, then unique_ptr will be ok
There was a problem hiding this comment.
I tried to fix it, but I always get an error when compiling involves unordered_map. Maybe there is something wrong with my understanding of uniqueu_ptr :(
There was a problem hiding this comment.
may be not use a pointer at all - just an object? (and in FileSegmentCell put std::optional to iterator).
There was a problem hiding this comment.
Sounds feasible, do you mean all ReadIterator and WriteIterator as objects? In this case, there will be more revisions, but I may not have much time to make revisions recently (there is a lot of work to deal with in reality), and I will reconsider the relevant implementation when I have time :).
There was a problem hiding this comment.
do you mean all ReadIterator and WriteIterator as objects
yes
but I may not have much time to make revisions recently (there is a lot of work to deal with in reality), and I will reconsider the relevant implementation when I have time
ok, let's leave it as it is for now
kssenii
left a comment
There was a problem hiding this comment.
LGTM
thanks, very good changes
1a23a95 to
1aa7bbc
Compare
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):