-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-24382 Flush partial stores of region filtered by seqId when arc… #1737
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
Changes from 3 commits
ba27fe1
994a2eb
ff0b090
5632d9f
78b9b5a
d494fca
9d2a3ea
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 |
|---|---|---|
|
|
@@ -17,7 +17,10 @@ | |
| */ | ||
| package org.apache.hadoop.hbase.regionserver; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.Collection; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
|
|
||
| import org.apache.hadoop.conf.Configured; | ||
| import org.apache.yetus.audience.InterfaceAudience; | ||
|
|
@@ -46,4 +49,16 @@ protected void configureForRegion(HRegion region) { | |
| */ | ||
| public abstract Collection<HStore> selectStoresToFlush(); | ||
|
|
||
| /** | ||
| * select stores which matches the specified families | ||
| * | ||
| * @return the stores need to be flushed. | ||
| */ | ||
| public Collection<HStore> selectStoresToFlush(Map<byte[], HStore> stores, List<byte[]> families) { | ||
|
||
| Collection<HStore> specificStoresToFlush = new ArrayList<>(); | ||
| for (byte[] family : families) { | ||
| specificStoresToFlush.add(stores.get(family)); | ||
| } | ||
| return specificStoresToFlush; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2386,6 +2386,11 @@ enum Result { | |
| boolean isCompactionNeeded(); | ||
| } | ||
|
|
||
| public FlushResultImpl flushcache(boolean forceFlushAllStores,boolean writeFlushRequestWalMarker, | ||
| FlushLifeCycleTracker tracker) throws IOException { | ||
| return this.flushcache(forceFlushAllStores, null, writeFlushRequestWalMarker, tracker); | ||
| } | ||
|
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. Good |
||
|
|
||
| /** | ||
| * Flush the cache. | ||
| * | ||
|
|
@@ -2400,6 +2405,7 @@ enum Result { | |
| * <p>This method may block for some time, so it should not be called from a | ||
| * time-sensitive thread. | ||
| * @param forceFlushAllStores whether we want to flush all stores | ||
| * @param families stores of region to flush. | ||
saintstack marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| * @param writeFlushRequestWalMarker whether to write the flush request marker to WAL | ||
| * @param tracker used to track the life cycle of this flush | ||
| * @return whether the flush is success and whether the region needs compacting | ||
|
|
@@ -2409,8 +2415,8 @@ enum Result { | |
| * because a Snapshot was not properly persisted. The region is put in closing mode, and the | ||
| * caller MUST abort after this. | ||
| */ | ||
| public FlushResultImpl flushcache(boolean forceFlushAllStores, boolean writeFlushRequestWalMarker, | ||
| FlushLifeCycleTracker tracker) throws IOException { | ||
| public FlushResultImpl flushcache(boolean forceFlushAllStores, List<byte[]> families, | ||
| boolean writeFlushRequestWalMarker, FlushLifeCycleTracker tracker) throws IOException { | ||
| // fail-fast instead of waiting on the lock | ||
| if (this.closing.get()) { | ||
| String msg = "Skipping flush on " + this + " because closing"; | ||
|
|
@@ -2457,8 +2463,13 @@ public FlushResultImpl flushcache(boolean forceFlushAllStores, boolean writeFlus | |
| } | ||
|
|
||
| try { | ||
| Collection<HStore> specificStoresToFlush = | ||
| Collection<HStore> specificStoresToFlush = null; | ||
| if (!forceFlushAllStores && families != null) { | ||
| specificStoresToFlush = flushPolicy.selectStoresToFlush(stores, families); | ||
|
||
| } else { | ||
| specificStoresToFlush = | ||
| forceFlushAllStores ? stores.values() : flushPolicy.selectStoresToFlush(); | ||
| } | ||
| FlushResultImpl fs = | ||
| internalFlushcache(specificStoresToFlush, status, writeFlushRequestWalMarker, tracker); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,9 @@ | |
| */ | ||
| package org.apache.hadoop.hbase.regionserver; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Map; | ||
|
|
||
| import org.apache.hadoop.hbase.wal.AbstractWALRoller; | ||
| import org.apache.hadoop.hbase.wal.WAL; | ||
| import org.apache.yetus.audience.InterfaceAudience; | ||
|
|
@@ -45,7 +47,7 @@ public LogRoller(RegionServerServices services) { | |
| super("LogRoller", services.getConfiguration(), services); | ||
| } | ||
|
|
||
| protected void scheduleFlush(String encodedRegionName) { | ||
| protected void scheduleFlush(String encodedRegionName, List<byte[]> families) { | ||
| RegionServerServices services = this.abortable; | ||
| HRegion r = (HRegion) services.getRegion(encodedRegionName); | ||
| if (r == null) { | ||
|
|
@@ -58,8 +60,8 @@ protected void scheduleFlush(String encodedRegionName) { | |
| encodedRegionName, r); | ||
| return; | ||
| } | ||
| // force flushing all stores to clean old logs | ||
| requester.requestFlush(r, true, FlushLifeCycleTracker.DUMMY); | ||
| // force flushing specified stores to clean old logs | ||
| requester.requestFlush(r, false, families, FlushLifeCycleTracker.DUMMY); | ||
|
||
| } | ||
|
|
||
| @VisibleForTesting | ||
|
|
||
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.
Should remove these imports? Seems we add a method in this class and then moved it out but forgot to remove these imports?
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.
Oh, you are right, fixed.
Thanks.