Skip to content

Commit

Permalink
HBASE-24377 MemStoreFlusher throw NullPointerException (#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>
  • Loading branch information
binlijin committed May 18, 2020
1 parent 61efb6d commit 6ce1e14
Showing 1 changed file with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,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 @@ -149,17 +147,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, Collection<HRegion>> regionsBySize = null;
switch(flushType) {
case ABOVE_OFFHEAP_HIGHER_MARK:
Expand Down Expand Up @@ -349,7 +343,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 @@ -716,7 +710,6 @@ public void reclaimMemStoreMemory() {
try {
flushType = isAboveHighWaterMark();
while (flushType != FlushType.NORMAL && !server.isStopped()) {
server.getMemStoreFlusher().setFlushType(flushType);
if (!blocked) {
startTime = EnvironmentEdgeManager.currentTime();
if (!server.getRegionServerAccounting().isOffheap()) {
Expand Down Expand Up @@ -774,7 +767,6 @@ public void reclaimMemStoreMemory() {
} else {
flushType = isAboveLowWaterMark();
if (flushType != FlushType.NORMAL) {
server.getMemStoreFlusher().setFlushType(flushType);
wakeupFlushThread();
}
}
Expand Down

0 comments on commit 6ce1e14

Please sign in to comment.