Skip to content

Commit

Permalink
HBASE-24377 MemStoreFlusher throw NullPointerException (apache#1721)
Browse files Browse the repository at this point in the history
Signed-off-by: Ramkrishna <ramkrishna@apache.org>
Signed-off-by: Anoop Sam John <anoop.hbase@gmail.com>
Signed-off-by: Duo Zhang <zhangduo@apache.org>
(cherry picked from commit 9b3fe09)

Change-Id: I3cba54b8c53775ccbf7f35c9a85c340af9e09663
  • Loading branch information
binlijin committed May 18, 2020
1 parent 6ba8378 commit 3cda3c9
Showing 1 changed file with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ class MemStoreFlusher implements FlushRequester {
private final FlushHandler[] flushHandlers;
private List<FlushRequestListener> flushRequestListeners = new ArrayList<>(1);

private FlushType flushType;

/**
* Singleton instance inserted into flush queue used for signaling.
*/
Expand Down Expand Up @@ -148,17 +146,13 @@ public LongAdder getUpdatesBlockedMsHighWater() {
return this.updatesBlockedMsHighWater;
}

public void setFlushType(FlushType flushType) {
this.flushType = flushType;
}

/**
* The memstore across all regions has exceeded the low water mark. Pick
* one region to flush and flush it synchronously (this is called from the
* flush thread)
* @return true if successful
*/
private boolean flushOneForGlobalPressure() {
private boolean flushOneForGlobalPressure(FlushType flushType) {
SortedMap<Long, HRegion> regionsBySize = null;
switch(flushType) {
case ABOVE_OFFHEAP_HIGHER_MARK:
Expand Down Expand Up @@ -348,7 +342,7 @@ public void run() {
// we still select the regions based on the region's memstore data size.
// TODO : If we want to decide based on heap over head it can be done without tracking
// it per region.
if (!flushOneForGlobalPressure()) {
if (!flushOneForGlobalPressure(type)) {
// Wasn't able to flush any region, but we're above low water mark
// This is unlikely to happen, but might happen when closing the
// entire server - another thread is flushing regions. We'll just
Expand Down Expand Up @@ -711,7 +705,6 @@ public void reclaimMemStoreMemory() {
try {
flushType = isAboveHighWaterMark();
while (flushType != FlushType.NORMAL && !server.isStopped()) {
server.cacheFlusher.setFlushType(flushType);
if (!blocked) {
startTime = EnvironmentEdgeManager.currentTime();
if (!server.getRegionServerAccounting().isOffheap()) {
Expand Down Expand Up @@ -769,7 +762,6 @@ public void reclaimMemStoreMemory() {
} else {
flushType = isAboveLowWaterMark();
if (flushType != FlushType.NORMAL) {
server.cacheFlusher.setFlushType(flushType);
wakeupFlushThread();
}
}
Expand Down

0 comments on commit 3cda3c9

Please sign in to comment.