[
https://issues.apache.org/jira/browse/RATIS-2017?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Duong updated RATIS-2017:
-------------------------
Description:
RATIS-1893 moved checkAndEvictCache to a separate thread.
This opens a condition race between evictCache and normal log operations like
get/put.
Before RATIS-1893, checkAndEvictCache was called from appendEntryImpl and safe
under a writeLock().
I noticed this error because there are get/put operations intervene with the
EntryCache eviction during testing zero-copy:
{code:java}
void clear() {
map.values().forEach(ReferenceCountedObject::release);
map.clear();
size.set(0);
} {code}
was:
RATIS-1893 moved checkAndEvictCache to a separate thread.
This opens a condition race between evictCache and normal log operations like
get/put.
Before RATIS-1893, checkAndEvictCache is called from appendEntryImpl and is
safe under a writeLock().
I noticed this error because there are get/put operations intervene with the
EntryCache eviction during testing zero-copy:
{code:java}
void clear() {
map.values().forEach(ReferenceCountedObject::release);
map.clear();
size.set(0);
} {code}
> CheckAndEvictCache must be done in writeLock
> --------------------------------------------
>
> Key: RATIS-2017
> URL: https://issues.apache.org/jira/browse/RATIS-2017
> Project: Ratis
> Issue Type: Bug
> Affects Versions: 3.0.0
> Reporter: Duong
> Assignee: Duong
> Priority: Major
>
> RATIS-1893 moved checkAndEvictCache to a separate thread.
> This opens a condition race between evictCache and normal log operations like
> get/put.
> Before RATIS-1893, checkAndEvictCache was called from appendEntryImpl and
> safe under a writeLock().
>
> I noticed this error because there are get/put operations intervene with the
> EntryCache eviction during testing zero-copy:
> {code:java}
> void clear() {
> map.values().forEach(ReferenceCountedObject::release);
> map.clear();
> size.set(0);
> } {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)