You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2019/02/04 11:36:52 UTC
[hbase] branch branch-2.1 updated: HBASE-21840
TestHRegionWithInMemoryFlush fails with NPE
This is an automated email from the ASF dual-hosted git repository.
zhangduo pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new e5dfb15 HBASE-21840 TestHRegionWithInMemoryFlush fails with NPE
e5dfb15 is described below
commit e5dfb153461682bfacf2e97d6c0755898949d6df
Author: zhangduo <zh...@apache.org>
AuthorDate: Mon Feb 4 13:26:37 2019 +0800
HBASE-21840 TestHRegionWithInMemoryFlush fails with NPE
---
.../hbase/regionserver/RegionServicesForStores.java | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServicesForStores.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServicesForStores.java
index 68d46ea..31cf282 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServicesForStores.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServicesForStores.java
@@ -18,14 +18,16 @@
*/
package org.apache.hadoop.hbase.regionserver;
+import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
-
+import java.util.concurrent.TimeUnit;
import org.apache.hadoop.hbase.client.RegionInfo;
import org.apache.hadoop.hbase.executor.ExecutorType;
import org.apache.hadoop.hbase.wal.WAL;
import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
+import org.apache.hbase.thirdparty.com.google.common.util.concurrent.ThreadFactoryBuilder;
/**
* Services a Store needs from a Region.
@@ -72,12 +74,24 @@ public class RegionServicesForStores {
return region.getWAL();
}
+ private static ThreadPoolExecutor INMEMORY_COMPACTION_POOL_FOR_TEST;
+
+ private static synchronized ThreadPoolExecutor getInMemoryCompactionPoolForTest() {
+ if (INMEMORY_COMPACTION_POOL_FOR_TEST == null) {
+ INMEMORY_COMPACTION_POOL_FOR_TEST = new ThreadPoolExecutor(10, 10, 60, TimeUnit.SECONDS,
+ new LinkedBlockingQueue<>(), new ThreadFactoryBuilder().setDaemon(true)
+ .setNameFormat("InMemoryCompactionsForTest-%d").build());
+ }
+ return INMEMORY_COMPACTION_POOL_FOR_TEST;
+ }
+
ThreadPoolExecutor getInMemoryCompactionPool() {
if (rsServices != null) {
return rsServices.getExecutorService().getExecutorLazily(ExecutorType.RS_IN_MEMORY_COMPACTION,
inMemoryPoolSize);
} else {
- return null;
+ // this could only happen in tests
+ return getInMemoryCompactionPoolForTest();
}
}