-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-29585 Add row-level cache for the get operation #7291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 12 commits
872f13a
80b728c
a6a8465
7429c3b
6df768a
e33db29
7091abe
d54fff4
99ce0f0
e3a8af8
ffba417
95d7892
859f6b0
cceda48
6545e31
113445d
5dad021
4db38bd
24a7ba8
7cc5d2a
7e2718a
7b4ddd9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,6 +65,7 @@ | |
| import java.util.concurrent.TimeUnit; | ||
| import java.util.concurrent.atomic.AtomicBoolean; | ||
| import java.util.concurrent.atomic.AtomicInteger; | ||
| import java.util.concurrent.atomic.AtomicLong; | ||
| import java.util.concurrent.atomic.LongAdder; | ||
| import java.util.concurrent.locks.Lock; | ||
| import java.util.concurrent.locks.ReadWriteLock; | ||
|
|
@@ -433,6 +434,11 @@ public MetricsTableRequests getMetricsTableRequests() { | |
| */ | ||
| private long openSeqNum = HConstants.NO_SEQNUM; | ||
|
|
||
| /** | ||
| * Basically the same as openSeqNum, but it is updated when bulk load is done. | ||
| */ | ||
| private final AtomicLong rowCacheSeqNum = new AtomicLong(HConstants.NO_SEQNUM); | ||
|
|
||
| /** | ||
| * The default setting for whether to enable on-demand CF loading for scan requests to this | ||
| * region. Requests can override it. | ||
|
|
@@ -7868,6 +7874,7 @@ private HRegion openHRegion(final CancelableProgressable reporter) throws IOExce | |
| LOG.debug("checking classloading for " + this.getRegionInfo().getEncodedName()); | ||
| TableDescriptorChecker.checkClassLoading(cConfig, htableDescriptor); | ||
| this.openSeqNum = initialize(reporter); | ||
| this.rowCacheSeqNum.set(this.openSeqNum); | ||
| this.mvcc.advanceTo(openSeqNum); | ||
| // The openSeqNum must be increased every time when a region is assigned, as we rely on it to | ||
| // determine whether a region has been successfully reopened. So here we always write open | ||
|
|
@@ -8696,6 +8703,17 @@ public long getOpenSeqNum() { | |
| return this.openSeqNum; | ||
| } | ||
|
|
||
| public long getRowCacheSeqNum() { | ||
| return this.rowCacheSeqNum.get(); | ||
| } | ||
|
|
||
| /** | ||
| * This is used to invalidate the entire row cache after bulk loading. | ||
| */ | ||
|
Comment on lines
8763
to
8765
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this comment correct? I thought we would be invalidating only the rows for the given regions. Rows from regions not touched by bulkload would stay valid.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK. I'll fix it.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| public void increaseRowCacheSeqNum() { | ||
| this.rowCacheSeqNum.incrementAndGet(); | ||
| } | ||
|
|
||
| @Override | ||
| public Map<byte[], Long> getMaxStoreSeqId() { | ||
| return this.maxSeqIdInStores; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!