From commits-return-82901-archive-asf-public=cust-asf.ponee.io@hbase.apache.org Mon Feb 4 11:36:27 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 7B6D4180651 for ; Mon, 4 Feb 2019 12:36:26 +0100 (CET) Received: (qmail 10859 invoked by uid 500); 4 Feb 2019 11:36:25 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 10850 invoked by uid 99); 4 Feb 2019 11:36:25 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Feb 2019 11:36:25 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 075498626A; Mon, 4 Feb 2019 11:36:25 +0000 (UTC) Date: Mon, 04 Feb 2019 11:36:24 +0000 To: "commits@hbase.apache.org" Subject: [hbase] branch branch-2 updated: HBASE-21840 TestHRegionWithInMemoryFlush fails with NPE MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <154928018491.5854.7500355821733381258@gitbox.apache.org> From: zhangduo@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: hbase X-Git-Refname: refs/heads/branch-2 X-Git-Reftype: branch X-Git-Oldrev: 789d9df1700d917de219fffa9ec43e0562379005 X-Git-Newrev: 2c6ab0c0471c149f8158dfd04ef34590c3a6607f X-Git-Rev: 2c6ab0c0471c149f8158dfd04ef34590c3a6607f X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. zhangduo pushed a commit to branch branch-2 in repository https://gitbox.apache.org/repos/asf/hbase.git The following commit(s) were added to refs/heads/branch-2 by this push: new 2c6ab0c HBASE-21840 TestHRegionWithInMemoryFlush fails with NPE 2c6ab0c is described below commit 2c6ab0c0471c149f8158dfd04ef34590c3a6607f Author: zhangduo 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 ae9977e..595ae7a 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. @@ -64,12 +66,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(); } }