Eungsop Yoo created HBASE-30604:
-----------------------------------
Summary: Fix consistency issues in the row cache
Key: HBASE-30604
URL: https://issues.apache.org/jira/browse/HBASE-30604
Project: HBase
Issue Type: Sub-task
Reporter: Eungsop Yoo
Assignee: Eungsop Yoo
While reviewing the row cache implementation on the HBASE-29585 feature branch,
I found the following issues. The first three can return stale or wrong rows
from the row cache without any error.
# HRegion#mutateRowsWithLocks does not invalidate the row cache. It calls
batchMutate with a MutationBatchOperation directly and skips the row cache
barrier, so rows mutated through MultiRowMutationEndpoint stay stale in the
cache.
# RowCache#canCacheRow does not check Get#getMaxVersions. A Get reading
multiple versions can populate the cache, and a later single-version Get is
then served all cached versions. The opposite direction is also wrong.
# A Get can cache a stale row when a mutation of the same row completes while
the Get is reading the row. The row level barrier only tells whether a mutation
is in progress, so if a mutation starts and finishes between the read and the
cache population, the old row stays in the cache until the next mutation of the
row.
# The barrier counters are incremented outside computeIfAbsent. A concurrent
removal can drop the counter from the map between the lookup and the increment,
which lets a mutation run without a barrier.
For #3, RowCache will register a pending-load token for the row before the
read. A mutation removes the token, and the Get populates the cache only if its
token is still registered.
This also adds a missing null check of the row cache in
HRegion#getScannerWithResults and cleans up the row cache eviction on region
close.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)