[GitHub] [hbase] bharathv commented on a change in pull request #1110: HBASE-23761: The new cache entry can overflow the maxSize in CachedEn…

2020-02-06 Thread GitBox
bharathv commented on a change in pull request #1110: HBASE-23761: The new 
cache entry can overflow the maxSize in CachedEn…
URL: https://github.com/apache/hbase/pull/1110#discussion_r376200409
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruCachedBlockQueue.java
 ##
 @@ -65,14 +65,15 @@ public LruCachedBlockQueue(long maxSize, long blockSize) {
* @param cb block to try to add to the queue
*/
   public void add(LruCachedBlock cb) {
 
 Review comment:
   That should be a separate change and is probably more involved ..just making 
it synchronized affects performance since that serializes all the invocations. 
(I'm not too familiar with that area of code on top of my head to explain the 
implications correctly, need to study it a little bit).


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] bharathv commented on a change in pull request #1141: HBASE-23808 [Flakey Test] TestMasterShutdown#testMasterShutdownBefore…

2020-02-06 Thread GitBox
bharathv commented on a change in pull request #1141: HBASE-23808 [Flakey Test] 
TestMasterShutdown#testMasterShutdownBefore…
URL: https://github.com/apache/hbase/pull/1141#discussion_r376196608
 
 

 ##
 File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java
 ##
 @@ -66,43 +78,45 @@ public void testMasterShutdown() throws Exception {
 Configuration conf = HBaseConfiguration.create();
 
 // Start the cluster
-HBaseTestingUtility htu = new HBaseTestingUtility(conf);
-StartMiniClusterOption option = StartMiniClusterOption.builder()
-
.numMasters(NUM_MASTERS).numRegionServers(NUM_RS).numDataNodes(NUM_RS).build();
-htu.startMiniCluster(option);
-MiniHBaseCluster cluster = htu.getHBaseCluster();
-
-// get all the master threads
-List masterThreads = cluster.getMasterThreads();
-
-// wait for each to come online
-for (MasterThread mt : masterThreads) {
-  assertTrue(mt.isAlive());
-}
-
-// find the active master
-HMaster active = null;
-for (int i = 0; i < masterThreads.size(); i++) {
-  if (masterThreads.get(i).getMaster().isActiveMaster()) {
-active = masterThreads.get(i).getMaster();
-break;
+try {
+  htu = new HBaseTestingUtility(conf);
+  StartMiniClusterOption option = StartMiniClusterOption.builder()
+.numMasters(NUM_MASTERS)
+.numRegionServers(NUM_RS)
+.numDataNodes(NUM_RS)
+.build();
+  final MiniHBaseCluster cluster = htu.startMiniCluster(option);
+
+  // wait for all master thread to spawn and start their run loop.
+  final long thirtySeconds = TimeUnit.SECONDS.toMillis(30);
+  final long oneSecond = TimeUnit.SECONDS.toMillis(1);
+  assertNotEquals(-1, htu.waitFor(thirtySeconds, oneSecond, () -> {
+final List masterThreads = cluster.getMasterThreads();
+return CollectionUtils.isNotEmpty(masterThreads)
 
 Review comment:
   nit: Can probably be simplified to masterThreads != null && 
masterThreads.size() >=3...
   because the second check automatically means isNotEmpty().


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] bharathv commented on a change in pull request #1141: HBASE-23808 [Flakey Test] TestMasterShutdown#testMasterShutdownBefore…

2020-02-06 Thread GitBox
bharathv commented on a change in pull request #1141: HBASE-23808 [Flakey Test] 
TestMasterShutdown#testMasterShutdownBefore…
URL: https://github.com/apache/hbase/pull/1141#discussion_r376199298
 
 

 ##
 File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java
 ##
 @@ -128,41 +142,50 @@ public void 
testMasterShutdownBeforeStartingAnyRegionServer() throws Exception {
 conf.setInt(ServerManager.WAIT_ON_REGIONSERVERS_MINTOSTART, 1);
 
 // Start the cluster
-final HBaseTestingUtility util = new HBaseTestingUtility(conf);
-util.startMiniDFSCluster(3);
-util.startMiniZKCluster();
-util.createRootDir();
-final LocalHBaseCluster cluster =
-new LocalHBaseCluster(conf, NUM_MASTERS, NUM_RS, HMaster.class,
-MiniHBaseCluster.MiniHBaseClusterRegionServer.class);
-final int MASTER_INDEX = 0;
-final MasterThread master = cluster.getMasters().get(MASTER_INDEX);
-master.start();
-LOG.info("Called master start on " + master.getName());
-Thread shutdownThread = new Thread("Shutdown-Thread") {
-  @Override
-  public void run() {
-LOG.info("Before call to shutdown master");
-try (Connection connection = createConnection(util); Admin admin = 
connection.getAdmin()) {
-  admin.shutdown();
-} catch (Exception e) {
-  LOG.info("Error while calling Admin.shutdown, which is expected: " + 
e.getMessage());
+LocalHBaseCluster cluster = null;
+try {
+  htu = new HBaseTestingUtility(conf);
+  htu.startMiniDFSCluster(3);
+  htu.startMiniZKCluster();
+  htu.createRootDir();
+  cluster = new LocalHBaseCluster(conf, NUM_MASTERS, NUM_RS, HMaster.class,
+MiniHBaseCluster.MiniHBaseClusterRegionServer.class);
+  final int MASTER_INDEX = 0;
+  final MasterThread master = cluster.getMasters().get(MASTER_INDEX);
+  master.start();
+  LOG.info("Called master start on " + master.getName());
+  final LocalHBaseCluster finalCluster = cluster;
+  Thread shutdownThread = new Thread("Shutdown-Thread") {
+@Override
+public void run() {
+  LOG.info("Before call to shutdown master");
+  try (Connection connection = createConnection(htu); Admin admin = 
connection.getAdmin()) {
+admin.shutdown();
+  } catch (Exception e) {
+LOG.info("Error while calling Admin.shutdown, which is expected: " 
+ e.getMessage());
+  }
+  LOG.info("After call to shutdown master");
+  finalCluster.waitOnMaster(MASTER_INDEX);
 }
-LOG.info("After call to shutdown master");
-cluster.waitOnMaster(MASTER_INDEX);
+  };
+  shutdownThread.start();
+  LOG.info("Called master join on " + master.getName());
+  master.join();
+  shutdownThread.join();
+
+  List masterThreads = cluster.getMasters();
+  // make sure all the masters properly shutdown
+  assertEquals(0, masterThreads.size());
+} finally {
+  if (cluster != null) {
+cluster.shutdown();
+  }
+  if (htu != null) {
+htu.shutdownMiniZKCluster();
 
 Review comment:
   nit: You could just use shutdownMiniCluster(). It appears null safe on 
underlying minicluster


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] bharathv commented on a change in pull request #1141: HBASE-23808 [Flakey Test] TestMasterShutdown#testMasterShutdownBefore…

2020-02-06 Thread GitBox
bharathv commented on a change in pull request #1141: HBASE-23808 [Flakey Test] 
TestMasterShutdown#testMasterShutdownBefore…
URL: https://github.com/apache/hbase/pull/1141#discussion_r376199438
 
 

 ##
 File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java
 ##
 @@ -128,41 +142,50 @@ public void 
testMasterShutdownBeforeStartingAnyRegionServer() throws Exception {
 conf.setInt(ServerManager.WAIT_ON_REGIONSERVERS_MINTOSTART, 1);
 
 // Start the cluster
-final HBaseTestingUtility util = new HBaseTestingUtility(conf);
-util.startMiniDFSCluster(3);
-util.startMiniZKCluster();
-util.createRootDir();
-final LocalHBaseCluster cluster =
-new LocalHBaseCluster(conf, NUM_MASTERS, NUM_RS, HMaster.class,
-MiniHBaseCluster.MiniHBaseClusterRegionServer.class);
-final int MASTER_INDEX = 0;
-final MasterThread master = cluster.getMasters().get(MASTER_INDEX);
-master.start();
-LOG.info("Called master start on " + master.getName());
-Thread shutdownThread = new Thread("Shutdown-Thread") {
-  @Override
-  public void run() {
-LOG.info("Before call to shutdown master");
-try (Connection connection = createConnection(util); Admin admin = 
connection.getAdmin()) {
-  admin.shutdown();
-} catch (Exception e) {
-  LOG.info("Error while calling Admin.shutdown, which is expected: " + 
e.getMessage());
+LocalHBaseCluster cluster = null;
+try {
+  htu = new HBaseTestingUtility(conf);
+  htu.startMiniDFSCluster(3);
+  htu.startMiniZKCluster();
+  htu.createRootDir();
+  cluster = new LocalHBaseCluster(conf, NUM_MASTERS, NUM_RS, HMaster.class,
+MiniHBaseCluster.MiniHBaseClusterRegionServer.class);
+  final int MASTER_INDEX = 0;
+  final MasterThread master = cluster.getMasters().get(MASTER_INDEX);
+  master.start();
+  LOG.info("Called master start on " + master.getName());
+  final LocalHBaseCluster finalCluster = cluster;
+  Thread shutdownThread = new Thread("Shutdown-Thread") {
+@Override
+public void run() {
+  LOG.info("Before call to shutdown master");
+  try (Connection connection = createConnection(htu); Admin admin = 
connection.getAdmin()) {
+admin.shutdown();
 
 Review comment:
   This is the place that the master registry exposed a race ..(shutdown goes 
missing..). Rebase will not be clean now :'(


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[jira] [Commented] (HBASE-18095) Provide an option for clients to find the server hosting META that does not involve the ZooKeeper client

2020-02-06 Thread Hudson (Jira)


[ 
https://issues.apache.org/jira/browse/HBASE-18095?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17032069#comment-17032069
 ] 

Hudson commented on HBASE-18095:


Results for branch HBASE-18095/client-locate-meta-no-zookeeper
[build #65 on 
builds.a.o|https://builds.apache.org/job/HBase%20Nightly/job/HBASE-18095%252Fclient-locate-meta-no-zookeeper/65/]:
 (x) *{color:red}-1 overall{color}*

details (if available):

(/) {color:green}+1 general checks{color}
-- For more information [see general 
report|https://builds.apache.org/job/HBase%20Nightly/job/HBASE-18095%252Fclient-locate-meta-no-zookeeper/65//General_Nightly_Build_Report/]




(x) {color:red}-1 jdk8 hadoop2 checks{color}
-- For more information [see jdk8 (hadoop2) 
report|https://builds.apache.org/job/HBase%20Nightly/job/HBASE-18095%252Fclient-locate-meta-no-zookeeper/65//JDK8_Nightly_Build_Report_(Hadoop2)/]


(x) {color:red}-1 jdk8 hadoop3 checks{color}
-- For more information [see jdk8 (hadoop3) 
report|https://builds.apache.org/job/HBase%20Nightly/job/HBASE-18095%252Fclient-locate-meta-no-zookeeper/65//JDK8_Nightly_Build_Report_(Hadoop3)/]


(/) {color:green}+1 source release artifact{color}
-- See build output for details.


(x) {color:red}-1 client integration test{color}
--Failed when running client tests on top of Hadoop 2. [see log for 
details|https://builds.apache.org/job/HBase%20Nightly/job/HBASE-18095%252Fclient-locate-meta-no-zookeeper/65//artifact/output-integration/hadoop-2.log].
 (note that this means we didn't run on Hadoop 3)


> Provide an option for clients to find the server hosting META that does not 
> involve the ZooKeeper client
> 
>
> Key: HBASE-18095
> URL: https://issues.apache.org/jira/browse/HBASE-18095
> Project: HBase
>  Issue Type: New Feature
>  Components: Client
>Reporter: Andrew Kyle Purtell
>Assignee: Bharath Vissapragada
>Priority: Major
> Fix For: 3.0.0, 2.3.0, 1.6.0
>
> Attachments: HBASE-18095.master-v1.patch, HBASE-18095.master-v2.patch
>
>
> Clients are required to connect to ZooKeeper to find the location of the 
> regionserver hosting the meta table region. Site configuration provides the 
> client a list of ZK quorum peers and the client uses an embedded ZK client to 
> query meta location. Timeouts and retry behavior of this embedded ZK client 
> are managed orthogonally to HBase layer settings and in some cases the ZK 
> cannot manage what in theory the HBase client can, i.e. fail fast upon outage 
> or network partition.
> We should consider new configuration settings that provide a list of 
> well-known master and backup master locations, and with this information the 
> client can contact any of the master processes directly. Any master in either 
> active or passive state will track meta location and respond to requests for 
> it with its cached last known location. If this location is stale, the client 
> can ask again with a flag set that requests the master refresh its location 
> cache and return the up-to-date location. Every client interaction with the 
> cluster thus uses only HBase RPC as transport, with appropriate settings 
> applied to the connection. The configuration toggle that enables this 
> alternative meta location lookup should be false by default.
> This removes the requirement that HBase clients embed the ZK client and 
> contact the ZK service directly at the beginning of the connection lifecycle. 
> This has several benefits. ZK service need not be exposed to clients, and 
> their potential abuse, yet no benefit ZK provides the HBase server cluster is 
> compromised. Normalizing HBase client and ZK client timeout settings and 
> retry behavior - in some cases, impossible, i.e. for fail-fast - is no longer 
> necessary. 
> And, from [~ghelmling]: There is an additional complication here for 
> token-based authentication. When a delegation token is used for SASL 
> authentication, the client uses the cluster ID obtained from Zookeeper to 
> select the token identifier to use. So there would also need to be some 
> Zookeeper-less, unauthenticated way to obtain the cluster ID as well. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[GitHub] [hbase] ndimiduk opened a new pull request #1141: HBASE-23808 [Flakey Test] TestMasterShutdown#testMasterShutdownBefore…

2020-02-06 Thread GitBox
ndimiduk opened a new pull request #1141: HBASE-23808 [Flakey Test] 
TestMasterShutdown#testMasterShutdownBefore…
URL: https://github.com/apache/hbase/pull/1141
 
 
   …StartingAnyRegionServer
   
   Be a bit more dogmatic about terminating the minicluster between test
   methods. I doubt this resolves the root issue, but we'll see.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[jira] [Created] (HBASE-23808) [Flakey Test] TestMasterShutdown#testMasterShutdownBeforeStartingAnyRegionServer

2020-02-06 Thread Nick Dimiduk (Jira)
Nick Dimiduk created HBASE-23808:


 Summary: [Flakey Test] 
TestMasterShutdown#testMasterShutdownBeforeStartingAnyRegionServer
 Key: HBASE-23808
 URL: https://issues.apache.org/jira/browse/HBASE-23808
 Project: HBase
  Issue Type: Test
  Components: test
Affects Versions: 2.3.0
Reporter: Nick Dimiduk


Reproduces locally from time to time. Not much to go on here. Looks like the 
test is trying to do some fancy HBase cluster initialization order on top of a 
mini-cluster. Failure seems related to trying to start the HBase master before 
HDFS is fully initialized.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (HBASE-23802) Remove unnecessary Configuration instantiation in LossyAccounting

2020-02-06 Thread Duo Zhang (Jira)


[ 
https://issues.apache.org/jira/browse/HBASE-23802?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17032047#comment-17032047
 ] 

Duo Zhang commented on HBASE-23802:
---

The change is small. +1 on backporting them to all active branches.

> Remove unnecessary Configuration instantiation in LossyAccounting
> -
>
> Key: HBASE-23802
> URL: https://issues.apache.org/jira/browse/HBASE-23802
> Project: HBase
>  Issue Type: Improvement
>  Components: metrics
>Reporter: Nick Dimiduk
>Assignee: Nick Dimiduk
>Priority: Minor
> Fix For: 3.0.0, 2.3.0, 1.6.0
>
>
> Mighty [~stack] pointed out over on HBASE-23801 that maybe {{LossyCounting}} 
> doesn't need to be instantiating a {{Configuration}} instance in the first 
> place.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HBASE-23804) Fix default master addr hostname in master registry

2020-02-06 Thread Bharath Vissapragada (Jira)


 [ 
https://issues.apache.org/jira/browse/HBASE-23804?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Bharath Vissapragada updated HBASE-23804:
-
Status: Patch Available  (was: Open)

> Fix default master addr hostname in master registry
> ---
>
> Key: HBASE-23804
> URL: https://issues.apache.org/jira/browse/HBASE-23804
> Project: HBase
>  Issue Type: Bug
>  Components: Client
>Affects Versions: 3.0.0, 2.3.0, 1.6.0, HBASE-18095
>Reporter: Bharath Vissapragada
>Assignee: Bharath Vissapragada
>Priority: Major
> Fix For: 3.0.0, 2.3.0
>
>
> Currently, master RPC server (*not* info server) always binds to the address 
> endpoint to which the default hostname of the server resolves to. However, 
> master registry picks the default end point to connect to as 
> "localhost:16000" when "hbase.masters" are not configured. This is leading to 
> a mismatch because the server may not be listening on the loopback address. 
> This is a problem only in the scripts (single proc/pseudo distributed modes) 
> because these are the cases in which "hbase.masters" is not populated by 
> default.
> The fix is to pick the service endpoint the same way the RPC server does it.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[GitHub] [hbase] bharathv commented on a change in pull request #1137: HBASE-23804: Fix default master addr hostname in master registry

2020-02-06 Thread GitBox
bharathv commented on a change in pull request #1137: HBASE-23804: Fix default 
master addr hostname in master registry
URL: https://github.com/apache/hbase/pull/1137#discussion_r376108852
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
 ##
 @@ -20,6 +20,7 @@
 import static 
org.apache.hadoop.hbase.HConstants.DEFAULT_HBASE_SPLIT_COORDINATED_BY_ZK;
 import static 
org.apache.hadoop.hbase.HConstants.HBASE_MASTER_LOGCLEANER_PLUGINS;
 import static 
org.apache.hadoop.hbase.HConstants.HBASE_SPLIT_WAL_COORDINATED_BY_ZK;
+import static org.apache.hadoop.hbase.HConstants.MASTER_HOSTNAME_KEY;
 
 Review comment:
   Actually it is needed here, I moved it to HConstants, so have to explicitly 
import now.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] VladRodionov commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
VladRodionov commented on a change in pull request #921: HBASE-22749: 
Distributed MOB compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r37617
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobFileCleanerChore.java
 ##
 @@ -0,0 +1,331 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hbase.mob;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.LocatedFileStatus;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.RemoteIterator;
+import org.apache.hadoop.hbase.ScheduledChore;
+import org.apache.hadoop.hbase.TableDescriptors;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.backup.HFileArchiver;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.TableDescriptor;
+import org.apache.hadoop.hbase.io.hfile.CacheConfig;
+import org.apache.hadoop.hbase.master.HMaster;
+import org.apache.hadoop.hbase.regionserver.BloomType;
+import org.apache.hadoop.hbase.regionserver.HStoreFile;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.hadoop.hbase.util.FSUtils;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import 
org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
+
+/**
+ * The class MobFileCleanerChore for running cleaner regularly to remove the 
expired
+ * and obsolete (files which have no active references to) mob files.
+ */
+@InterfaceAudience.Private
+public class MobFileCleanerChore extends ScheduledChore {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(MobFileCleanerChore.class);
+  private final HMaster master;
+  private ExpiredMobFileCleaner cleaner;
+
+  static {
+Configuration.addDeprecation(MobConstants.DEPRECATED_MOB_CLEANER_PERIOD,
+  MobConstants.MOB_CLEANER_PERIOD);
+  }
+
+  public MobFileCleanerChore(HMaster master) {
+super(master.getServerName() + "-ExpiredMobFileCleanerChore", master,
+master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD,
+  MobConstants.DEFAULT_MOB_CLEANER_PERIOD),
+master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD,
+  MobConstants.DEFAULT_MOB_CLEANER_PERIOD),
+TimeUnit.SECONDS);
+this.master = master;
+cleaner = new ExpiredMobFileCleaner();
+cleaner.setConf(master.getConfiguration());
+checkObsoleteConfigurations();
+  }
+
+  private void checkObsoleteConfigurations() {
+Configuration conf = master.getConfiguration();
+
+if (conf.get("hbase.mob.compaction.mergeable.threshold") != null) {
+  LOG.warn("'hbase.mob.compaction.mergeable.threshold' is obsolete and not 
used anymore.");
+}
+if (conf.get("hbase.mob.delfile.max.count") != null) {
+  LOG.warn("'hbase.mob.delfile.max.count' is obsolete and not used 
anymore.");
+}
+if (conf.get("hbase.mob.compaction.threads.max") != null) {
+  LOG.warn("'hbase.mob.compaction.threads.max' is obsolete and not used 
anymore.");
+}
+if (conf.get("hbase.mob.compaction.batch.size") != null) {
+  LOG.warn("'hbase.mob.compaction.batch.size' is obsolete and not used 
anymore.");
+}
+  }
+
+  @VisibleForTesting
+  public MobFileCleanerChore() {
+this.master = null;
+  }
+
+  @Override
+  @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = 
"REC_CATCH_EXCEPTION",
+  justification = "Intentional")
+
+  protected void chore() {
+TableDescriptors htds = master.getTableDescriptors();
+
+Map map = null;
+try {
+  map = htds.getAll();
+} catch (IOException e) {
+  

[GitHub] [hbase] VladRodionov commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
VladRodionov commented on a change in pull request #921: HBASE-22749: 
Distributed MOB compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r376110893
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobFileCleanerChore.java
 ##
 @@ -0,0 +1,331 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hbase.mob;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.LocatedFileStatus;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.RemoteIterator;
+import org.apache.hadoop.hbase.ScheduledChore;
+import org.apache.hadoop.hbase.TableDescriptors;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.backup.HFileArchiver;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.TableDescriptor;
+import org.apache.hadoop.hbase.io.hfile.CacheConfig;
+import org.apache.hadoop.hbase.master.HMaster;
+import org.apache.hadoop.hbase.regionserver.BloomType;
+import org.apache.hadoop.hbase.regionserver.HStoreFile;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.hadoop.hbase.util.FSUtils;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import 
org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
+
+/**
+ * The class MobFileCleanerChore for running cleaner regularly to remove the 
expired
+ * and obsolete (files which have no active references to) mob files.
+ */
+@InterfaceAudience.Private
+public class MobFileCleanerChore extends ScheduledChore {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(MobFileCleanerChore.class);
+  private final HMaster master;
+  private ExpiredMobFileCleaner cleaner;
+
+  static {
+Configuration.addDeprecation(MobConstants.DEPRECATED_MOB_CLEANER_PERIOD,
+  MobConstants.MOB_CLEANER_PERIOD);
+  }
+
+  public MobFileCleanerChore(HMaster master) {
+super(master.getServerName() + "-ExpiredMobFileCleanerChore", master,
+master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD,
+  MobConstants.DEFAULT_MOB_CLEANER_PERIOD),
+master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD,
+  MobConstants.DEFAULT_MOB_CLEANER_PERIOD),
+TimeUnit.SECONDS);
+this.master = master;
+cleaner = new ExpiredMobFileCleaner();
+cleaner.setConf(master.getConfiguration());
+checkObsoleteConfigurations();
+  }
+
+  private void checkObsoleteConfigurations() {
+Configuration conf = master.getConfiguration();
+
+if (conf.get("hbase.mob.compaction.mergeable.threshold") != null) {
+  LOG.warn("'hbase.mob.compaction.mergeable.threshold' is obsolete and not 
used anymore.");
+}
+if (conf.get("hbase.mob.delfile.max.count") != null) {
+  LOG.warn("'hbase.mob.delfile.max.count' is obsolete and not used 
anymore.");
+}
+if (conf.get("hbase.mob.compaction.threads.max") != null) {
+  LOG.warn("'hbase.mob.compaction.threads.max' is obsolete and not used 
anymore.");
+}
+if (conf.get("hbase.mob.compaction.batch.size") != null) {
+  LOG.warn("'hbase.mob.compaction.batch.size' is obsolete and not used 
anymore.");
+}
+  }
+
+  @VisibleForTesting
+  public MobFileCleanerChore() {
+this.master = null;
+  }
+
+  @Override
+  @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = 
"REC_CATCH_EXCEPTION",
+  justification = "Intentional")
+
+  protected void chore() {
+TableDescriptors htds = master.getTableDescriptors();
+
+Map map = null;
+try {
+  map = htds.getAll();
+} catch (IOException e) {
+  

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375602497
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobConstants.java
 ##
 @@ -35,26 +35,88 @@
   public static final String MOB_CACHE_BLOCKS = "hbase.mob.cache.blocks";
   public static final String MOB_SCAN_REF_ONLY = "hbase.mob.scan.ref.only";
   public static final String EMPTY_VALUE_ON_MOBCELL_MISS = 
"empty.value.on.mobcell.miss";
-
   public static final String MOB_FILE_CACHE_SIZE_KEY = 
"hbase.mob.file.cache.size";
   public static final int DEFAULT_MOB_FILE_CACHE_SIZE = 1000;
-
   public static final String MOB_DIR_NAME = "mobdir";
   public static final String MOB_REGION_NAME = ".mob";
   public static final byte[] MOB_REGION_NAME_BYTES = 
Bytes.toBytes(MOB_REGION_NAME);
-
-  public static final String MOB_CLEANER_PERIOD = 
"hbase.master.mob.ttl.cleaner.period";
+  public static final String MOB_CLEANER_PERIOD = 
"hbase.master.mob.cleaner.period";
+  public static final String DEPRECATED_MOB_CLEANER_PERIOD = 
"hbase.master.mob.ttl.cleaner.period";
   public static final int DEFAULT_MOB_CLEANER_PERIOD = 24 * 60 * 60; // one day
-
   public static final String MOB_CACHE_EVICT_PERIOD = 
"hbase.mob.cache.evict.period";
   public static final String MOB_CACHE_EVICT_REMAIN_RATIO = 
"hbase.mob.cache.evict.remain.ratio";
-  public static final Tag MOB_REF_TAG = new 
ArrayBackedTag(TagType.MOB_REFERENCE_TAG_TYPE,
-  HConstants.EMPTY_BYTE_ARRAY);
+  public static final Tag MOB_REF_TAG =
+  new ArrayBackedTag(TagType.MOB_REFERENCE_TAG_TYPE, 
HConstants.EMPTY_BYTE_ARRAY);
 
   public static final float DEFAULT_EVICT_REMAIN_RATIO = 0.5f;
   public static final long DEFAULT_MOB_CACHE_EVICT_PERIOD = 3600L;
 
   public final static String TEMP_DIR_NAME = ".tmp";
+
+  /**
+   * The max number of a MOB table regions that is allowed in a batch of the 
mob compaction. By
+   * setting this number to a custom value, users can control the overall 
effect of a major
+   * compaction of a large MOB-enabled table.
+   */
+
+  public static final String MOB_MAJOR_COMPACTION_REGION_BATCH_SIZE =
+  "hbase.mob.major.compaction.region.batch.size";
+
+  /**
+   * Default is 0 - means no limit - all regions of a MOB table will be 
compacted at once
+   */
+
+  public static final int DEFAULT_MOB_MAJOR_COMPACTION_REGION_BATCH_SIZE = 0;
+
+  /**
+   * The period that MobCompactionChore runs. The unit is second. The default 
value is one week.
+   */
+  public static final String MOB_COMPACTION_CHORE_PERIOD = 
"hbase.mob.compaction.chore.period";
+  public static final int DEFAULT_MOB_COMPACTION_CHORE_PERIOD = 24 * 60 * 60 * 
7; // a week
+  public static final String MOB_COMPACTOR_CLASS_KEY = 
"hbase.mob.compactor.class";
 
 Review comment:
   I think this isn't used now? it should get cleaned out of 
`hbase-common/src/main/resources/hbase-default.xml`


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375607555
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobFileCleanerChore.java
 ##
 @@ -0,0 +1,331 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hbase.mob;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.LocatedFileStatus;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.RemoteIterator;
+import org.apache.hadoop.hbase.ScheduledChore;
+import org.apache.hadoop.hbase.TableDescriptors;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.backup.HFileArchiver;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.TableDescriptor;
+import org.apache.hadoop.hbase.io.hfile.CacheConfig;
+import org.apache.hadoop.hbase.master.HMaster;
+import org.apache.hadoop.hbase.regionserver.BloomType;
+import org.apache.hadoop.hbase.regionserver.HStoreFile;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.hadoop.hbase.util.FSUtils;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import 
org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
+
+/**
+ * The class MobFileCleanerChore for running cleaner regularly to remove the 
expired
+ * and obsolete (files which have no active references to) mob files.
+ */
+@InterfaceAudience.Private
+public class MobFileCleanerChore extends ScheduledChore {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(MobFileCleanerChore.class);
+  private final HMaster master;
+  private ExpiredMobFileCleaner cleaner;
+
+  static {
+Configuration.addDeprecation(MobConstants.DEPRECATED_MOB_CLEANER_PERIOD,
+  MobConstants.MOB_CLEANER_PERIOD);
+  }
+
+  public MobFileCleanerChore(HMaster master) {
+super(master.getServerName() + "-ExpiredMobFileCleanerChore", master,
+master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD,
+  MobConstants.DEFAULT_MOB_CLEANER_PERIOD),
+master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD,
+  MobConstants.DEFAULT_MOB_CLEANER_PERIOD),
+TimeUnit.SECONDS);
+this.master = master;
+cleaner = new ExpiredMobFileCleaner();
+cleaner.setConf(master.getConfiguration());
+checkObsoleteConfigurations();
+  }
+
+  private void checkObsoleteConfigurations() {
+Configuration conf = master.getConfiguration();
+
+if (conf.get("hbase.mob.compaction.mergeable.threshold") != null) {
+  LOG.warn("'hbase.mob.compaction.mergeable.threshold' is obsolete and not 
used anymore.");
+}
+if (conf.get("hbase.mob.delfile.max.count") != null) {
+  LOG.warn("'hbase.mob.delfile.max.count' is obsolete and not used 
anymore.");
+}
+if (conf.get("hbase.mob.compaction.threads.max") != null) {
+  LOG.warn("'hbase.mob.compaction.threads.max' is obsolete and not used 
anymore.");
+}
+if (conf.get("hbase.mob.compaction.batch.size") != null) {
+  LOG.warn("'hbase.mob.compaction.batch.size' is obsolete and not used 
anymore.");
+}
+  }
+
+  @VisibleForTesting
+  public MobFileCleanerChore() {
+this.master = null;
+  }
+
+  @Override
+  @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = 
"REC_CATCH_EXCEPTION",
+  justification = "Intentional")
+
+  protected void chore() {
+TableDescriptors htds = master.getTableDescriptors();
+
+Map map = null;
+try {
+  map = htds.getAll();
+} catch (IOException e) {
+  

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375532118
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/DefaultMobStoreCompactor.java
 ##
 @@ -183,105 +271,184 @@ protected boolean performCompaction(FileDetails fd, 
InternalScanner scanner, Cel
 boolean hasMore;
 Path path = MobUtils.getMobFamilyPath(conf, store.getTableName(), 
store.getColumnFamilyName());
 byte[] fileName = null;
-StoreFileWriter mobFileWriter = null, delFileWriter = null;
-long mobCells = 0, deleteMarkersCount = 0;
+StoreFileWriter mobFileWriter = null;
+/*
+ * mobCells are used only to decide if we need to commit or abort current 
MOB output file.
+ */
+long mobCells = 0;
 long cellsCountCompactedToMob = 0, cellsCountCompactedFromMob = 0;
 long cellsSizeCompactedToMob = 0, cellsSizeCompactedFromMob = 0;
 boolean finished = false;
+
 ScannerContext scannerContext =
 ScannerContext.newBuilder().setBatchLimit(compactionKVMax).build();
 throughputController.start(compactionName);
-KeyValueScanner kvs = (scanner instanceof KeyValueScanner)? 
(KeyValueScanner)scanner : null;
-long shippedCallSizeLimit = (long) numofFilesToCompact * 
this.store.getColumnFamilyDescriptor().getBlocksize();
+KeyValueScanner kvs = (scanner instanceof KeyValueScanner) ? 
(KeyValueScanner) scanner : null;
+long shippedCallSizeLimit =
+(long) numofFilesToCompact * 
this.store.getColumnFamilyDescriptor().getBlocksize();
+
+Cell mobCell = null;
 try {
-  try {
-// If the mob file writer could not be created, directly write the 
cell to the store file.
-mobFileWriter = mobStore.createWriterInTmp(new Date(fd.latestPutTs), 
fd.maxKeyCount,
-  compactionCompression, store.getRegionInfo().getStartKey(), true);
-fileName = Bytes.toBytes(mobFileWriter.getPath().getName());
-  } catch (IOException e) {
-LOG.warn("Failed to create mob writer, "
-   + "we will continue the compaction by writing MOB cells 
directly in store files", e);
-  }
-  if (major) {
-try {
-  delFileWriter = mobStore.createDelFileWriterInTmp(new 
Date(fd.latestPutTs),
-fd.maxKeyCount, compactionCompression, 
store.getRegionInfo().getStartKey());
-} catch (IOException e) {
-  LOG.warn(
-"Failed to create del writer, "
-+ "we will continue the compaction by writing delete markers 
directly in store files",
-e);
-}
-  }
+
+  mobFileWriter = newMobWriter(fd);
+  fileName = Bytes.toBytes(mobFileWriter.getPath().getName());
+
   do {
 hasMore = scanner.next(cells, scannerContext);
-if (LOG.isDebugEnabled()) {
-  now = EnvironmentEdgeManager.currentTime();
-}
+now = EnvironmentEdgeManager.currentTime();
 for (Cell c : cells) {
-  if (major && CellUtil.isDelete(c)) {
-if (MobUtils.isMobReferenceCell(c) || delFileWriter == null) {
-  // Directly write it to a store file
-  writer.append(c);
+  if (compactMOBs) {
+if (MobUtils.isMobReferenceCell(c)) {
+  String fName = MobUtils.getMobFileName(c);
+  Path pp = new Path(new Path(fs.getUri()), new Path(path, fName));
+
+  // Added to support migration
+  try {
+mobCell = mobStore.resolve(c, true, false).getCell();
+  } catch (FileNotFoundException fnfe) {
+if (discardMobMiss) {
+  LOG.error("Missing MOB cell: file={} not found cell={}", 
fName, c);
+  continue;
+} else {
+  throw fnfe;
+}
+  }
+
+  if (discardMobMiss && mobCell.getValueLength() == 0) {
+LOG.error("Missing MOB cell value: file={} cell={}", pp, 
mobCell);
+continue;
+  } else if (mobCell.getValueLength() == 0) {
+String errMsg = String.format("Found 0 length MOB cell in a 
file=%s cell=%s",
+  fName, mobCell);
+throw new IOException(errMsg);
+  }
+
+  if (mobCell.getValueLength() > mobSizeThreshold) {
+// put the mob data back to the MOB store file
+PrivateCellUtil.setSequenceId(mobCell, c.getSequenceId());
+if (!ioOptimizedMode) {
+  mobFileWriter.append(mobCell);
+  mobCells++;
+  writer.append(
+MobUtils.createMobRefCell(mobCell, fileName, 
this.mobStore.getRefCellTags()));
+} else {
+  // I/O optimized mode
+  // Check if MOB cell origin file size is
+  // greater than threshold
+

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r376086146
 
 

 ##
 File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/mob/FaultyMobStoreCompactor.java
 ##
 @@ -0,0 +1,373 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mob;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.PrivateCellUtil;
+import org.apache.hadoop.hbase.io.hfile.CorruptHFileException;
+import org.apache.hadoop.hbase.regionserver.CellSink;
+import org.apache.hadoop.hbase.regionserver.HStore;
+import org.apache.hadoop.hbase.regionserver.InternalScanner;
+import org.apache.hadoop.hbase.regionserver.KeyValueScanner;
+import org.apache.hadoop.hbase.regionserver.ScannerContext;
+import org.apache.hadoop.hbase.regionserver.ShipperListener;
+import org.apache.hadoop.hbase.regionserver.StoreFileWriter;
+import org.apache.hadoop.hbase.regionserver.throttle.ThroughputControlUtil;
+import org.apache.hadoop.hbase.regionserver.throttle.ThroughputController;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+/**
+ * This class is used for testing only. The main purpose is to emulate
+ * random failures during MOB compaction process.
+ * Example of usage:
+ * {@code
+ * public class SomeTest {
+ *
+ *   public void initConfiguration(Configuration conf){
+ * conf.set(MobStoreEngine.DEFAULT_MOB_COMPACTOR_CLASS_KEY,
+ FaultyMobStoreCompactor.class.getName());
+   conf.setDouble("hbase.mob.compaction.fault.probability", 0.1);
+ *   }
+ * }
+ * }
+ * @see org.apache.hadoop.hbase.mob.MobStressToolRunner on how to use and 
configure
+ *   this class.
+ *
+ */
+@InterfaceAudience.Private
+public class FaultyMobStoreCompactor extends DefaultMobStoreCompactor {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(FaultyMobStoreCompactor.class);
+
+  public static AtomicLong mobCounter = new AtomicLong();
+  public static AtomicLong totalFailures = new AtomicLong();
+  public static AtomicLong totalCompactions = new AtomicLong();
+  public static AtomicLong totalMajorCompactions = new AtomicLong();
+
+  static double failureProb = 0.1d;
+  static Random rnd = new Random();
+
+  public FaultyMobStoreCompactor(Configuration conf, HStore store) {
+super(conf, store);
+failureProb = conf.getDouble("hbase.mob.compaction.fault.probability", 
0.1);
+  }
+
+  @Override
+  protected boolean performCompaction(FileDetails fd, InternalScanner scanner, 
CellSink writer,
+  long smallestReadPoint, boolean cleanSeqId, ThroughputController 
throughputController,
+  boolean major, int numofFilesToCompact) throws IOException {
+
+totalCompactions.incrementAndGet();
+if (major) {
+  totalMajorCompactions.incrementAndGet();
+}
+long bytesWrittenProgressForCloseCheck = 0;
+long bytesWrittenProgressForLog = 0;
+long bytesWrittenProgressForShippedCall = 0;
+// Clear old mob references
+mobRefSet.get().clear();
+boolean isUserRequest = userRequest.get();
+boolean compactMOBs = major && isUserRequest;
+boolean discardMobMiss = 
conf.getBoolean(MobConstants.MOB_UNSAFE_DISCARD_MISS_KEY,
+  MobConstants.DEFAULT_MOB_DISCARD_MISS);
+
+boolean mustFail = false;
+if (compactMOBs) {
+  mobCounter.incrementAndGet();
+  double dv = rnd.nextDouble();
+  if (dv < failureProb) {
+mustFail = true;
+totalFailures.incrementAndGet();
+  }
+}
+
+FileSystem fs = FileSystem.get(conf);
+
+// Since scanner.next() can return 'false' 

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375604250
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobFileCleanerChore.java
 ##
 @@ -0,0 +1,331 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hbase.mob;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.LocatedFileStatus;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.RemoteIterator;
+import org.apache.hadoop.hbase.ScheduledChore;
+import org.apache.hadoop.hbase.TableDescriptors;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.backup.HFileArchiver;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.TableDescriptor;
+import org.apache.hadoop.hbase.io.hfile.CacheConfig;
+import org.apache.hadoop.hbase.master.HMaster;
+import org.apache.hadoop.hbase.regionserver.BloomType;
+import org.apache.hadoop.hbase.regionserver.HStoreFile;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.hadoop.hbase.util.FSUtils;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import 
org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
+
+/**
+ * The class MobFileCleanerChore for running cleaner regularly to remove the 
expired
+ * and obsolete (files which have no active references to) mob files.
+ */
+@InterfaceAudience.Private
+public class MobFileCleanerChore extends ScheduledChore {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(MobFileCleanerChore.class);
+  private final HMaster master;
+  private ExpiredMobFileCleaner cleaner;
+
+  static {
+Configuration.addDeprecation(MobConstants.DEPRECATED_MOB_CLEANER_PERIOD,
+  MobConstants.MOB_CLEANER_PERIOD);
+  }
+
+  public MobFileCleanerChore(HMaster master) {
+super(master.getServerName() + "-ExpiredMobFileCleanerChore", master,
+master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD,
+  MobConstants.DEFAULT_MOB_CLEANER_PERIOD),
+master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD,
+  MobConstants.DEFAULT_MOB_CLEANER_PERIOD),
+TimeUnit.SECONDS);
+this.master = master;
+cleaner = new ExpiredMobFileCleaner();
+cleaner.setConf(master.getConfiguration());
+checkObsoleteConfigurations();
+  }
+
+  private void checkObsoleteConfigurations() {
+Configuration conf = master.getConfiguration();
+
+if (conf.get("hbase.mob.compaction.mergeable.threshold") != null) {
+  LOG.warn("'hbase.mob.compaction.mergeable.threshold' is obsolete and not 
used anymore.");
+}
+if (conf.get("hbase.mob.delfile.max.count") != null) {
+  LOG.warn("'hbase.mob.delfile.max.count' is obsolete and not used 
anymore.");
+}
+if (conf.get("hbase.mob.compaction.threads.max") != null) {
+  LOG.warn("'hbase.mob.compaction.threads.max' is obsolete and not used 
anymore.");
+}
+if (conf.get("hbase.mob.compaction.batch.size") != null) {
+  LOG.warn("'hbase.mob.compaction.batch.size' is obsolete and not used 
anymore.");
+}
+  }
+
+  @VisibleForTesting
+  public MobFileCleanerChore() {
+this.master = null;
+  }
+
+  @Override
+  @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = 
"REC_CATCH_EXCEPTION",
+  justification = "Intentional")
+
+  protected void chore() {
+TableDescriptors htds = master.getTableDescriptors();
+
+Map map = null;
+try {
+  map = htds.getAll();
+} catch (IOException e) {
+  

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r376096340
 
 

 ##
 File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/mob/TestMobCompactionRegularMode.java
 ##
 @@ -0,0 +1,80 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mob;
+import java.io.IOException;
+
+import org.apache.hadoop.hbase.HBaseClassTestRule;
+import org.apache.hadoop.hbase.HColumnDescriptor;
+import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.testclassification.LargeTests;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+  * Mob file compaction chore in a regular non-batch mode test.
+  * 1. Uses default (non-batch) mode for regular MOB compaction,
+  * 2. Disables periodic MOB compactions, sets minimum age to archive to 10 sec
+  * 3. Creates MOB table with 20 regions
+  * 4. Loads MOB data (randomized keys, 1000 rows), flushes data.
+  * 5. Repeats 4. two more times
+  * 6. Verifies that we have 20 *3 = 60 mob files (equals to number of regions 
x 3)
+  * 7. Runs major MOB compaction.
+  * 8. Verifies that number of MOB files in a mob directory is 20 x4 = 80
+  * 9. Waits for a period of time larger than minimum age to archive
+  * 10. Runs Mob cleaner chore
+  * 11 Verifies that number of MOB files in a mob directory is 20.
+  * 12 Runs scanner and checks all 3 * 1000 rows.
+ */
+@SuppressWarnings("deprecation")
+@Category(LargeTests.class)
+public class TestMobCompactionRegularMode extends TestMobCompactionBase{
+  private static final Logger LOG =
+  LoggerFactory.getLogger(TestMobCompactionRegularMode.class);
+  @ClassRule
+  public static final HBaseClassTestRule CLASS_RULE =
+  HBaseClassTestRule.forClass(TestMobCompactionRegularMode.class);
+  @Rule
+  public TestName testName = new TestName();
 
 Review comment:
   I don't see where this gets used. could you point me in the right direction?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375604440
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobFileCleanerChore.java
 ##
 @@ -0,0 +1,331 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hbase.mob;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.LocatedFileStatus;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.RemoteIterator;
+import org.apache.hadoop.hbase.ScheduledChore;
+import org.apache.hadoop.hbase.TableDescriptors;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.backup.HFileArchiver;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.TableDescriptor;
+import org.apache.hadoop.hbase.io.hfile.CacheConfig;
+import org.apache.hadoop.hbase.master.HMaster;
+import org.apache.hadoop.hbase.regionserver.BloomType;
+import org.apache.hadoop.hbase.regionserver.HStoreFile;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.hadoop.hbase.util.FSUtils;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import 
org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
+
+/**
+ * The class MobFileCleanerChore for running cleaner regularly to remove the 
expired
+ * and obsolete (files which have no active references to) mob files.
+ */
+@InterfaceAudience.Private
+public class MobFileCleanerChore extends ScheduledChore {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(MobFileCleanerChore.class);
+  private final HMaster master;
+  private ExpiredMobFileCleaner cleaner;
+
+  static {
+Configuration.addDeprecation(MobConstants.DEPRECATED_MOB_CLEANER_PERIOD,
+  MobConstants.MOB_CLEANER_PERIOD);
+  }
+
+  public MobFileCleanerChore(HMaster master) {
+super(master.getServerName() + "-ExpiredMobFileCleanerChore", master,
+master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD,
+  MobConstants.DEFAULT_MOB_CLEANER_PERIOD),
+master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD,
+  MobConstants.DEFAULT_MOB_CLEANER_PERIOD),
+TimeUnit.SECONDS);
+this.master = master;
+cleaner = new ExpiredMobFileCleaner();
+cleaner.setConf(master.getConfiguration());
+checkObsoleteConfigurations();
+  }
+
+  private void checkObsoleteConfigurations() {
+Configuration conf = master.getConfiguration();
+
+if (conf.get("hbase.mob.compaction.mergeable.threshold") != null) {
+  LOG.warn("'hbase.mob.compaction.mergeable.threshold' is obsolete and not 
used anymore.");
+}
+if (conf.get("hbase.mob.delfile.max.count") != null) {
+  LOG.warn("'hbase.mob.delfile.max.count' is obsolete and not used 
anymore.");
+}
+if (conf.get("hbase.mob.compaction.threads.max") != null) {
+  LOG.warn("'hbase.mob.compaction.threads.max' is obsolete and not used 
anymore.");
+}
+if (conf.get("hbase.mob.compaction.batch.size") != null) {
+  LOG.warn("'hbase.mob.compaction.batch.size' is obsolete and not used 
anymore.");
+}
+  }
+
+  @VisibleForTesting
+  public MobFileCleanerChore() {
+this.master = null;
+  }
+
+  @Override
+  @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = 
"REC_CATCH_EXCEPTION",
+  justification = "Intentional")
+
+  protected void chore() {
+TableDescriptors htds = master.getTableDescriptors();
+
+Map map = null;
+try {
+  map = htds.getAll();
+} catch (IOException e) {
+  

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r376097153
 
 

 ##
 File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/mob/TestMobFileCleanerChore.java
 ##
 @@ -0,0 +1,230 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mob;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.Arrays;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.HBaseClassTestRule;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.HColumnDescriptor;
+import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.CompactionState;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.Result;
+import org.apache.hadoop.hbase.client.ResultScanner;
+import org.apache.hadoop.hbase.client.Table;
+import org.apache.hadoop.hbase.master.cleaner.TimeToLiveHFileCleaner;
+import org.apache.hadoop.hbase.testclassification.MediumTests;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+  * Mob file cleaner chore test.
+  * 1. Creates MOB table
+  * 2. Load MOB data and flushes it N times
+  * 3. Runs major MOB compaction (N MOB files go to archive)
+  * 4. Verifies that number of MOB files in a mob directory is N+1
+  * 5. Waits for a period of time larger than minimum age to archive
+  * 6. Runs Mob cleaner chore
+  * 7 Verifies that number of MOB files in a mob directory is 1.
+ */
+@SuppressWarnings("deprecation")
+@Category(MediumTests.class)
+public class TestMobFileCleanerChore {
+  private static final Logger LOG = 
LoggerFactory.getLogger(TestMobFileCleanerChore.class);
+  @ClassRule
+  public static final HBaseClassTestRule CLASS_RULE =
+  HBaseClassTestRule.forClass(TestMobFileCleanerChore.class);
+  @Rule
+  public TestName testName = new TestName();
 
 Review comment:
   I don't see where this gets used. could you point me in the right direction?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375976299
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobFileCompactionChore.java
 ##
 @@ -0,0 +1,253 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mob;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.ScheduledChore;
+import org.apache.hadoop.hbase.TableDescriptors;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
+import org.apache.hadoop.hbase.client.CompactionState;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.RegionInfo;
+import org.apache.hadoop.hbase.client.TableDescriptor;
+import org.apache.hadoop.hbase.client.TableState;
+import org.apache.hadoop.hbase.master.HMaster;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import 
org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
+
+
+/**
+ * Periodic MOB compaction chore.
+ * It runs MOB compaction on region servers in parallel, thus
+ * utilizing distributed cluster resources. To avoid possible major
+ * compaction storms, one can specify maximum number regions to be compacted
+ * in parallel by setting configuration parameter: 
+ * 'hbase.mob.major.compaction.region.batch.size', which by default is 0 
(unlimited).
+ *
+ */
+@InterfaceAudience.Private
+public class MobFileCompactionChore extends ScheduledChore {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(MobFileCompactionChore.class);
+  private Configuration conf;
+  private HMaster master;
+  private int regionBatchSize = 0;// not set - compact all
+
+  public MobFileCompactionChore(HMaster master) {
+super(master.getServerName() + "-MobFileCompactionChore", master,
+
master.getConfiguration().getInt(MobConstants.MOB_COMPACTION_CHORE_PERIOD,
+  MobConstants.DEFAULT_MOB_COMPACTION_CHORE_PERIOD),
+
master.getConfiguration().getInt(MobConstants.MOB_COMPACTION_CHORE_PERIOD,
+  MobConstants.DEFAULT_MOB_COMPACTION_CHORE_PERIOD),
+TimeUnit.SECONDS);
+this.master = master;
+this.conf = master.getConfiguration();
+this.regionBatchSize =
+
master.getConfiguration().getInt(MobConstants.MOB_MAJOR_COMPACTION_REGION_BATCH_SIZE,
+  MobConstants.DEFAULT_MOB_MAJOR_COMPACTION_REGION_BATCH_SIZE);
+
+  }
+
+  @VisibleForTesting
+  public MobFileCompactionChore(Configuration conf, int batchSize) {
+this.conf = conf;
+this.regionBatchSize = batchSize;
+  }
+
+  @Override
+  protected void chore() {
+
+boolean reported = false;
+
+try (Connection conn = ConnectionFactory.createConnection(conf);
+Admin admin = conn.getAdmin();) {
+
+  TableDescriptors htds = master.getTableDescriptors();
+  Map map = htds.getAll();
+  for (TableDescriptor htd : map.values()) {
+if (!master.getTableStateManager().isTableState(htd.getTableName(),
+  TableState.State.ENABLED)) {
+  LOG.info("Skipping MOB compaction on table {} because it is not 
ENABLED",
+htd.getTableName());
+  continue;
+} else {
+  LOG.info("Starting MOB compaction on table {}, checking {} column 
families",
+htd.getTableName(), htd.getColumnFamilyCount());
+}
+for (ColumnFamilyDescriptor hcd : htd.getColumnFamilies()) {
+  try {
+if (hcd.isMobEnabled()) {
+  if (!reported) {
+master.reportMobCompactionStart(htd.getTableName());
+reported = true;
+  }
+  LOG.info("Major MOB 

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375603734
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobConstants.java
 ##
 @@ -35,26 +35,88 @@
   public static final String MOB_CACHE_BLOCKS = "hbase.mob.cache.blocks";
   public static final String MOB_SCAN_REF_ONLY = "hbase.mob.scan.ref.only";
   public static final String EMPTY_VALUE_ON_MOBCELL_MISS = 
"empty.value.on.mobcell.miss";
-
   public static final String MOB_FILE_CACHE_SIZE_KEY = 
"hbase.mob.file.cache.size";
   public static final int DEFAULT_MOB_FILE_CACHE_SIZE = 1000;
-
   public static final String MOB_DIR_NAME = "mobdir";
   public static final String MOB_REGION_NAME = ".mob";
   public static final byte[] MOB_REGION_NAME_BYTES = 
Bytes.toBytes(MOB_REGION_NAME);
-
-  public static final String MOB_CLEANER_PERIOD = 
"hbase.master.mob.ttl.cleaner.period";
+  public static final String MOB_CLEANER_PERIOD = 
"hbase.master.mob.cleaner.period";
+  public static final String DEPRECATED_MOB_CLEANER_PERIOD = 
"hbase.master.mob.ttl.cleaner.period";
   public static final int DEFAULT_MOB_CLEANER_PERIOD = 24 * 60 * 60; // one day
-
   public static final String MOB_CACHE_EVICT_PERIOD = 
"hbase.mob.cache.evict.period";
   public static final String MOB_CACHE_EVICT_REMAIN_RATIO = 
"hbase.mob.cache.evict.remain.ratio";
-  public static final Tag MOB_REF_TAG = new 
ArrayBackedTag(TagType.MOB_REFERENCE_TAG_TYPE,
-  HConstants.EMPTY_BYTE_ARRAY);
+  public static final Tag MOB_REF_TAG =
+  new ArrayBackedTag(TagType.MOB_REFERENCE_TAG_TYPE, 
HConstants.EMPTY_BYTE_ARRAY);
 
   public static final float DEFAULT_EVICT_REMAIN_RATIO = 0.5f;
   public static final long DEFAULT_MOB_CACHE_EVICT_PERIOD = 3600L;
 
   public final static String TEMP_DIR_NAME = ".tmp";
+
+  /**
+   * The max number of a MOB table regions that is allowed in a batch of the 
mob compaction. By
+   * setting this number to a custom value, users can control the overall 
effect of a major
+   * compaction of a large MOB-enabled table.
+   */
+
+  public static final String MOB_MAJOR_COMPACTION_REGION_BATCH_SIZE =
+  "hbase.mob.major.compaction.region.batch.size";
+
+  /**
+   * Default is 0 - means no limit - all regions of a MOB table will be 
compacted at once
+   */
+
+  public static final int DEFAULT_MOB_MAJOR_COMPACTION_REGION_BATCH_SIZE = 0;
+
+  /**
+   * The period that MobCompactionChore runs. The unit is second. The default 
value is one week.
+   */
+  public static final String MOB_COMPACTION_CHORE_PERIOD = 
"hbase.mob.compaction.chore.period";
+  public static final int DEFAULT_MOB_COMPACTION_CHORE_PERIOD = 24 * 60 * 60 * 
7; // a week
+  public static final String MOB_COMPACTOR_CLASS_KEY = 
"hbase.mob.compactor.class";
+
+  /**
+   * Mob compaction type: "full", "optimized" "full" - run full major 
compaction (during migration)
+   * "optimized" - optimized version for use case with infrequent 
updates/deletes
+   */
+
+  public final static String OPTIMIZED_MOB_COMPACTION_TYPE = "optimized";
+
+  public final static String FULL_MOB_COMPACTION_TYPE = "full";
+
+  public final static String MOB_COMPACTION_TYPE_KEY = 
"hbase.mob.compaction.type";
+
+  public final static String DEFAULT_MOB_COMPACTION_TYPE = 
FULL_MOB_COMPACTION_TYPE;
+
+  /**
+   * Maximum size of a MOB compaction selection
+   */
+  public static final String MOB_COMPACTION_MAX_FILE_SIZE_KEY =
+  "hbase.mob.compactions.max.file.size";
 
 Review comment:
   nit: Is there any particular reason we're not repurposing 
`hbase.mob.compaction.mergeable.threshold` here?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375963730
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobFileCompactionChore.java
 ##
 @@ -0,0 +1,253 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mob;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.ScheduledChore;
+import org.apache.hadoop.hbase.TableDescriptors;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
+import org.apache.hadoop.hbase.client.CompactionState;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.RegionInfo;
+import org.apache.hadoop.hbase.client.TableDescriptor;
+import org.apache.hadoop.hbase.client.TableState;
+import org.apache.hadoop.hbase.master.HMaster;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import 
org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
+
+
+/**
+ * Periodic MOB compaction chore.
+ * It runs MOB compaction on region servers in parallel, thus
+ * utilizing distributed cluster resources. To avoid possible major
+ * compaction storms, one can specify maximum number regions to be compacted
+ * in parallel by setting configuration parameter: 
+ * 'hbase.mob.major.compaction.region.batch.size', which by default is 0 
(unlimited).
+ *
+ */
+@InterfaceAudience.Private
+public class MobFileCompactionChore extends ScheduledChore {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(MobFileCompactionChore.class);
+  private Configuration conf;
+  private HMaster master;
+  private int regionBatchSize = 0;// not set - compact all
+
+  public MobFileCompactionChore(HMaster master) {
+super(master.getServerName() + "-MobFileCompactionChore", master,
+
master.getConfiguration().getInt(MobConstants.MOB_COMPACTION_CHORE_PERIOD,
+  MobConstants.DEFAULT_MOB_COMPACTION_CHORE_PERIOD),
+
master.getConfiguration().getInt(MobConstants.MOB_COMPACTION_CHORE_PERIOD,
+  MobConstants.DEFAULT_MOB_COMPACTION_CHORE_PERIOD),
+TimeUnit.SECONDS);
+this.master = master;
+this.conf = master.getConfiguration();
+this.regionBatchSize =
+
master.getConfiguration().getInt(MobConstants.MOB_MAJOR_COMPACTION_REGION_BATCH_SIZE,
+  MobConstants.DEFAULT_MOB_MAJOR_COMPACTION_REGION_BATCH_SIZE);
+
+  }
+
+  @VisibleForTesting
+  public MobFileCompactionChore(Configuration conf, int batchSize) {
+this.conf = conf;
+this.regionBatchSize = batchSize;
+  }
+
+  @Override
+  protected void chore() {
+
+boolean reported = false;
+
+try (Connection conn = ConnectionFactory.createConnection(conf);
+Admin admin = conn.getAdmin();) {
+
+  TableDescriptors htds = master.getTableDescriptors();
+  Map map = htds.getAll();
+  for (TableDescriptor htd : map.values()) {
+if (!master.getTableStateManager().isTableState(htd.getTableName(),
+  TableState.State.ENABLED)) {
+  LOG.info("Skipping MOB compaction on table {} because it is not 
ENABLED",
+htd.getTableName());
+  continue;
+} else {
+  LOG.info("Starting MOB compaction on table {}, checking {} column 
families",
+htd.getTableName(), htd.getColumnFamilyCount());
+}
+for (ColumnFamilyDescriptor hcd : htd.getColumnFamilies()) {
+  try {
+if (hcd.isMobEnabled()) {
+  if (!reported) {
+master.reportMobCompactionStart(htd.getTableName());
+reported = true;
+  }
+  LOG.info("Major MOB 

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r376081350
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileInfo.java
 ##
 @@ -443,22 +430,42 @@ public static boolean isHFile(final String fileName) {
   }
 
   /**
-   * @param path Path to check.
-   * @return True if the path has format of a del file.
+   * Checks if the file is a MOB file
+   * @param path path to a file
+   * @return true, if - yes, false otherwise
*/
-  public static boolean isDelFile(final Path path) {
-return isDelFile(path.getName());
+  public static boolean isMobFile(final Path path) {
 
 Review comment:
   Just to make sure I understand, we're purposefully going to return `false` 
for any files in the MOB storage area that are from prior to the distributed 
mob compaction changes?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375602739
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobConstants.java
 ##
 @@ -63,40 +125,23 @@
* be merged in mob compaction. The default value is 1280MB.
*/
   public static final String MOB_COMPACTION_MERGEABLE_THRESHOLD =
-"hbase.mob.compaction.mergeable.threshold";
+  "hbase.mob.compaction.mergeable.threshold";
   public static final long DEFAULT_MOB_COMPACTION_MERGEABLE_THRESHOLD = 10 * 
128 * 1024 * 1024;
-  /**
-   * The max number of del files that is allowed in the mob file compaction. 
In the mob
-   * compaction, when the number of existing del files is larger than this 
value, they are merged
-   * until number of del files is not larger this value. The default value is 
3.
-   */
   public static final String MOB_DELFILE_MAX_COUNT = 
"hbase.mob.delfile.max.count";
   public static final int DEFAULT_MOB_DELFILE_MAX_COUNT = 3;
   /**
-   * The max number of the mob files that is allowed in a batch of the mob 
compaction.
-   * The mob compaction merges the small mob files to bigger ones. If the 
number of the
-   * small files is very large, it could lead to a "too many opened file 
handlers" in the merge.
-   * And the merge has to be split into batches. This value limits the number 
of mob files
-   * that are selected in a batch of the mob compaction. The default value is 
100.
+   * The max number of the mob files that is allowed in a batch of the mob 
compaction. The mob
+   * compaction merges the small mob files to bigger ones. If the number of 
the small files is very
+   * large, it could lead to a "too many opened file handlers" in the merge. 
And the merge has to be
+   * split into batches. This value limits the number of mob files that are 
selected in a batch of
+   * the mob compaction. The default value is 100. Default is 0 - means no 
limit - all regions of a
+   * MOB table will be compacted at once
*/
-  public static final String MOB_COMPACTION_BATCH_SIZE =
-"hbase.mob.compaction.batch.size";
+  public static final String MOB_COMPACTION_BATCH_SIZE = 
"hbase.mob.compaction.batch.size";
   public static final int DEFAULT_MOB_COMPACTION_BATCH_SIZE = 100;
-  /**
-   * The period that MobCompactionChore runs. The unit is second.
-   * The default value is one week.
-   */
-  public static final String MOB_COMPACTION_CHORE_PERIOD =
-"hbase.mob.compaction.chore.period";
-  public static final int DEFAULT_MOB_COMPACTION_CHORE_PERIOD =
-24 * 60 * 60 * 7; // a week
-  public static final String MOB_COMPACTOR_CLASS_KEY = 
"hbase.mob.compactor.class";
-  /**
-   * The max number of threads used in MobCompactor.
-   */
-  public static final String MOB_COMPACTION_THREADS_MAX =
-"hbase.mob.compaction.threads.max";
+  public static final String MOB_COMPACTION_THREADS_MAX = 
"hbase.mob.compaction.threads.max";
 
 Review comment:
   should get removed from `hbase-common/src/main/resources/hbase-default.xml`


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375997351
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobFileCompactionChore.java
 ##
 @@ -0,0 +1,253 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mob;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.ScheduledChore;
+import org.apache.hadoop.hbase.TableDescriptors;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
+import org.apache.hadoop.hbase.client.CompactionState;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.RegionInfo;
+import org.apache.hadoop.hbase.client.TableDescriptor;
+import org.apache.hadoop.hbase.client.TableState;
+import org.apache.hadoop.hbase.master.HMaster;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import 
org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
+
+
+/**
+ * Periodic MOB compaction chore.
+ * It runs MOB compaction on region servers in parallel, thus
+ * utilizing distributed cluster resources. To avoid possible major
+ * compaction storms, one can specify maximum number regions to be compacted
+ * in parallel by setting configuration parameter: 
+ * 'hbase.mob.major.compaction.region.batch.size', which by default is 0 
(unlimited).
+ *
+ */
+@InterfaceAudience.Private
+public class MobFileCompactionChore extends ScheduledChore {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(MobFileCompactionChore.class);
+  private Configuration conf;
+  private HMaster master;
+  private int regionBatchSize = 0;// not set - compact all
+
+  public MobFileCompactionChore(HMaster master) {
+super(master.getServerName() + "-MobFileCompactionChore", master,
+
master.getConfiguration().getInt(MobConstants.MOB_COMPACTION_CHORE_PERIOD,
+  MobConstants.DEFAULT_MOB_COMPACTION_CHORE_PERIOD),
+
master.getConfiguration().getInt(MobConstants.MOB_COMPACTION_CHORE_PERIOD,
+  MobConstants.DEFAULT_MOB_COMPACTION_CHORE_PERIOD),
+TimeUnit.SECONDS);
+this.master = master;
+this.conf = master.getConfiguration();
+this.regionBatchSize =
+
master.getConfiguration().getInt(MobConstants.MOB_MAJOR_COMPACTION_REGION_BATCH_SIZE,
+  MobConstants.DEFAULT_MOB_MAJOR_COMPACTION_REGION_BATCH_SIZE);
+
+  }
+
+  @VisibleForTesting
+  public MobFileCompactionChore(Configuration conf, int batchSize) {
+this.conf = conf;
+this.regionBatchSize = batchSize;
+  }
+
+  @Override
+  protected void chore() {
+
+boolean reported = false;
+
+try (Connection conn = ConnectionFactory.createConnection(conf);
+Admin admin = conn.getAdmin();) {
+
+  TableDescriptors htds = master.getTableDescriptors();
+  Map map = htds.getAll();
+  for (TableDescriptor htd : map.values()) {
+if (!master.getTableStateManager().isTableState(htd.getTableName(),
+  TableState.State.ENABLED)) {
+  LOG.info("Skipping MOB compaction on table {} because it is not 
ENABLED",
+htd.getTableName());
+  continue;
+} else {
+  LOG.info("Starting MOB compaction on table {}, checking {} column 
families",
+htd.getTableName(), htd.getColumnFamilyCount());
+}
+for (ColumnFamilyDescriptor hcd : htd.getColumnFamilies()) {
+  try {
+if (hcd.isMobEnabled()) {
+  if (!reported) {
+master.reportMobCompactionStart(htd.getTableName());
+reported = true;
+  }
+  LOG.info("Major MOB 

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r376086853
 
 

 ##
 File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/mob/FaultyMobStoreCompactor.java
 ##
 @@ -0,0 +1,373 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mob;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.PrivateCellUtil;
+import org.apache.hadoop.hbase.io.hfile.CorruptHFileException;
+import org.apache.hadoop.hbase.regionserver.CellSink;
+import org.apache.hadoop.hbase.regionserver.HStore;
+import org.apache.hadoop.hbase.regionserver.InternalScanner;
+import org.apache.hadoop.hbase.regionserver.KeyValueScanner;
+import org.apache.hadoop.hbase.regionserver.ScannerContext;
+import org.apache.hadoop.hbase.regionserver.ShipperListener;
+import org.apache.hadoop.hbase.regionserver.StoreFileWriter;
+import org.apache.hadoop.hbase.regionserver.throttle.ThroughputControlUtil;
+import org.apache.hadoop.hbase.regionserver.throttle.ThroughputController;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+/**
+ * This class is used for testing only. The main purpose is to emulate
+ * random failures during MOB compaction process.
+ * Example of usage:
+ * {@code
+ * public class SomeTest {
+ *
+ *   public void initConfiguration(Configuration conf){
+ * conf.set(MobStoreEngine.DEFAULT_MOB_COMPACTOR_CLASS_KEY,
+ FaultyMobStoreCompactor.class.getName());
+   conf.setDouble("hbase.mob.compaction.fault.probability", 0.1);
+ *   }
+ * }
+ * }
+ * @see org.apache.hadoop.hbase.mob.MobStressToolRunner on how to use and 
configure
+ *   this class.
+ *
+ */
+@InterfaceAudience.Private
+public class FaultyMobStoreCompactor extends DefaultMobStoreCompactor {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(FaultyMobStoreCompactor.class);
+
+  public static AtomicLong mobCounter = new AtomicLong();
+  public static AtomicLong totalFailures = new AtomicLong();
+  public static AtomicLong totalCompactions = new AtomicLong();
+  public static AtomicLong totalMajorCompactions = new AtomicLong();
+
+  static double failureProb = 0.1d;
+  static Random rnd = new Random();
+
+  public FaultyMobStoreCompactor(Configuration conf, HStore store) {
+super(conf, store);
+failureProb = conf.getDouble("hbase.mob.compaction.fault.probability", 
0.1);
+  }
+
+  @Override
+  protected boolean performCompaction(FileDetails fd, InternalScanner scanner, 
CellSink writer,
+  long smallestReadPoint, boolean cleanSeqId, ThroughputController 
throughputController,
+  boolean major, int numofFilesToCompact) throws IOException {
+
+totalCompactions.incrementAndGet();
+if (major) {
+  totalMajorCompactions.incrementAndGet();
+}
+long bytesWrittenProgressForCloseCheck = 0;
+long bytesWrittenProgressForLog = 0;
+long bytesWrittenProgressForShippedCall = 0;
+// Clear old mob references
+mobRefSet.get().clear();
+boolean isUserRequest = userRequest.get();
+boolean compactMOBs = major && isUserRequest;
+boolean discardMobMiss = 
conf.getBoolean(MobConstants.MOB_UNSAFE_DISCARD_MISS_KEY,
+  MobConstants.DEFAULT_MOB_DISCARD_MISS);
+
+boolean mustFail = false;
+if (compactMOBs) {
+  mobCounter.incrementAndGet();
+  double dv = rnd.nextDouble();
+  if (dv < failureProb) {
+mustFail = true;
+totalFailures.incrementAndGet();
+  }
+}
+
+FileSystem fs = FileSystem.get(conf);
+
+// Since scanner.next() can return 'false' 

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375603896
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobConstants.java
 ##
 @@ -63,40 +125,23 @@
* be merged in mob compaction. The default value is 1280MB.
*/
   public static final String MOB_COMPACTION_MERGEABLE_THRESHOLD =
-"hbase.mob.compaction.mergeable.threshold";
+  "hbase.mob.compaction.mergeable.threshold";
 
 Review comment:
   needs references cleaned up in 
`hbase-common/src/main/resources/hbase-default.xml` and in the ref guide


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r376092399
 
 

 ##
 File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/mob/MobStressToolRunner.java
 ##
 @@ -0,0 +1,325 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mob;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.Arrays;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.HColumnDescriptor;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.KeepDeletedCells;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.Result;
+import org.apache.hadoop.hbase.client.ResultScanner;
+import org.apache.hadoop.hbase.client.Table;
+import org.apache.hadoop.hbase.master.cleaner.TimeToLiveHFileCleaner;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+/**
+Reproduction for MOB data loss
+
+ 1. Settings: Region Size 200 MB,  Flush threshold 800 KB.
+ 2. Insert 10 Million records
+ 3. MOB Compaction and Archiver
+  a) Trigger MOB Compaction (every 2 minutes)
+  b) Trigger major compaction (every 2 minutes)
+  c) Trigger archive cleaner (every 3 minutes)
+ 4. Validate MOB data after complete data load.
+
+ This class is used by MobStressTool only. This is not a unit test
+
+ */
+@SuppressWarnings("deprecation")
+public class MobStressToolRunner {
+  private static final Logger LOG = 
LoggerFactory.getLogger(MobStressToolRunner.class);
+
+
+  private HBaseTestingUtility HTU;
+
+  private final static String famStr = "f1";
+  private final static byte[] fam = Bytes.toBytes(famStr);
+  private final static byte[] qualifier = Bytes.toBytes("q1");
+  private final static long mobLen = 10;
+  private final static byte[] mobVal = Bytes
+  
.toBytes("01234567890123456789012345678901234567890123456789012345678901234567890123456789");
+
+  private Configuration conf;
+  private HTableDescriptor hdt;
+  private HColumnDescriptor hcd;
+  private Admin admin;
+  private long count = 50;
+  private double failureProb = 0.1;
+  private Table table = null;
+  private MobFileCleanerChore chore = new MobFileCleanerChore();
+
+  private static volatile boolean run = true;
+
+  public MobStressToolRunner() {
+
+  }
+
+  public void init(Configuration conf, long numRows) throws IOException {
+this.conf = conf;
+this.count = numRows;
+initConf();
+printConf();
+hdt = createTableDescriptor("testMobCompactTable");
+Connection conn = ConnectionFactory.createConnection(this.conf);
+this.admin = conn.getAdmin();
+this.hcd = new HColumnDescriptor(fam);
+this.hcd.setMobEnabled(true);
+this.hcd.setMobThreshold(mobLen);
+this.hcd.setMaxVersions(1);
+this.hdt.addFamily(hcd);
+if (admin.tableExists(hdt.getTableName())) {
+  admin.disableTable(hdt.getTableName());
+  admin.deleteTable(hdt.getTableName());
+}
+admin.createTable(hdt);
+table = conn.getTable(hdt.getTableName());
+  }
+
+  private void printConf() {
+LOG.info("Please ensure the following HBase configuration is set:");
+LOG.info("hfile.format.version=3");
+LOG.info("hbase.master.hfilecleaner.ttl=0");
+LOG.info("hbase.hregion.max.filesize=2");
+LOG.info("hbase.client.retries.number=100");
+LOG.info("hbase.hregion.memstore.flush.size=80");
+LOG.info("hbase.hstore.blockingStoreFiles=150");
+LOG.info("hbase.hstore.compaction.throughput.lower.bound=5000");
+LOG.info("hbase.hstore.compaction.throughput.higher.bound=1");
+

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r376086218
 
 

 ##
 File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/mob/FaultyMobStoreCompactor.java
 ##
 @@ -0,0 +1,373 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mob;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.PrivateCellUtil;
+import org.apache.hadoop.hbase.io.hfile.CorruptHFileException;
+import org.apache.hadoop.hbase.regionserver.CellSink;
+import org.apache.hadoop.hbase.regionserver.HStore;
+import org.apache.hadoop.hbase.regionserver.InternalScanner;
+import org.apache.hadoop.hbase.regionserver.KeyValueScanner;
+import org.apache.hadoop.hbase.regionserver.ScannerContext;
+import org.apache.hadoop.hbase.regionserver.ShipperListener;
+import org.apache.hadoop.hbase.regionserver.StoreFileWriter;
+import org.apache.hadoop.hbase.regionserver.throttle.ThroughputControlUtil;
+import org.apache.hadoop.hbase.regionserver.throttle.ThroughputController;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+/**
+ * This class is used for testing only. The main purpose is to emulate
+ * random failures during MOB compaction process.
+ * Example of usage:
+ * {@code
+ * public class SomeTest {
+ *
+ *   public void initConfiguration(Configuration conf){
+ * conf.set(MobStoreEngine.DEFAULT_MOB_COMPACTOR_CLASS_KEY,
+ FaultyMobStoreCompactor.class.getName());
+   conf.setDouble("hbase.mob.compaction.fault.probability", 0.1);
+ *   }
+ * }
+ * }
+ * @see org.apache.hadoop.hbase.mob.MobStressToolRunner on how to use and 
configure
+ *   this class.
+ *
+ */
+@InterfaceAudience.Private
+public class FaultyMobStoreCompactor extends DefaultMobStoreCompactor {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(FaultyMobStoreCompactor.class);
+
+  public static AtomicLong mobCounter = new AtomicLong();
+  public static AtomicLong totalFailures = new AtomicLong();
+  public static AtomicLong totalCompactions = new AtomicLong();
+  public static AtomicLong totalMajorCompactions = new AtomicLong();
+
+  static double failureProb = 0.1d;
+  static Random rnd = new Random();
+
+  public FaultyMobStoreCompactor(Configuration conf, HStore store) {
+super(conf, store);
+failureProb = conf.getDouble("hbase.mob.compaction.fault.probability", 
0.1);
+  }
+
+  @Override
+  protected boolean performCompaction(FileDetails fd, InternalScanner scanner, 
CellSink writer,
+  long smallestReadPoint, boolean cleanSeqId, ThroughputController 
throughputController,
+  boolean major, int numofFilesToCompact) throws IOException {
+
+totalCompactions.incrementAndGet();
+if (major) {
+  totalMajorCompactions.incrementAndGet();
+}
+long bytesWrittenProgressForCloseCheck = 0;
+long bytesWrittenProgressForLog = 0;
+long bytesWrittenProgressForShippedCall = 0;
+// Clear old mob references
+mobRefSet.get().clear();
+boolean isUserRequest = userRequest.get();
+boolean compactMOBs = major && isUserRequest;
+boolean discardMobMiss = 
conf.getBoolean(MobConstants.MOB_UNSAFE_DISCARD_MISS_KEY,
+  MobConstants.DEFAULT_MOB_DISCARD_MISS);
+
+boolean mustFail = false;
+if (compactMOBs) {
+  mobCounter.incrementAndGet();
+  double dv = rnd.nextDouble();
+  if (dv < failureProb) {
+mustFail = true;
+totalFailures.incrementAndGet();
+  }
+}
+
+FileSystem fs = FileSystem.get(conf);
+
+// Since scanner.next() can return 'false' 

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375527325
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/DefaultMobStoreCompactor.java
 ##
 @@ -183,105 +271,184 @@ protected boolean performCompaction(FileDetails fd, 
InternalScanner scanner, Cel
 boolean hasMore;
 Path path = MobUtils.getMobFamilyPath(conf, store.getTableName(), 
store.getColumnFamilyName());
 byte[] fileName = null;
-StoreFileWriter mobFileWriter = null, delFileWriter = null;
-long mobCells = 0, deleteMarkersCount = 0;
+StoreFileWriter mobFileWriter = null;
+/*
+ * mobCells are used only to decide if we need to commit or abort current 
MOB output file.
+ */
+long mobCells = 0;
 long cellsCountCompactedToMob = 0, cellsCountCompactedFromMob = 0;
 long cellsSizeCompactedToMob = 0, cellsSizeCompactedFromMob = 0;
 boolean finished = false;
+
 ScannerContext scannerContext =
 ScannerContext.newBuilder().setBatchLimit(compactionKVMax).build();
 throughputController.start(compactionName);
-KeyValueScanner kvs = (scanner instanceof KeyValueScanner)? 
(KeyValueScanner)scanner : null;
-long shippedCallSizeLimit = (long) numofFilesToCompact * 
this.store.getColumnFamilyDescriptor().getBlocksize();
+KeyValueScanner kvs = (scanner instanceof KeyValueScanner) ? 
(KeyValueScanner) scanner : null;
+long shippedCallSizeLimit =
+(long) numofFilesToCompact * 
this.store.getColumnFamilyDescriptor().getBlocksize();
+
+Cell mobCell = null;
 try {
-  try {
-// If the mob file writer could not be created, directly write the 
cell to the store file.
-mobFileWriter = mobStore.createWriterInTmp(new Date(fd.latestPutTs), 
fd.maxKeyCount,
-  compactionCompression, store.getRegionInfo().getStartKey(), true);
-fileName = Bytes.toBytes(mobFileWriter.getPath().getName());
-  } catch (IOException e) {
-LOG.warn("Failed to create mob writer, "
-   + "we will continue the compaction by writing MOB cells 
directly in store files", e);
-  }
-  if (major) {
-try {
-  delFileWriter = mobStore.createDelFileWriterInTmp(new 
Date(fd.latestPutTs),
-fd.maxKeyCount, compactionCompression, 
store.getRegionInfo().getStartKey());
-} catch (IOException e) {
-  LOG.warn(
-"Failed to create del writer, "
-+ "we will continue the compaction by writing delete markers 
directly in store files",
-e);
-}
-  }
+
+  mobFileWriter = newMobWriter(fd);
+  fileName = Bytes.toBytes(mobFileWriter.getPath().getName());
+
   do {
 hasMore = scanner.next(cells, scannerContext);
-if (LOG.isDebugEnabled()) {
-  now = EnvironmentEdgeManager.currentTime();
-}
+now = EnvironmentEdgeManager.currentTime();
 for (Cell c : cells) {
-  if (major && CellUtil.isDelete(c)) {
-if (MobUtils.isMobReferenceCell(c) || delFileWriter == null) {
-  // Directly write it to a store file
-  writer.append(c);
+  if (compactMOBs) {
+if (MobUtils.isMobReferenceCell(c)) {
+  String fName = MobUtils.getMobFileName(c);
+  Path pp = new Path(new Path(fs.getUri()), new Path(path, fName));
+
+  // Added to support migration
+  try {
+mobCell = mobStore.resolve(c, true, false).getCell();
+  } catch (FileNotFoundException fnfe) {
+if (discardMobMiss) {
+  LOG.error("Missing MOB cell: file={} not found cell={}", 
fName, c);
+  continue;
+} else {
+  throw fnfe;
+}
+  }
+
+  if (discardMobMiss && mobCell.getValueLength() == 0) {
+LOG.error("Missing MOB cell value: file={} cell={}", pp, 
mobCell);
 
 Review comment:
   this is the call that should be logging `fName` instead of `pp`


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r376087184
 
 

 ##
 File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/mob/FaultyMobStoreCompactor.java
 ##
 @@ -0,0 +1,373 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mob;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.PrivateCellUtil;
+import org.apache.hadoop.hbase.io.hfile.CorruptHFileException;
+import org.apache.hadoop.hbase.regionserver.CellSink;
+import org.apache.hadoop.hbase.regionserver.HStore;
+import org.apache.hadoop.hbase.regionserver.InternalScanner;
+import org.apache.hadoop.hbase.regionserver.KeyValueScanner;
+import org.apache.hadoop.hbase.regionserver.ScannerContext;
+import org.apache.hadoop.hbase.regionserver.ShipperListener;
+import org.apache.hadoop.hbase.regionserver.StoreFileWriter;
+import org.apache.hadoop.hbase.regionserver.throttle.ThroughputControlUtil;
+import org.apache.hadoop.hbase.regionserver.throttle.ThroughputController;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+/**
+ * This class is used for testing only. The main purpose is to emulate
+ * random failures during MOB compaction process.
+ * Example of usage:
+ * {@code
+ * public class SomeTest {
+ *
+ *   public void initConfiguration(Configuration conf){
+ * conf.set(MobStoreEngine.DEFAULT_MOB_COMPACTOR_CLASS_KEY,
+ FaultyMobStoreCompactor.class.getName());
+   conf.setDouble("hbase.mob.compaction.fault.probability", 0.1);
+ *   }
+ * }
+ * }
+ * @see org.apache.hadoop.hbase.mob.MobStressToolRunner on how to use and 
configure
+ *   this class.
+ *
+ */
+@InterfaceAudience.Private
+public class FaultyMobStoreCompactor extends DefaultMobStoreCompactor {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(FaultyMobStoreCompactor.class);
+
+  public static AtomicLong mobCounter = new AtomicLong();
+  public static AtomicLong totalFailures = new AtomicLong();
+  public static AtomicLong totalCompactions = new AtomicLong();
+  public static AtomicLong totalMajorCompactions = new AtomicLong();
+
+  static double failureProb = 0.1d;
+  static Random rnd = new Random();
+
+  public FaultyMobStoreCompactor(Configuration conf, HStore store) {
+super(conf, store);
+failureProb = conf.getDouble("hbase.mob.compaction.fault.probability", 
0.1);
+  }
+
+  @Override
+  protected boolean performCompaction(FileDetails fd, InternalScanner scanner, 
CellSink writer,
+  long smallestReadPoint, boolean cleanSeqId, ThroughputController 
throughputController,
+  boolean major, int numofFilesToCompact) throws IOException {
+
+totalCompactions.incrementAndGet();
+if (major) {
+  totalMajorCompactions.incrementAndGet();
+}
+long bytesWrittenProgressForCloseCheck = 0;
+long bytesWrittenProgressForLog = 0;
+long bytesWrittenProgressForShippedCall = 0;
+// Clear old mob references
+mobRefSet.get().clear();
+boolean isUserRequest = userRequest.get();
+boolean compactMOBs = major && isUserRequest;
+boolean discardMobMiss = 
conf.getBoolean(MobConstants.MOB_UNSAFE_DISCARD_MISS_KEY,
+  MobConstants.DEFAULT_MOB_DISCARD_MISS);
+
+boolean mustFail = false;
+if (compactMOBs) {
+  mobCounter.incrementAndGet();
+  double dv = rnd.nextDouble();
+  if (dv < failureProb) {
+mustFail = true;
+totalFailures.incrementAndGet();
+  }
+}
+
+FileSystem fs = FileSystem.get(conf);
+
+// Since scanner.next() can return 'false' 

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375528398
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/DefaultMobStoreCompactor.java
 ##
 @@ -183,105 +271,184 @@ protected boolean performCompaction(FileDetails fd, 
InternalScanner scanner, Cel
 boolean hasMore;
 Path path = MobUtils.getMobFamilyPath(conf, store.getTableName(), 
store.getColumnFamilyName());
 byte[] fileName = null;
-StoreFileWriter mobFileWriter = null, delFileWriter = null;
-long mobCells = 0, deleteMarkersCount = 0;
+StoreFileWriter mobFileWriter = null;
+/*
+ * mobCells are used only to decide if we need to commit or abort current 
MOB output file.
+ */
+long mobCells = 0;
 long cellsCountCompactedToMob = 0, cellsCountCompactedFromMob = 0;
 long cellsSizeCompactedToMob = 0, cellsSizeCompactedFromMob = 0;
 boolean finished = false;
+
 ScannerContext scannerContext =
 ScannerContext.newBuilder().setBatchLimit(compactionKVMax).build();
 throughputController.start(compactionName);
-KeyValueScanner kvs = (scanner instanceof KeyValueScanner)? 
(KeyValueScanner)scanner : null;
-long shippedCallSizeLimit = (long) numofFilesToCompact * 
this.store.getColumnFamilyDescriptor().getBlocksize();
+KeyValueScanner kvs = (scanner instanceof KeyValueScanner) ? 
(KeyValueScanner) scanner : null;
+long shippedCallSizeLimit =
+(long) numofFilesToCompact * 
this.store.getColumnFamilyDescriptor().getBlocksize();
+
+Cell mobCell = null;
 try {
-  try {
-// If the mob file writer could not be created, directly write the 
cell to the store file.
-mobFileWriter = mobStore.createWriterInTmp(new Date(fd.latestPutTs), 
fd.maxKeyCount,
-  compactionCompression, store.getRegionInfo().getStartKey(), true);
-fileName = Bytes.toBytes(mobFileWriter.getPath().getName());
-  } catch (IOException e) {
-LOG.warn("Failed to create mob writer, "
-   + "we will continue the compaction by writing MOB cells 
directly in store files", e);
-  }
-  if (major) {
-try {
-  delFileWriter = mobStore.createDelFileWriterInTmp(new 
Date(fd.latestPutTs),
-fd.maxKeyCount, compactionCompression, 
store.getRegionInfo().getStartKey());
-} catch (IOException e) {
-  LOG.warn(
-"Failed to create del writer, "
-+ "we will continue the compaction by writing delete markers 
directly in store files",
-e);
-}
-  }
+
+  mobFileWriter = newMobWriter(fd);
+  fileName = Bytes.toBytes(mobFileWriter.getPath().getName());
+
   do {
 hasMore = scanner.next(cells, scannerContext);
-if (LOG.isDebugEnabled()) {
-  now = EnvironmentEdgeManager.currentTime();
-}
+now = EnvironmentEdgeManager.currentTime();
 for (Cell c : cells) {
-  if (major && CellUtil.isDelete(c)) {
-if (MobUtils.isMobReferenceCell(c) || delFileWriter == null) {
-  // Directly write it to a store file
-  writer.append(c);
+  if (compactMOBs) {
+if (MobUtils.isMobReferenceCell(c)) {
+  String fName = MobUtils.getMobFileName(c);
+  Path pp = new Path(new Path(fs.getUri()), new Path(path, fName));
+
+  // Added to support migration
+  try {
+mobCell = mobStore.resolve(c, true, false).getCell();
+  } catch (FileNotFoundException fnfe) {
+if (discardMobMiss) {
+  LOG.error("Missing MOB cell: file={} not found cell={}", 
fName, c);
+  continue;
+} else {
+  throw fnfe;
+}
+  }
+
+  if (discardMobMiss && mobCell.getValueLength() == 0) {
+LOG.error("Missing MOB cell value: file={} cell={}", pp, 
mobCell);
 
 Review comment:
   this should log `c` in addition to `mobCell`


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375536023
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/DefaultMobStoreCompactor.java
 ##
 @@ -326,47 +493,113 @@ protected boolean performCompaction(FileDetails fd, 
InternalScanner scanner, Cel
   progress.cancel();
   throw new InterruptedIOException(
   "Interrupted while control throughput of compacting " + 
compactionName);
+} catch (IOException t) {
+  String msg = "Mob compaction failed for region: " +
+store.getRegionInfo().getEncodedName();
+  throw new IOException(msg, t);
 } finally {
   // Clone last cell in the final because writer will append last cell 
when committing. If
   // don't clone here and once the scanner get closed, then the memory of 
last cell will be
   // released. (HBASE-22582)
   ((ShipperListener) writer).beforeShipped();
   throughputController.finish(compactionName);
   if (!finished && mobFileWriter != null) {
+// Remove all MOB references because compaction failed
+mobRefSet.get().clear();
+// Abort writer
+LOG.debug("Aborting writer for {} because of a compaction failure, 
Store {}",
+  mobFileWriter.getPath(), getStoreInfo());
 abortWriter(mobFileWriter);
   }
-  if (!finished && delFileWriter != null) {
-abortWriter(delFileWriter);
-  }
 }
-if (delFileWriter != null) {
-  if (deleteMarkersCount > 0) {
-// If the del file is not empty, commit it.
-// If the commit fails, the compaction is re-performed again.
-delFileWriter.appendMetadata(fd.maxSeqId, major, deleteMarkersCount);
-delFileWriter.close();
-mobStore.commitFile(delFileWriter.getPath(), path);
-  } else {
-// If the del file is empty, delete it instead of committing.
-abortWriter(delFileWriter);
-  }
+
+// Commit last MOB writer
+commitOrAbortMobWriter(mobFileWriter, fd.maxSeqId, mobCells, major);
+mobStore.updateCellsCountCompactedFromMob(cellsCountCompactedFromMob);
+mobStore.updateCellsCountCompactedToMob(cellsCountCompactedToMob);
+mobStore.updateCellsSizeCompactedFromMob(cellsSizeCompactedFromMob);
+mobStore.updateCellsSizeCompactedToMob(cellsSizeCompactedToMob);
+progress.complete();
+return true;
+  }
+
+  private String getStoreInfo() {
+return String.format("[table=%s family=%s region=%s]", 
store.getTableName().getNameAsString(),
+  store.getColumnFamilyName(), store.getRegionInfo().getEncodedName()) ;
+  }
+
+  private void clearThreadLocals() {
+Set set = mobRefSet.get();
+if (set != null) {
+  set.clear();
 }
+HashMap map = mobLengthMap.get();
+if (map != null) {
+  map.clear();
+}
+  }
+
+  private StoreFileWriter newMobWriter(FileDetails fd)
+  throws IOException {
+try {
+  StoreFileWriter mobFileWriter = mobStore.createWriterInTmp(new 
Date(fd.latestPutTs),
+fd.maxKeyCount, compactionCompression, 
store.getRegionInfo().getStartKey(), true);
+  LOG.debug("New MOB writer created={}", 
mobFileWriter.getPath().getName());
 
 Review comment:
   include the store info here


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375953741
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobFileCleanerChore.java
 ##
 @@ -0,0 +1,331 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hbase.mob;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.LocatedFileStatus;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.RemoteIterator;
+import org.apache.hadoop.hbase.ScheduledChore;
+import org.apache.hadoop.hbase.TableDescriptors;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.backup.HFileArchiver;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.TableDescriptor;
+import org.apache.hadoop.hbase.io.hfile.CacheConfig;
+import org.apache.hadoop.hbase.master.HMaster;
+import org.apache.hadoop.hbase.regionserver.BloomType;
+import org.apache.hadoop.hbase.regionserver.HStoreFile;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.hadoop.hbase.util.FSUtils;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import 
org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
+
+/**
+ * The class MobFileCleanerChore for running cleaner regularly to remove the 
expired
+ * and obsolete (files which have no active references to) mob files.
+ */
+@InterfaceAudience.Private
+public class MobFileCleanerChore extends ScheduledChore {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(MobFileCleanerChore.class);
+  private final HMaster master;
+  private ExpiredMobFileCleaner cleaner;
+
+  static {
+Configuration.addDeprecation(MobConstants.DEPRECATED_MOB_CLEANER_PERIOD,
+  MobConstants.MOB_CLEANER_PERIOD);
+  }
+
+  public MobFileCleanerChore(HMaster master) {
+super(master.getServerName() + "-ExpiredMobFileCleanerChore", master,
+master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD,
+  MobConstants.DEFAULT_MOB_CLEANER_PERIOD),
+master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD,
+  MobConstants.DEFAULT_MOB_CLEANER_PERIOD),
+TimeUnit.SECONDS);
+this.master = master;
+cleaner = new ExpiredMobFileCleaner();
+cleaner.setConf(master.getConfiguration());
+checkObsoleteConfigurations();
+  }
+
+  private void checkObsoleteConfigurations() {
+Configuration conf = master.getConfiguration();
+
+if (conf.get("hbase.mob.compaction.mergeable.threshold") != null) {
+  LOG.warn("'hbase.mob.compaction.mergeable.threshold' is obsolete and not 
used anymore.");
+}
+if (conf.get("hbase.mob.delfile.max.count") != null) {
+  LOG.warn("'hbase.mob.delfile.max.count' is obsolete and not used 
anymore.");
+}
+if (conf.get("hbase.mob.compaction.threads.max") != null) {
+  LOG.warn("'hbase.mob.compaction.threads.max' is obsolete and not used 
anymore.");
+}
+if (conf.get("hbase.mob.compaction.batch.size") != null) {
+  LOG.warn("'hbase.mob.compaction.batch.size' is obsolete and not used 
anymore.");
+}
+  }
+
+  @VisibleForTesting
+  public MobFileCleanerChore() {
+this.master = null;
+  }
+
+  @Override
+  @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = 
"REC_CATCH_EXCEPTION",
+  justification = "Intentional")
+
+  protected void chore() {
+TableDescriptors htds = master.getTableDescriptors();
+
+Map map = null;
+try {
+  map = htds.getAll();
+} catch (IOException e) {
+  

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375996466
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobFileCompactionChore.java
 ##
 @@ -0,0 +1,253 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mob;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.ScheduledChore;
+import org.apache.hadoop.hbase.TableDescriptors;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
+import org.apache.hadoop.hbase.client.CompactionState;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.RegionInfo;
+import org.apache.hadoop.hbase.client.TableDescriptor;
+import org.apache.hadoop.hbase.client.TableState;
+import org.apache.hadoop.hbase.master.HMaster;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import 
org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
+
+
+/**
+ * Periodic MOB compaction chore.
+ * It runs MOB compaction on region servers in parallel, thus
+ * utilizing distributed cluster resources. To avoid possible major
+ * compaction storms, one can specify maximum number regions to be compacted
+ * in parallel by setting configuration parameter: 
+ * 'hbase.mob.major.compaction.region.batch.size', which by default is 0 
(unlimited).
+ *
+ */
+@InterfaceAudience.Private
+public class MobFileCompactionChore extends ScheduledChore {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(MobFileCompactionChore.class);
+  private Configuration conf;
+  private HMaster master;
+  private int regionBatchSize = 0;// not set - compact all
+
+  public MobFileCompactionChore(HMaster master) {
+super(master.getServerName() + "-MobFileCompactionChore", master,
+
master.getConfiguration().getInt(MobConstants.MOB_COMPACTION_CHORE_PERIOD,
+  MobConstants.DEFAULT_MOB_COMPACTION_CHORE_PERIOD),
+
master.getConfiguration().getInt(MobConstants.MOB_COMPACTION_CHORE_PERIOD,
+  MobConstants.DEFAULT_MOB_COMPACTION_CHORE_PERIOD),
+TimeUnit.SECONDS);
+this.master = master;
+this.conf = master.getConfiguration();
+this.regionBatchSize =
+
master.getConfiguration().getInt(MobConstants.MOB_MAJOR_COMPACTION_REGION_BATCH_SIZE,
+  MobConstants.DEFAULT_MOB_MAJOR_COMPACTION_REGION_BATCH_SIZE);
+
+  }
+
+  @VisibleForTesting
+  public MobFileCompactionChore(Configuration conf, int batchSize) {
+this.conf = conf;
+this.regionBatchSize = batchSize;
+  }
+
+  @Override
+  protected void chore() {
+
+boolean reported = false;
+
+try (Connection conn = ConnectionFactory.createConnection(conf);
+Admin admin = conn.getAdmin();) {
+
+  TableDescriptors htds = master.getTableDescriptors();
+  Map map = htds.getAll();
+  for (TableDescriptor htd : map.values()) {
+if (!master.getTableStateManager().isTableState(htd.getTableName(),
+  TableState.State.ENABLED)) {
+  LOG.info("Skipping MOB compaction on table {} because it is not 
ENABLED",
+htd.getTableName());
+  continue;
+} else {
+  LOG.info("Starting MOB compaction on table {}, checking {} column 
families",
+htd.getTableName(), htd.getColumnFamilyCount());
+}
+for (ColumnFamilyDescriptor hcd : htd.getColumnFamilies()) {
+  try {
+if (hcd.isMobEnabled()) {
+  if (!reported) {
+master.reportMobCompactionStart(htd.getTableName());
+reported = true;
+  }
+  LOG.info("Major MOB 

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375998007
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobFileCompactionChore.java
 ##
 @@ -0,0 +1,253 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mob;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.ScheduledChore;
+import org.apache.hadoop.hbase.TableDescriptors;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
+import org.apache.hadoop.hbase.client.CompactionState;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.RegionInfo;
+import org.apache.hadoop.hbase.client.TableDescriptor;
+import org.apache.hadoop.hbase.client.TableState;
+import org.apache.hadoop.hbase.master.HMaster;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import 
org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
+
+
+/**
+ * Periodic MOB compaction chore.
+ * It runs MOB compaction on region servers in parallel, thus
+ * utilizing distributed cluster resources. To avoid possible major
+ * compaction storms, one can specify maximum number regions to be compacted
+ * in parallel by setting configuration parameter: 
+ * 'hbase.mob.major.compaction.region.batch.size', which by default is 0 
(unlimited).
+ *
+ */
+@InterfaceAudience.Private
+public class MobFileCompactionChore extends ScheduledChore {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(MobFileCompactionChore.class);
+  private Configuration conf;
+  private HMaster master;
+  private int regionBatchSize = 0;// not set - compact all
+
+  public MobFileCompactionChore(HMaster master) {
+super(master.getServerName() + "-MobFileCompactionChore", master,
+
master.getConfiguration().getInt(MobConstants.MOB_COMPACTION_CHORE_PERIOD,
+  MobConstants.DEFAULT_MOB_COMPACTION_CHORE_PERIOD),
+
master.getConfiguration().getInt(MobConstants.MOB_COMPACTION_CHORE_PERIOD,
+  MobConstants.DEFAULT_MOB_COMPACTION_CHORE_PERIOD),
+TimeUnit.SECONDS);
+this.master = master;
+this.conf = master.getConfiguration();
+this.regionBatchSize =
+
master.getConfiguration().getInt(MobConstants.MOB_MAJOR_COMPACTION_REGION_BATCH_SIZE,
+  MobConstants.DEFAULT_MOB_MAJOR_COMPACTION_REGION_BATCH_SIZE);
+
+  }
+
+  @VisibleForTesting
+  public MobFileCompactionChore(Configuration conf, int batchSize) {
+this.conf = conf;
+this.regionBatchSize = batchSize;
+  }
+
+  @Override
+  protected void chore() {
+
+boolean reported = false;
+
+try (Connection conn = ConnectionFactory.createConnection(conf);
+Admin admin = conn.getAdmin();) {
+
+  TableDescriptors htds = master.getTableDescriptors();
+  Map map = htds.getAll();
+  for (TableDescriptor htd : map.values()) {
+if (!master.getTableStateManager().isTableState(htd.getTableName(),
+  TableState.State.ENABLED)) {
+  LOG.info("Skipping MOB compaction on table {} because it is not 
ENABLED",
+htd.getTableName());
+  continue;
+} else {
+  LOG.info("Starting MOB compaction on table {}, checking {} column 
families",
+htd.getTableName(), htd.getColumnFamilyCount());
+}
+for (ColumnFamilyDescriptor hcd : htd.getColumnFamilies()) {
+  try {
+if (hcd.isMobEnabled()) {
+  if (!reported) {
+master.reportMobCompactionStart(htd.getTableName());
+reported = true;
+  }
+  LOG.info("Major MOB 

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r376087011
 
 

 ##
 File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/mob/FaultyMobStoreCompactor.java
 ##
 @@ -0,0 +1,373 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mob;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.PrivateCellUtil;
+import org.apache.hadoop.hbase.io.hfile.CorruptHFileException;
+import org.apache.hadoop.hbase.regionserver.CellSink;
+import org.apache.hadoop.hbase.regionserver.HStore;
+import org.apache.hadoop.hbase.regionserver.InternalScanner;
+import org.apache.hadoop.hbase.regionserver.KeyValueScanner;
+import org.apache.hadoop.hbase.regionserver.ScannerContext;
+import org.apache.hadoop.hbase.regionserver.ShipperListener;
+import org.apache.hadoop.hbase.regionserver.StoreFileWriter;
+import org.apache.hadoop.hbase.regionserver.throttle.ThroughputControlUtil;
+import org.apache.hadoop.hbase.regionserver.throttle.ThroughputController;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+/**
+ * This class is used for testing only. The main purpose is to emulate
+ * random failures during MOB compaction process.
+ * Example of usage:
+ * {@code
+ * public class SomeTest {
+ *
+ *   public void initConfiguration(Configuration conf){
+ * conf.set(MobStoreEngine.DEFAULT_MOB_COMPACTOR_CLASS_KEY,
+ FaultyMobStoreCompactor.class.getName());
+   conf.setDouble("hbase.mob.compaction.fault.probability", 0.1);
+ *   }
+ * }
+ * }
+ * @see org.apache.hadoop.hbase.mob.MobStressToolRunner on how to use and 
configure
+ *   this class.
+ *
+ */
+@InterfaceAudience.Private
+public class FaultyMobStoreCompactor extends DefaultMobStoreCompactor {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(FaultyMobStoreCompactor.class);
+
+  public static AtomicLong mobCounter = new AtomicLong();
+  public static AtomicLong totalFailures = new AtomicLong();
+  public static AtomicLong totalCompactions = new AtomicLong();
+  public static AtomicLong totalMajorCompactions = new AtomicLong();
+
+  static double failureProb = 0.1d;
+  static Random rnd = new Random();
+
+  public FaultyMobStoreCompactor(Configuration conf, HStore store) {
+super(conf, store);
+failureProb = conf.getDouble("hbase.mob.compaction.fault.probability", 
0.1);
+  }
+
+  @Override
+  protected boolean performCompaction(FileDetails fd, InternalScanner scanner, 
CellSink writer,
+  long smallestReadPoint, boolean cleanSeqId, ThroughputController 
throughputController,
+  boolean major, int numofFilesToCompact) throws IOException {
+
+totalCompactions.incrementAndGet();
+if (major) {
+  totalMajorCompactions.incrementAndGet();
+}
+long bytesWrittenProgressForCloseCheck = 0;
+long bytesWrittenProgressForLog = 0;
+long bytesWrittenProgressForShippedCall = 0;
+// Clear old mob references
+mobRefSet.get().clear();
+boolean isUserRequest = userRequest.get();
+boolean compactMOBs = major && isUserRequest;
+boolean discardMobMiss = 
conf.getBoolean(MobConstants.MOB_UNSAFE_DISCARD_MISS_KEY,
+  MobConstants.DEFAULT_MOB_DISCARD_MISS);
+
+boolean mustFail = false;
+if (compactMOBs) {
+  mobCounter.incrementAndGet();
+  double dv = rnd.nextDouble();
+  if (dv < failureProb) {
+mustFail = true;
+totalFailures.incrementAndGet();
+  }
+}
+
+FileSystem fs = FileSystem.get(conf);
+
+// Since scanner.next() can return 'false' 

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r376096501
 
 

 ##
 File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/mob/TestMobCompactionRegularRegionBatchMode.java
 ##
 @@ -0,0 +1,95 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mob;
+import java.io.IOException;
+
+import org.apache.hadoop.hbase.HBaseClassTestRule;
+import org.apache.hadoop.hbase.HColumnDescriptor;
+import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.testclassification.LargeTests;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+  * Mob file compaction chore in a regular batch mode test.
+  * 1. Enables batch mode for regular MOB compaction,
+  *Sets batch size to 7 regions.
+  * 2. Disables periodic MOB compactions, sets minimum age to archive to 10 sec
+  * 3. Creates MOB table with 20 regions
+  * 4. Loads MOB data (randomized keys, 1000 rows), flushes data.
+  * 5. Repeats 4. two more times
+  * 6. Verifies that we have 20 *3 = 60 mob files (equals to number of regions 
x 3)
+  * 7. Runs major MOB compaction.
+  * 8. Verifies that number of MOB files in a mob directory is 20 x4 = 80
+  * 9. Waits for a period of time larger than minimum age to archive
+  * 10. Runs Mob cleaner chore
+  * 11 Verifies that number of MOB files in a mob directory is 20.
+  * 12 Runs scanner and checks all 3 * 1000 rows.
+ */
+@SuppressWarnings("deprecation")
+@Category(LargeTests.class)
+public class TestMobCompactionRegularRegionBatchMode extends 
TestMobCompactionBase{
+  private static final Logger LOG =
+  LoggerFactory.getLogger(TestMobCompactionRegularRegionBatchMode.class);
+  @ClassRule
+  public static final HBaseClassTestRule CLASS_RULE =
+  
HBaseClassTestRule.forClass(TestMobCompactionRegularRegionBatchMode.class);
+  @Rule
+  public TestName testName = new TestName();
 
 Review comment:
   I don't see where this gets used. could you point me in the right direction?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375533635
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/DefaultMobStoreCompactor.java
 ##
 @@ -183,105 +271,184 @@ protected boolean performCompaction(FileDetails fd, 
InternalScanner scanner, Cel
 boolean hasMore;
 Path path = MobUtils.getMobFamilyPath(conf, store.getTableName(), 
store.getColumnFamilyName());
 byte[] fileName = null;
-StoreFileWriter mobFileWriter = null, delFileWriter = null;
-long mobCells = 0, deleteMarkersCount = 0;
+StoreFileWriter mobFileWriter = null;
+/*
+ * mobCells are used only to decide if we need to commit or abort current 
MOB output file.
+ */
+long mobCells = 0;
 long cellsCountCompactedToMob = 0, cellsCountCompactedFromMob = 0;
 long cellsSizeCompactedToMob = 0, cellsSizeCompactedFromMob = 0;
 boolean finished = false;
+
 ScannerContext scannerContext =
 ScannerContext.newBuilder().setBatchLimit(compactionKVMax).build();
 throughputController.start(compactionName);
-KeyValueScanner kvs = (scanner instanceof KeyValueScanner)? 
(KeyValueScanner)scanner : null;
-long shippedCallSizeLimit = (long) numofFilesToCompact * 
this.store.getColumnFamilyDescriptor().getBlocksize();
+KeyValueScanner kvs = (scanner instanceof KeyValueScanner) ? 
(KeyValueScanner) scanner : null;
+long shippedCallSizeLimit =
+(long) numofFilesToCompact * 
this.store.getColumnFamilyDescriptor().getBlocksize();
+
+Cell mobCell = null;
 try {
-  try {
-// If the mob file writer could not be created, directly write the 
cell to the store file.
-mobFileWriter = mobStore.createWriterInTmp(new Date(fd.latestPutTs), 
fd.maxKeyCount,
-  compactionCompression, store.getRegionInfo().getStartKey(), true);
-fileName = Bytes.toBytes(mobFileWriter.getPath().getName());
-  } catch (IOException e) {
-LOG.warn("Failed to create mob writer, "
-   + "we will continue the compaction by writing MOB cells 
directly in store files", e);
-  }
-  if (major) {
-try {
-  delFileWriter = mobStore.createDelFileWriterInTmp(new 
Date(fd.latestPutTs),
-fd.maxKeyCount, compactionCompression, 
store.getRegionInfo().getStartKey());
-} catch (IOException e) {
-  LOG.warn(
-"Failed to create del writer, "
-+ "we will continue the compaction by writing delete markers 
directly in store files",
-e);
-}
-  }
+
+  mobFileWriter = newMobWriter(fd);
+  fileName = Bytes.toBytes(mobFileWriter.getPath().getName());
+
   do {
 hasMore = scanner.next(cells, scannerContext);
-if (LOG.isDebugEnabled()) {
-  now = EnvironmentEdgeManager.currentTime();
-}
+now = EnvironmentEdgeManager.currentTime();
 for (Cell c : cells) {
-  if (major && CellUtil.isDelete(c)) {
-if (MobUtils.isMobReferenceCell(c) || delFileWriter == null) {
-  // Directly write it to a store file
-  writer.append(c);
+  if (compactMOBs) {
+if (MobUtils.isMobReferenceCell(c)) {
+  String fName = MobUtils.getMobFileName(c);
+  Path pp = new Path(new Path(fs.getUri()), new Path(path, fName));
+
+  // Added to support migration
+  try {
+mobCell = mobStore.resolve(c, true, false).getCell();
+  } catch (FileNotFoundException fnfe) {
+if (discardMobMiss) {
+  LOG.error("Missing MOB cell: file={} not found cell={}", 
fName, c);
+  continue;
+} else {
+  throw fnfe;
+}
+  }
+
+  if (discardMobMiss && mobCell.getValueLength() == 0) {
+LOG.error("Missing MOB cell value: file={} cell={}", pp, 
mobCell);
+continue;
+  } else if (mobCell.getValueLength() == 0) {
+String errMsg = String.format("Found 0 length MOB cell in a 
file=%s cell=%s",
+  fName, mobCell);
+throw new IOException(errMsg);
+  }
+
+  if (mobCell.getValueLength() > mobSizeThreshold) {
+// put the mob data back to the MOB store file
+PrivateCellUtil.setSequenceId(mobCell, c.getSequenceId());
+if (!ioOptimizedMode) {
+  mobFileWriter.append(mobCell);
+  mobCells++;
+  writer.append(
+MobUtils.createMobRefCell(mobCell, fileName, 
this.mobStore.getRefCellTags()));
+} else {
+  // I/O optimized mode
+  // Check if MOB cell origin file size is
+  // greater than threshold
+

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375604720
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobFileCleanerChore.java
 ##
 @@ -0,0 +1,331 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hbase.mob;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.LocatedFileStatus;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.RemoteIterator;
+import org.apache.hadoop.hbase.ScheduledChore;
+import org.apache.hadoop.hbase.TableDescriptors;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.backup.HFileArchiver;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.TableDescriptor;
+import org.apache.hadoop.hbase.io.hfile.CacheConfig;
+import org.apache.hadoop.hbase.master.HMaster;
+import org.apache.hadoop.hbase.regionserver.BloomType;
+import org.apache.hadoop.hbase.regionserver.HStoreFile;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.hadoop.hbase.util.FSUtils;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import 
org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
+
+/**
+ * The class MobFileCleanerChore for running cleaner regularly to remove the 
expired
+ * and obsolete (files which have no active references to) mob files.
+ */
+@InterfaceAudience.Private
+public class MobFileCleanerChore extends ScheduledChore {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(MobFileCleanerChore.class);
+  private final HMaster master;
+  private ExpiredMobFileCleaner cleaner;
+
+  static {
+Configuration.addDeprecation(MobConstants.DEPRECATED_MOB_CLEANER_PERIOD,
+  MobConstants.MOB_CLEANER_PERIOD);
+  }
+
+  public MobFileCleanerChore(HMaster master) {
+super(master.getServerName() + "-ExpiredMobFileCleanerChore", master,
+master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD,
+  MobConstants.DEFAULT_MOB_CLEANER_PERIOD),
+master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD,
+  MobConstants.DEFAULT_MOB_CLEANER_PERIOD),
+TimeUnit.SECONDS);
+this.master = master;
+cleaner = new ExpiredMobFileCleaner();
+cleaner.setConf(master.getConfiguration());
+checkObsoleteConfigurations();
+  }
+
+  private void checkObsoleteConfigurations() {
+Configuration conf = master.getConfiguration();
+
+if (conf.get("hbase.mob.compaction.mergeable.threshold") != null) {
+  LOG.warn("'hbase.mob.compaction.mergeable.threshold' is obsolete and not 
used anymore.");
+}
+if (conf.get("hbase.mob.delfile.max.count") != null) {
+  LOG.warn("'hbase.mob.delfile.max.count' is obsolete and not used 
anymore.");
+}
+if (conf.get("hbase.mob.compaction.threads.max") != null) {
+  LOG.warn("'hbase.mob.compaction.threads.max' is obsolete and not used 
anymore.");
+}
+if (conf.get("hbase.mob.compaction.batch.size") != null) {
+  LOG.warn("'hbase.mob.compaction.batch.size' is obsolete and not used 
anymore.");
+}
+  }
+
+  @VisibleForTesting
+  public MobFileCleanerChore() {
+this.master = null;
+  }
+
+  @Override
+  @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = 
"REC_CATCH_EXCEPTION",
 
 Review comment:
   Where is there catching a bare Exception in this method? 


This is an automated message from the Apache Git Service.
To respond to the message, please 

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375522161
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/DefaultMobStoreCompactor.java
 ##
 @@ -99,59 +145,85 @@ public DefaultMobStoreCompactor(Configuration conf, 
HStore store) {
 if (!(store instanceof HMobStore)) {
   throw new IllegalArgumentException("The store " + store + " is not a 
HMobStore");
 }
-mobStore = (HMobStore) store;
-mobSizeThreshold = store.getColumnFamilyDescriptor().getMobThreshold();
+this.mobStore = (HMobStore) store;
+this.mobSizeThreshold = 
store.getColumnFamilyDescriptor().getMobThreshold();
+this.ioOptimizedMode = conf.get(MobConstants.MOB_COMPACTION_TYPE_KEY,
+  MobConstants.DEFAULT_MOB_COMPACTION_TYPE).
+equals(MobConstants.OPTIMIZED_MOB_COMPACTION_TYPE);
+
   }
 
   @Override
-  public List compact(CompactionRequestImpl request, 
ThroughputController throughputController,
-  User user) throws IOException {
+  public List compact(CompactionRequestImpl request,
+  ThroughputController throughputController, User user) throws IOException 
{
+String tableName = store.getTableName().toString();
+String regionName = store.getRegionInfo().getRegionNameAsString();
+String familyName = store.getColumnFamilyName();
+LOG.info("MOB compaction: major={} isAll={} priority={} throughput 
controller={}" +
+  " table={} cf={} region={}",
+  request.isMajor(), request.isAllFiles(), request.getPriority(),
+  throughputController, tableName, familyName, regionName);
+if (request.getPriority() == HStore.PRIORITY_USER) {
+  userRequest.set(Boolean.TRUE);
+} else {
+  userRequest.set(Boolean.FALSE);
+}
+LOG.debug("MOB compaction table={} cf={} region={} files: ", tableName, 
familyName,
+  regionName, request.getFiles());
+// Check if I/O optimized MOB compaction
+if (ioOptimizedMode) {
+  if (request.isMajor() && request.getPriority() == HStore.PRIORITY_USER) {
+Path mobDir =
+MobUtils.getMobFamilyPath(conf, store.getTableName(), 
store.getColumnFamilyName());
+List mobFiles = 
MobUtils.getReferencedMobFiles(request.getFiles(), mobDir);
+if (mobFiles.size() > 0) {
+  calculateMobLengthMap(mobFiles);
+}
+LOG.info("Table={} cf={} region={}. I/O optimized MOB compaction. "+
+"Total referenced MOB files: {}", tableName, familyName, 
regionName, mobFiles.size());
+  }
+}
+
 return compact(request, scannerFactory, writerFactory, 
throughputController, user);
   }
 
+  private void calculateMobLengthMap(List mobFiles) throws IOException {
+FileSystem fs = mobFiles.get(0).getFileSystem(this.conf);
 
 Review comment:
   we should avoid creating new FileSystem objects. use `store.getFileSystem()`


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375963595
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobFileCompactionChore.java
 ##
 @@ -0,0 +1,253 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mob;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.ScheduledChore;
+import org.apache.hadoop.hbase.TableDescriptors;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
+import org.apache.hadoop.hbase.client.CompactionState;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.RegionInfo;
+import org.apache.hadoop.hbase.client.TableDescriptor;
+import org.apache.hadoop.hbase.client.TableState;
+import org.apache.hadoop.hbase.master.HMaster;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import 
org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
+
+
+/**
+ * Periodic MOB compaction chore.
+ * It runs MOB compaction on region servers in parallel, thus
+ * utilizing distributed cluster resources. To avoid possible major
+ * compaction storms, one can specify maximum number regions to be compacted
+ * in parallel by setting configuration parameter: 
+ * 'hbase.mob.major.compaction.region.batch.size', which by default is 0 
(unlimited).
+ *
+ */
+@InterfaceAudience.Private
+public class MobFileCompactionChore extends ScheduledChore {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(MobFileCompactionChore.class);
+  private Configuration conf;
+  private HMaster master;
+  private int regionBatchSize = 0;// not set - compact all
+
+  public MobFileCompactionChore(HMaster master) {
+super(master.getServerName() + "-MobFileCompactionChore", master,
+
master.getConfiguration().getInt(MobConstants.MOB_COMPACTION_CHORE_PERIOD,
+  MobConstants.DEFAULT_MOB_COMPACTION_CHORE_PERIOD),
+
master.getConfiguration().getInt(MobConstants.MOB_COMPACTION_CHORE_PERIOD,
+  MobConstants.DEFAULT_MOB_COMPACTION_CHORE_PERIOD),
+TimeUnit.SECONDS);
+this.master = master;
+this.conf = master.getConfiguration();
+this.regionBatchSize =
+
master.getConfiguration().getInt(MobConstants.MOB_MAJOR_COMPACTION_REGION_BATCH_SIZE,
+  MobConstants.DEFAULT_MOB_MAJOR_COMPACTION_REGION_BATCH_SIZE);
+
+  }
+
+  @VisibleForTesting
+  public MobFileCompactionChore(Configuration conf, int batchSize) {
+this.conf = conf;
+this.regionBatchSize = batchSize;
+  }
+
+  @Override
+  protected void chore() {
+
+boolean reported = false;
+
+try (Connection conn = ConnectionFactory.createConnection(conf);
+Admin admin = conn.getAdmin();) {
+
+  TableDescriptors htds = master.getTableDescriptors();
+  Map map = htds.getAll();
+  for (TableDescriptor htd : map.values()) {
+if (!master.getTableStateManager().isTableState(htd.getTableName(),
+  TableState.State.ENABLED)) {
+  LOG.info("Skipping MOB compaction on table {} because it is not 
ENABLED",
+htd.getTableName());
+  continue;
+} else {
+  LOG.info("Starting MOB compaction on table {}, checking {} column 
families",
+htd.getTableName(), htd.getColumnFamilyCount());
+}
+for (ColumnFamilyDescriptor hcd : htd.getColumnFamilies()) {
+  try {
+if (hcd.isMobEnabled()) {
+  if (!reported) {
+master.reportMobCompactionStart(htd.getTableName());
+reported = true;
+  }
+  LOG.info("Major MOB 

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375975407
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobFileCompactionChore.java
 ##
 @@ -0,0 +1,253 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mob;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.ScheduledChore;
+import org.apache.hadoop.hbase.TableDescriptors;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
+import org.apache.hadoop.hbase.client.CompactionState;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.RegionInfo;
+import org.apache.hadoop.hbase.client.TableDescriptor;
+import org.apache.hadoop.hbase.client.TableState;
+import org.apache.hadoop.hbase.master.HMaster;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import 
org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
+
+
+/**
+ * Periodic MOB compaction chore.
+ * It runs MOB compaction on region servers in parallel, thus
+ * utilizing distributed cluster resources. To avoid possible major
+ * compaction storms, one can specify maximum number regions to be compacted
+ * in parallel by setting configuration parameter: 
+ * 'hbase.mob.major.compaction.region.batch.size', which by default is 0 
(unlimited).
+ *
+ */
+@InterfaceAudience.Private
+public class MobFileCompactionChore extends ScheduledChore {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(MobFileCompactionChore.class);
+  private Configuration conf;
+  private HMaster master;
+  private int regionBatchSize = 0;// not set - compact all
+
+  public MobFileCompactionChore(HMaster master) {
+super(master.getServerName() + "-MobFileCompactionChore", master,
+
master.getConfiguration().getInt(MobConstants.MOB_COMPACTION_CHORE_PERIOD,
+  MobConstants.DEFAULT_MOB_COMPACTION_CHORE_PERIOD),
+
master.getConfiguration().getInt(MobConstants.MOB_COMPACTION_CHORE_PERIOD,
+  MobConstants.DEFAULT_MOB_COMPACTION_CHORE_PERIOD),
+TimeUnit.SECONDS);
+this.master = master;
+this.conf = master.getConfiguration();
+this.regionBatchSize =
+
master.getConfiguration().getInt(MobConstants.MOB_MAJOR_COMPACTION_REGION_BATCH_SIZE,
+  MobConstants.DEFAULT_MOB_MAJOR_COMPACTION_REGION_BATCH_SIZE);
+
+  }
+
+  @VisibleForTesting
+  public MobFileCompactionChore(Configuration conf, int batchSize) {
+this.conf = conf;
+this.regionBatchSize = batchSize;
+  }
+
+  @Override
+  protected void chore() {
+
+boolean reported = false;
+
+try (Connection conn = ConnectionFactory.createConnection(conf);
+Admin admin = conn.getAdmin();) {
+
+  TableDescriptors htds = master.getTableDescriptors();
+  Map map = htds.getAll();
+  for (TableDescriptor htd : map.values()) {
+if (!master.getTableStateManager().isTableState(htd.getTableName(),
+  TableState.State.ENABLED)) {
+  LOG.info("Skipping MOB compaction on table {} because it is not 
ENABLED",
+htd.getTableName());
+  continue;
+} else {
+  LOG.info("Starting MOB compaction on table {}, checking {} column 
families",
+htd.getTableName(), htd.getColumnFamilyCount());
+}
+for (ColumnFamilyDescriptor hcd : htd.getColumnFamilies()) {
+  try {
+if (hcd.isMobEnabled()) {
+  if (!reported) {
+master.reportMobCompactionStart(htd.getTableName());
+reported = true;
+  }
+  LOG.info("Major MOB 

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375603072
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobConstants.java
 ##
 @@ -63,40 +125,23 @@
* be merged in mob compaction. The default value is 1280MB.
*/
   public static final String MOB_COMPACTION_MERGEABLE_THRESHOLD =
-"hbase.mob.compaction.mergeable.threshold";
+  "hbase.mob.compaction.mergeable.threshold";
   public static final long DEFAULT_MOB_COMPACTION_MERGEABLE_THRESHOLD = 10 * 
128 * 1024 * 1024;
-  /**
-   * The max number of del files that is allowed in the mob file compaction. 
In the mob
-   * compaction, when the number of existing del files is larger than this 
value, they are merged
-   * until number of del files is not larger this value. The default value is 
3.
-   */
   public static final String MOB_DELFILE_MAX_COUNT = 
"hbase.mob.delfile.max.count";
 
 Review comment:
   should get removed from `hbase-common/src/main/resources/hbase-default.xml`


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375606927
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobFileCleanerChore.java
 ##
 @@ -0,0 +1,331 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hbase.mob;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.LocatedFileStatus;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.RemoteIterator;
+import org.apache.hadoop.hbase.ScheduledChore;
+import org.apache.hadoop.hbase.TableDescriptors;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.backup.HFileArchiver;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.TableDescriptor;
+import org.apache.hadoop.hbase.io.hfile.CacheConfig;
+import org.apache.hadoop.hbase.master.HMaster;
+import org.apache.hadoop.hbase.regionserver.BloomType;
+import org.apache.hadoop.hbase.regionserver.HStoreFile;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.hadoop.hbase.util.FSUtils;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import 
org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
+
+/**
+ * The class MobFileCleanerChore for running cleaner regularly to remove the 
expired
+ * and obsolete (files which have no active references to) mob files.
+ */
+@InterfaceAudience.Private
+public class MobFileCleanerChore extends ScheduledChore {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(MobFileCleanerChore.class);
+  private final HMaster master;
+  private ExpiredMobFileCleaner cleaner;
+
+  static {
+Configuration.addDeprecation(MobConstants.DEPRECATED_MOB_CLEANER_PERIOD,
+  MobConstants.MOB_CLEANER_PERIOD);
+  }
+
+  public MobFileCleanerChore(HMaster master) {
+super(master.getServerName() + "-ExpiredMobFileCleanerChore", master,
+master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD,
+  MobConstants.DEFAULT_MOB_CLEANER_PERIOD),
+master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD,
+  MobConstants.DEFAULT_MOB_CLEANER_PERIOD),
+TimeUnit.SECONDS);
+this.master = master;
+cleaner = new ExpiredMobFileCleaner();
+cleaner.setConf(master.getConfiguration());
+checkObsoleteConfigurations();
+  }
+
+  private void checkObsoleteConfigurations() {
+Configuration conf = master.getConfiguration();
+
+if (conf.get("hbase.mob.compaction.mergeable.threshold") != null) {
+  LOG.warn("'hbase.mob.compaction.mergeable.threshold' is obsolete and not 
used anymore.");
+}
+if (conf.get("hbase.mob.delfile.max.count") != null) {
+  LOG.warn("'hbase.mob.delfile.max.count' is obsolete and not used 
anymore.");
+}
+if (conf.get("hbase.mob.compaction.threads.max") != null) {
+  LOG.warn("'hbase.mob.compaction.threads.max' is obsolete and not used 
anymore.");
+}
+if (conf.get("hbase.mob.compaction.batch.size") != null) {
+  LOG.warn("'hbase.mob.compaction.batch.size' is obsolete and not used 
anymore.");
+}
+  }
+
+  @VisibleForTesting
+  public MobFileCleanerChore() {
+this.master = null;
+  }
+
+  @Override
+  @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = 
"REC_CATCH_EXCEPTION",
+  justification = "Intentional")
+
+  protected void chore() {
+TableDescriptors htds = master.getTableDescriptors();
+
+Map map = null;
+try {
+  map = htds.getAll();
+} catch (IOException e) {
+  

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375505030
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/DefaultMobStoreCompactor.java
 ##
 @@ -99,59 +145,85 @@ public DefaultMobStoreCompactor(Configuration conf, 
HStore store) {
 if (!(store instanceof HMobStore)) {
   throw new IllegalArgumentException("The store " + store + " is not a 
HMobStore");
 }
-mobStore = (HMobStore) store;
-mobSizeThreshold = store.getColumnFamilyDescriptor().getMobThreshold();
+this.mobStore = (HMobStore) store;
+this.mobSizeThreshold = 
store.getColumnFamilyDescriptor().getMobThreshold();
+this.ioOptimizedMode = conf.get(MobConstants.MOB_COMPACTION_TYPE_KEY,
+  MobConstants.DEFAULT_MOB_COMPACTION_TYPE).
+equals(MobConstants.OPTIMIZED_MOB_COMPACTION_TYPE);
+
   }
 
   @Override
-  public List compact(CompactionRequestImpl request, 
ThroughputController throughputController,
-  User user) throws IOException {
+  public List compact(CompactionRequestImpl request,
+  ThroughputController throughputController, User user) throws IOException 
{
+String tableName = store.getTableName().toString();
+String regionName = store.getRegionInfo().getRegionNameAsString();
+String familyName = store.getColumnFamilyName();
+LOG.info("MOB compaction: major={} isAll={} priority={} throughput 
controller={}" +
+  " table={} cf={} region={}",
+  request.isMajor(), request.isAllFiles(), request.getPriority(),
+  throughputController, tableName, familyName, regionName);
+if (request.getPriority() == HStore.PRIORITY_USER) {
+  userRequest.set(Boolean.TRUE);
+} else {
+  userRequest.set(Boolean.FALSE);
+}
+LOG.debug("MOB compaction table={} cf={} region={} files: ", tableName, 
familyName,
 
 Review comment:
   missing a place holder for the file list. e.g. `files={}` rather than 
`files: `


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375506309
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/DefaultMobStoreCompactor.java
 ##
 @@ -169,6 +241,22 @@ protected boolean performCompaction(FileDetails fd, 
InternalScanner scanner, Cel
 long bytesWrittenProgressForCloseCheck = 0;
 long bytesWrittenProgressForLog = 0;
 long bytesWrittenProgressForShippedCall = 0;
+// Clear old mob references
+mobRefSet.get().clear();
+boolean isUserRequest = userRequest.get();
+boolean compactMOBs = major && isUserRequest;
+boolean discardMobMiss = 
conf.getBoolean(MobConstants.MOB_UNSAFE_DISCARD_MISS_KEY,
+  MobConstants.DEFAULT_MOB_DISCARD_MISS);
+if (discardMobMiss) {
+  LOG.warn("{}=true. This is unsafe setting recommended only"+
+" during upgrade process from MOB 1.0 to MOB 2.0 versions.",
 
 Review comment:
   Please don't refer to MOB version numbers, since they haven't been used 
consistently in the project. refer to the specific feature that necessitates 
using the key. e.g. "only when first upgrading to a version with the 
distributed mob compaction feature on a cluster that has experienced MOB data 
corruption."


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375529862
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/DefaultMobStoreCompactor.java
 ##
 @@ -183,105 +271,184 @@ protected boolean performCompaction(FileDetails fd, 
InternalScanner scanner, Cel
 boolean hasMore;
 Path path = MobUtils.getMobFamilyPath(conf, store.getTableName(), 
store.getColumnFamilyName());
 byte[] fileName = null;
-StoreFileWriter mobFileWriter = null, delFileWriter = null;
-long mobCells = 0, deleteMarkersCount = 0;
+StoreFileWriter mobFileWriter = null;
+/*
+ * mobCells are used only to decide if we need to commit or abort current 
MOB output file.
+ */
+long mobCells = 0;
 long cellsCountCompactedToMob = 0, cellsCountCompactedFromMob = 0;
 long cellsSizeCompactedToMob = 0, cellsSizeCompactedFromMob = 0;
 boolean finished = false;
+
 ScannerContext scannerContext =
 ScannerContext.newBuilder().setBatchLimit(compactionKVMax).build();
 throughputController.start(compactionName);
-KeyValueScanner kvs = (scanner instanceof KeyValueScanner)? 
(KeyValueScanner)scanner : null;
-long shippedCallSizeLimit = (long) numofFilesToCompact * 
this.store.getColumnFamilyDescriptor().getBlocksize();
+KeyValueScanner kvs = (scanner instanceof KeyValueScanner) ? 
(KeyValueScanner) scanner : null;
+long shippedCallSizeLimit =
+(long) numofFilesToCompact * 
this.store.getColumnFamilyDescriptor().getBlocksize();
+
+Cell mobCell = null;
 try {
-  try {
-// If the mob file writer could not be created, directly write the 
cell to the store file.
-mobFileWriter = mobStore.createWriterInTmp(new Date(fd.latestPutTs), 
fd.maxKeyCount,
-  compactionCompression, store.getRegionInfo().getStartKey(), true);
-fileName = Bytes.toBytes(mobFileWriter.getPath().getName());
-  } catch (IOException e) {
-LOG.warn("Failed to create mob writer, "
-   + "we will continue the compaction by writing MOB cells 
directly in store files", e);
-  }
-  if (major) {
-try {
-  delFileWriter = mobStore.createDelFileWriterInTmp(new 
Date(fd.latestPutTs),
-fd.maxKeyCount, compactionCompression, 
store.getRegionInfo().getStartKey());
-} catch (IOException e) {
-  LOG.warn(
-"Failed to create del writer, "
-+ "we will continue the compaction by writing delete markers 
directly in store files",
-e);
-}
-  }
+
+  mobFileWriter = newMobWriter(fd);
+  fileName = Bytes.toBytes(mobFileWriter.getPath().getName());
+
   do {
 hasMore = scanner.next(cells, scannerContext);
-if (LOG.isDebugEnabled()) {
-  now = EnvironmentEdgeManager.currentTime();
-}
+now = EnvironmentEdgeManager.currentTime();
 for (Cell c : cells) {
-  if (major && CellUtil.isDelete(c)) {
-if (MobUtils.isMobReferenceCell(c) || delFileWriter == null) {
-  // Directly write it to a store file
-  writer.append(c);
+  if (compactMOBs) {
+if (MobUtils.isMobReferenceCell(c)) {
+  String fName = MobUtils.getMobFileName(c);
+  Path pp = new Path(new Path(fs.getUri()), new Path(path, fName));
+
+  // Added to support migration
+  try {
+mobCell = mobStore.resolve(c, true, false).getCell();
+  } catch (FileNotFoundException fnfe) {
+if (discardMobMiss) {
+  LOG.error("Missing MOB cell: file={} not found cell={}", 
fName, c);
+  continue;
+} else {
+  throw fnfe;
+}
+  }
+
+  if (discardMobMiss && mobCell.getValueLength() == 0) {
+LOG.error("Missing MOB cell value: file={} cell={}", pp, 
mobCell);
+continue;
+  } else if (mobCell.getValueLength() == 0) {
+String errMsg = String.format("Found 0 length MOB cell in a 
file=%s cell=%s",
+  fName, mobCell);
+throw new IOException(errMsg);
+  }
+
+  if (mobCell.getValueLength() > mobSizeThreshold) {
+// put the mob data back to the MOB store file
+PrivateCellUtil.setSequenceId(mobCell, c.getSequenceId());
+if (!ioOptimizedMode) {
+  mobFileWriter.append(mobCell);
+  mobCells++;
+  writer.append(
+MobUtils.createMobRefCell(mobCell, fileName, 
this.mobStore.getRefCellTags()));
+} else {
+  // I/O optimized mode
+  // Check if MOB cell origin file size is
+  // greater than threshold
+

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375961492
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobFileCompactionChore.java
 ##
 @@ -0,0 +1,253 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mob;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.ScheduledChore;
+import org.apache.hadoop.hbase.TableDescriptors;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
+import org.apache.hadoop.hbase.client.CompactionState;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.RegionInfo;
+import org.apache.hadoop.hbase.client.TableDescriptor;
+import org.apache.hadoop.hbase.client.TableState;
+import org.apache.hadoop.hbase.master.HMaster;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import 
org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
+
+
+/**
+ * Periodic MOB compaction chore.
+ * It runs MOB compaction on region servers in parallel, thus
+ * utilizing distributed cluster resources. To avoid possible major
+ * compaction storms, one can specify maximum number regions to be compacted
+ * in parallel by setting configuration parameter: 
+ * 'hbase.mob.major.compaction.region.batch.size', which by default is 0 
(unlimited).
+ *
+ */
+@InterfaceAudience.Private
+public class MobFileCompactionChore extends ScheduledChore {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(MobFileCompactionChore.class);
+  private Configuration conf;
+  private HMaster master;
+  private int regionBatchSize = 0;// not set - compact all
+
+  public MobFileCompactionChore(HMaster master) {
+super(master.getServerName() + "-MobFileCompactionChore", master,
+
master.getConfiguration().getInt(MobConstants.MOB_COMPACTION_CHORE_PERIOD,
+  MobConstants.DEFAULT_MOB_COMPACTION_CHORE_PERIOD),
+
master.getConfiguration().getInt(MobConstants.MOB_COMPACTION_CHORE_PERIOD,
+  MobConstants.DEFAULT_MOB_COMPACTION_CHORE_PERIOD),
+TimeUnit.SECONDS);
+this.master = master;
+this.conf = master.getConfiguration();
+this.regionBatchSize =
+
master.getConfiguration().getInt(MobConstants.MOB_MAJOR_COMPACTION_REGION_BATCH_SIZE,
+  MobConstants.DEFAULT_MOB_MAJOR_COMPACTION_REGION_BATCH_SIZE);
+
+  }
+
+  @VisibleForTesting
+  public MobFileCompactionChore(Configuration conf, int batchSize) {
+this.conf = conf;
+this.regionBatchSize = batchSize;
+  }
+
+  @Override
+  protected void chore() {
+
+boolean reported = false;
+
+try (Connection conn = ConnectionFactory.createConnection(conf);
 
 Review comment:
   can we reuse `master.getConnection()` instead of creating a new one here?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375521543
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/DefaultMobStoreCompactor.java
 ##
 @@ -169,6 +241,22 @@ protected boolean performCompaction(FileDetails fd, 
InternalScanner scanner, Cel
 long bytesWrittenProgressForCloseCheck = 0;
 long bytesWrittenProgressForLog = 0;
 long bytesWrittenProgressForShippedCall = 0;
+// Clear old mob references
+mobRefSet.get().clear();
+boolean isUserRequest = userRequest.get();
+boolean compactMOBs = major && isUserRequest;
+boolean discardMobMiss = 
conf.getBoolean(MobConstants.MOB_UNSAFE_DISCARD_MISS_KEY,
+  MobConstants.DEFAULT_MOB_DISCARD_MISS);
+if (discardMobMiss) {
+  LOG.warn("{}=true. This is unsafe setting recommended only"+
+" during upgrade process from MOB 1.0 to MOB 2.0 versions.",
+MobConstants.MOB_UNSAFE_DISCARD_MISS_KEY);
+}
+long maxMobFileSize = 
conf.getLong(MobConstants.MOB_COMPACTION_MAX_FILE_SIZE_KEY,
+  MobConstants.DEFAULT_MOB_COMPACTION_MAX_FILE_SIZE);
+LOG.info("Compact MOB={} optimized={} maximum MOB file size={} major={} 
store={}", compactMOBs,
+  ioOptimizedMode, maxMobFileSize, major, getStoreInfo());
+FileSystem fs = FileSystem.get(conf);
 
 Review comment:
   we should avoid creating FileSystem objects when we already have one. use 
`store.getFileSystem()`


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r376013305
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobStoreEngine.java
 ##
 @@ -43,6 +44,13 @@ protected void createStoreFlusher(Configuration conf, 
HStore store) throws IOExc
*/
   @Override
   protected void createCompactor(Configuration conf, HStore store) throws 
IOException {
-compactor = new DefaultMobStoreCompactor(conf, store);
+String className =
+conf.get(MOB_COMPACTOR_CLASS_KEY, 
DefaultMobStoreCompactor.class.getName());
+try {
+  compactor = ReflectionUtils.instantiateWithCustomCtor(className,
+new Class[] { Configuration.class, HStore.class }, new Object[] { 
conf, store });
+} catch (Exception e) {
 
 Review comment:
   This should only be `RuntimeException`


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375607228
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobFileCleanerChore.java
 ##
 @@ -0,0 +1,310 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hbase.mob;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.LocatedFileStatus;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.RemoteIterator;
+import org.apache.hadoop.hbase.ScheduledChore;
+import org.apache.hadoop.hbase.TableDescriptors;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.backup.HFileArchiver;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.TableDescriptor;
+import org.apache.hadoop.hbase.io.hfile.CacheConfig;
+import org.apache.hadoop.hbase.master.HMaster;
+import org.apache.hadoop.hbase.regionserver.BloomType;
+import org.apache.hadoop.hbase.regionserver.HStoreFile;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.hadoop.hbase.util.FSUtils;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import 
org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
+
+/**
+ * The class MobFileCleanerChore for running cleaner regularly to remove the 
expired
+ * and obsolete (files which have no active references to) mob files.
+ */
+@SuppressWarnings("deprecation")
+@InterfaceAudience.Private
+public class MobFileCleanerChore extends ScheduledChore {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(MobFileCleanerChore.class);
+  private final HMaster master;
+  private ExpiredMobFileCleaner cleaner;
+  
+  static {
+Configuration.addDeprecation(MobConstants.DEPRECATED_MOB_CLEANER_PERIOD, 
+  MobConstants.MOB_CLEANER_PERIOD);
+  }
+
+  public MobFileCleanerChore(HMaster master) {
+super(master.getServerName() + "-ExpiredMobFileCleanerChore", master,
+master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD,
+  MobConstants.DEFAULT_MOB_CLEANER_PERIOD),
+master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD,
+  MobConstants.DEFAULT_MOB_CLEANER_PERIOD),
+TimeUnit.SECONDS);
+this.master = master;
+cleaner = new ExpiredMobFileCleaner();
+cleaner.setConf(master.getConfiguration());
+checkObsoleteConfigurations();
+  }
+
+  private void checkObsoleteConfigurations() {
+Configuration conf = master.getConfiguration();
+
+if (conf.get("hbase.mob.compaction.mergeable.threshold") != null) {
+  LOG.warn("'hbase.mob.compaction.mergeable.threshold' is obsolete and not 
used anymore.");
+}
+if (conf.get("hbase.mob.delfile.max.count") != null) {
+  LOG.warn("'hbase.mob.delfile.max.count' is obsolete and not used 
anymore.");
+}
+if (conf.get("hbase.mob.compaction.threads.max") != null) {
+  LOG.warn("'hbase.mob.compaction.threads.max' is obsolete and not used 
anymore.");
+}
+if (conf.get("hbase.mob.compaction.batch.size") != null) {
+  LOG.warn("'hbase.mob.compaction.batch.size' is obsolete and not used 
anymore.");
+}
+  }
+
+  @VisibleForTesting
+  public MobFileCleanerChore() {
+this.master = null;
+  }
+
+  @Override
+  @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = 
"REC_CATCH_EXCEPTION",
+  justification = "Intentional")
+
+  protected void chore() {
+TableDescriptors htds = master.getTableDescriptors();
+
+Map map = null;
+try {
+  map = htds.getAll();
+} catch (IOException e) {
+  

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375607985
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobFileCleanerChore.java
 ##
 @@ -0,0 +1,310 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hbase.mob;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.LocatedFileStatus;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.RemoteIterator;
+import org.apache.hadoop.hbase.ScheduledChore;
+import org.apache.hadoop.hbase.TableDescriptors;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.backup.HFileArchiver;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.TableDescriptor;
+import org.apache.hadoop.hbase.io.hfile.CacheConfig;
+import org.apache.hadoop.hbase.master.HMaster;
+import org.apache.hadoop.hbase.regionserver.BloomType;
+import org.apache.hadoop.hbase.regionserver.HStoreFile;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.hadoop.hbase.util.FSUtils;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import 
org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
+
+/**
+ * The class MobFileCleanerChore for running cleaner regularly to remove the 
expired
+ * and obsolete (files which have no active references to) mob files.
+ */
+@SuppressWarnings("deprecation")
+@InterfaceAudience.Private
+public class MobFileCleanerChore extends ScheduledChore {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(MobFileCleanerChore.class);
+  private final HMaster master;
+  private ExpiredMobFileCleaner cleaner;
+  
+  static {
+Configuration.addDeprecation(MobConstants.DEPRECATED_MOB_CLEANER_PERIOD, 
+  MobConstants.MOB_CLEANER_PERIOD);
+  }
+
+  public MobFileCleanerChore(HMaster master) {
+super(master.getServerName() + "-ExpiredMobFileCleanerChore", master,
+master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD,
+  MobConstants.DEFAULT_MOB_CLEANER_PERIOD),
+master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD,
+  MobConstants.DEFAULT_MOB_CLEANER_PERIOD),
+TimeUnit.SECONDS);
+this.master = master;
+cleaner = new ExpiredMobFileCleaner();
+cleaner.setConf(master.getConfiguration());
+checkObsoleteConfigurations();
+  }
+
+  private void checkObsoleteConfigurations() {
+Configuration conf = master.getConfiguration();
+
+if (conf.get("hbase.mob.compaction.mergeable.threshold") != null) {
+  LOG.warn("'hbase.mob.compaction.mergeable.threshold' is obsolete and not 
used anymore.");
+}
+if (conf.get("hbase.mob.delfile.max.count") != null) {
+  LOG.warn("'hbase.mob.delfile.max.count' is obsolete and not used 
anymore.");
+}
+if (conf.get("hbase.mob.compaction.threads.max") != null) {
+  LOG.warn("'hbase.mob.compaction.threads.max' is obsolete and not used 
anymore.");
+}
+if (conf.get("hbase.mob.compaction.batch.size") != null) {
+  LOG.warn("'hbase.mob.compaction.batch.size' is obsolete and not used 
anymore.");
+}
+  }
+
+  @VisibleForTesting
+  public MobFileCleanerChore() {
+this.master = null;
+  }
+
+  @Override
+  @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = 
"REC_CATCH_EXCEPTION",
+  justification = "Intentional")
+
+  protected void chore() {
+TableDescriptors htds = master.getTableDescriptors();
+
+Map map = null;
+try {
+  map = htds.getAll();
+} catch (IOException e) {
+  

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375534296
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/DefaultMobStoreCompactor.java
 ##
 @@ -183,105 +271,184 @@ protected boolean performCompaction(FileDetails fd, 
InternalScanner scanner, Cel
 boolean hasMore;
 Path path = MobUtils.getMobFamilyPath(conf, store.getTableName(), 
store.getColumnFamilyName());
 byte[] fileName = null;
-StoreFileWriter mobFileWriter = null, delFileWriter = null;
-long mobCells = 0, deleteMarkersCount = 0;
+StoreFileWriter mobFileWriter = null;
+/*
+ * mobCells are used only to decide if we need to commit or abort current 
MOB output file.
+ */
+long mobCells = 0;
 long cellsCountCompactedToMob = 0, cellsCountCompactedFromMob = 0;
 long cellsSizeCompactedToMob = 0, cellsSizeCompactedFromMob = 0;
 boolean finished = false;
+
 ScannerContext scannerContext =
 ScannerContext.newBuilder().setBatchLimit(compactionKVMax).build();
 throughputController.start(compactionName);
-KeyValueScanner kvs = (scanner instanceof KeyValueScanner)? 
(KeyValueScanner)scanner : null;
-long shippedCallSizeLimit = (long) numofFilesToCompact * 
this.store.getColumnFamilyDescriptor().getBlocksize();
+KeyValueScanner kvs = (scanner instanceof KeyValueScanner) ? 
(KeyValueScanner) scanner : null;
+long shippedCallSizeLimit =
+(long) numofFilesToCompact * 
this.store.getColumnFamilyDescriptor().getBlocksize();
+
+Cell mobCell = null;
 try {
-  try {
-// If the mob file writer could not be created, directly write the 
cell to the store file.
-mobFileWriter = mobStore.createWriterInTmp(new Date(fd.latestPutTs), 
fd.maxKeyCount,
-  compactionCompression, store.getRegionInfo().getStartKey(), true);
-fileName = Bytes.toBytes(mobFileWriter.getPath().getName());
-  } catch (IOException e) {
-LOG.warn("Failed to create mob writer, "
-   + "we will continue the compaction by writing MOB cells 
directly in store files", e);
-  }
-  if (major) {
-try {
-  delFileWriter = mobStore.createDelFileWriterInTmp(new 
Date(fd.latestPutTs),
-fd.maxKeyCount, compactionCompression, 
store.getRegionInfo().getStartKey());
-} catch (IOException e) {
-  LOG.warn(
-"Failed to create del writer, "
-+ "we will continue the compaction by writing delete markers 
directly in store files",
-e);
-}
-  }
+
+  mobFileWriter = newMobWriter(fd);
+  fileName = Bytes.toBytes(mobFileWriter.getPath().getName());
+
   do {
 hasMore = scanner.next(cells, scannerContext);
-if (LOG.isDebugEnabled()) {
-  now = EnvironmentEdgeManager.currentTime();
-}
+now = EnvironmentEdgeManager.currentTime();
 for (Cell c : cells) {
-  if (major && CellUtil.isDelete(c)) {
-if (MobUtils.isMobReferenceCell(c) || delFileWriter == null) {
-  // Directly write it to a store file
-  writer.append(c);
+  if (compactMOBs) {
+if (MobUtils.isMobReferenceCell(c)) {
+  String fName = MobUtils.getMobFileName(c);
+  Path pp = new Path(new Path(fs.getUri()), new Path(path, fName));
+
+  // Added to support migration
+  try {
+mobCell = mobStore.resolve(c, true, false).getCell();
+  } catch (FileNotFoundException fnfe) {
+if (discardMobMiss) {
+  LOG.error("Missing MOB cell: file={} not found cell={}", 
fName, c);
+  continue;
+} else {
+  throw fnfe;
+}
+  }
+
+  if (discardMobMiss && mobCell.getValueLength() == 0) {
+LOG.error("Missing MOB cell value: file={} cell={}", pp, 
mobCell);
+continue;
+  } else if (mobCell.getValueLength() == 0) {
+String errMsg = String.format("Found 0 length MOB cell in a 
file=%s cell=%s",
+  fName, mobCell);
+throw new IOException(errMsg);
+  }
+
+  if (mobCell.getValueLength() > mobSizeThreshold) {
+// put the mob data back to the MOB store file
+PrivateCellUtil.setSequenceId(mobCell, c.getSequenceId());
+if (!ioOptimizedMode) {
+  mobFileWriter.append(mobCell);
+  mobCells++;
+  writer.append(
+MobUtils.createMobRefCell(mobCell, fileName, 
this.mobStore.getRefCellTags()));
+} else {
+  // I/O optimized mode
+  // Check if MOB cell origin file size is
+  // greater than threshold
+

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375527182
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/DefaultMobStoreCompactor.java
 ##
 @@ -183,105 +262,185 @@ protected boolean performCompaction(FileDetails fd, 
InternalScanner scanner, Cel
 boolean hasMore;
 Path path = MobUtils.getMobFamilyPath(conf, store.getTableName(), 
store.getColumnFamilyName());
 byte[] fileName = null;
-StoreFileWriter mobFileWriter = null, delFileWriter = null;
-long mobCells = 0, deleteMarkersCount = 0;
+StoreFileWriter mobFileWriter = null;
+/*
+ * mobCells are used only to decide if we need to commit or abort current 
MOB output file.
+ */
+long mobCells = 0;
 long cellsCountCompactedToMob = 0, cellsCountCompactedFromMob = 0;
 long cellsSizeCompactedToMob = 0, cellsSizeCompactedFromMob = 0;
 boolean finished = false;
+
 ScannerContext scannerContext =
 ScannerContext.newBuilder().setBatchLimit(compactionKVMax).build();
 throughputController.start(compactionName);
-KeyValueScanner kvs = (scanner instanceof KeyValueScanner)? 
(KeyValueScanner)scanner : null;
-long shippedCallSizeLimit = (long) numofFilesToCompact * 
this.store.getColumnFamilyDescriptor().getBlocksize();
+KeyValueScanner kvs = (scanner instanceof KeyValueScanner) ? 
(KeyValueScanner) scanner : null;
+long shippedCallSizeLimit =
+(long) numofFilesToCompact * 
this.store.getColumnFamilyDescriptor().getBlocksize();
+
+Cell mobCell = null;
 try {
-  try {
-// If the mob file writer could not be created, directly write the 
cell to the store file.
-mobFileWriter = mobStore.createWriterInTmp(new Date(fd.latestPutTs), 
fd.maxKeyCount,
-  compactionCompression, store.getRegionInfo().getStartKey(), true);
-fileName = Bytes.toBytes(mobFileWriter.getPath().getName());
-  } catch (IOException e) {
-LOG.warn("Failed to create mob writer, "
-   + "we will continue the compaction by writing MOB cells 
directly in store files", e);
-  }
-  if (major) {
-try {
-  delFileWriter = mobStore.createDelFileWriterInTmp(new 
Date(fd.latestPutTs),
-fd.maxKeyCount, compactionCompression, 
store.getRegionInfo().getStartKey());
-} catch (IOException e) {
-  LOG.warn(
-"Failed to create del writer, "
-+ "we will continue the compaction by writing delete markers 
directly in store files",
-e);
-}
-  }
+
+  mobFileWriter = newMobWriter(fd);
+  fileName = Bytes.toBytes(mobFileWriter.getPath().getName());
+
   do {
 hasMore = scanner.next(cells, scannerContext);
-if (LOG.isDebugEnabled()) {
-  now = EnvironmentEdgeManager.currentTime();
-}
+now = EnvironmentEdgeManager.currentTime();
 for (Cell c : cells) {
-  if (major && CellUtil.isDelete(c)) {
-if (MobUtils.isMobReferenceCell(c) || delFileWriter == null) {
-  // Directly write it to a store file
-  writer.append(c);
+  if (compactMOBs) {
+if (MobUtils.isMobReferenceCell(c)) {
+  String fName = MobUtils.getMobFileName(c);
+  Path pp = new Path(new Path(fs.getUri()), new Path(path, fName));
 
 Review comment:
   there's a second logging of this constructed path that should also just log 
fName. The `pp` variable shouldn't be needed.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r376097031
 
 

 ##
 File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/mob/TestMobFileCleanerChore.java
 ##
 @@ -0,0 +1,230 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mob;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.Arrays;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.HBaseClassTestRule;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.HColumnDescriptor;
+import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.CompactionState;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.Result;
+import org.apache.hadoop.hbase.client.ResultScanner;
+import org.apache.hadoop.hbase.client.Table;
+import org.apache.hadoop.hbase.master.cleaner.TimeToLiveHFileCleaner;
+import org.apache.hadoop.hbase.testclassification.MediumTests;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+  * Mob file cleaner chore test.
+  * 1. Creates MOB table
+  * 2. Load MOB data and flushes it N times
+  * 3. Runs major MOB compaction (N MOB files go to archive)
+  * 4. Verifies that number of MOB files in a mob directory is N+1
+  * 5. Waits for a period of time larger than minimum age to archive
+  * 6. Runs Mob cleaner chore
+  * 7 Verifies that number of MOB files in a mob directory is 1.
+ */
+@SuppressWarnings("deprecation")
+@Category(MediumTests.class)
+public class TestMobFileCleanerChore {
+  private static final Logger LOG = 
LoggerFactory.getLogger(TestMobFileCleanerChore.class);
+  @ClassRule
+  public static final HBaseClassTestRule CLASS_RULE =
+  HBaseClassTestRule.forClass(TestMobFileCleanerChore.class);
+  @Rule
+  public TestName testName = new TestName();
+
+  private HBaseTestingUtility HTU;
+
+  private final static String famStr = "f1";
+  private final static byte[] fam = Bytes.toBytes(famStr);
+  private final static byte[] qualifier = Bytes.toBytes("q1");
+  private final static long mobLen = 10;
+  private final static byte[] mobVal = Bytes
+  
.toBytes("01234567890123456789012345678901234567890123456789012345678901234567890123456789");
+
+  private Configuration conf;
+  private HTableDescriptor hdt;
+  private HColumnDescriptor hcd;
+  private Admin admin;
+  private Table table = null;
+  private MobFileCleanerChore chore;
+  private long minAgeToArchive = 1;
+
+  public TestMobFileCleanerChore() {
+  }
+
+
+  @Before
+  public void setUp() throws Exception {
+HTU = new HBaseTestingUtility();
+hdt = HTU.createTableDescriptor("testMobCompactTable");
+conf = HTU.getConfiguration();
+
+initConf();
+
+HTU.startMiniCluster();
+admin = HTU.getAdmin();
+chore = new MobFileCleanerChore();
+hcd = new HColumnDescriptor(fam);
+hcd.setMobEnabled(true);
+hcd.setMobThreshold(mobLen);
+hcd.setMaxVersions(1);
+hdt.addFamily(hcd);
+table = HTU.createTable(hdt, null);
+  }
+
+  private void initConf() {
+
+conf.setInt("hfile.format.version", 3);
+conf.setLong(TimeToLiveHFileCleaner.TTL_CONF_KEY, 0);
+conf.setInt("hbase.client.retries.number", 100);
+conf.setInt("hbase.hregion.max.filesize", 2);
+conf.setInt("hbase.hregion.memstore.flush.size", 80);
+conf.setInt("hbase.hstore.blockingStoreFiles", 150);
+conf.setInt("hbase.hstore.compaction.throughput.lower.bound", 52428800);
+conf.setInt("hbase.hstore.compaction.throughput.higher.bound", 2 * 

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375955256
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobFileCleanerChore.java
 ##
 @@ -0,0 +1,331 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hbase.mob;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.LocatedFileStatus;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.RemoteIterator;
+import org.apache.hadoop.hbase.ScheduledChore;
+import org.apache.hadoop.hbase.TableDescriptors;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.backup.HFileArchiver;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.TableDescriptor;
+import org.apache.hadoop.hbase.io.hfile.CacheConfig;
+import org.apache.hadoop.hbase.master.HMaster;
+import org.apache.hadoop.hbase.regionserver.BloomType;
+import org.apache.hadoop.hbase.regionserver.HStoreFile;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.hadoop.hbase.util.FSUtils;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import 
org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
+
+/**
+ * The class MobFileCleanerChore for running cleaner regularly to remove the 
expired
+ * and obsolete (files which have no active references to) mob files.
+ */
+@InterfaceAudience.Private
+public class MobFileCleanerChore extends ScheduledChore {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(MobFileCleanerChore.class);
+  private final HMaster master;
+  private ExpiredMobFileCleaner cleaner;
+
+  static {
+Configuration.addDeprecation(MobConstants.DEPRECATED_MOB_CLEANER_PERIOD,
+  MobConstants.MOB_CLEANER_PERIOD);
+  }
+
+  public MobFileCleanerChore(HMaster master) {
+super(master.getServerName() + "-ExpiredMobFileCleanerChore", master,
+master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD,
+  MobConstants.DEFAULT_MOB_CLEANER_PERIOD),
+master.getConfiguration().getInt(MobConstants.MOB_CLEANER_PERIOD,
+  MobConstants.DEFAULT_MOB_CLEANER_PERIOD),
+TimeUnit.SECONDS);
+this.master = master;
+cleaner = new ExpiredMobFileCleaner();
+cleaner.setConf(master.getConfiguration());
+checkObsoleteConfigurations();
+  }
+
+  private void checkObsoleteConfigurations() {
+Configuration conf = master.getConfiguration();
+
+if (conf.get("hbase.mob.compaction.mergeable.threshold") != null) {
+  LOG.warn("'hbase.mob.compaction.mergeable.threshold' is obsolete and not 
used anymore.");
+}
+if (conf.get("hbase.mob.delfile.max.count") != null) {
+  LOG.warn("'hbase.mob.delfile.max.count' is obsolete and not used 
anymore.");
+}
+if (conf.get("hbase.mob.compaction.threads.max") != null) {
+  LOG.warn("'hbase.mob.compaction.threads.max' is obsolete and not used 
anymore.");
+}
+if (conf.get("hbase.mob.compaction.batch.size") != null) {
+  LOG.warn("'hbase.mob.compaction.batch.size' is obsolete and not used 
anymore.");
+}
+  }
+
+  @VisibleForTesting
+  public MobFileCleanerChore() {
+this.master = null;
+  }
+
+  @Override
+  @edu.umd.cs.findbugs.annotations.SuppressWarnings(value = 
"REC_CATCH_EXCEPTION",
+  justification = "Intentional")
+
+  protected void chore() {
+TableDescriptors htds = master.getTableDescriptors();
+
+Map map = null;
+try {
+  map = htds.getAll();
+} catch (IOException e) {
+  

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375528536
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/DefaultMobStoreCompactor.java
 ##
 @@ -183,105 +271,184 @@ protected boolean performCompaction(FileDetails fd, 
InternalScanner scanner, Cel
 boolean hasMore;
 Path path = MobUtils.getMobFamilyPath(conf, store.getTableName(), 
store.getColumnFamilyName());
 byte[] fileName = null;
-StoreFileWriter mobFileWriter = null, delFileWriter = null;
-long mobCells = 0, deleteMarkersCount = 0;
+StoreFileWriter mobFileWriter = null;
+/*
+ * mobCells are used only to decide if we need to commit or abort current 
MOB output file.
+ */
+long mobCells = 0;
 long cellsCountCompactedToMob = 0, cellsCountCompactedFromMob = 0;
 long cellsSizeCompactedToMob = 0, cellsSizeCompactedFromMob = 0;
 boolean finished = false;
+
 ScannerContext scannerContext =
 ScannerContext.newBuilder().setBatchLimit(compactionKVMax).build();
 throughputController.start(compactionName);
-KeyValueScanner kvs = (scanner instanceof KeyValueScanner)? 
(KeyValueScanner)scanner : null;
-long shippedCallSizeLimit = (long) numofFilesToCompact * 
this.store.getColumnFamilyDescriptor().getBlocksize();
+KeyValueScanner kvs = (scanner instanceof KeyValueScanner) ? 
(KeyValueScanner) scanner : null;
+long shippedCallSizeLimit =
+(long) numofFilesToCompact * 
this.store.getColumnFamilyDescriptor().getBlocksize();
+
+Cell mobCell = null;
 try {
-  try {
-// If the mob file writer could not be created, directly write the 
cell to the store file.
-mobFileWriter = mobStore.createWriterInTmp(new Date(fd.latestPutTs), 
fd.maxKeyCount,
-  compactionCompression, store.getRegionInfo().getStartKey(), true);
-fileName = Bytes.toBytes(mobFileWriter.getPath().getName());
-  } catch (IOException e) {
-LOG.warn("Failed to create mob writer, "
-   + "we will continue the compaction by writing MOB cells 
directly in store files", e);
-  }
-  if (major) {
-try {
-  delFileWriter = mobStore.createDelFileWriterInTmp(new 
Date(fd.latestPutTs),
-fd.maxKeyCount, compactionCompression, 
store.getRegionInfo().getStartKey());
-} catch (IOException e) {
-  LOG.warn(
-"Failed to create del writer, "
-+ "we will continue the compaction by writing delete markers 
directly in store files",
-e);
-}
-  }
+
+  mobFileWriter = newMobWriter(fd);
+  fileName = Bytes.toBytes(mobFileWriter.getPath().getName());
+
   do {
 hasMore = scanner.next(cells, scannerContext);
-if (LOG.isDebugEnabled()) {
-  now = EnvironmentEdgeManager.currentTime();
-}
+now = EnvironmentEdgeManager.currentTime();
 for (Cell c : cells) {
-  if (major && CellUtil.isDelete(c)) {
-if (MobUtils.isMobReferenceCell(c) || delFileWriter == null) {
-  // Directly write it to a store file
-  writer.append(c);
+  if (compactMOBs) {
+if (MobUtils.isMobReferenceCell(c)) {
+  String fName = MobUtils.getMobFileName(c);
+  Path pp = new Path(new Path(fs.getUri()), new Path(path, fName));
+
+  // Added to support migration
+  try {
+mobCell = mobStore.resolve(c, true, false).getCell();
+  } catch (FileNotFoundException fnfe) {
+if (discardMobMiss) {
+  LOG.error("Missing MOB cell: file={} not found cell={}", 
fName, c);
+  continue;
+} else {
+  throw fnfe;
+}
+  }
+
+  if (discardMobMiss && mobCell.getValueLength() == 0) {
+LOG.error("Missing MOB cell value: file={} cell={}", pp, 
mobCell);
+continue;
+  } else if (mobCell.getValueLength() == 0) {
+String errMsg = String.format("Found 0 length MOB cell in a 
file=%s cell=%s",
 
 Review comment:
   this should log `c` in addition to `mobCell`


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r376086341
 
 

 ##
 File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/mob/FaultyMobStoreCompactor.java
 ##
 @@ -0,0 +1,373 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mob;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.PrivateCellUtil;
+import org.apache.hadoop.hbase.io.hfile.CorruptHFileException;
+import org.apache.hadoop.hbase.regionserver.CellSink;
+import org.apache.hadoop.hbase.regionserver.HStore;
+import org.apache.hadoop.hbase.regionserver.InternalScanner;
+import org.apache.hadoop.hbase.regionserver.KeyValueScanner;
+import org.apache.hadoop.hbase.regionserver.ScannerContext;
+import org.apache.hadoop.hbase.regionserver.ShipperListener;
+import org.apache.hadoop.hbase.regionserver.StoreFileWriter;
+import org.apache.hadoop.hbase.regionserver.throttle.ThroughputControlUtil;
+import org.apache.hadoop.hbase.regionserver.throttle.ThroughputController;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+/**
+ * This class is used for testing only. The main purpose is to emulate
+ * random failures during MOB compaction process.
+ * Example of usage:
+ * {@code
+ * public class SomeTest {
+ *
+ *   public void initConfiguration(Configuration conf){
+ * conf.set(MobStoreEngine.DEFAULT_MOB_COMPACTOR_CLASS_KEY,
+ FaultyMobStoreCompactor.class.getName());
+   conf.setDouble("hbase.mob.compaction.fault.probability", 0.1);
+ *   }
+ * }
+ * }
+ * @see org.apache.hadoop.hbase.mob.MobStressToolRunner on how to use and 
configure
+ *   this class.
+ *
+ */
+@InterfaceAudience.Private
+public class FaultyMobStoreCompactor extends DefaultMobStoreCompactor {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(FaultyMobStoreCompactor.class);
+
+  public static AtomicLong mobCounter = new AtomicLong();
+  public static AtomicLong totalFailures = new AtomicLong();
+  public static AtomicLong totalCompactions = new AtomicLong();
+  public static AtomicLong totalMajorCompactions = new AtomicLong();
+
+  static double failureProb = 0.1d;
+  static Random rnd = new Random();
+
+  public FaultyMobStoreCompactor(Configuration conf, HStore store) {
+super(conf, store);
+failureProb = conf.getDouble("hbase.mob.compaction.fault.probability", 
0.1);
+  }
+
+  @Override
+  protected boolean performCompaction(FileDetails fd, InternalScanner scanner, 
CellSink writer,
+  long smallestReadPoint, boolean cleanSeqId, ThroughputController 
throughputController,
+  boolean major, int numofFilesToCompact) throws IOException {
+
+totalCompactions.incrementAndGet();
+if (major) {
+  totalMajorCompactions.incrementAndGet();
+}
+long bytesWrittenProgressForCloseCheck = 0;
+long bytesWrittenProgressForLog = 0;
+long bytesWrittenProgressForShippedCall = 0;
+// Clear old mob references
+mobRefSet.get().clear();
+boolean isUserRequest = userRequest.get();
+boolean compactMOBs = major && isUserRequest;
+boolean discardMobMiss = 
conf.getBoolean(MobConstants.MOB_UNSAFE_DISCARD_MISS_KEY,
+  MobConstants.DEFAULT_MOB_DISCARD_MISS);
+
+boolean mustFail = false;
+if (compactMOBs) {
+  mobCounter.incrementAndGet();
+  double dv = rnd.nextDouble();
+  if (dv < failureProb) {
+mustFail = true;
+totalFailures.incrementAndGet();
+  }
+}
+
+FileSystem fs = FileSystem.get(conf);
+
+// Since scanner.next() can return 'false' 

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r376084962
 
 

 ##
 File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/mob/FaultyMobStoreCompactor.java
 ##
 @@ -0,0 +1,373 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mob;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.PrivateCellUtil;
+import org.apache.hadoop.hbase.io.hfile.CorruptHFileException;
+import org.apache.hadoop.hbase.regionserver.CellSink;
+import org.apache.hadoop.hbase.regionserver.HStore;
+import org.apache.hadoop.hbase.regionserver.InternalScanner;
+import org.apache.hadoop.hbase.regionserver.KeyValueScanner;
+import org.apache.hadoop.hbase.regionserver.ScannerContext;
+import org.apache.hadoop.hbase.regionserver.ShipperListener;
+import org.apache.hadoop.hbase.regionserver.StoreFileWriter;
+import org.apache.hadoop.hbase.regionserver.throttle.ThroughputControlUtil;
+import org.apache.hadoop.hbase.regionserver.throttle.ThroughputController;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+/**
+ * This class is used for testing only. The main purpose is to emulate
+ * random failures during MOB compaction process.
+ * Example of usage:
+ * {@code
+ * public class SomeTest {
+ *
+ *   public void initConfiguration(Configuration conf){
+ * conf.set(MobStoreEngine.DEFAULT_MOB_COMPACTOR_CLASS_KEY,
+ FaultyMobStoreCompactor.class.getName());
+   conf.setDouble("hbase.mob.compaction.fault.probability", 0.1);
+ *   }
+ * }
+ * }
+ * @see org.apache.hadoop.hbase.mob.MobStressToolRunner on how to use and 
configure
+ *   this class.
+ *
+ */
+@InterfaceAudience.Private
+public class FaultyMobStoreCompactor extends DefaultMobStoreCompactor {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(FaultyMobStoreCompactor.class);
+
+  public static AtomicLong mobCounter = new AtomicLong();
+  public static AtomicLong totalFailures = new AtomicLong();
+  public static AtomicLong totalCompactions = new AtomicLong();
+  public static AtomicLong totalMajorCompactions = new AtomicLong();
+
+  static double failureProb = 0.1d;
+  static Random rnd = new Random();
+
+  public FaultyMobStoreCompactor(Configuration conf, HStore store) {
+super(conf, store);
+failureProb = conf.getDouble("hbase.mob.compaction.fault.probability", 
0.1);
+  }
+
+  @Override
+  protected boolean performCompaction(FileDetails fd, InternalScanner scanner, 
CellSink writer,
+  long smallestReadPoint, boolean cleanSeqId, ThroughputController 
throughputController,
+  boolean major, int numofFilesToCompact) throws IOException {
+
+totalCompactions.incrementAndGet();
+if (major) {
+  totalMajorCompactions.incrementAndGet();
+}
+long bytesWrittenProgressForCloseCheck = 0;
+long bytesWrittenProgressForLog = 0;
+long bytesWrittenProgressForShippedCall = 0;
+// Clear old mob references
+mobRefSet.get().clear();
+boolean isUserRequest = userRequest.get();
+boolean compactMOBs = major && isUserRequest;
+boolean discardMobMiss = 
conf.getBoolean(MobConstants.MOB_UNSAFE_DISCARD_MISS_KEY,
+  MobConstants.DEFAULT_MOB_DISCARD_MISS);
+
+boolean mustFail = false;
+if (compactMOBs) {
+  mobCounter.incrementAndGet();
+  double dv = rnd.nextDouble();
+  if (dv < failureProb) {
+mustFail = true;
+totalFailures.incrementAndGet();
+  }
+}
+
+FileSystem fs = FileSystem.get(conf);
 
 Review comment:
   we should avoid creating new 

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375600646
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobConstants.java
 ##
 @@ -35,26 +35,88 @@
   public static final String MOB_CACHE_BLOCKS = "hbase.mob.cache.blocks";
   public static final String MOB_SCAN_REF_ONLY = "hbase.mob.scan.ref.only";
   public static final String EMPTY_VALUE_ON_MOBCELL_MISS = 
"empty.value.on.mobcell.miss";
-
   public static final String MOB_FILE_CACHE_SIZE_KEY = 
"hbase.mob.file.cache.size";
   public static final int DEFAULT_MOB_FILE_CACHE_SIZE = 1000;
-
   public static final String MOB_DIR_NAME = "mobdir";
   public static final String MOB_REGION_NAME = ".mob";
   public static final byte[] MOB_REGION_NAME_BYTES = 
Bytes.toBytes(MOB_REGION_NAME);
-
-  public static final String MOB_CLEANER_PERIOD = 
"hbase.master.mob.ttl.cleaner.period";
+  public static final String MOB_CLEANER_PERIOD = 
"hbase.master.mob.cleaner.period";
+  public static final String DEPRECATED_MOB_CLEANER_PERIOD = 
"hbase.master.mob.ttl.cleaner.period";
 
 Review comment:
   this is still in `hbase-common/src/main/resources/hbase-default.xml` and 
should be replaced with the new config.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r376085509
 
 

 ##
 File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/mob/FaultyMobStoreCompactor.java
 ##
 @@ -0,0 +1,373 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mob;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.PrivateCellUtil;
+import org.apache.hadoop.hbase.io.hfile.CorruptHFileException;
+import org.apache.hadoop.hbase.regionserver.CellSink;
+import org.apache.hadoop.hbase.regionserver.HStore;
+import org.apache.hadoop.hbase.regionserver.InternalScanner;
+import org.apache.hadoop.hbase.regionserver.KeyValueScanner;
+import org.apache.hadoop.hbase.regionserver.ScannerContext;
+import org.apache.hadoop.hbase.regionserver.ShipperListener;
+import org.apache.hadoop.hbase.regionserver.StoreFileWriter;
+import org.apache.hadoop.hbase.regionserver.throttle.ThroughputControlUtil;
+import org.apache.hadoop.hbase.regionserver.throttle.ThroughputController;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+/**
+ * This class is used for testing only. The main purpose is to emulate
+ * random failures during MOB compaction process.
+ * Example of usage:
+ * {@code
+ * public class SomeTest {
+ *
+ *   public void initConfiguration(Configuration conf){
+ * conf.set(MobStoreEngine.DEFAULT_MOB_COMPACTOR_CLASS_KEY,
+ FaultyMobStoreCompactor.class.getName());
+   conf.setDouble("hbase.mob.compaction.fault.probability", 0.1);
+ *   }
+ * }
+ * }
+ * @see org.apache.hadoop.hbase.mob.MobStressToolRunner on how to use and 
configure
+ *   this class.
+ *
+ */
+@InterfaceAudience.Private
+public class FaultyMobStoreCompactor extends DefaultMobStoreCompactor {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(FaultyMobStoreCompactor.class);
+
+  public static AtomicLong mobCounter = new AtomicLong();
+  public static AtomicLong totalFailures = new AtomicLong();
+  public static AtomicLong totalCompactions = new AtomicLong();
+  public static AtomicLong totalMajorCompactions = new AtomicLong();
+
+  static double failureProb = 0.1d;
+  static Random rnd = new Random();
+
+  public FaultyMobStoreCompactor(Configuration conf, HStore store) {
+super(conf, store);
+failureProb = conf.getDouble("hbase.mob.compaction.fault.probability", 
0.1);
+  }
+
+  @Override
+  protected boolean performCompaction(FileDetails fd, InternalScanner scanner, 
CellSink writer,
+  long smallestReadPoint, boolean cleanSeqId, ThroughputController 
throughputController,
+  boolean major, int numofFilesToCompact) throws IOException {
+
+totalCompactions.incrementAndGet();
+if (major) {
+  totalMajorCompactions.incrementAndGet();
+}
+long bytesWrittenProgressForCloseCheck = 0;
+long bytesWrittenProgressForLog = 0;
+long bytesWrittenProgressForShippedCall = 0;
+// Clear old mob references
+mobRefSet.get().clear();
+boolean isUserRequest = userRequest.get();
+boolean compactMOBs = major && isUserRequest;
+boolean discardMobMiss = 
conf.getBoolean(MobConstants.MOB_UNSAFE_DISCARD_MISS_KEY,
+  MobConstants.DEFAULT_MOB_DISCARD_MISS);
+
+boolean mustFail = false;
+if (compactMOBs) {
+  mobCounter.incrementAndGet();
+  double dv = rnd.nextDouble();
+  if (dv < failureProb) {
+mustFail = true;
+totalFailures.incrementAndGet();
+  }
+}
+
+FileSystem fs = FileSystem.get(conf);
+
+// Since scanner.next() can return 'false' 

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r375964136
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobFileCompactionChore.java
 ##
 @@ -0,0 +1,253 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mob;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.ScheduledChore;
+import org.apache.hadoop.hbase.TableDescriptors;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
+import org.apache.hadoop.hbase.client.CompactionState;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.RegionInfo;
+import org.apache.hadoop.hbase.client.TableDescriptor;
+import org.apache.hadoop.hbase.client.TableState;
+import org.apache.hadoop.hbase.master.HMaster;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.yetus.audience.InterfaceAudience;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import 
org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
+
+
+/**
+ * Periodic MOB compaction chore.
+ * It runs MOB compaction on region servers in parallel, thus
+ * utilizing distributed cluster resources. To avoid possible major
+ * compaction storms, one can specify maximum number regions to be compacted
+ * in parallel by setting configuration parameter: 
+ * 'hbase.mob.major.compaction.region.batch.size', which by default is 0 
(unlimited).
+ *
+ */
+@InterfaceAudience.Private
+public class MobFileCompactionChore extends ScheduledChore {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(MobFileCompactionChore.class);
+  private Configuration conf;
+  private HMaster master;
+  private int regionBatchSize = 0;// not set - compact all
+
+  public MobFileCompactionChore(HMaster master) {
+super(master.getServerName() + "-MobFileCompactionChore", master,
+
master.getConfiguration().getInt(MobConstants.MOB_COMPACTION_CHORE_PERIOD,
+  MobConstants.DEFAULT_MOB_COMPACTION_CHORE_PERIOD),
+
master.getConfiguration().getInt(MobConstants.MOB_COMPACTION_CHORE_PERIOD,
+  MobConstants.DEFAULT_MOB_COMPACTION_CHORE_PERIOD),
+TimeUnit.SECONDS);
+this.master = master;
+this.conf = master.getConfiguration();
+this.regionBatchSize =
+
master.getConfiguration().getInt(MobConstants.MOB_MAJOR_COMPACTION_REGION_BATCH_SIZE,
+  MobConstants.DEFAULT_MOB_MAJOR_COMPACTION_REGION_BATCH_SIZE);
+
+  }
+
+  @VisibleForTesting
+  public MobFileCompactionChore(Configuration conf, int batchSize) {
+this.conf = conf;
+this.regionBatchSize = batchSize;
+  }
+
+  @Override
+  protected void chore() {
+
+boolean reported = false;
+
+try (Connection conn = ConnectionFactory.createConnection(conf);
+Admin admin = conn.getAdmin();) {
+
+  TableDescriptors htds = master.getTableDescriptors();
+  Map map = htds.getAll();
+  for (TableDescriptor htd : map.values()) {
+if (!master.getTableStateManager().isTableState(htd.getTableName(),
+  TableState.State.ENABLED)) {
+  LOG.info("Skipping MOB compaction on table {} because it is not 
ENABLED",
+htd.getTableName());
+  continue;
+} else {
+  LOG.info("Starting MOB compaction on table {}, checking {} column 
families",
+htd.getTableName(), htd.getColumnFamilyCount());
+}
+for (ColumnFamilyDescriptor hcd : htd.getColumnFamilies()) {
+  try {
+if (hcd.isMobEnabled()) {
+  if (!reported) {
+master.reportMobCompactionStart(htd.getTableName());
+reported = true;
+  }
+  LOG.info("Major MOB 

[GitHub] [hbase] busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB compactions

2020-02-06 Thread GitBox
busbey commented on a change in pull request #921: HBASE-22749: Distributed MOB 
compactions
URL: https://github.com/apache/hbase/pull/921#discussion_r376096118
 
 

 ##
 File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/mob/TestMobCompactionOptRegionBatchMode.java
 ##
 @@ -0,0 +1,98 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mob;
+import java.io.IOException;
+
+import org.apache.hadoop.hbase.HBaseClassTestRule;
+import org.apache.hadoop.hbase.HColumnDescriptor;
+import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.testclassification.LargeTests;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+  * Mob file compaction chore in a generational batch mode test.
+  * 1. Enables batch mode for regular MOB compaction,
+  *Sets batch size to 7 regions. Enables generational mode.
+  * 2. Disables periodic MOB compactions, sets minimum age to archive to 10 sec
+  * 3. Creates MOB table with 20 regions
+  * 4. Loads MOB data (randomized keys, 1000 rows), flushes data.
+  * 5. Repeats 4. two more times
+  * 6. Verifies that we have 20 *3 = 60 mob files (equals to number of regions 
x 3)
+  * 7. Runs major MOB compaction.
+  * 8. Verifies that number of MOB files in a mob directory is 20 x4 = 80
+  * 9. Waits for a period of time larger than minimum age to archive
+  * 10. Runs Mob cleaner chore
+  * 11 Verifies that number of MOB files in a mob directory is 20.
+  * 12 Runs scanner and checks all 3 * 1000 rows.
+ */
+@SuppressWarnings("deprecation")
+@Category(LargeTests.class)
+public class TestMobCompactionOptRegionBatchMode extends TestMobCompactionBase{
+  private static final Logger LOG =
+  LoggerFactory.getLogger(TestMobCompactionOptRegionBatchMode.class);
+  @ClassRule
+  public static final HBaseClassTestRule CLASS_RULE =
+  HBaseClassTestRule.forClass(TestMobCompactionOptRegionBatchMode.class);
+  @Rule
+  public TestName testName = new TestName();
 
 Review comment:
   I don't see where this gets used. could you point me in the right direction?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] bharathv commented on issue #1139: Add Bharath Vissapragada to developers list.

2020-02-06 Thread GitBox
bharathv commented on issue #1139: Add Bharath Vissapragada to developers list.
URL: https://github.com/apache/hbase/pull/1139#issuecomment-583122416
 
 
   I hope the test failure is not related :-D


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] bharathv merged pull request #1139: Add Bharath Vissapragada to developers list.

2020-02-06 Thread GitBox
bharathv merged pull request #1139: Add Bharath Vissapragada to developers list.
URL: https://github.com/apache/hbase/pull/1139
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[jira] [Commented] (HBASE-23793) Increase maven heap allocation to 4G in Yetus personality

2020-02-06 Thread Hudson (Jira)


[ 
https://issues.apache.org/jira/browse/HBASE-23793?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17031950#comment-17031950
 ] 

Hudson commented on HBASE-23793:


Results for branch branch-1.4
[build #1170 on 
builds.a.o|https://builds.apache.org/job/HBase%20Nightly/job/branch-1.4/1170/]: 
(/) *{color:green}+1 overall{color}*

details (if available):

(/) {color:green}+1 general checks{color}
-- For more information [see general 
report|https://builds.apache.org/job/HBase%20Nightly/job/branch-1.4/1170//General_Nightly_Build_Report/]


(/) {color:green}+1 jdk7 checks{color}
-- For more information [see jdk7 
report|https://builds.apache.org/job/HBase%20Nightly/job/branch-1.4/1170//JDK7_Nightly_Build_Report/]


(/) {color:green}+1 jdk8 hadoop2 checks{color}
-- For more information [see jdk8 (hadoop2) 
report|https://builds.apache.org/job/HBase%20Nightly/job/branch-1.4/1170//JDK8_Nightly_Build_Report_(Hadoop2)/]




(/) {color:green}+1 source release artifact{color}
-- See build output for details.


> Increase maven heap allocation to 4G in Yetus personality
> -
>
> Key: HBASE-23793
> URL: https://issues.apache.org/jira/browse/HBASE-23793
> Project: HBase
>  Issue Type: Test
>  Components: build, test
>Affects Versions: 2.3.0
>Reporter: Nick Dimiduk
>Assignee: Nick Dimiduk
>Priority: Major
> Fix For: 3.0.0, 2.3.0, 1.6.0, 1.3.7, 2.1.9, 1.4.13, 2.2.4
>
>
> I saw this over on 
> [https://builds.apache.org/view/H-L/view/HBase/job/HBase%20Nightly/job/branch-2/2447/console].
>  Looks like we need to bump the memory allocation for maven. I wonder if this 
> is the underlying cause of HBASE-22470.
>  
> {noformat}
> 6:38:47  
> 
> 16:38:47  
> 
> 16:38:47Finished build.
> 16:38:47  
> 
> 16:38:47  
> 
> 16:38:47  
> 16:38:47  
> Post stage
> [Pipeline] stash
> 16:38:48  Warning: overwriting stash 'hadoop2-result'
> 16:38:48  Stashed 1 file(s)
> [Pipeline] junit
> 16:38:48  Recording test results
> 16:38:54  Remote call on H2 failed
> Error when executing always post condition:
> java.io.IOException: Remote call on H2 failed
>   at hudson.remoting.Channel.call(Channel.java:963)
>   at hudson.FilePath.act(FilePath.java:1072)
>   at hudson.FilePath.act(FilePath.java:1061)
>   at hudson.tasks.junit.JUnitParser.parseResult(JUnitParser.java:114)
>   at 
> hudson.tasks.junit.JUnitResultArchiver.parse(JUnitResultArchiver.java:137)
>   at 
> hudson.tasks.junit.JUnitResultArchiver.parseAndAttach(JUnitResultArchiver.java:167)
>   at 
> hudson.tasks.junit.pipeline.JUnitResultsStepExecution.run(JUnitResultsStepExecution.java:52)
>   at 
> hudson.tasks.junit.pipeline.JUnitResultsStepExecution.run(JUnitResultsStepExecution.java:25)
>   at 
> org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
>   at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>   at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>   at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>   at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>   at java.lang.Thread.run(Thread.java:748)
> Caused by: java.lang.OutOfMemoryError: Java heap space
>   at 
> com.sun.org.apache.xerces.internal.util.XMLStringBuffer.append(XMLStringBuffer.java:208)
>   at 
> com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.scanData(XMLEntityScanner.java:1515)
>   at 
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanCDATASection(XMLDocumentFragmentScannerImpl.java:1654)
>   at 
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3014)
>   at 
> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
>   at 
> com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
>   at 
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
>   at 
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842)
>   at 
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
>   at 
> 

[jira] [Commented] (HBASE-23779) Up the default fork count to make builds complete faster; make count relative to CPU count

2020-02-06 Thread Nick Dimiduk (Jira)


[ 
https://issues.apache.org/jira/browse/HBASE-23779?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17031936#comment-17031936
 ] 

Nick Dimiduk commented on HBASE-23779:
--

In theory 
https://builds.apache.org/view/H-L/view/HBase/job/PreCommit-HBASE-Build/1121/ 
will tell us if the yetus patch works.

> Up the default fork count to make builds complete faster; make count relative 
> to CPU count
> --
>
> Key: HBASE-23779
> URL: https://issues.apache.org/jira/browse/HBASE-23779
> Project: HBase
>  Issue Type: Bug
>  Components: test
>Reporter: Michael Stack
>Assignee: Michael Stack
>Priority: Major
> Fix For: 3.0.0, 2.3.0
>
> Attachments: test_yetus_934.0.patch
>
>
> Tests take a long time. Our fork count running all tests are conservative -- 
> 1 (small) for first part and 5 for second part (medium and large). Rather 
> than hardcoding we should set the fork count to be relative to machine size. 
> Suggestion here is 0.75C where C is CPU count. This ups the CPU use on my box.
> Looking up at jenkins, it seems like the boxes are 24 cores... at least going 
> by my random survey. The load reported on a few seems low though this not 
> representative (looking at machine/uptime).
> More parallelism willl probably mean more test failure. Let me take a look 
> see.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HBASE-23802) Remove unnecessary Configuration instantiation in LossyAccounting

2020-02-06 Thread Nick Dimiduk (Jira)


 [ 
https://issues.apache.org/jira/browse/HBASE-23802?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nick Dimiduk updated HBASE-23802:
-
Fix Version/s: 1.6.0

> Remove unnecessary Configuration instantiation in LossyAccounting
> -
>
> Key: HBASE-23802
> URL: https://issues.apache.org/jira/browse/HBASE-23802
> Project: HBase
>  Issue Type: Improvement
>  Components: metrics
>Reporter: Nick Dimiduk
>Assignee: Nick Dimiduk
>Priority: Minor
> Fix For: 3.0.0, 2.3.0, 1.6.0
>
>
> Mighty [~stack] pointed out over on HBASE-23801 that maybe {{LossyCounting}} 
> doesn't need to be instantiating a {{Configuration}} instance in the first 
> place.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[GitHub] [hbase] swaroopak commented on issue #1110: HBASE-23761: The new cache entry can overflow the maxSize in CachedEn…

2020-02-06 Thread GitBox
swaroopak commented on issue #1110: HBASE-23761: The new cache entry can 
overflow the maxSize in CachedEn…
URL: https://github.com/apache/hbase/pull/1110#issuecomment-583111098
 
 
   @bharathv where should I add UT? I dont see an existing UT class for this 
class. Should I create a new one?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] ndimiduk commented on issue #1140: Backport of HBASE-23802 for branch-1

2020-02-06 Thread GitBox
ndimiduk commented on issue #1140: Backport of HBASE-23802 for branch-1
URL: https://github.com/apache/hbase/pull/1140#issuecomment-583111002
 
 
   #1127 applied more-or-less cleanly.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] swaroopak commented on a change in pull request #1110: HBASE-23761: The new cache entry can overflow the maxSize in CachedEn…

2020-02-06 Thread GitBox
swaroopak commented on a change in pull request #1110: HBASE-23761: The new 
cache entry can overflow the maxSize in CachedEn…
URL: https://github.com/apache/hbase/pull/1110#discussion_r376081965
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruCachedBlockQueue.java
 ##
 @@ -65,14 +65,15 @@ public LruCachedBlockQueue(long maxSize, long blockSize) {
* @param cb block to try to add to the queue
*/
   public void add(LruCachedBlock cb) {
 
 Review comment:
   I was wondering if we should make the method synchronized and heapSize a 
volatile variable? What are your thoughts?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] ndimiduk opened a new pull request #1140: Backport of HBASE-23802 for branch-1

2020-02-06 Thread GitBox
ndimiduk opened a new pull request #1140: Backport of HBASE-23802 for branch-1
URL: https://github.com/apache/hbase/pull/1140
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] swaroopak commented on a change in pull request #1110: HBASE-23761: The new cache entry can overflow the maxSize in CachedEn…

2020-02-06 Thread GitBox
swaroopak commented on a change in pull request #1110: HBASE-23761: The new 
cache entry can overflow the maxSize in CachedEn…
URL: https://github.com/apache/hbase/pull/1110#discussion_r376082001
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruCachedBlockQueue.java
 ##
 @@ -65,14 +65,15 @@ public LruCachedBlockQueue(long maxSize, long blockSize) {
* @param cb block to try to add to the queue
*/
   public void add(LruCachedBlock cb) {
-if(heapSize < maxSize) {
+long cbSize = cb.heapSize();
+if(heapSize + cbSize < maxSize) {
   queue.add(cb);
-  heapSize += cb.heapSize();
+  heapSize += cbSize;
 } else {
   LruCachedBlock head = queue.peek();
   if(cb.compareTo(head) > 0) {
 heapSize += cb.heapSize();
-heapSize -= head.heapSize();
+heapSize -= cbSize;
 
 Review comment:
   Oh yes, my bad!


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] brfrn169 commented on a change in pull request #1114: HBASE-23146 Support CheckAndMutate with multi conditions

2020-02-06 Thread GitBox
brfrn169 commented on a change in pull request #1114: HBASE-23146 Support 
CheckAndMutate with multi conditions
URL: https://github.com/apache/hbase/pull/1114#discussion_r376072388
 
 

 ##
 File path: 
hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncTable.java
 ##
 @@ -233,6 +234,28 @@
*/
   CheckAndMutateBuilder checkAndMutate(byte[] row, byte[] family);
 
+  /**
+   * Atomically checks if a row matches the specified filter. If it does, it 
adds the
+   * Put/Delete/RowMutations.
+   * 
+   * Use the returned {@link CheckAndMutateBuilder} to construct your request 
and then execute it.
+   * This is a fluent style API, the code is like:
+   *
+   * 
+   * 
+   * table.checkAndMutate(row).ifMatches(filter).thenPut(put)
+   * .thenAccept(succ -> {
+   *   if (succ) {
+   * System.out.println("Check and put succeeded");
+   *   } else {
+   * System.out.println("Check and put failed");
+   *   }
+   * });
+   * 
+   * 
+   */
+  CheckAndMutateBuilder checkAndMutate(byte[] row);
 
 Review comment:
   Ping @Apache9 


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[jira] [Commented] (HBASE-23779) Up the default fork count to make builds complete faster; make count relative to CPU count

2020-02-06 Thread Michael Stack (Jira)


[ 
https://issues.apache.org/jira/browse/HBASE-23779?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17031911#comment-17031911
 ] 

Michael Stack commented on HBASE-23779:
---

I pushed this last night into master branch as addendum in hbase-personality. 
It don't seem to work either:
{code}
commit 867b1e9cbca6217da84d12b8a1772af8e607bd36 (HEAD -> m, origin/master, 
origin/HEAD)
Author: stack 
Date:   Wed Feb 5 21:47:34 2020 -0800

HBASE-23779 Up the default fork count; make count relative to CPU count 
(#1108)
ADDENDUM: Try this way of setting MAVEN_ARGS

diff --git a/dev-support/hbase-personality.sh b/dev-support/hbase-personality.sh
index 76fc96bf76..169f19abcc 100755
--- a/dev-support/hbase-personality.sh
+++ b/dev-support/hbase-personality.sh
@@ -81,13 +81,14 @@ function personality_globals

   # Override the maven options
   MAVEN_OPTS="${MAVEN_OPTS:-"-Xms4G -Xmx4G"}"
+
   # Pass maven a -T argument. Should make it run faster. Pass conservative 
value.
   # Default is one thread. 0.5C on an apache box of 24 cores and 2 executors 
should
   # make for 6 threads? Lets see. Setting this here for yetus to pick up. See
   # 
https://yetus.apache.org/documentation/0.11.1/precommit-advanced/#global-definitions
   # See below for more on -T:
   # 
https://cwiki.apache.org/confluence/display/MAVEN/Parallel+builds+in+Maven+3
-  export MAVEN_ARGS="-T0.5C ${MAVEN_ARGS}"
+  MAVEN_ARGS=("-T0.5C" "${MAVEN_ARGS[@]}")
{code}

> Up the default fork count to make builds complete faster; make count relative 
> to CPU count
> --
>
> Key: HBASE-23779
> URL: https://issues.apache.org/jira/browse/HBASE-23779
> Project: HBase
>  Issue Type: Bug
>  Components: test
>Reporter: Michael Stack
>Assignee: Michael Stack
>Priority: Major
> Fix For: 3.0.0, 2.3.0
>
> Attachments: test_yetus_934.0.patch
>
>
> Tests take a long time. Our fork count running all tests are conservative -- 
> 1 (small) for first part and 5 for second part (medium and large). Rather 
> than hardcoding we should set the fork count to be relative to machine size. 
> Suggestion here is 0.75C where C is CPU count. This ups the CPU use on my box.
> Looking up at jenkins, it seems like the boxes are 24 cores... at least going 
> by my random survey. The load reported on a few seems low though this not 
> representative (looking at machine/uptime).
> More parallelism willl probably mean more test failure. Let me take a look 
> see.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (HBASE-23802) Remove unnecessary Configuration instantiation in LossyAccounting

2020-02-06 Thread Nick Dimiduk (Jira)


[ 
https://issues.apache.org/jira/browse/HBASE-23802?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17031885#comment-17031885
 ] 

Nick Dimiduk commented on HBASE-23802:
--

Looking at taking this further back, seems branch-2.2 and branch-2.1 are 
missing HBASE-15519 and HBASE-23364. [~zghao], [~zhangduo]: you want all these 
others backported?

> Remove unnecessary Configuration instantiation in LossyAccounting
> -
>
> Key: HBASE-23802
> URL: https://issues.apache.org/jira/browse/HBASE-23802
> Project: HBase
>  Issue Type: Improvement
>  Components: metrics
>Reporter: Nick Dimiduk
>Assignee: Nick Dimiduk
>Priority: Minor
> Fix For: 3.0.0, 2.3.0
>
>
> Mighty [~stack] pointed out over on HBASE-23801 that maybe {{LossyCounting}} 
> doesn't need to be instantiating a {{Configuration}} instance in the first 
> place.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (HBASE-23804) Fix default master addr hostname in master registry

2020-02-06 Thread HBase QA (Jira)


[ 
https://issues.apache.org/jira/browse/HBASE-23804?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17031881#comment-17031881
 ] 

HBase QA commented on HBASE-23804:
--

| (x) *{color:red}-1 overall{color}* |
\\
\\
|| Vote || Subsystem || Runtime || Comment ||
| {color:blue}0{color} | {color:blue} reexec {color} | {color:blue}  1m 
27s{color} | {color:blue} Docker mode activated. {color} |
|| || || || {color:brown} Prechecks {color} ||
| {color:green}+1{color} | {color:green} dupname {color} | {color:green}  0m  
0s{color} | {color:green} No case conflicting files found. {color} |
| {color:blue}0{color} | {color:blue} shelldocs {color} | {color:blue}  0m  
0s{color} | {color:blue} Shelldocs was not available. {color} |
| {color:green}+1{color} | {color:green} hbaseanti {color} | {color:green}  0m  
0s{color} | {color:green} Patch does not have any anti-patterns. {color} |
| {color:green}+1{color} | {color:green} @author {color} | {color:green}  0m  
0s{color} | {color:green} The patch does not contain any @author tags. {color} |
| {color:green}+1{color} | {color:green} test4tests {color} | {color:green}  0m 
 0s{color} | {color:green} The patch appears to include 4 new or modified test 
files. {color} |
|| || || || {color:brown} HBASE-18095/client-locate-meta-no-zookeeper Compile 
Tests {color} ||
| {color:blue}0{color} | {color:blue} mvndep {color} | {color:blue}  0m 
47s{color} | {color:blue} Maven dependency ordering for branch {color} |
| {color:green}+1{color} | {color:green} mvninstall {color} | {color:green}  6m 
 7s{color} | {color:green} HBASE-18095/client-locate-meta-no-zookeeper passed 
{color} |
| {color:green}+1{color} | {color:green} compile {color} | {color:green}  3m 
35s{color} | {color:green} HBASE-18095/client-locate-meta-no-zookeeper passed 
{color} |
| {color:green}+1{color} | {color:green} checkstyle {color} | {color:green}  2m 
41s{color} | {color:green} HBASE-18095/client-locate-meta-no-zookeeper passed 
{color} |
| {color:blue}0{color} | {color:blue} refguide {color} | {color:blue}  5m 
51s{color} | {color:blue} branch has no errors when building the reference 
guide. See footer for rendered docs, which you should manually inspect. {color} 
|
| {color:green}+1{color} | {color:green} shadedjars {color} | {color:green}  5m 
26s{color} | {color:green} branch has no errors when building our shaded 
downstream artifacts. {color} |
| {color:green}+1{color} | {color:green} javadoc {color} | {color:green}  4m 
22s{color} | {color:green} HBASE-18095/client-locate-meta-no-zookeeper passed 
{color} |
| {color:blue}0{color} | {color:blue} spotbugs {color} | {color:blue}  4m 
23s{color} | {color:blue} Used deprecated FindBugs config; considering 
switching to SpotBugs. {color} |
| {color:green}+1{color} | {color:green} findbugs {color} | {color:green} 22m 
37s{color} | {color:green} HBASE-18095/client-locate-meta-no-zookeeper passed 
{color} |
|| || || || {color:brown} Patch Compile Tests {color} ||
| {color:blue}0{color} | {color:blue} mvndep {color} | {color:blue}  0m 
21s{color} | {color:blue} Maven dependency ordering for patch {color} |
| {color:green}+1{color} | {color:green} mvninstall {color} | {color:green}  5m 
37s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} compile {color} | {color:green}  3m 
23s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} javac {color} | {color:green}  3m 
23s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} checkstyle {color} | {color:green}  2m 
35s{color} | {color:green} root: The patch generated 0 new + 408 unchanged - 1 
fixed = 408 total (was 409) {color} |
| {color:green}+1{color} | {color:green} shellcheck {color} | {color:green}  0m 
 2s{color} | {color:green} There were no new shellcheck issues. {color} |
| {color:green}+1{color} | {color:green} whitespace {color} | {color:green}  0m 
 0s{color} | {color:green} The patch has no whitespace issues. {color} |
| {color:green}+1{color} | {color:green} xml {color} | {color:green}  0m  
2s{color} | {color:green} The patch has no ill-formed XML file. {color} |
| {color:blue}0{color} | {color:blue} refguide {color} | {color:blue}  5m 
26s{color} | {color:blue} patch has no errors when building the reference 
guide. See footer for rendered docs, which you should manually inspect. {color} 
|
| {color:green}+1{color} | {color:green} shadedjars {color} | {color:green}  5m 
 5s{color} | {color:green} patch has no errors when building our shaded 
downstream artifacts. {color} |
| {color:green}+1{color} | {color:green} hadoopcheck {color} | {color:green} 
17m 36s{color} | {color:green} Patch does not cause any errors with Hadoop 
2.8.5 2.9.2 or 3.1.2. {color} |
| {color:green}+1{color} | {color:green} javadoc {color} | {color:green}  4m 
42s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | 

[GitHub] [hbase] Apache-HBase commented on issue #1137: HBASE-23804: Fix default master addr hostname in master registry

2020-02-06 Thread GitBox
Apache-HBase commented on issue #1137: HBASE-23804: Fix default master addr 
hostname in master registry
URL: https://github.com/apache/hbase/pull/1137#issuecomment-583086885
 
 
   :broken_heart: **-1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime | Comment |
   |::|--:|:|:|
   | +0 :ok: |  reexec  |   1m 27s |  Docker mode activated.  |
   ||| _ Prechecks _ |
   | +1 :green_heart: |  dupname  |   0m  0s |  No case conflicting files 
found.  |
   | +0 :ok: |  shelldocs  |   0m  0s |  Shelldocs was not available.  |
   | +1 :green_heart: |  hbaseanti  |   0m  0s |  Patch does not have any 
anti-patterns.  |
   | +1 :green_heart: |  @author  |   0m  0s |  The patch does not contain any 
@author tags.  |
   | +1 :green_heart: |  test4tests  |   0m  0s |  The patch appears to include 
4 new or modified test files.  |
   ||| _ HBASE-18095/client-locate-meta-no-zookeeper Compile Tests _ |
   | +0 :ok: |  mvndep  |   0m 47s |  Maven dependency ordering for branch  |
   | +1 :green_heart: |  mvninstall  |   6m  7s |  
HBASE-18095/client-locate-meta-no-zookeeper passed  |
   | +1 :green_heart: |  compile  |   3m 35s |  
HBASE-18095/client-locate-meta-no-zookeeper passed  |
   | +1 :green_heart: |  checkstyle  |   2m 41s |  
HBASE-18095/client-locate-meta-no-zookeeper passed  |
   | +0 :ok: |  refguide  |   5m 51s |  branch has no errors when building the 
reference guide. See footer for rendered docs, which you should manually 
inspect.  |
   | +1 :green_heart: |  shadedjars  |   5m 26s |  branch has no errors when 
building our shaded downstream artifacts.  |
   | +1 :green_heart: |  javadoc  |   4m 22s |  
HBASE-18095/client-locate-meta-no-zookeeper passed  |
   | +0 :ok: |  spotbugs  |   4m 23s |  Used deprecated FindBugs config; 
considering switching to SpotBugs.  |
   | +1 :green_heart: |  findbugs  |  22m 37s |  
HBASE-18095/client-locate-meta-no-zookeeper passed  |
   ||| _ Patch Compile Tests _ |
   | +0 :ok: |  mvndep  |   0m 21s |  Maven dependency ordering for patch  |
   | +1 :green_heart: |  mvninstall  |   5m 37s |  the patch passed  |
   | +1 :green_heart: |  compile  |   3m 23s |  the patch passed  |
   | +1 :green_heart: |  javac  |   3m 23s |  the patch passed  |
   | +1 :green_heart: |  checkstyle  |   2m 35s |  root: The patch generated 0 
new + 408 unchanged - 1 fixed = 408 total (was 409)  |
   | +1 :green_heart: |  shellcheck  |   0m  2s |  There were no new shellcheck 
issues.  |
   | +1 :green_heart: |  whitespace  |   0m  0s |  The patch has no whitespace 
issues.  |
   | +1 :green_heart: |  xml  |   0m  2s |  The patch has no ill-formed XML 
file.  |
   | +0 :ok: |  refguide  |   5m 26s |  patch has no errors when building the 
reference guide. See footer for rendered docs, which you should manually 
inspect.  |
   | +1 :green_heart: |  shadedjars  |   5m  5s |  patch has no errors when 
building our shaded downstream artifacts.  |
   | +1 :green_heart: |  hadoopcheck  |  17m 36s |  Patch does not cause any 
errors with Hadoop 2.8.5 2.9.2 or 3.1.2.  |
   | +1 :green_heart: |  javadoc  |   4m 42s |  the patch passed  |
   | +1 :green_heart: |  findbugs  |  23m 32s |  the patch passed  |
   ||| _ Other Tests _ |
   | -1 :x: |  unit  | 177m 59s |  root in the patch failed.  |
   | -1 :x: |  asflicense  |   1m 48s |  The patch generated 1 ASF License 
warnings.  |
   |  |   | 308m 44s |   |
   
   
   | Reason | Tests |
   |---:|:--|
   | Failed junit tests | 
hadoop.hbase.security.access.TestSnapshotScannerHDFSAclController |
   
   
   | Subsystem | Report/Notes |
   |--:|:-|
   | Docker | Client=19.03.5 Server=19.03.5 base: 
https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1137/2/artifact/out/Dockerfile
 |
   | GITHUB PR | https://github.com/apache/hbase/pull/1137 |
   | JIRA Issue | HBASE-23804 |
   | Optional Tests | dupname asflicense shellcheck shelldocs javac javadoc 
unit spotbugs findbugs shadedjars hadoopcheck hbaseanti checkstyle compile xml 
refguide |
   | uname | Linux fbbe3dbfc7c8 4.15.0-74-generic #84-Ubuntu SMP Thu Dec 19 
08:06:28 UTC 2019 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | 
/home/jenkins/jenkins-slave/workspace/Base-PreCommit-GitHub-PR_PR-1137/out/precommit/personality/provided.sh
 |
   | git revision | HBASE-18095/client-locate-meta-no-zookeeper / d110c08dce |
   | Default Java | 1.8.0_181 |
   | refguide | 
https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1137/2/artifact/out/branch-site/book.html
 |
   | refguide | 
https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1137/2/artifact/out/patch-site/book.html
 |
   | unit | 
https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1137/2/artifact/out/patch-unit-root.txt
 |
   |  Test Results | 
https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1137/2/testReport/
 |
   | asflicense | 

[jira] [Updated] (HBASE-23802) Remove unnecessary Configuration instantiation in LossyAccounting

2020-02-06 Thread Nick Dimiduk (Jira)


 [ 
https://issues.apache.org/jira/browse/HBASE-23802?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nick Dimiduk updated HBASE-23802:
-
Fix Version/s: 2.3.0

> Remove unnecessary Configuration instantiation in LossyAccounting
> -
>
> Key: HBASE-23802
> URL: https://issues.apache.org/jira/browse/HBASE-23802
> Project: HBase
>  Issue Type: Improvement
>  Components: metrics
>Reporter: Nick Dimiduk
>Assignee: Nick Dimiduk
>Priority: Minor
> Fix For: 3.0.0, 2.3.0
>
>
> Mighty [~stack] pointed out over on HBASE-23801 that maybe {{LossyCounting}} 
> doesn't need to be instantiating a {{Configuration}} instance in the first 
> place.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[GitHub] [hbase] ndimiduk merged pull request #1136: HBASE-23802 Remove unnecessary Configuration instantiation in LossyAc…

2020-02-06 Thread GitBox
ndimiduk merged pull request #1136: HBASE-23802 Remove unnecessary 
Configuration instantiation in LossyAc…
URL: https://github.com/apache/hbase/pull/1136
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[jira] [Updated] (HBASE-23779) Up the default fork count to make builds complete faster; make count relative to CPU count

2020-02-06 Thread Nick Dimiduk (Jira)


 [ 
https://issues.apache.org/jira/browse/HBASE-23779?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nick Dimiduk updated HBASE-23779:
-
Attachment: test_yetus_934.0.patch

> Up the default fork count to make builds complete faster; make count relative 
> to CPU count
> --
>
> Key: HBASE-23779
> URL: https://issues.apache.org/jira/browse/HBASE-23779
> Project: HBase
>  Issue Type: Bug
>  Components: test
>Reporter: Michael Stack
>Assignee: Michael Stack
>Priority: Major
> Fix For: 3.0.0, 2.3.0
>
> Attachments: test_yetus_934.0.patch
>
>
> Tests take a long time. Our fork count running all tests are conservative -- 
> 1 (small) for first part and 5 for second part (medium and large). Rather 
> than hardcoding we should set the fork count to be relative to machine size. 
> Suggestion here is 0.75C where C is CPU count. This ups the CPU use on my box.
> Looking up at jenkins, it seems like the boxes are 24 cores... at least going 
> by my random survey. The load reported on a few seems low though this not 
> representative (looking at machine/uptime).
> More parallelism willl probably mean more test failure. Let me take a look 
> see.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HBASE-23779) Up the default fork count to make builds complete faster; make count relative to CPU count

2020-02-06 Thread Nick Dimiduk (Jira)


 [ 
https://issues.apache.org/jira/browse/HBASE-23779?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nick Dimiduk updated HBASE-23779:
-
Status: Patch Available  (was: Open)

> Up the default fork count to make builds complete faster; make count relative 
> to CPU count
> --
>
> Key: HBASE-23779
> URL: https://issues.apache.org/jira/browse/HBASE-23779
> Project: HBase
>  Issue Type: Bug
>  Components: test
>Reporter: Michael Stack
>Assignee: Michael Stack
>Priority: Major
> Fix For: 3.0.0, 2.3.0
>
> Attachments: test_yetus_934.0.patch
>
>
> Tests take a long time. Our fork count running all tests are conservative -- 
> 1 (small) for first part and 5 for second part (medium and large). Rather 
> than hardcoding we should set the fork count to be relative to machine size. 
> Suggestion here is 0.75C where C is CPU count. This ups the CPU use on my box.
> Looking up at jenkins, it seems like the boxes are 24 cores... at least going 
> by my random survey. The load reported on a few seems low though this not 
> representative (looking at machine/uptime).
> More parallelism willl probably mean more test failure. Let me take a look 
> see.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[GitHub] [hbase] Apache-HBase commented on issue #1139: Add Bharath Vissapragada to developers list.

2020-02-06 Thread GitBox
Apache-HBase commented on issue #1139: Add Bharath Vissapragada to developers 
list.
URL: https://github.com/apache/hbase/pull/1139#issuecomment-583034152
 
 
   :broken_heart: **-1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime | Comment |
   |::|--:|:|:|
   | +0 :ok: |  reexec  |   1m  8s |  Docker mode activated.  |
   ||| _ Prechecks _ |
   | +1 :green_heart: |  dupname  |   0m  0s |  No case conflicting files 
found.  |
   | +1 :green_heart: |  @author  |   0m  0s |  The patch does not contain any 
@author tags.  |
   | -0 :warning: |  test4tests  |   0m  0s |  The patch doesn't appear to 
include any new or modified tests. Please justify why no new tests are needed 
for this patch. Also please list what manual steps were performed to verify 
this patch.  |
   ||| _ master Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   5m 30s |  master passed  |
   | +1 :green_heart: |  compile  |   3m  9s |  master passed  |
   | +1 :green_heart: |  shadedjars  |   4m 42s |  branch has no errors when 
building our shaded downstream artifacts.  |
   | +1 :green_heart: |  javadoc  |   2m 58s |  master passed  |
   ||| _ Patch Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   4m 57s |  the patch passed  |
   | +1 :green_heart: |  compile  |   3m  6s |  the patch passed  |
   | +1 :green_heart: |  javac  |   3m  6s |  the patch passed  |
   | +1 :green_heart: |  whitespace  |   0m  0s |  The patch has no whitespace 
issues.  |
   | +1 :green_heart: |  xml  |   0m  2s |  The patch has no ill-formed XML 
file.  |
   | +1 :green_heart: |  shadedjars  |   4m 40s |  patch has no errors when 
building our shaded downstream artifacts.  |
   | +1 :green_heart: |  hadoopcheck  |  16m  7s |  Patch does not cause any 
errors with Hadoop 2.8.5 2.9.2 or 3.1.2.  |
   | +1 :green_heart: |  javadoc  |   2m 52s |  the patch passed  |
   ||| _ Other Tests _ |
   | -1 :x: |  unit  |  77m 45s |  root in the patch failed.  |
   | +1 :green_heart: |  asflicense  |   0m 42s |  The patch does not generate 
ASF License warnings.  |
   |  |   | 134m 24s |   |
   
   
   | Reason | Tests |
   |---:|:--|
   | Unreaped Processes | root:3 |
   
   
   | Subsystem | Report/Notes |
   |--:|:-|
   | Docker | Client=19.03.5 Server=19.03.5 base: 
https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1139/1/artifact/out/Dockerfile
 |
   | GITHUB PR | https://github.com/apache/hbase/pull/1139 |
   | Optional Tests | dupname asflicense javac javadoc unit shadedjars 
hadoopcheck xml compile |
   | uname | Linux 6beefd16bf34 4.15.0-60-generic #67-Ubuntu SMP Thu Aug 22 
16:55:30 UTC 2019 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | 
/home/jenkins/jenkins-slave/workspace/Base-PreCommit-GitHub-PR_PR-1139/out/precommit/personality/provided.sh
 |
   | git revision | master / 867b1e9cbc |
   | Default Java | 1.8.0_181 |
   | Unreaped Processes Log | 
https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1139/1/artifact/out/patch-unit-root-reaper.txt
 |
   | unit | 
https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1139/1/artifact/out/patch-unit-root.txt
 |
   |  Test Results | 
https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1139/1/testReport/
 |
   | Max. process+thread count | 8453 (vs. ulimit of 1) |
   | modules | C: . U: . |
   | Console output | 
https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1139/1/console |
   | versions | git=2.11.0 maven=2018-06-17T18:33:14Z) |
   | Powered by | Apache Yetus 0.11.1 https://yetus.apache.org |
   
   
   This message was automatically generated.
   
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] Apache-HBase commented on issue #913: HBASE-23381: Improve Logging in HBase Commons Package

2020-02-06 Thread GitBox
Apache-HBase commented on issue #913: HBASE-23381: Improve Logging in HBase 
Commons Package
URL: https://github.com/apache/hbase/pull/913#issuecomment-583027350
 
 
   :broken_heart: **-1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime | Comment |
   |::|--:|:|:|
   | +0 :ok: |  reexec  |   1m 10s |  Docker mode activated.  |
   ||| _ Prechecks _ |
   | +1 :green_heart: |  dupname  |   0m  0s |  No case conflicting files 
found.  |
   | +1 :green_heart: |  hbaseanti  |   0m  0s |  Patch does not have any 
anti-patterns.  |
   | +1 :green_heart: |  @author  |   0m  0s |  The patch does not contain any 
@author tags.  |
   | -0 :warning: |  test4tests  |   0m  0s |  The patch doesn't appear to 
include any new or modified tests. Please justify why no new tests are needed 
for this patch. Also please list what manual steps were performed to verify 
this patch.  |
   ||| _ master Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   6m  8s |  master passed  |
   | +1 :green_heart: |  compile  |   0m 21s |  master passed  |
   | +1 :green_heart: |  checkstyle  |   0m 29s |  master passed  |
   | +1 :green_heart: |  shadedjars  |   5m  5s |  branch has no errors when 
building our shaded downstream artifacts.  |
   | +1 :green_heart: |  javadoc  |   0m 21s |  master passed  |
   | +0 :ok: |  spotbugs  |   0m 52s |  Used deprecated FindBugs config; 
considering switching to SpotBugs.  |
   | +1 :green_heart: |  findbugs  |   0m 49s |  master passed  |
   | -0 :warning: |  patch  |   0m 57s |  Used diff version of patch file. 
Binary files and potentially other changes not applied. Please rebase and 
squash commits if necessary.  |
   ||| _ Patch Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   5m 32s |  the patch passed  |
   | +1 :green_heart: |  compile  |   0m 23s |  the patch passed  |
   | +1 :green_heart: |  javac  |   0m 23s |  the patch passed  |
   | -1 :x: |  checkstyle  |   0m 26s |  hbase-common: The patch generated 5 
new + 125 unchanged - 9 fixed = 130 total (was 134)  |
   | +1 :green_heart: |  whitespace  |   0m  0s |  The patch has no whitespace 
issues.  |
   | +1 :green_heart: |  shadedjars  |   5m 22s |  patch has no errors when 
building our shaded downstream artifacts.  |
   | +1 :green_heart: |  hadoopcheck  |  18m 39s |  Patch does not cause any 
errors with Hadoop 2.8.5 2.9.2 or 3.1.2.  |
   | +1 :green_heart: |  javadoc  |   0m 23s |  the patch passed  |
   | +1 :green_heart: |  findbugs  |   1m 10s |  the patch passed  |
   ||| _ Other Tests _ |
   | +1 :green_heart: |  unit  |   1m 22s |  hbase-common in the patch passed.  
|
   | +1 :green_heart: |  unit  | 103m 39s |  hbase-server in the patch passed.  
|
   | +1 :green_heart: |  asflicense  |   0m 26s |  The patch does not generate 
ASF License warnings.  |
   |  |   | 158m 58s |   |
   
   
   | Subsystem | Report/Notes |
   |--:|:-|
   | Docker | Client=19.03.5 Server=19.03.5 base: 
https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-913/7/artifact/out/Dockerfile
 |
   | GITHUB PR | https://github.com/apache/hbase/pull/913 |
   | JIRA Issue | HBASE-23381 |
   | Optional Tests | dupname asflicense javac javadoc unit spotbugs findbugs 
shadedjars hadoopcheck hbaseanti checkstyle compile |
   | uname | Linux 0997eef65df9 4.15.0-74-generic #84-Ubuntu SMP Thu Dec 19 
08:06:28 UTC 2019 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | 
/home/jenkins/jenkins-slave/workspace/HBase-PreCommit-GitHub-PR_PR-913/out/precommit/personality/provided.sh
 |
   | git revision | master / 867b1e9cbc |
   | Default Java | 1.8.0_181 |
   | checkstyle | 
https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-913/7/artifact/out/diff-checkstyle-hbase-common.txt
 |
   |  Test Results | 
https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-913/7/testReport/
 |
   | Max. process+thread count | 6313 (vs. ulimit of 1) |
   | modules | C: hbase-common U: hbase-common |
   | Console output | 
https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-913/7/console |
   | versions | git=2.11.0 maven=2018-06-17T18:33:14Z) findbugs=3.1.11 |
   | Powered by | Apache Yetus 0.11.1 https://yetus.apache.org |
   
   
   This message was automatically generated.
   
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[jira] [Commented] (HBASE-23381) Improve Logging in HBase Commons Package

2020-02-06 Thread HBase QA (Jira)


[ 
https://issues.apache.org/jira/browse/HBASE-23381?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17031824#comment-17031824
 ] 

HBase QA commented on HBASE-23381:
--

| (x) *{color:red}-1 overall{color}* |
\\
\\
|| Vote || Subsystem || Runtime || Comment ||
| {color:blue}0{color} | {color:blue} reexec {color} | {color:blue}  1m 
10s{color} | {color:blue} Docker mode activated. {color} |
|| || || || {color:brown} Prechecks {color} ||
| {color:green}+1{color} | {color:green} dupname {color} | {color:green}  0m  
0s{color} | {color:green} No case conflicting files found. {color} |
| {color:green}+1{color} | {color:green} hbaseanti {color} | {color:green}  0m  
0s{color} | {color:green} Patch does not have any anti-patterns. {color} |
| {color:green}+1{color} | {color:green} @author {color} | {color:green}  0m  
0s{color} | {color:green} The patch does not contain any @author tags. {color} |
| {color:orange}-0{color} | {color:orange} test4tests {color} | {color:orange}  
0m  0s{color} | {color:orange} The patch doesn't appear to include any new or 
modified tests. Please justify why no new tests are needed for this patch. Also 
please list what manual steps were performed to verify this patch. {color} |
|| || || || {color:brown} master Compile Tests {color} ||
| {color:green}+1{color} | {color:green} mvninstall {color} | {color:green}  6m 
 8s{color} | {color:green} master passed {color} |
| {color:green}+1{color} | {color:green} compile {color} | {color:green}  0m 
21s{color} | {color:green} master passed {color} |
| {color:green}+1{color} | {color:green} checkstyle {color} | {color:green}  0m 
29s{color} | {color:green} master passed {color} |
| {color:green}+1{color} | {color:green} shadedjars {color} | {color:green}  5m 
 5s{color} | {color:green} branch has no errors when building our shaded 
downstream artifacts. {color} |
| {color:green}+1{color} | {color:green} javadoc {color} | {color:green}  0m 
21s{color} | {color:green} master passed {color} |
| {color:blue}0{color} | {color:blue} spotbugs {color} | {color:blue}  0m 
52s{color} | {color:blue} Used deprecated FindBugs config; considering 
switching to SpotBugs. {color} |
| {color:green}+1{color} | {color:green} findbugs {color} | {color:green}  0m 
49s{color} | {color:green} master passed {color} |
| {color:orange}-0{color} | {color:orange} patch {color} | {color:orange}  0m 
57s{color} | {color:orange} Used diff version of patch file. Binary files and 
potentially other changes not applied. Please rebase and squash commits if 
necessary. {color} |
|| || || || {color:brown} Patch Compile Tests {color} ||
| {color:green}+1{color} | {color:green} mvninstall {color} | {color:green}  5m 
32s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} compile {color} | {color:green}  0m 
23s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} javac {color} | {color:green}  0m 
23s{color} | {color:green} the patch passed {color} |
| {color:red}-1{color} | {color:red} checkstyle {color} | {color:red}  0m 
26s{color} | {color:red} hbase-common: The patch generated 5 new + 125 
unchanged - 9 fixed = 130 total (was 134) {color} |
| {color:green}+1{color} | {color:green} whitespace {color} | {color:green}  0m 
 0s{color} | {color:green} The patch has no whitespace issues. {color} |
| {color:green}+1{color} | {color:green} shadedjars {color} | {color:green}  5m 
22s{color} | {color:green} patch has no errors when building our shaded 
downstream artifacts. {color} |
| {color:green}+1{color} | {color:green} hadoopcheck {color} | {color:green} 
18m 39s{color} | {color:green} Patch does not cause any errors with Hadoop 
2.8.5 2.9.2 or 3.1.2. {color} |
| {color:green}+1{color} | {color:green} javadoc {color} | {color:green}  0m 
23s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} findbugs {color} | {color:green}  1m 
10s{color} | {color:green} the patch passed {color} |
|| || || || {color:brown} Other Tests {color} ||
| {color:green}+1{color} | {color:green} unit {color} | {color:green}  1m 
22s{color} | {color:green} hbase-common in the patch passed. {color} |
| {color:green}+1{color} | {color:green} unit {color} | {color:green}103m 
39s{color} | {color:green} hbase-server in the patch passed. {color} |
| {color:green}+1{color} | {color:green} asflicense {color} | {color:green}  0m 
26s{color} | {color:green} The patch does not generate ASF License warnings. 
{color} |
| {color:black}{color} | {color:black} {color} | {color:black}158m 58s{color} | 
{color:black} {color} |
\\
\\
|| Subsystem || Report/Notes ||
| Docker | Client=19.03.5 Server=19.03.5 base: 
https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-913/7/artifact/out/Dockerfile
 |
| GITHUB PR | https://github.com/apache/hbase/pull/913 |
| JIRA Issue | HBASE-23381 |
| Optional Tests | dupname asflicense javac javadoc unit 

[jira] [Commented] (HBASE-23568) Improve Threading of Replication

2020-02-06 Thread HBase QA (Jira)


[ 
https://issues.apache.org/jira/browse/HBASE-23568?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17031817#comment-17031817
 ] 

HBase QA commented on HBASE-23568:
--

| (x) *{color:red}-1 overall{color}* |
\\
\\
|| Vote || Subsystem || Runtime || Comment ||
| {color:blue}0{color} | {color:blue} reexec {color} | {color:blue}  1m 
12s{color} | {color:blue} Docker mode activated. {color} |
|| || || || {color:brown} Prechecks {color} ||
| {color:green}+1{color} | {color:green} dupname {color} | {color:green}  0m  
0s{color} | {color:green} No case conflicting files found. {color} |
| {color:green}+1{color} | {color:green} hbaseanti {color} | {color:green}  0m  
0s{color} | {color:green} Patch does not have any anti-patterns. {color} |
| {color:green}+1{color} | {color:green} @author {color} | {color:green}  0m  
0s{color} | {color:green} The patch does not contain any @author tags. {color} |
| {color:green}+1{color} | {color:green} test4tests {color} | {color:green}  0m 
 0s{color} | {color:green} The patch appears to include 1 new or modified test 
files. {color} |
|| || || || {color:brown} master Compile Tests {color} ||
| {color:green}+1{color} | {color:green} mvninstall {color} | {color:green}  6m 
 8s{color} | {color:green} master passed {color} |
| {color:green}+1{color} | {color:green} compile {color} | {color:green}  1m  
0s{color} | {color:green} master passed {color} |
| {color:green}+1{color} | {color:green} checkstyle {color} | {color:green}  1m 
16s{color} | {color:green} master passed {color} |
| {color:green}+1{color} | {color:green} shadedjars {color} | {color:green}  5m 
 7s{color} | {color:green} branch has no errors when building our shaded 
downstream artifacts. {color} |
| {color:green}+1{color} | {color:green} javadoc {color} | {color:green}  0m 
37s{color} | {color:green} master passed {color} |
| {color:blue}0{color} | {color:blue} spotbugs {color} | {color:blue}  4m 
42s{color} | {color:blue} Used deprecated FindBugs config; considering 
switching to SpotBugs. {color} |
| {color:green}+1{color} | {color:green} findbugs {color} | {color:green}  4m 
38s{color} | {color:green} master passed {color} |
|| || || || {color:brown} Patch Compile Tests {color} ||
| {color:green}+1{color} | {color:green} mvninstall {color} | {color:green}  5m 
36s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} compile {color} | {color:green}  1m  
0s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} javac {color} | {color:green}  1m  
0s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} checkstyle {color} | {color:green}  1m 
14s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} whitespace {color} | {color:green}  0m 
 0s{color} | {color:green} The patch has no whitespace issues. {color} |
| {color:green}+1{color} | {color:green} shadedjars {color} | {color:green}  5m 
 7s{color} | {color:green} patch has no errors when building our shaded 
downstream artifacts. {color} |
| {color:green}+1{color} | {color:green} hadoopcheck {color} | {color:green} 
17m 42s{color} | {color:green} Patch does not cause any errors with Hadoop 
2.8.5 2.9.2 or 3.1.2. {color} |
| {color:green}+1{color} | {color:green} javadoc {color} | {color:green}  0m 
36s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} findbugs {color} | {color:green}  4m 
44s{color} | {color:green} the patch passed {color} |
|| || || || {color:brown} Other Tests {color} ||
| {color:red}-1{color} | {color:red} unit {color} | {color:red}100m 29s{color} 
| {color:red} hbase-server in the patch failed. {color} |
| {color:green}+1{color} | {color:green} asflicense {color} | {color:green}  0m 
29s{color} | {color:green} The patch does not generate ASF License warnings. 
{color} |
| {color:black}{color} | {color:black} {color} | {color:black}163m 57s{color} | 
{color:black} {color} |
\\
\\
|| Reason || Tests ||
| Failed junit tests | hadoop.hbase.replication.TestReplicationSmallTestsSync |
|   | hadoop.hbase.replication.TestReplicationDroppedTables |
|   | hadoop.hbase.io.asyncfs.TestSaslFanOutOneBlockAsyncDFSOutput |
\\
\\
|| Subsystem || Report/Notes ||
| Docker | Client=19.03.5 Server=19.03.5 base: 
https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-934/6/artifact/out/Dockerfile
 |
| GITHUB PR | https://github.com/apache/hbase/pull/934 |
| JIRA Issue | HBASE-23568 |
| Optional Tests | dupname asflicense javac javadoc unit spotbugs findbugs 
shadedjars hadoopcheck hbaseanti checkstyle compile |
| uname | Linux 1375918e083d 4.15.0-74-generic #84-Ubuntu SMP Thu Dec 19 
08:06:28 UTC 2019 x86_64 GNU/Linux |
| Build tool | maven |
| Personality | 
/home/jenkins/jenkins-slave/workspace/HBase-PreCommit-GitHub-PR_PR-934/out/precommit/personality/provided.sh
 |
| git revision | master / 867b1e9cbc 

[GitHub] [hbase] Apache-HBase commented on issue #934: HBASE-23568: Improve Threading of Replication

2020-02-06 Thread GitBox
Apache-HBase commented on issue #934: HBASE-23568: Improve Threading of 
Replication
URL: https://github.com/apache/hbase/pull/934#issuecomment-583024812
 
 
   :broken_heart: **-1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime | Comment |
   |::|--:|:|:|
   | +0 :ok: |  reexec  |   1m 12s |  Docker mode activated.  |
   ||| _ Prechecks _ |
   | +1 :green_heart: |  dupname  |   0m  0s |  No case conflicting files 
found.  |
   | +1 :green_heart: |  hbaseanti  |   0m  0s |  Patch does not have any 
anti-patterns.  |
   | +1 :green_heart: |  @author  |   0m  0s |  The patch does not contain any 
@author tags.  |
   | +1 :green_heart: |  test4tests  |   0m  0s |  The patch appears to include 
1 new or modified test files.  |
   ||| _ master Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   6m  8s |  master passed  |
   | +1 :green_heart: |  compile  |   1m  0s |  master passed  |
   | +1 :green_heart: |  checkstyle  |   1m 16s |  master passed  |
   | +1 :green_heart: |  shadedjars  |   5m  7s |  branch has no errors when 
building our shaded downstream artifacts.  |
   | +1 :green_heart: |  javadoc  |   0m 37s |  master passed  |
   | +0 :ok: |  spotbugs  |   4m 42s |  Used deprecated FindBugs config; 
considering switching to SpotBugs.  |
   | +1 :green_heart: |  findbugs  |   4m 38s |  master passed  |
   ||| _ Patch Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   5m 36s |  the patch passed  |
   | +1 :green_heart: |  compile  |   1m  0s |  the patch passed  |
   | +1 :green_heart: |  javac  |   1m  0s |  the patch passed  |
   | +1 :green_heart: |  checkstyle  |   1m 14s |  the patch passed  |
   | +1 :green_heart: |  whitespace  |   0m  0s |  The patch has no whitespace 
issues.  |
   | +1 :green_heart: |  shadedjars  |   5m  7s |  patch has no errors when 
building our shaded downstream artifacts.  |
   | +1 :green_heart: |  hadoopcheck  |  17m 42s |  Patch does not cause any 
errors with Hadoop 2.8.5 2.9.2 or 3.1.2.  |
   | +1 :green_heart: |  javadoc  |   0m 36s |  the patch passed  |
   | +1 :green_heart: |  findbugs  |   4m 44s |  the patch passed  |
   ||| _ Other Tests _ |
   | -1 :x: |  unit  | 100m 29s |  hbase-server in the patch failed.  |
   | +1 :green_heart: |  asflicense  |   0m 29s |  The patch does not generate 
ASF License warnings.  |
   |  |   | 163m 57s |   |
   
   
   | Reason | Tests |
   |---:|:--|
   | Failed junit tests | 
hadoop.hbase.replication.TestReplicationSmallTestsSync |
   |   | hadoop.hbase.replication.TestReplicationDroppedTables |
   |   | hadoop.hbase.io.asyncfs.TestSaslFanOutOneBlockAsyncDFSOutput |
   
   
   | Subsystem | Report/Notes |
   |--:|:-|
   | Docker | Client=19.03.5 Server=19.03.5 base: 
https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-934/6/artifact/out/Dockerfile
 |
   | GITHUB PR | https://github.com/apache/hbase/pull/934 |
   | JIRA Issue | HBASE-23568 |
   | Optional Tests | dupname asflicense javac javadoc unit spotbugs findbugs 
shadedjars hadoopcheck hbaseanti checkstyle compile |
   | uname | Linux 1375918e083d 4.15.0-74-generic #84-Ubuntu SMP Thu Dec 19 
08:06:28 UTC 2019 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | 
/home/jenkins/jenkins-slave/workspace/HBase-PreCommit-GitHub-PR_PR-934/out/precommit/personality/provided.sh
 |
   | git revision | master / 867b1e9cbc |
   | Default Java | 1.8.0_181 |
   | unit | 
https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-934/6/artifact/out/patch-unit-hbase-server.txt
 |
   |  Test Results | 
https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-934/6/testReport/
 |
   | Max. process+thread count | 6419 (vs. ulimit of 1) |
   | modules | C: hbase-server U: hbase-server |
   | Console output | 
https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-934/6/console |
   | versions | git=2.11.0 maven=2018-06-17T18:33:14Z) findbugs=3.1.11 |
   | Powered by | Apache Yetus 0.11.1 https://yetus.apache.org |
   
   
   This message was automatically generated.
   
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] bharathv opened a new pull request #1139: Add Bharath Vissapragada to developers list.

2020-02-06 Thread GitBox
bharathv opened a new pull request #1139: Add Bharath Vissapragada to 
developers list.
URL: https://github.com/apache/hbase/pull/1139
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] belugabehr commented on issue #913: HBASE-23381: Improve Logging in HBase Commons Package

2020-02-06 Thread GitBox
belugabehr commented on issue #913: HBASE-23381: Improve Logging in HBase 
Commons Package
URL: https://github.com/apache/hbase/pull/913#issuecomment-582963189
 
 
   @saintstack @busbey Just merged in latest changes and fixed conflicts.  
Thanks!


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[jira] [Updated] (HBASE-23804) Fix default master addr hostname in master registry

2020-02-06 Thread Bharath Vissapragada (Jira)


 [ 
https://issues.apache.org/jira/browse/HBASE-23804?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Bharath Vissapragada updated HBASE-23804:
-
Description: 
Currently, master RPC server (*not* info server) always binds to the address 
endpoint to which the default hostname of the server resolves to. However, 
master registry picks the default end point to connect to as "localhost:16000" 
when "hbase.masters" are not configured. This is leading to a mismatch because 
the server may not be listening on the loopback address. This is a problem only 
in the scripts (single proc/pseudo distributed modes) because these are the 
cases in which "hbase.masters" is not populated by default.

The fix is to pick the service endpoint the same way the RPC server does it.

  was:Currently master addr end point always defaults to localhost:16000 if 
nothing is configured. This is not always correct, especially if the master rpc 
end point binds to an address that is not loopback.  The default behavior for 
rpc server's bind address is to looks u the hostname and then bind to the 
address to which it resolves. Master registry should do the same.


> Fix default master addr hostname in master registry
> ---
>
> Key: HBASE-23804
> URL: https://issues.apache.org/jira/browse/HBASE-23804
> Project: HBase
>  Issue Type: Bug
>  Components: Client
>Affects Versions: 3.0.0, 2.3.0, 1.6.0, HBASE-18095
>Reporter: Bharath Vissapragada
>Assignee: Bharath Vissapragada
>Priority: Major
> Fix For: 3.0.0, 2.3.0
>
>
> Currently, master RPC server (*not* info server) always binds to the address 
> endpoint to which the default hostname of the server resolves to. However, 
> master registry picks the default end point to connect to as 
> "localhost:16000" when "hbase.masters" are not configured. This is leading to 
> a mismatch because the server may not be listening on the loopback address. 
> This is a problem only in the scripts (single proc/pseudo distributed modes) 
> because these are the cases in which "hbase.masters" is not populated by 
> default.
> The fix is to pick the service endpoint the same way the RPC server does it.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (HBASE-23804) Fix default master addr hostname in master registry

2020-02-06 Thread Bharath Vissapragada (Jira)


 [ 
https://issues.apache.org/jira/browse/HBASE-23804?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Bharath Vissapragada updated HBASE-23804:
-
Affects Version/s: HBASE-18095

> Fix default master addr hostname in master registry
> ---
>
> Key: HBASE-23804
> URL: https://issues.apache.org/jira/browse/HBASE-23804
> Project: HBase
>  Issue Type: Bug
>  Components: Client
>Affects Versions: 3.0.0, 2.3.0, 1.6.0, HBASE-18095
>Reporter: Bharath Vissapragada
>Assignee: Bharath Vissapragada
>Priority: Major
> Fix For: 3.0.0, 2.3.0
>
>
> Currently master addr end point always defaults to localhost:16000 if nothing 
> is configured. This is not always correct, especially if the master rpc end 
> point binds to an address that is not loopback.  The default behavior for rpc 
> server's bind address is to looks u the hostname and then bind to the address 
> to which it resolves. Master registry should do the same.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[GitHub] [hbase] bharathv commented on a change in pull request #1137: HBASE-23804: Fix default master addr hostname in master registry

2020-02-06 Thread GitBox
bharathv commented on a change in pull request #1137: HBASE-23804: Fix default 
master addr hostname in master registry
URL: https://github.com/apache/hbase/pull/1137#discussion_r375873505
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
 ##
 @@ -20,6 +20,7 @@
 import static 
org.apache.hadoop.hbase.HConstants.DEFAULT_HBASE_SPLIT_COORDINATED_BY_ZK;
 import static 
org.apache.hadoop.hbase.HConstants.HBASE_MASTER_LOGCLEANER_PLUGINS;
 import static 
org.apache.hadoop.hbase.HConstants.HBASE_SPLIT_WAL_COORDINATED_BY_ZK;
+import static org.apache.hadoop.hbase.HConstants.MASTER_HOSTNAME_KEY;
 
 Review comment:
   Fixed.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] belugabehr commented on a change in pull request #934: HBASE-23568: Improve Threading of Replication

2020-02-06 Thread GitBox
belugabehr commented on a change in pull request #934: HBASE-23568: Improve 
Threading of Replication
URL: https://github.com/apache/hbase/pull/934#discussion_r375877892
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
 ##
 @@ -304,31 +318,56 @@ private void initializeWALEntryFilter(UUID 
peerClusterId) {
 this.walEntryFilter = new ChainWALEntryFilter(filters);
   }
 
-  private void tryStartNewShipper(String walGroupId, 
PriorityBlockingQueue queue) {
-workerThreads.compute(walGroupId, (key, value) -> {
-  if (value != null) {
-if (LOG.isDebugEnabled()) {
-  LOG.debug(
-  "{} Someone has beat us to start a worker thread for wal group 
{}",
-  logPeerId(), key);
-}
-return value;
-  } else {
-if (LOG.isDebugEnabled()) {
-  LOG.debug("{} Starting up worker for wal group {}", logPeerId(), 
key);
+  /**
+   * Synchronized method so that only one item is inserted at a time. Should 
be the only place that
 
 Review comment:
   @bharathv Good question.  The answer is: dead lock.
   
   To simplify other parts of the code, I added Guava Future Callback.  This 
allows the thread to un-register itself once it has completed executing instead 
of having to have a developer remember to explicitly do it in the meat of the 
thread code (knowing that there can be many different exit code paths that all 
need to make sure they call the `tryFinish` method).  Not to mention there are 
multiple subclasses that also all need to explicitly call `tryFinish`.  Much 
cleaner to let all the classes involved not even be aware that they are being 
registered / unregistered.
   
   However, the catch is that the callback is applied to the future after it 
has been registered with the `ExecutionService` and therefore it is possible 
that the thread finishes before the callback is applied.  In such a scenario, 
the callback is executed by the thread that tried to apply the callback in the 
first place.  So, what could happen is that, the main thread submits a 
`Callable` to the `ExecutorService`, that `Callable` is assigned a thread, 
executes, and finishes.  The main thread then applies the callback and it must 
run the un-register code on behalf of the `Callable` which means that it tries 
to remove the `Callable` from the `workerThreads` Map.  However, in the 
original code, the main thread was running within the lock of the Map, so 
trying to then remove an entry from the Map that is already had a lock on 
caused a deadlock.
   
   So now there is a single lock (synchronized) at the cost of using multiple 
locks across the Map, but it would be hard to say that this has a measurable 
negative impact on performance at the cost of much more simple code in the 
thread.
   
   https://github.com/google/guava/wiki/ListenableFutureExplained


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] belugabehr commented on a change in pull request #934: HBASE-23568: Improve Threading of Replication

2020-02-06 Thread GitBox
belugabehr commented on a change in pull request #934: HBASE-23568: Improve 
Threading of Replication
URL: https://github.com/apache/hbase/pull/934#discussion_r375864354
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
 ##
 @@ -304,31 +318,56 @@ private void initializeWALEntryFilter(UUID 
peerClusterId) {
 this.walEntryFilter = new ChainWALEntryFilter(filters);
   }
 
-  private void tryStartNewShipper(String walGroupId, 
PriorityBlockingQueue queue) {
-workerThreads.compute(walGroupId, (key, value) -> {
-  if (value != null) {
-if (LOG.isDebugEnabled()) {
-  LOG.debug(
-  "{} Someone has beat us to start a worker thread for wal group 
{}",
-  logPeerId(), key);
-}
-return value;
-  } else {
-if (LOG.isDebugEnabled()) {
-  LOG.debug("{} Starting up worker for wal group {}", logPeerId(), 
key);
+  /**
+   * Synchronized method so that only one item is inserted at a time. Should 
be the only place that
+   * insertions are performed on the workerThreads data structure.
+   *
+   * @param walGroupId The WAL group ID
+   * @param queue The queue of paths to process
+   */
+  private synchronized void tryStartNewShipper(final String walGroupId,
+  final PriorityBlockingQueue queue) {
+
+if (workerThreads.containsKey(walGroupId)) {
+  return;
+}
+
+LOG.debug("{} Register worker for wallGroupID {}", logPeerId(), 
walGroupId);
 
 Review comment:
   Not very performance sensitive code, gets called a couple of times on 
initialization, but will add since you brought it to my attention.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] belugabehr commented on a change in pull request #934: HBASE-23568: Improve Threading of Replication

2020-02-06 Thread GitBox
belugabehr commented on a change in pull request #934: HBASE-23568: Improve 
Threading of Replication
URL: https://github.com/apache/hbase/pull/934#discussion_r375862415
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/RecoveredReplicationSourceShipper.java
 ##
 @@ -92,10 +86,7 @@ private void terminate(String reason, Exception cause) {
 "Closing worker for wal group " + this.walGroupId + " because an error 
occurred: " + reason,
 cause);
 }
-entryReader.interrupt();
-Threads.shutdown(entryReader, sleepForRetries);
-this.interrupt();
-Threads.shutdown(this, sleepForRetries);
-LOG.info("ReplicationSourceWorker {} terminated", this.getName());
+LOG.info("ReplicationSourceWorker stopping");
 
 Review comment:
   Nah.  Better where it is so that, through logging, it is known what other 
class is stopping the thread.  Also, it could be very verbose if somewhere in 
the code it is repeatedly calling the method.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] belugabehr commented on a change in pull request #934: HBASE-23568: Improve Threading of Replication

2020-02-06 Thread GitBox
belugabehr commented on a change in pull request #934: HBASE-23568: Improve 
Threading of Replication
URL: https://github.com/apache/hbase/pull/934#discussion_r375861045
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceWALReader.java
 ##
 @@ -72,8 +73,8 @@
   private final int maxRetriesMultiplier;
   private final boolean eofAutoRecovery;
 
-  //Indicates whether this particular worker is running
-  private boolean isReaderRunning = true;
+  // Indicates whether this particular worker is running
+  private final AtomicBoolean isReaderRunning = new AtomicBoolean(true);
 
 Review comment:
   The volatile keyword is a fickle thing and this is not time-sensitive code.  
More straight forward to use the Java concurrent package


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] belugabehr commented on a change in pull request #934: HBASE-23568: Improve Threading of Replication

2020-02-06 Thread GitBox
belugabehr commented on a change in pull request #934: HBASE-23568: Improve 
Threading of Replication
URL: https://github.com/apache/hbase/pull/934#discussion_r375860573
 
 

 ##
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
 ##
 @@ -575,50 +609,24 @@ public void terminate(String reason, Exception cause, 
boolean clearMetrics, bool
   initThread.interrupt();
   Threads.shutdown(initThread, this.sleepForRetries);
 }
-Collection workers = workerThreads.values();
-for (ReplicationSourceShipper worker : workers) {
-  worker.stopWorker();
-  if(worker.entryReader != null) {
-worker.entryReader.setReaderRunning(false);
-  }
-}
 
-for (ReplicationSourceShipper worker : workers) {
-  if (worker.isAlive() || worker.entryReader.isAlive()) {
-try {
-  // Wait worker to stop
-  Thread.sleep(this.sleepForRetries);
-} catch (InterruptedException e) {
-  LOG.info("{} Interrupted while waiting {} to stop", logPeerId(), 
worker.getName());
-  Thread.currentThread().interrupt();
-}
-// If worker still is alive after waiting, interrupt it
-if (worker.isAlive()) {
-  worker.interrupt();
-}
-// If entry reader is alive after waiting, interrupt it
-if (worker.entryReader.isAlive()) {
-  worker.entryReader.interrupt();
-}
-  }
+this.workerThreads.values().forEach(worker -> worker.stopWorker());
+
+final boolean shutdownSuccess = 
MoreExecutors.shutdownAndAwaitTermination(this.executorService,
+  10L, TimeUnit.SECONDS);
 
 Review comment:
   Changed to be based on the number of workerThreads.  Thanks.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [hbase] Apache-HBase commented on issue #1138: HBASE-22827 Expose multi-region merge in shell and Admin API

2020-02-06 Thread GitBox
Apache-HBase commented on issue #1138: HBASE-22827 Expose multi-region merge in 
shell and Admin API
URL: https://github.com/apache/hbase/pull/1138#issuecomment-582891013
 
 
   :broken_heart: **-1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime | Comment |
   |::|--:|:|:|
   | +0 :ok: |  reexec  |   0m 32s |  Docker mode activated.  |
   ||| _ Prechecks _ |
   | +1 :green_heart: |  dupname  |   0m  0s |  No case conflicting files 
found.  |
   | +1 :green_heart: |  hbaseanti  |   0m  0s |  Patch does not have any 
anti-patterns.  |
   | +1 :green_heart: |  @author  |   0m  0s |  The patch does not contain any 
@author tags.  |
   | +1 :green_heart: |  test4tests  |   0m  0s |  The patch appears to include 
1 new or modified test files.  |
   ||| _ master Compile Tests _ |
   | +0 :ok: |  mvndep  |   0m 39s |  Maven dependency ordering for branch  |
   | +1 :green_heart: |  mvninstall  |   5m 19s |  master passed  |
   | +1 :green_heart: |  compile  |   0m 54s |  master passed  |
   | +1 :green_heart: |  checkstyle  |   0m 45s |  master passed  |
   | +1 :green_heart: |  shadedjars  |   4m 42s |  branch has no errors when 
building our shaded downstream artifacts.  |
   | +1 :green_heart: |  javadoc  |   0m 40s |  master passed  |
   | +0 :ok: |  spotbugs  |   1m 11s |  Used deprecated FindBugs config; 
considering switching to SpotBugs.  |
   | +1 :green_heart: |  findbugs  |   1m 10s |  master passed  |
   ||| _ Patch Compile Tests _ |
   | +0 :ok: |  mvndep  |   0m 16s |  Maven dependency ordering for patch  |
   | +1 :green_heart: |  mvninstall  |   4m 58s |  the patch passed  |
   | +1 :green_heart: |  compile  |   0m 53s |  the patch passed  |
   | +1 :green_heart: |  javac  |   0m 53s |  the patch passed  |
   | -1 :x: |  checkstyle  |   0m 30s |  hbase-client: The patch generated 3 
new + 37 unchanged - 0 fixed = 40 total (was 37)  |
   | +1 :green_heart: |  rubocop  |   0m  9s |  There were no new rubocop 
issues.  |
   | +1 :green_heart: |  whitespace  |   0m  0s |  The patch has no whitespace 
issues.  |
   | +1 :green_heart: |  shadedjars  |   4m 43s |  patch has no errors when 
building our shaded downstream artifacts.  |
   | +1 :green_heart: |  hadoopcheck  |  15m 56s |  Patch does not cause any 
errors with Hadoop 2.8.5 2.9.2 or 3.1.2.  |
   | +1 :green_heart: |  javadoc  |   0m 38s |  the patch passed  |
   | +1 :green_heart: |  findbugs  |   1m 12s |  the patch passed  |
   ||| _ Other Tests _ |
   | +1 :green_heart: |  unit  |   0m 56s |  hbase-client in the patch passed.  
|
   | +1 :green_heart: |  unit  |   6m 58s |  hbase-shell in the patch passed.  |
   | +1 :green_heart: |  asflicense  |   0m 26s |  The patch does not generate 
ASF License warnings.  |
   |  |   |  59m 10s |   |
   
   
   | Subsystem | Report/Notes |
   |--:|:-|
   | Docker | Client=19.03.5 Server=19.03.5 base: 
https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1138/1/artifact/out/Dockerfile
 |
   | GITHUB PR | https://github.com/apache/hbase/pull/1138 |
   | Optional Tests | dupname asflicense javac javadoc unit spotbugs findbugs 
shadedjars hadoopcheck hbaseanti checkstyle compile rubocop |
   | uname | Linux 73df112a11e1 4.15.0-60-generic #67-Ubuntu SMP Thu Aug 22 
16:55:30 UTC 2019 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | 
/home/jenkins/jenkins-slave/workspace/Base-PreCommit-GitHub-PR_PR-1138/out/precommit/personality/provided.sh
 |
   | git revision | master / 867b1e9cbc |
   | Default Java | 1.8.0_181 |
   | checkstyle | 
https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1138/1/artifact/out/diff-checkstyle-hbase-client.txt
 |
   |  Test Results | 
https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1138/1/testReport/
 |
   | Max. process+thread count | 3673 (vs. ulimit of 1) |
   | modules | C: hbase-client hbase-shell U: . |
   | Console output | 
https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1138/1/console |
   | versions | git=2.11.0 maven=2018-06-17T18:33:14Z) findbugs=3.1.11 
rubocop=0.79.0 |
   | Powered by | Apache Yetus 0.11.1 https://yetus.apache.org |
   
   
   This message was automatically generated.
   
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


  1   2   >