HBASE-24377 MemStoreFlusher throw NullPointerException (#1721)

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>
This commit is contained in:
binlijin 2020-05-18 09:58:28 +08:00 committed by GitHub
parent 61efb6d5ad
commit 6ce1e140ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 10 deletions

View File

@ -87,8 +87,6 @@ class MemStoreFlusher implements FlushRequester {
private final FlushHandler[] flushHandlers; private final FlushHandler[] flushHandlers;
private List<FlushRequestListener> flushRequestListeners = new ArrayList<>(1); private List<FlushRequestListener> flushRequestListeners = new ArrayList<>(1);
private FlushType flushType;
/** /**
* Singleton instance inserted into flush queue used for signaling. * Singleton instance inserted into flush queue used for signaling.
*/ */
@ -149,17 +147,13 @@ class MemStoreFlusher implements FlushRequester {
return this.updatesBlockedMsHighWater; return this.updatesBlockedMsHighWater;
} }
public void setFlushType(FlushType flushType) {
this.flushType = flushType;
}
/** /**
* The memstore across all regions has exceeded the low water mark. Pick * 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 * one region to flush and flush it synchronously (this is called from the
* flush thread) * flush thread)
* @return true if successful * @return true if successful
*/ */
private boolean flushOneForGlobalPressure() { private boolean flushOneForGlobalPressure(FlushType flushType) {
SortedMap<Long, Collection<HRegion>> regionsBySize = null; SortedMap<Long, Collection<HRegion>> regionsBySize = null;
switch(flushType) { switch(flushType) {
case ABOVE_OFFHEAP_HIGHER_MARK: case ABOVE_OFFHEAP_HIGHER_MARK:
@ -349,7 +343,7 @@ class MemStoreFlusher implements FlushRequester {
// we still select the regions based on the region's memstore data size. // 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 // TODO : If we want to decide based on heap over head it can be done without tracking
// it per region. // it per region.
if (!flushOneForGlobalPressure()) { if (!flushOneForGlobalPressure(type)) {
// Wasn't able to flush any region, but we're above low water mark // 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 // This is unlikely to happen, but might happen when closing the
// entire server - another thread is flushing regions. We'll just // entire server - another thread is flushing regions. We'll just
@ -716,7 +710,6 @@ class MemStoreFlusher implements FlushRequester {
try { try {
flushType = isAboveHighWaterMark(); flushType = isAboveHighWaterMark();
while (flushType != FlushType.NORMAL && !server.isStopped()) { while (flushType != FlushType.NORMAL && !server.isStopped()) {
server.getMemStoreFlusher().setFlushType(flushType);
if (!blocked) { if (!blocked) {
startTime = EnvironmentEdgeManager.currentTime(); startTime = EnvironmentEdgeManager.currentTime();
if (!server.getRegionServerAccounting().isOffheap()) { if (!server.getRegionServerAccounting().isOffheap()) {
@ -774,7 +767,6 @@ class MemStoreFlusher implements FlushRequester {
} else { } else {
flushType = isAboveLowWaterMark(); flushType = isAboveLowWaterMark();
if (flushType != FlushType.NORMAL) { if (flushType != FlushType.NORMAL) {
server.getMemStoreFlusher().setFlushType(flushType);
wakeupFlushThread(); wakeupFlushThread();
} }
} }