You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2017/08/22 16:02:48 UTC
[01/21] hbase git commit: HBASE-14498 Master stuck in infinite loop
when all Zookeeper servers are unreachable
Repository: hbase
Updated Branches:
refs/heads/HBASE-14070.HLC b2a184806 -> 4e7c55d99
HBASE-14498 Master stuck in infinite loop when all Zookeeper servers are unreachable
Signed-off-by: Michael Stack <st...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/1ab6882f
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/1ab6882f
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/1ab6882f
Branch: refs/heads/HBASE-14070.HLC
Commit: 1ab6882f6285e0bfa2864a09208edf4f2ae4125d
Parents: 75a6b36
Author: Pankaj Kumar <pa...@huawei.com>
Authored: Thu Aug 17 17:06:50 2017 +0800
Committer: Michael Stack <st...@apache.org>
Committed: Thu Aug 17 19:02:39 2017 -0700
----------------------------------------------------------------------
.../hbase/zookeeper/ZooKeeperWatcher.java | 85 +++++++++++++++++++-
.../hbase/zookeeper/TestZooKeeperWatcher.java | 47 +++++++++++
.../hbase/regionserver/HRegionServer.java | 2 +-
3 files changed, 131 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/1ab6882f/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java
index 6bec352..8266c9a 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java
@@ -26,6 +26,9 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.atomic.AtomicBoolean;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -39,6 +42,7 @@ import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.ZooKeeperConnectionException;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.security.Superusers;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
@@ -76,7 +80,7 @@ public class ZooKeeperWatcher implements Watcher, Abortable, Closeable {
private final RecoverableZooKeeper recoverableZooKeeper;
// abortable in case of zk failure
- protected Abortable abortable;
+ protected final Abortable abortable;
// Used if abortable is null
private boolean aborted = false;
@@ -89,6 +93,13 @@ public class ZooKeeperWatcher implements Watcher, Abortable, Closeable {
// negotiation to complete
public CountDownLatch saslLatch = new CountDownLatch(1);
+ // Connection timeout on disconnect event
+ private long connWaitTimeOut;
+ private AtomicBoolean connected = new AtomicBoolean(false);
+ private boolean forceAbortOnZKDisconnect;
+
+ // Execute service for zookeeper disconnect event watcher
+ private ExecutorService zkEventWatcherExecService = null;
private final Configuration conf;
@@ -122,6 +133,24 @@ public class ZooKeeperWatcher implements Watcher, Abortable, Closeable {
public ZooKeeperWatcher(Configuration conf, String identifier,
Abortable abortable, boolean canCreateBaseZNode)
throws IOException, ZooKeeperConnectionException {
+ this(conf, identifier, abortable, canCreateBaseZNode, false);
+ }
+
+ /**
+ * Instantiate a ZooKeeper connection and watcher.
+ * @param conf Configuration
+ * @param identifier string that is passed to RecoverableZookeeper to be used as identifier for
+ * this instance. Use null for default.
+ * @param abortable Can be null if there is on error there is no host to abort: e.g. client
+ * context.
+ * @param canCreateBaseZNode whether create base node.
+ * @param forceAbortOnZKDisconnect abort the watcher if true.
+ * @throws IOException when any IO exception
+ * @throws ZooKeeperConnectionException when any zookeeper connection exception
+ */
+ public ZooKeeperWatcher(Configuration conf, String identifier, Abortable abortable,
+ boolean canCreateBaseZNode, boolean forceAbortOnZKDisconnect) throws IOException,
+ ZooKeeperConnectionException {
this.conf = conf;
this.quorum = ZKConfig.getZKQuorumServersString(conf);
this.prefix = identifier;
@@ -130,6 +159,9 @@ public class ZooKeeperWatcher implements Watcher, Abortable, Closeable {
this.identifier = identifier + "0x0";
this.abortable = abortable;
this.znodePaths = new ZNodePaths(conf);
+ // On Disconnected event a thread will wait for sometime (2/3 of zookeeper.session.timeout),
+ // it will abort the process if no SyncConnected event reported by the time.
+ connWaitTimeOut = this.conf.getLong("zookeeper.session.timeout", 90000) * 2 / 3;
PendingWatcher pendingWatcher = new PendingWatcher();
this.recoverableZooKeeper = ZKUtil.connect(conf, quorum, pendingWatcher, identifier);
pendingWatcher.prepare(this);
@@ -146,6 +178,10 @@ public class ZooKeeperWatcher implements Watcher, Abortable, Closeable {
throw zce;
}
}
+ this.forceAbortOnZKDisconnect = forceAbortOnZKDisconnect;
+ if (this.forceAbortOnZKDisconnect) {
+ this.zkEventWatcherExecService = Executors.newSingleThreadExecutor();
+ }
}
private void createBaseZNodes() throws ZooKeeperConnectionException {
@@ -526,11 +562,19 @@ public class ZooKeeperWatcher implements Watcher, Abortable, Closeable {
Long.toHexString(this.recoverableZooKeeper.getSessionId());
// Update our identifier. Otherwise ignore.
LOG.debug(this.identifier + " connected");
+ connected.set(true);
break;
// Abort the server if Disconnected or Expired
case Disconnected:
- LOG.debug(prefix("Received Disconnected from ZooKeeper, ignoring"));
+ LOG.debug(prefix("Received Disconnected from ZooKeeper."));
+ if (forceAbortOnZKDisconnect) {
+ connected.set(false);
+ ZKDisconnectEventWatcher task = new ZKDisconnectEventWatcher();
+ zkEventWatcherExecService.execute(task);
+ } else {
+ LOG.debug("Received Disconnected from ZooKeeper, ignoring.");
+ }
break;
case Expired:
@@ -553,6 +597,39 @@ public class ZooKeeperWatcher implements Watcher, Abortable, Closeable {
}
}
+ /*
+ * Task to watch zookeper disconnect event.
+ */
+ class ZKDisconnectEventWatcher implements Runnable {
+ @Override
+ public void run() {
+ if (connected.get()) {
+ return;
+ }
+
+ long startTime = EnvironmentEdgeManager.currentTime();
+ while (EnvironmentEdgeManager.currentTime() - startTime < connWaitTimeOut) {
+ if (connected.get()) {
+ LOG.debug("Client got reconnected to zookeeper.");
+ return;
+ }
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ break;
+ }
+ }
+
+ if (!connected.get() && abortable != null) {
+ String msg =
+ prefix("Couldn't connect to ZooKeeper after waiting " + connWaitTimeOut
+ + " ms, aborting");
+ abortable.abort(msg, new KeeperException.ConnectionLossException());
+ }
+ }
+ }
+
/**
* Forces a synchronization of this ZooKeeper client connection.
* <p>
@@ -617,6 +694,10 @@ public class ZooKeeperWatcher implements Watcher, Abortable, Closeable {
public void close() {
try {
recoverableZooKeeper.close();
+ if (zkEventWatcherExecService != null) {
+ zkEventWatcherExecService.shutdown();
+ zkEventWatcherExecService = null;
+ }
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/1ab6882f/hbase-client/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperWatcher.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperWatcher.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperWatcher.java
index de2ec2a..929bd98 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperWatcher.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperWatcher.java
@@ -23,14 +23,22 @@ import static org.junit.Assert.assertTrue;
import java.io.IOException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.Abortable;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.ZooKeeperConnectionException;
import org.apache.hadoop.hbase.testclassification.SmallTests;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.zookeeper.WatchedEvent;
+import org.apache.zookeeper.Watcher;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@Category({ SmallTests.class })
public class TestZooKeeperWatcher {
+ private final static Log LOG = LogFactory.getLog(TestZooKeeperWatcher.class);
@Test
public void testIsClientReadable() throws ZooKeeperConnectionException, IOException {
@@ -57,4 +65,43 @@ public class TestZooKeeperWatcher {
watcher.close();
}
+ @Test
+ public void testConnectionEvent() throws ZooKeeperConnectionException, IOException {
+ long zkSessionTimeout = 15000l;
+ Configuration conf = HBaseConfiguration.create();
+ conf.set("zookeeper.session.timeout", "15000");
+
+ Abortable abortable = new Abortable() {
+ boolean aborted = false;
+
+ @Override
+ public void abort(String why, Throwable e) {
+ aborted = true;
+ LOG.error(why, e);
+ }
+
+ @Override
+ public boolean isAborted() {
+ return aborted;
+ }
+ };
+ ZooKeeperWatcher watcher = new ZooKeeperWatcher(conf, "testConnectionEvent", abortable, false, true);
+
+ WatchedEvent event =
+ new WatchedEvent(Watcher.Event.EventType.None, Watcher.Event.KeeperState.Disconnected, null);
+
+ long startTime = EnvironmentEdgeManager.currentTime();
+ while (!abortable.isAborted()
+ && (EnvironmentEdgeManager.currentTime() - startTime < zkSessionTimeout)) {
+ watcher.process(event);
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+ }
+
+ assertTrue(abortable.isAborted());
+ watcher.close();
+ }
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/1ab6882f/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
index 0c1814f..524164f 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
@@ -642,7 +642,7 @@ public class HRegionServer extends HasThread implements
if (!conf.getBoolean("hbase.testing.nocluster", false)) {
// Open connection to zookeeper and set primary watcher
zooKeeper = new ZooKeeperWatcher(conf, getProcessName() + ":" +
- rpcServices.isa.getPort(), this, canCreateBaseZNode());
+ rpcServices.isa.getPort(), this, canCreateBaseZNode(), true);
this.csm = (BaseCoordinatedStateManager) csm;
this.csm.initialize(this);
[13/21] hbase git commit: HBASE-18629 Enhance ChaosMonkeyRunner with
interruptibility - revert addendum
Posted by st...@apache.org.
HBASE-18629 Enhance ChaosMonkeyRunner with interruptibility - revert addendum
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/70da5541
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/70da5541
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/70da5541
Branch: refs/heads/HBASE-14070.HLC
Commit: 70da554183213778911d3ed0537402c6cfeab173
Parents: fef7e8f
Author: tedyu <yu...@gmail.com>
Authored: Mon Aug 21 10:01:42 2017 -0700
Committer: tedyu <yu...@gmail.com>
Committed: Mon Aug 21 10:01:42 2017 -0700
----------------------------------------------------------------------
.../apache/hadoop/hbase/chaos/util/ChaosMonkeyRunner.java | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/70da5541/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/util/ChaosMonkeyRunner.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/util/ChaosMonkeyRunner.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/util/ChaosMonkeyRunner.java
index 80f99e5..f142321 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/util/ChaosMonkeyRunner.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/util/ChaosMonkeyRunner.java
@@ -45,8 +45,6 @@ public class ChaosMonkeyRunner extends AbstractHBaseTool {
public static final String TABLE_NAME_OPT = "tableName";
public static final String FAMILY_NAME_OPT = "familyName";
- private static ChaosMonkeyRunner runner;
-
protected IntegrationTestingUtility util;
protected ChaosMonkey monkey;
protected String monkeyToUse;
@@ -101,8 +99,8 @@ public class ChaosMonkeyRunner extends AbstractHBaseTool {
return 0;
}
- public static void stopRunner() {
- runner.stop = true;
+ public void stopRunner() {
+ stop = true;
}
public void setUpCluster() throws Exception {
@@ -178,8 +176,7 @@ public class ChaosMonkeyRunner extends AbstractHBaseTool {
System.arraycopy(args, 2, actualArgs, 0, argCount);
}
IntegrationTestingUtility.setUseDistributedCluster(conf);
- runner = new ChaosMonkeyRunner();
- int ret = ToolRunner.run(conf, runner, actualArgs);
+ int ret = ToolRunner.run(conf, new ChaosMonkeyRunner(), actualArgs);
System.exit(ret);
}
[05/21] hbase git commit: HBASE-18572 Delete can't remove the cells
which have no visibility label
Posted by st...@apache.org.
HBASE-18572 Delete can't remove the cells which have no visibility label
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/e9bafeb0
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/e9bafeb0
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/e9bafeb0
Branch: refs/heads/HBASE-14070.HLC
Commit: e9bafeb091549cce35f25a56688b6632578de74b
Parents: e2532ec
Author: Chia-Ping Tsai <ch...@gmail.com>
Authored: Sat Aug 19 01:55:45 2017 +0800
Committer: Chia-Ping Tsai <ch...@gmail.com>
Committed: Sat Aug 19 01:55:45 2017 +0800
----------------------------------------------------------------------
.../DefaultVisibilityLabelServiceImpl.java | 12 +-
.../visibility/VisibilityController.java | 4 +
.../visibility/VisibilityScanDeleteTracker.java | 19 +-
.../ExpAsStringVisibilityLabelServiceImpl.java | 4 +
.../TestVisibilityLabelsWithDeletes.java | 191 +++++++++++++++++++
5 files changed, 222 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/e9bafeb0/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/DefaultVisibilityLabelServiceImpl.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/DefaultVisibilityLabelServiceImpl.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/DefaultVisibilityLabelServiceImpl.java
index d4a5627..672da8a 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/DefaultVisibilityLabelServiceImpl.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/DefaultVisibilityLabelServiceImpl.java
@@ -551,12 +551,16 @@ public class DefaultVisibilityLabelServiceImpl implements VisibilityLabelService
@Override
public boolean matchVisibility(List<Tag> putVisTags, Byte putTagsFormat, List<Tag> deleteVisTags,
Byte deleteTagsFormat) throws IOException {
+ // Early out if there are no tags in both of cell and delete
+ if (putVisTags.isEmpty() && deleteVisTags.isEmpty()) {
+ return true;
+ }
+ // Early out if one of the tags is empty
+ if (putVisTags.isEmpty() ^ deleteVisTags.isEmpty()) {
+ return false;
+ }
if ((deleteTagsFormat != null && deleteTagsFormat == SORTED_ORDINAL_SERIALIZATION_FORMAT)
&& (putTagsFormat == null || putTagsFormat == SORTED_ORDINAL_SERIALIZATION_FORMAT)) {
- if (putVisTags.isEmpty()) {
- // Early out if there are no tags in the cell
- return false;
- }
if (putTagsFormat == null) {
return matchUnSortedVisibilityTags(putVisTags, deleteVisTags);
} else {
http://git-wip-us.apache.org/repos/asf/hbase/blob/e9bafeb0/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityController.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityController.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityController.java
index 23f0583..130587a 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityController.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityController.java
@@ -1074,6 +1074,10 @@ public class VisibilityController implements MasterObserver, RegionObserver,
public ReturnCode filterKeyValue(Cell cell) throws IOException {
List<Tag> putVisTags = new ArrayList<>();
Byte putCellVisTagsFormat = VisibilityUtils.extractVisibilityTags(cell, putVisTags);
+ if (putVisTags.isEmpty() && deleteCellVisTags.isEmpty()) {
+ // Early out if there are no tags in the cell
+ return ReturnCode.INCLUDE;
+ }
boolean matchFound = VisibilityLabelServiceManager
.getInstance().getVisibilityLabelService()
.matchVisibility(putVisTags, putCellVisTagsFormat, deleteCellVisTags,
http://git-wip-us.apache.org/repos/asf/hbase/blob/e9bafeb0/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityScanDeleteTracker.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityScanDeleteTracker.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityScanDeleteTracker.java
index 67181e1..f62e8d0 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityScanDeleteTracker.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityScanDeleteTracker.java
@@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.security.visibility;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.apache.commons.logging.Log;
@@ -45,6 +46,10 @@ public class VisibilityScanDeleteTracker extends ScanDeleteTracker {
private static final Log LOG = LogFactory.getLog(VisibilityScanDeleteTracker.class);
+ /**
+ * This tag is used for the DELETE cell which has no visibility label.
+ */
+ private static final List<Tag> EMPTY_TAG = Collections.EMPTY_LIST;
// Its better to track the visibility tags in delete based on each type. Create individual
// data structures for tracking each of them. This would ensure that there is no tracking based
// on time and also would handle all cases where deletefamily or deletecolumns is specified with
@@ -110,9 +115,8 @@ public class VisibilityScanDeleteTracker extends ScanDeleteTracker {
private boolean extractDeleteCellVisTags(Cell delCell, Type type) {
// If tag is present in the delete
boolean hasVisTag = false;
- if (delCell.getTagsLength() > 0) {
- Byte deleteCellVisTagsFormat = null;
- switch (type) {
+ Byte deleteCellVisTagsFormat = null;
+ switch (type) {
case DeleteFamily:
List<Tag> delTags = new ArrayList<>();
if (visibilityTagsDeleteFamily == null) {
@@ -122,6 +126,8 @@ public class VisibilityScanDeleteTracker extends ScanDeleteTracker {
if (!delTags.isEmpty()) {
visibilityTagsDeleteFamily.add(new Triple<>(delTags, deleteCellVisTagsFormat, delCell.getTimestamp()));
hasVisTag = true;
+ } else {
+ visibilityTagsDeleteFamily.add(new Triple<>(EMPTY_TAG, deleteCellVisTagsFormat, delCell.getTimestamp()));
}
break;
case DeleteFamilyVersion:
@@ -133,6 +139,8 @@ public class VisibilityScanDeleteTracker extends ScanDeleteTracker {
if (!delTags.isEmpty()) {
visibilityTagsDeleteFamilyVersion.add(new Triple<>(delTags, deleteCellVisTagsFormat, delCell.getTimestamp()));
hasVisTag = true;
+ } else {
+ visibilityTagsDeleteFamilyVersion.add(new Triple<>(EMPTY_TAG, deleteCellVisTagsFormat, delCell.getTimestamp()));
}
break;
case DeleteColumn:
@@ -144,6 +152,8 @@ public class VisibilityScanDeleteTracker extends ScanDeleteTracker {
if (!delTags.isEmpty()) {
visibilityTagsDeleteColumns.add(new Pair<>(delTags, deleteCellVisTagsFormat));
hasVisTag = true;
+ } else {
+ visibilityTagsDeleteColumns.add(new Pair<>(EMPTY_TAG, deleteCellVisTagsFormat));
}
break;
case Delete:
@@ -155,11 +165,12 @@ public class VisibilityScanDeleteTracker extends ScanDeleteTracker {
if (!delTags.isEmpty()) {
visiblityTagsDeleteColumnVersion.add(new Pair<>(delTags, deleteCellVisTagsFormat));
hasVisTag = true;
+ } else {
+ visiblityTagsDeleteColumnVersion.add(new Pair<>(EMPTY_TAG, deleteCellVisTagsFormat));
}
break;
default:
throw new IllegalArgumentException("Invalid delete type");
- }
}
return hasVisTag;
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/e9bafeb0/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/ExpAsStringVisibilityLabelServiceImpl.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/ExpAsStringVisibilityLabelServiceImpl.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/ExpAsStringVisibilityLabelServiceImpl.java
index d8d6f1e..043d08b 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/ExpAsStringVisibilityLabelServiceImpl.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/ExpAsStringVisibilityLabelServiceImpl.java
@@ -418,6 +418,10 @@ public class ExpAsStringVisibilityLabelServiceImpl implements VisibilityLabelSer
private static boolean checkForMatchingVisibilityTagsWithSortedOrder(List<Tag> putVisTags,
List<Tag> deleteVisTags) {
+ // Early out if there are no tags in both of cell and delete
+ if (putVisTags.isEmpty() && deleteVisTags.isEmpty()) {
+ return true;
+ }
boolean matchFound = false;
// If the size does not match. Definitely we are not comparing the equal
// tags.
http://git-wip-us.apache.org/repos/asf/hbase/blob/e9bafeb0/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java
index dfc48bf..4f48236 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java
@@ -17,9 +17,12 @@
*/
package org.apache.hadoop.hbase.security.visibility;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellScanner;
+import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HConstants;
@@ -41,6 +44,9 @@ import org.apache.hadoop.hbase.security.User;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.testclassification.SecurityTests;
import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.DefaultEnvironmentEdge;
+import org.apache.hadoop.hbase.util.EnvironmentEdge;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
import org.apache.hadoop.hbase.util.Threads;
import org.junit.After;
import org.junit.AfterClass;
@@ -67,6 +73,7 @@ import static org.junit.Assert.assertTrue;
*/
@Category({SecurityTests.class, MediumTests.class})
public class TestVisibilityLabelsWithDeletes {
+ private static final Log LOG = LogFactory.getLog(TestVisibilityLabelsWithDeletes.class);
private static final String TOPSECRET = "TOPSECRET";
private static final String PUBLIC = "PUBLIC";
private static final String PRIVATE = "PRIVATE";
@@ -3285,4 +3292,188 @@ public class TestVisibilityLabelsWithDeletes {
public static <T> List<T> createList(T... ts) {
return new ArrayList<>(Arrays.asList(ts));
}
+
+
+ private enum DeleteMark {
+ ROW,
+ FAMILY,
+ FAMILY_VERSION,
+ COLUMN,
+ CELL
+ }
+
+ private static Delete addDeleteMark(Delete d, DeleteMark mark, long now) {
+ switch (mark) {
+ case ROW:
+ break;
+ case FAMILY:
+ d.addFamily(fam);
+ break;
+ case FAMILY_VERSION:
+ d.addFamilyVersion(fam, now);
+ break;
+ case COLUMN:
+ d.addColumns(fam, qual);
+ break;
+ case CELL:
+ d.addColumn(fam, qual);
+ break;
+ default:
+ break;
+ }
+ return d;
+ }
+
+ @Test
+ public void testDeleteCellWithoutVisibility() throws IOException, InterruptedException {
+ for (DeleteMark mark : DeleteMark.values()) {
+ testDeleteCellWithoutVisibility(mark);
+ }
+ }
+
+ private void testDeleteCellWithoutVisibility(DeleteMark mark) throws IOException, InterruptedException {
+ setAuths();
+ final TableName tableName = TableName.valueOf("testDeleteCellWithoutVisibility-" + mark.name());
+ Admin hBaseAdmin = TEST_UTIL.getAdmin();
+ HColumnDescriptor colDesc = new HColumnDescriptor(fam);
+ colDesc.setMaxVersions(5);
+ HTableDescriptor desc = new HTableDescriptor(tableName);
+ desc.addFamily(colDesc);
+ hBaseAdmin.createTable(desc);
+ long now = EnvironmentEdgeManager.currentTime();
+ List<Put> puts = new ArrayList<>(1);
+ Put put = new Put(row1);
+ if (mark == DeleteMark.FAMILY_VERSION) {
+ put.addColumn(fam, qual, now, value);
+ } else {
+ put.addColumn(fam, qual, value);
+ }
+
+ puts.add(put);
+ try (Table table = TEST_UTIL.getConnection().getTable(tableName)){
+ table.put(puts);
+ Result r = table.get(new Get(row1));
+ assertEquals(1, r.size());
+ assertEquals(Bytes.toString(value), Bytes.toString(CellUtil.cloneValue(r.rawCells()[0])));
+
+ Delete d = addDeleteMark(new Delete(row1), mark, now);
+ table.delete(d);
+ r = table.get(new Get(row1));
+ assertEquals(0, r.size());
+ }
+ }
+
+ @Test
+ public void testDeleteCellWithVisibility() throws IOException, InterruptedException {
+ for (DeleteMark mark : DeleteMark.values()) {
+ testDeleteCellWithVisibility(mark);
+ testDeleteCellWithVisibilityV2(mark);
+ }
+ }
+
+ private void testDeleteCellWithVisibility(DeleteMark mark) throws IOException, InterruptedException {
+ setAuths();
+ final TableName tableName = TableName.valueOf("testDeleteCellWithVisibility-" + mark.name());
+ Admin hBaseAdmin = TEST_UTIL.getAdmin();
+ HColumnDescriptor colDesc = new HColumnDescriptor(fam);
+ colDesc.setMaxVersions(5);
+ HTableDescriptor desc = new HTableDescriptor(tableName);
+ desc.addFamily(colDesc);
+ hBaseAdmin.createTable(desc);
+ long now = EnvironmentEdgeManager.currentTime();
+ List<Put> puts = new ArrayList<>(2);
+ Put put = new Put(row1);
+ if (mark == DeleteMark.FAMILY_VERSION) {
+ put.addColumn(fam, qual, now, value);
+ } else {
+ put.addColumn(fam, qual, value);
+ }
+ puts.add(put);
+ put = new Put(row1);
+ if (mark == DeleteMark.FAMILY_VERSION) {
+ put.addColumn(fam, qual, now, value1);
+ } else {
+ put.addColumn(fam, qual, value1);
+ }
+ put.setCellVisibility(new CellVisibility(PRIVATE));
+ puts.add(put);
+ try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
+ table.put(puts);
+ Result r = table.get(new Get(row1));
+ assertEquals(0, r.size());
+ r = table.get(new Get(row1).setAuthorizations(new Authorizations(PRIVATE)));
+ assertEquals(1, r.size());
+ assertEquals(Bytes.toString(value1), Bytes.toString(CellUtil.cloneValue(r.rawCells()[0])));
+
+ Delete d = addDeleteMark(new Delete(row1), mark, now);
+ table.delete(d);
+
+ r = table.get(new Get(row1));
+ assertEquals(0, r.size());
+ r = table.get(new Get(row1).setAuthorizations(new Authorizations(PRIVATE)));
+ assertEquals(1, r.size());
+ assertEquals(Bytes.toString(value1), Bytes.toString(CellUtil.cloneValue(r.rawCells()[0])));
+
+ d = addDeleteMark(new Delete(row1).setCellVisibility(new CellVisibility(PRIVATE)), mark, now);
+ table.delete(d);
+
+ r = table.get(new Get(row1));
+ assertEquals(0, r.size());
+ r = table.get(new Get(row1).setAuthorizations(new Authorizations(PRIVATE)));
+ assertEquals(0, r.size());
+ }
+ }
+
+ private void testDeleteCellWithVisibilityV2(DeleteMark mark) throws IOException, InterruptedException {
+ setAuths();
+ final TableName tableName = TableName.valueOf("testDeleteCellWithVisibilityV2-" + mark.name());
+ Admin hBaseAdmin = TEST_UTIL.getAdmin();
+ HColumnDescriptor colDesc = new HColumnDescriptor(fam);
+ colDesc.setMaxVersions(5);
+ HTableDescriptor desc = new HTableDescriptor(tableName);
+ desc.addFamily(colDesc);
+ hBaseAdmin.createTable(desc);
+ long now = EnvironmentEdgeManager.currentTime();
+ List<Put> puts = new ArrayList<>(2);
+ Put put = new Put(row1);
+ put.setCellVisibility(new CellVisibility(PRIVATE));
+ if (mark == DeleteMark.FAMILY_VERSION) {
+ put.addColumn(fam, qual, now, value);
+ } else {
+ put.addColumn(fam, qual, value);
+ }
+ puts.add(put);
+ put = new Put(row1);
+ if (mark == DeleteMark.FAMILY_VERSION) {
+ put.addColumn(fam, qual, now, value1);
+ } else {
+ put.addColumn(fam, qual, value1);
+ }
+ puts.add(put);
+ try (Table table = TEST_UTIL.getConnection().getTable(tableName)){
+ table.put(puts);
+ Result r = table.get(new Get(row1));
+ assertEquals(1, r.size());
+ assertEquals(Bytes.toString(value1), Bytes.toString(CellUtil.cloneValue(r.rawCells()[0])));
+ r = table.get(new Get(row1).setAuthorizations(new Authorizations(PRIVATE)));
+ assertEquals(1, r.size());
+ assertEquals(Bytes.toString(value1), Bytes.toString(CellUtil.cloneValue(r.rawCells()[0])));
+
+ Delete d = addDeleteMark(new Delete(row1), mark, now);
+ table.delete(d);
+
+ r = table.get(new Get(row1));
+ assertEquals(0, r.size());
+ r = table.get(new Get(row1).setAuthorizations(new Authorizations(PRIVATE)));
+ assertEquals(0, r.size());
+
+ d = addDeleteMark(new Delete(row1).setCellVisibility(new CellVisibility(PRIVATE)), mark, now);
+ table.delete(d);
+
+ r = table.get(new Get(row1));
+ assertEquals(0, r.size());
+ r = table.get(new Get(row1).setAuthorizations(new Authorizations(PRIVATE)));
+ assertEquals(0, r.size());
+ }
+ }
}
[19/21] hbase git commit: HBASE-18644 Duplicate compactionQueueLength
metric in Region Server metrics
Posted by st...@apache.org.
HBASE-18644 Duplicate compactionQueueLength metric in Region Server metrics
Signed-off-by: Andrew Purtell <ap...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/23ddf69c
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/23ddf69c
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/23ddf69c
Branch: refs/heads/HBASE-14070.HLC
Commit: 23ddf69c00a90673184f803ce4d76266ed0d45c5
Parents: 5895538
Author: Sukumar Maddineni <su...@gmail.com>
Authored: Mon Aug 21 16:54:42 2017 -0700
Committer: Andrew Purtell <ap...@apache.org>
Committed: Mon Aug 21 17:43:17 2017 -0700
----------------------------------------------------------------------
.../hadoop/hbase/regionserver/MetricsRegionServerSourceImpl.java | 2 --
1 file changed, 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/23ddf69c/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSourceImpl.java
----------------------------------------------------------------------
diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSourceImpl.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSourceImpl.java
index e69e17c..77643ca 100644
--- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSourceImpl.java
+++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerSourceImpl.java
@@ -398,8 +398,6 @@ public class MetricsRegionServerSourceImpl
rsWrap.getSmallCompactionQueueSize())
.addGauge(Interns.info(LARGE_COMPACTION_QUEUE_LENGTH, LARGE_COMPACTION_QUEUE_LENGTH_DESC),
rsWrap.getLargeCompactionQueueSize())
- .addGauge(Interns.info(COMPACTION_QUEUE_LENGTH, COMPACTION_QUEUE_LENGTH_DESC),
- rsWrap.getCompactionQueueSize())
.addGauge(Interns.info(FLUSH_QUEUE_LENGTH, FLUSH_QUEUE_LENGTH_DESC),
rsWrap.getFlushQueueSize())
[17/21] hbase git commit: HBASE-18627 Fix
TestRegionServerReadRequestMetrics (Chia-Ping Tsai)
Posted by st...@apache.org.
HBASE-18627 Fix TestRegionServerReadRequestMetrics (Chia-Ping Tsai)
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/bf343da4
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/bf343da4
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/bf343da4
Branch: refs/heads/HBASE-14070.HLC
Commit: bf343da4a445cd9ed1da953e2b24861a5b869846
Parents: 078a6be
Author: Michael Stack <st...@apache.org>
Authored: Mon Aug 21 15:38:15 2017 -0700
Committer: Michael Stack <st...@apache.org>
Committed: Mon Aug 21 15:38:15 2017 -0700
----------------------------------------------------------------------
.../hbase/regionserver/TestRegionServerReadRequestMetrics.java | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/bf343da4/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerReadRequestMetrics.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerReadRequestMetrics.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerReadRequestMetrics.java
index 297aa50..2cd1559 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerReadRequestMetrics.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerReadRequestMetrics.java
@@ -89,6 +89,8 @@ public class TestRegionServerReadRequestMetrics {
@BeforeClass
public static void setUpOnce() throws Exception {
// Default starts one regionserver only.
+ TEST_UTIL.getConfiguration().setBoolean(LoadBalancer.TABLES_ON_MASTER, true);
+ TEST_UTIL.getConfiguration().setBoolean(LoadBalancer.SYSTEM_TABLES_ON_MASTER, true);
TEST_UTIL.startMiniCluster();
admin = TEST_UTIL.getAdmin();
serverNames = admin.getClusterStatus().getServers();
[15/21] hbase git commit: Revert "HBASE-Fix
client.TestClientClusterStatus (Chia-Ping Tsai)" Revert because missing JIRA
number
Posted by st...@apache.org.
Revert "HBASE-Fix client.TestClientClusterStatus (Chia-Ping Tsai)"
Revert because missing JIRA number
This reverts commit 7b3291fa8b836be9539817876799994fac5de335.
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/fbbae877
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/fbbae877
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/fbbae877
Branch: refs/heads/HBASE-14070.HLC
Commit: fbbae8774ca3162245c0d883c9f477f7d92bc8a5
Parents: 7b3291f
Author: Michael Stack <st...@apache.org>
Authored: Mon Aug 21 14:38:22 2017 -0700
Committer: Michael Stack <st...@apache.org>
Committed: Mon Aug 21 14:38:22 2017 -0700
----------------------------------------------------------------------
.../hadoop/hbase/client/TestClientClusterStatus.java | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/fbbae877/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestClientClusterStatus.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestClientClusterStatus.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestClientClusterStatus.java
index 484ee06..49b4ff2 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestClientClusterStatus.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestClientClusterStatus.java
@@ -65,7 +65,7 @@ public class TestClientClusterStatus {
RegionServerThread rst = rsts.get(rsts.size() - 1);
DEAD = rst.getRegionServer();
DEAD.stop("Test dead servers status");
- while (rst.isAlive()) {
+ while (!DEAD.isStopped()) {
Thread.sleep(500);
}
}
@@ -155,11 +155,9 @@ public class TestClientClusterStatus {
Assert.assertNotNull(status);
Assert.assertNotNull(status.getServers());
// exclude a dead region server
- Assert.assertEquals(SLAVES -1, numRs);
- // live servers = nums of regionservers
- // By default, HMaster don't carry any regions so it won't report its load.
- // Hence, it won't be in the server list.
- Assert.assertEquals(status.getServers().size(), numRs);
+ Assert.assertEquals(SLAVES, numRs);
+ // live servers = primary master + nums of regionservers
+ Assert.assertEquals(status.getServers().size() + 1 /*Master*/, numRs);
Assert.assertTrue(status.getRegionsCount() > 0);
Assert.assertNotNull(status.getDeadServerNames());
Assert.assertEquals(1, status.getDeadServersSize());
[06/21] hbase git commit: HBASE-18471 The DeleteFamily cell is
skipped when StoreScanner seeks to next column
Posted by st...@apache.org.
HBASE-18471 The DeleteFamily cell is skipped when StoreScanner seeks to next column
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/56f9e1a6
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/56f9e1a6
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/56f9e1a6
Branch: refs/heads/HBASE-14070.HLC
Commit: 56f9e1a60af224f8f3b0453932155ca46d44cf71
Parents: e9bafeb
Author: Chia-Ping Tsai <ch...@gmail.com>
Authored: Sat Aug 19 02:15:12 2017 +0800
Committer: Chia-Ping Tsai <ch...@gmail.com>
Committed: Sat Aug 19 02:15:12 2017 +0800
----------------------------------------------------------------------
.../java/org/apache/hadoop/hbase/CellUtil.java | 53 ++++++++++
.../querymatcher/ScanQueryMatcher.java | 13 +++
.../hbase/client/TestFromClientSide3.java | 101 +++++++++++++++++++
3 files changed, 167 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/56f9e1a6/hbase-common/src/main/java/org/apache/hadoop/hbase/CellUtil.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/CellUtil.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/CellUtil.java
index 1146de4..03d8b70 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/CellUtil.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/CellUtil.java
@@ -3135,4 +3135,57 @@ public final class CellUtil {
return Type.DeleteFamily.getCode();
}
}
+
+ /**
+ * @return An new cell is located following input cell. If both of type and timestamp are
+ * minimum, the input cell will be returned directly.
+ */
+ @InterfaceAudience.Private
+ public static Cell createNextOnRowCol(Cell cell) {
+ long ts = cell.getTimestamp();
+ byte type = cell.getTypeByte();
+ if (type != Type.Minimum.getCode()) {
+ type = KeyValue.Type.values()[KeyValue.Type.codeToType(type).ordinal() - 1].getCode();
+ } else if (ts != HConstants.OLDEST_TIMESTAMP) {
+ ts = ts - 1;
+ type = Type.Maximum.getCode();
+ } else {
+ return cell;
+ }
+ return createNextOnRowCol(cell, ts, type);
+ }
+
+ private static Cell createNextOnRowCol(Cell cell, long ts, byte type) {
+ if (cell instanceof ByteBufferCell) {
+ return new LastOnRowColByteBufferCell(((ByteBufferCell) cell).getRowByteBuffer(),
+ ((ByteBufferCell) cell).getRowPosition(), cell.getRowLength(),
+ ((ByteBufferCell) cell).getFamilyByteBuffer(),
+ ((ByteBufferCell) cell).getFamilyPosition(), cell.getFamilyLength(),
+ ((ByteBufferCell) cell).getQualifierByteBuffer(),
+ ((ByteBufferCell) cell).getQualifierPosition(), cell.getQualifierLength()) {
+ @Override
+ public long getTimestamp() {
+ return ts;
+ }
+
+ @Override
+ public byte getTypeByte() {
+ return type;
+ }
+ };
+ }
+ return new LastOnRowColCell(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength(),
+ cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength(),
+ cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength()) {
+ @Override
+ public long getTimestamp() {
+ return ts;
+ }
+
+ @Override
+ public byte getTypeByte() {
+ return type;
+ }
+ };
+ }
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/56f9e1a6/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/querymatcher/ScanQueryMatcher.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/querymatcher/ScanQueryMatcher.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/querymatcher/ScanQueryMatcher.java
index 524d3f7..f00a400 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/querymatcher/ScanQueryMatcher.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/querymatcher/ScanQueryMatcher.java
@@ -290,6 +290,19 @@ public abstract class ScanQueryMatcher implements ShipperListener {
public abstract boolean moreRowsMayExistAfter(Cell cell);
public Cell getKeyForNextColumn(Cell cell) {
+ // We aren't sure whether any DeleteFamily cells exist, so we can't skip to next column.
+ // TODO: Current way disable us to seek to next column quickly. Is there any better solution?
+ // see HBASE-18471 for more details
+ // see TestFromClientSide3#testScanAfterDeletingSpecifiedRow
+ // see TestFromClientSide3#testScanAfterDeletingSpecifiedRowV2
+ if (cell.getQualifierLength() == 0) {
+ Cell nextKey = CellUtil.createNextOnRowCol(cell);
+ if (nextKey != cell) {
+ return nextKey;
+ }
+ // The cell is at the end of row/family/qualifier, so it is impossible to find any DeleteFamily cells.
+ // Let us seek to next column.
+ }
ColumnCount nextColumn = columns.getColumnHint();
if (nextColumn == null) {
return CellUtil.createLastOnRowCol(cell);
http://git-wip-us.apache.org/repos/asf/hbase/blob/56f9e1a6/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide3.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide3.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide3.java
index f20c050..7b6c9a8 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide3.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide3.java
@@ -34,6 +34,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.Coprocessor;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
@@ -159,6 +160,106 @@ public class TestFromClientSide3 {
}
}
+ private static List<Cell> toList(ResultScanner scanner) {
+ try {
+ List<Cell> cells = new ArrayList<>();
+ for (Result r : scanner) {
+ cells.addAll(r.listCells());
+ }
+ return cells;
+ } finally {
+ scanner.close();
+ }
+ }
+
+ @Test
+ public void testScanAfterDeletingSpecifiedRow() throws IOException {
+ TableName tableName = TableName.valueOf(name.getMethodName());
+ TableDescriptor desc = TableDescriptorBuilder.newBuilder(tableName)
+ .addColumnFamily(ColumnFamilyDescriptorBuilder.of(FAMILY))
+ .build();
+ TEST_UTIL.getAdmin().createTable(desc);
+ byte[] row = Bytes.toBytes("SpecifiedRow");
+ byte[] value0 = Bytes.toBytes("value_0");
+ byte[] value1 = Bytes.toBytes("value_1");
+ try (Table t = TEST_UTIL.getConnection().getTable(tableName)) {
+ Put put = new Put(row);
+ put.addColumn(FAMILY, QUALIFIER, VALUE);
+ t.put(put);
+ Delete d = new Delete(row);
+ t.delete(d);
+ put = new Put(row);
+ put.addColumn(FAMILY, null, value0);
+ t.put(put);
+ put = new Put(row);
+ put.addColumn(FAMILY, null, value1);
+ t.put(put);
+ List<Cell> cells = toList(t.getScanner(new Scan()));
+ assertEquals(1, cells.size());
+ assertEquals("value_1", Bytes.toString(CellUtil.cloneValue(cells.get(0))));
+
+ cells = toList(t.getScanner(new Scan().addFamily(FAMILY)));
+ assertEquals(1, cells.size());
+ assertEquals("value_1", Bytes.toString(CellUtil.cloneValue(cells.get(0))));
+
+ cells = toList(t.getScanner(new Scan().addColumn(FAMILY, QUALIFIER)));
+ assertEquals(0, cells.size());
+
+ TEST_UTIL.getAdmin().flush(tableName);
+ cells = toList(t.getScanner(new Scan()));
+ assertEquals(1, cells.size());
+ assertEquals("value_1", Bytes.toString(CellUtil.cloneValue(cells.get(0))));
+
+ cells = toList(t.getScanner(new Scan().addFamily(FAMILY)));
+ assertEquals(1, cells.size());
+ assertEquals("value_1", Bytes.toString(CellUtil.cloneValue(cells.get(0))));
+
+ cells = toList(t.getScanner(new Scan().addColumn(FAMILY, QUALIFIER)));
+ assertEquals(0, cells.size());
+ }
+ }
+
+ @Test
+ public void testScanAfterDeletingSpecifiedRowV2() throws IOException {
+ TableName tableName = TableName.valueOf(name.getMethodName());
+ TableDescriptor desc = TableDescriptorBuilder.newBuilder(tableName)
+ .addColumnFamily(ColumnFamilyDescriptorBuilder.of(FAMILY))
+ .build();
+ TEST_UTIL.getAdmin().createTable(desc);
+ byte[] row = Bytes.toBytes("SpecifiedRow");
+ byte[] qual0 = Bytes.toBytes("qual0");
+ byte[] qual1 = Bytes.toBytes("qual1");
+ try (Table t = TEST_UTIL.getConnection().getTable(tableName)) {
+ Delete d = new Delete(row);
+ t.delete(d);
+
+ Put put = new Put(row);
+ put.addColumn(FAMILY, null, VALUE);
+ t.put(put);
+
+ put = new Put(row);
+ put.addColumn(FAMILY, qual1, qual1);
+ t.put(put);
+
+ put = new Put(row);
+ put.addColumn(FAMILY, qual0, qual0);
+ t.put(put);
+
+ Result r = t.get(new Get(row));
+ assertEquals(3, r.size());
+ assertEquals("testValue", Bytes.toString(CellUtil.cloneValue(r.rawCells()[0])));
+ assertEquals("qual0", Bytes.toString(CellUtil.cloneValue(r.rawCells()[1])));
+ assertEquals("qual1", Bytes.toString(CellUtil.cloneValue(r.rawCells()[2])));
+
+ TEST_UTIL.getAdmin().flush(tableName);
+ r = t.get(new Get(row));
+ assertEquals(3, r.size());
+ assertEquals("testValue", Bytes.toString(CellUtil.cloneValue(r.rawCells()[0])));
+ assertEquals("qual0", Bytes.toString(CellUtil.cloneValue(r.rawCells()[1])));
+ assertEquals("qual1", Bytes.toString(CellUtil.cloneValue(r.rawCells()[2])));
+ }
+ }
+
// override the config settings at the CF level and ensure priority
@Test(timeout = 60000)
public void testAdvancedConfigOverride() throws Exception {
[02/21] hbase git commit: HBASE-18489 Addendum revert protected to
private, give shaded import a separated block
Posted by st...@apache.org.
HBASE-18489 Addendum revert protected to private, give shaded import a separated block
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/2af2b4c0
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/2af2b4c0
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/2af2b4c0
Branch: refs/heads/HBASE-14070.HLC
Commit: 2af2b4c040ca2de9c10ee6dcff92b55c37956faf
Parents: 1ab6882f
Author: zhangduo <zh...@apache.org>
Authored: Fri Aug 18 10:47:30 2017 +0800
Committer: zhangduo <zh...@apache.org>
Committed: Fri Aug 18 10:54:49 2017 +0800
----------------------------------------------------------------------
.../hbase/regionserver/RSRpcServices.java | 23 ++++++++++----------
.../hadoop/hbase/regionserver/StoreScanner.java | 5 +++--
2 files changed, 15 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/2af2b4c0/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
index 696bd76..9a25275 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
@@ -115,6 +115,18 @@ import org.apache.hadoop.hbase.regionserver.handler.OpenRegionHandler;
import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
import org.apache.hadoop.hbase.security.Superusers;
import org.apache.hadoop.hbase.security.User;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.DNS;
+import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.hadoop.hbase.util.Pair;
+import org.apache.hadoop.hbase.util.ServerRegionReplicaUtil;
+import org.apache.hadoop.hbase.util.Strings;
+import org.apache.hadoop.hbase.wal.WAL;
+import org.apache.hadoop.hbase.wal.WALKey;
+import org.apache.hadoop.hbase.wal.WALSplitter;
+import org.apache.hadoop.hbase.zookeeper.ZKSplitLog;
+import org.apache.zookeeper.KeeperException;
+
import org.apache.hadoop.hbase.shaded.com.google.common.annotations.VisibleForTesting;
import org.apache.hadoop.hbase.shaded.com.google.common.cache.Cache;
import org.apache.hadoop.hbase.shaded.com.google.common.cache.CacheBuilder;
@@ -208,17 +220,6 @@ import org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.BulkLoadDescr
import org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.CompactionDescriptor;
import org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.FlushDescriptor;
import org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.RegionEventDescriptor;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.hbase.util.DNS;
-import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
-import org.apache.hadoop.hbase.util.Pair;
-import org.apache.hadoop.hbase.util.ServerRegionReplicaUtil;
-import org.apache.hadoop.hbase.util.Strings;
-import org.apache.hadoop.hbase.wal.WAL;
-import org.apache.hadoop.hbase.wal.WALKey;
-import org.apache.hadoop.hbase.wal.WALSplitter;
-import org.apache.hadoop.hbase.zookeeper.ZKSplitLog;
-import org.apache.zookeeper.KeeperException;
/**
* Implements the regionserver RPC services.
http://git-wip-us.apache.org/repos/asf/hbase/blob/2af2b4c0/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java
index 5286c39..a220f54 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java
@@ -48,10 +48,11 @@ import org.apache.hadoop.hbase.regionserver.querymatcher.CompactionScanQueryMatc
import org.apache.hadoop.hbase.regionserver.querymatcher.LegacyScanQueryMatcher;
import org.apache.hadoop.hbase.regionserver.querymatcher.ScanQueryMatcher;
import org.apache.hadoop.hbase.regionserver.querymatcher.UserScanQueryMatcher;
-import org.apache.hadoop.hbase.shaded.com.google.common.annotations.VisibleForTesting;
import org.apache.hadoop.hbase.util.CollectionUtils;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+import org.apache.hadoop.hbase.shaded.com.google.common.annotations.VisibleForTesting;
+
/**
* Scanner scans both the memstore and the Store. Coalesce KeyValue stream into List<KeyValue>
* for a single row.
@@ -104,7 +105,7 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner
* KVs skipped via seeking to next row/column. TODO: estimate them?
*/
private long kvsScanned = 0;
- protected Cell prevCell = null;
+ private Cell prevCell = null;
private final long preadMaxBytes;
private long bytesRead;
[16/21] hbase git commit: HBASE-18634 HBASE-Fix
client.TestClientClusterStatus (Chia-Ping Tsai) This is a revert of a revert;
i.e. a reapply just to fix commit message.
Posted by st...@apache.org.
HBASE-18634 HBASE-Fix client.TestClientClusterStatus (Chia-Ping Tsai)
This is a revert of a revert; i.e. a reapply just to fix commit message.
This reverts commit fbbae8774ca3162245c0d883c9f477f7d92bc8a5.
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/078a6be7
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/078a6be7
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/078a6be7
Branch: refs/heads/HBASE-14070.HLC
Commit: 078a6be7d0ccd370016ba351090e21ea0e041e86
Parents: fbbae87
Author: Michael Stack <st...@apache.org>
Authored: Mon Aug 21 14:38:58 2017 -0700
Committer: Michael Stack <st...@apache.org>
Committed: Mon Aug 21 14:38:58 2017 -0700
----------------------------------------------------------------------
.../hadoop/hbase/client/TestClientClusterStatus.java | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/078a6be7/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestClientClusterStatus.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestClientClusterStatus.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestClientClusterStatus.java
index 49b4ff2..484ee06 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestClientClusterStatus.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestClientClusterStatus.java
@@ -65,7 +65,7 @@ public class TestClientClusterStatus {
RegionServerThread rst = rsts.get(rsts.size() - 1);
DEAD = rst.getRegionServer();
DEAD.stop("Test dead servers status");
- while (!DEAD.isStopped()) {
+ while (rst.isAlive()) {
Thread.sleep(500);
}
}
@@ -155,9 +155,11 @@ public class TestClientClusterStatus {
Assert.assertNotNull(status);
Assert.assertNotNull(status.getServers());
// exclude a dead region server
- Assert.assertEquals(SLAVES, numRs);
- // live servers = primary master + nums of regionservers
- Assert.assertEquals(status.getServers().size() + 1 /*Master*/, numRs);
+ Assert.assertEquals(SLAVES -1, numRs);
+ // live servers = nums of regionservers
+ // By default, HMaster don't carry any regions so it won't report its load.
+ // Hence, it won't be in the server list.
+ Assert.assertEquals(status.getServers().size(), numRs);
Assert.assertTrue(status.getRegionsCount() > 0);
Assert.assertNotNull(status.getDeadServerNames());
Assert.assertEquals(1, status.getDeadServersSize());
[04/21] hbase git commit: HBASE-18617 FuzzyRowKeyFilter should not
modify the filter pairs (vinisha)
Posted by st...@apache.org.
HBASE-18617 FuzzyRowKeyFilter should not modify the filter pairs (vinisha)
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/e2532ecd
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/e2532ecd
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/e2532ecd
Branch: refs/heads/HBASE-14070.HLC
Commit: e2532ecd1e6093f9c56b16e2e8e6865bd0ad1cb7
Parents: 7fee03e
Author: tedyu <yu...@gmail.com>
Authored: Fri Aug 18 09:10:20 2017 -0700
Committer: tedyu <yu...@gmail.com>
Committed: Fri Aug 18 09:10:20 2017 -0700
----------------------------------------------------------------------
.../hadoop/hbase/filter/FuzzyRowFilter.java | 22 +++++++++++-----
.../filter/TestFuzzyRowFilterEndToEnd.java | 27 +++++++++++++-------
2 files changed, 33 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/e2532ecd/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FuzzyRowFilter.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FuzzyRowFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FuzzyRowFilter.java
index 20c6656..2aa4857 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FuzzyRowFilter.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FuzzyRowFilter.java
@@ -76,23 +76,31 @@ public class FuzzyRowFilter extends FilterBase {
private RowTracker tracker;
public FuzzyRowFilter(List<Pair<byte[], byte[]>> fuzzyKeysData) {
- Pair<byte[], byte[]> p;
- for (int i = 0; i < fuzzyKeysData.size(); i++) {
- p = fuzzyKeysData.get(i);
- if (p.getFirst().length != p.getSecond().length) {
+ List<Pair<byte[], byte[]>> fuzzyKeyDataCopy = new ArrayList<>(fuzzyKeysData.size());
+
+ for (Pair<byte[], byte[]> aFuzzyKeysData : fuzzyKeysData) {
+ if (aFuzzyKeysData.getFirst().length != aFuzzyKeysData.getSecond().length) {
Pair<String, String> readable =
- new Pair<>(Bytes.toStringBinary(p.getFirst()), Bytes.toStringBinary(p
- .getSecond()));
+ new Pair<>(Bytes.toStringBinary(aFuzzyKeysData.getFirst()), Bytes.toStringBinary(aFuzzyKeysData.getSecond()));
throw new IllegalArgumentException("Fuzzy pair lengths do not match: " + readable);
}
+
+ Pair<byte[], byte[]> p = new Pair<>();
+ // create a copy of pair bytes so that they are not modified by the filter.
+ p.setFirst(Arrays.copyOf(aFuzzyKeysData.getFirst(), aFuzzyKeysData.getFirst().length));
+ p.setSecond(Arrays.copyOf(aFuzzyKeysData.getSecond(), aFuzzyKeysData.getSecond().length));
+
// update mask ( 0 -> -1 (0xff), 1 -> 2)
p.setSecond(preprocessMask(p.getSecond()));
preprocessSearchKey(p);
+
+ fuzzyKeyDataCopy.add(p);
}
- this.fuzzyKeysData = fuzzyKeysData;
+ this.fuzzyKeysData = fuzzyKeyDataCopy;
this.tracker = new RowTracker();
}
+
private void preprocessSearchKey(Pair<byte[], byte[]> p) {
if (!UNSAFE_UNALIGNED) {
// do nothing
http://git-wip-us.apache.org/repos/asf/hbase/blob/e2532ecd/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestFuzzyRowFilterEndToEnd.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestFuzzyRowFilterEndToEnd.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestFuzzyRowFilterEndToEnd.java
index 686c2a2..b043e07 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestFuzzyRowFilterEndToEnd.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestFuzzyRowFilterEndToEnd.java
@@ -17,13 +17,6 @@
*/
package org.apache.hadoop.hbase.filter;
-import static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.List;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
@@ -42,6 +35,7 @@ import org.apache.hadoop.hbase.filter.FilterList.Operator;
import org.apache.hadoop.hbase.regionserver.ConstantSizeRegionSplitPolicy;
import org.apache.hadoop.hbase.regionserver.HRegion;
import org.apache.hadoop.hbase.regionserver.RegionScanner;
+import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
import org.apache.hadoop.hbase.testclassification.FilterTests;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.util.Bytes;
@@ -53,10 +47,16 @@ import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
-
-import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
import org.junit.rules.TestName;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+
/**
*/
@Category({ FilterTests.class, MediumTests.class })
@@ -140,6 +140,11 @@ public class TestFuzzyRowFilterEndToEnd {
List<Pair<byte[], byte[]>> data = new ArrayList<>();
byte[] fuzzyKey = Bytes.toBytesBinary("\\x9B\\x00\\x044e");
byte[] mask = new byte[] { 0, 0, 0, 0, 0 };
+
+ // copy the fuzzy key and mask to test HBASE-18617
+ byte[] copyFuzzyKey = Arrays.copyOf(fuzzyKey, fuzzyKey.length);
+ byte[] copyMask = Arrays.copyOf(mask, mask.length);
+
data.add(new Pair<>(fuzzyKey, mask));
FuzzyRowFilter filter = new FuzzyRowFilter(data);
@@ -152,6 +157,10 @@ public class TestFuzzyRowFilterEndToEnd {
total++;
}
assertEquals(2, total);
+
+ assertEquals(true, Arrays.equals(copyFuzzyKey, fuzzyKey));
+ assertEquals(true, Arrays.equals(copyMask, mask));
+
TEST_UTIL.deleteTable(TableName.valueOf(name.getMethodName()));
}
[08/21] hbase git commit: HBASE-18631 Allow ChaosMonkey properties to
be specified in hbase-site
Posted by st...@apache.org.
HBASE-18631 Allow ChaosMonkey properties to be specified in hbase-site
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/13028d71
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/13028d71
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/13028d71
Branch: refs/heads/HBASE-14070.HLC
Commit: 13028d71576eebda3f5a831903e2a2e6d5f97ff4
Parents: b932d38
Author: Josh Elser <el...@apache.org>
Authored: Fri Aug 18 22:25:14 2017 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Sun Aug 20 14:51:32 2017 -0400
----------------------------------------------------------------------
.../hadoop/hbase/IntegrationTestBase.java | 21 +++++++++
.../hadoop/hbase/TestIntegrationTestBase.java | 48 ++++++++++++++++++++
.../hbase/chaos/factories/MonkeyConstants.java | 11 +++++
3 files changed, 80 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/13028d71/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestBase.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestBase.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestBase.java
index d3433c7..46f0490 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestBase.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestBase.java
@@ -19,6 +19,7 @@
package org.apache.hadoop.hbase;
import java.io.IOException;
+import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
@@ -27,6 +28,7 @@ import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.chaos.factories.MonkeyConstants;
import org.apache.hadoop.hbase.chaos.factories.MonkeyFactory;
import org.apache.hadoop.hbase.chaos.monkies.ChaosMonkey;
import org.apache.hadoop.hbase.util.AbstractHBaseTool;
@@ -86,6 +88,10 @@ public abstract class IntegrationTestBase extends AbstractHBaseTool {
noClusterCleanUp = true;
}
monkeyProps = new Properties();
+ // Add entries for the CM from hbase-site.xml as a convenience.
+ // Do this prior to loading from the properties file to make sure those in the properties
+ // file are given precedence to those in hbase-site.xml (backwards compatibility).
+ loadMonkeyProperties(monkeyProps, HBaseConfiguration.create());
if (cmd.hasOption(CHAOS_MONKEY_PROPS)) {
String chaosMonkeyPropsFile = cmd.getOptionValue(CHAOS_MONKEY_PROPS);
if (StringUtils.isNotEmpty(chaosMonkeyPropsFile)) {
@@ -100,6 +106,21 @@ public abstract class IntegrationTestBase extends AbstractHBaseTool {
}
}
+ /**
+ * Loads entries from the provided {@code conf} into {@code props} when the configuration key
+ * is one that may be configuring ChaosMonkey actions.
+ */
+ void loadMonkeyProperties(Properties props, Configuration conf) {
+ for (Entry<String,String> entry : conf) {
+ for (String prefix : MonkeyConstants.MONKEY_CONFIGURATION_KEY_PREFIXES) {
+ if (entry.getKey().startsWith(prefix)) {
+ props.put(entry.getKey(), entry.getValue());
+ break;
+ }
+ }
+ }
+ }
+
@Override
protected void processOptions(CommandLine cmd) {
processBaseOptions(cmd);
http://git-wip-us.apache.org/repos/asf/hbase/blob/13028d71/hbase-it/src/test/java/org/apache/hadoop/hbase/TestIntegrationTestBase.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/TestIntegrationTestBase.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/TestIntegrationTestBase.java
new file mode 100644
index 0000000..7330909
--- /dev/null
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/TestIntegrationTestBase.java
@@ -0,0 +1,48 @@
+/**
+ * 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;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Properties;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.chaos.factories.MonkeyConstants;
+import org.apache.hadoop.hbase.testclassification.SmallTests;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+@Category(SmallTests.class)
+public class TestIntegrationTestBase {
+
+ @Test
+ public void testMonkeyPropertiesParsing() {
+ final Configuration conf = new Configuration(false);
+ conf.set(MonkeyConstants.BATCH_RESTART_RS_RATIO, "0.85");
+ conf.set(MonkeyConstants.MOVE_REGIONS_MAX_TIME, "60000");
+ conf.set("hbase.rootdir", "/foo/bar/baz");
+
+ final Properties props = new Properties();
+ IntegrationTestBase testBase = new IntegrationTestDDLMasterFailover();
+ assertEquals(0, props.size());
+ testBase.loadMonkeyProperties(props, conf);
+ assertEquals(2, props.size());
+ assertEquals("0.85", props.getProperty(MonkeyConstants.BATCH_RESTART_RS_RATIO));
+ assertEquals("60000", props.getProperty(MonkeyConstants.MOVE_REGIONS_MAX_TIME));
+ }
+}
http://git-wip-us.apache.org/repos/asf/hbase/blob/13028d71/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/factories/MonkeyConstants.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/factories/MonkeyConstants.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/factories/MonkeyConstants.java
index 452d903..5657d39 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/factories/MonkeyConstants.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/factories/MonkeyConstants.java
@@ -17,6 +17,10 @@
*/
package org.apache.hadoop.hbase.chaos.factories;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
public interface MonkeyConstants {
String PERIODIC_ACTION1_PERIOD = "sdm.action1.period";
@@ -42,6 +46,13 @@ public interface MonkeyConstants {
String UNBALANCE_KILL_META_RS = "unbalance.action.kill.meta.rs";
String DECREASE_HFILE_SIZE_SLEEP_TIME = "decrease.hfile.size.sleep.time";
+ /**
+ * A Set of prefixes which encompasses all of the configuration properties for the ChaosMonky.
+ */
+ Set<String> MONKEY_CONFIGURATION_KEY_PREFIXES = new HashSet<>(
+ Arrays.asList("sdm.", "move.", "restart.", "batch.", "rolling.", "compact.",
+ "unbalance.", "decrease."));
+
long DEFAULT_PERIODIC_ACTION1_PERIOD = 60 * 1000;
long DEFAULT_PERIODIC_ACTION2_PERIOD = 90 * 1000;
long DEFAULT_PERIODIC_ACTION4_PERIOD = 90 * 1000;
[12/21] hbase git commit: HBASE-18629 Enhance ChaosMonkeyRunner with
interruptibility - addendum makes stopRunner() static
Posted by st...@apache.org.
HBASE-18629 Enhance ChaosMonkeyRunner with interruptibility - addendum makes stopRunner() static
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/fef7e8f7
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/fef7e8f7
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/fef7e8f7
Branch: refs/heads/HBASE-14070.HLC
Commit: fef7e8f7e8242b87f6e1c6b4b8df440af8ca6da5
Parents: 70d48b1
Author: tedyu <yu...@gmail.com>
Authored: Mon Aug 21 09:37:30 2017 -0700
Committer: tedyu <yu...@gmail.com>
Committed: Mon Aug 21 09:37:30 2017 -0700
----------------------------------------------------------------------
.../apache/hadoop/hbase/chaos/util/ChaosMonkeyRunner.java | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/fef7e8f7/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/util/ChaosMonkeyRunner.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/util/ChaosMonkeyRunner.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/util/ChaosMonkeyRunner.java
index f142321..80f99e5 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/util/ChaosMonkeyRunner.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/util/ChaosMonkeyRunner.java
@@ -45,6 +45,8 @@ public class ChaosMonkeyRunner extends AbstractHBaseTool {
public static final String TABLE_NAME_OPT = "tableName";
public static final String FAMILY_NAME_OPT = "familyName";
+ private static ChaosMonkeyRunner runner;
+
protected IntegrationTestingUtility util;
protected ChaosMonkey monkey;
protected String monkeyToUse;
@@ -99,8 +101,8 @@ public class ChaosMonkeyRunner extends AbstractHBaseTool {
return 0;
}
- public void stopRunner() {
- stop = true;
+ public static void stopRunner() {
+ runner.stop = true;
}
public void setUpCluster() throws Exception {
@@ -176,7 +178,8 @@ public class ChaosMonkeyRunner extends AbstractHBaseTool {
System.arraycopy(args, 2, actualArgs, 0, argCount);
}
IntegrationTestingUtility.setUseDistributedCluster(conf);
- int ret = ToolRunner.run(conf, new ChaosMonkeyRunner(), actualArgs);
+ runner = new ChaosMonkeyRunner();
+ int ret = ToolRunner.run(conf, runner, actualArgs);
System.exit(ret);
}
[14/21] hbase git commit: HBASE-Fix client.TestClientClusterStatus
(Chia-Ping Tsai)
Posted by st...@apache.org.
HBASE-Fix client.TestClientClusterStatus (Chia-Ping Tsai)
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/7b3291fa
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/7b3291fa
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/7b3291fa
Branch: refs/heads/HBASE-14070.HLC
Commit: 7b3291fa8b836be9539817876799994fac5de335
Parents: 70da554
Author: Michael Stack <st...@apache.org>
Authored: Mon Aug 21 14:21:30 2017 -0700
Committer: Michael Stack <st...@apache.org>
Committed: Mon Aug 21 14:21:30 2017 -0700
----------------------------------------------------------------------
.../hadoop/hbase/client/TestClientClusterStatus.java | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/7b3291fa/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestClientClusterStatus.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestClientClusterStatus.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestClientClusterStatus.java
index 49b4ff2..484ee06 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestClientClusterStatus.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestClientClusterStatus.java
@@ -65,7 +65,7 @@ public class TestClientClusterStatus {
RegionServerThread rst = rsts.get(rsts.size() - 1);
DEAD = rst.getRegionServer();
DEAD.stop("Test dead servers status");
- while (!DEAD.isStopped()) {
+ while (rst.isAlive()) {
Thread.sleep(500);
}
}
@@ -155,9 +155,11 @@ public class TestClientClusterStatus {
Assert.assertNotNull(status);
Assert.assertNotNull(status.getServers());
// exclude a dead region server
- Assert.assertEquals(SLAVES, numRs);
- // live servers = primary master + nums of regionservers
- Assert.assertEquals(status.getServers().size() + 1 /*Master*/, numRs);
+ Assert.assertEquals(SLAVES -1, numRs);
+ // live servers = nums of regionservers
+ // By default, HMaster don't carry any regions so it won't report its load.
+ // Hence, it won't be in the server list.
+ Assert.assertEquals(status.getServers().size(), numRs);
Assert.assertTrue(status.getRegionsCount() > 0);
Assert.assertNotNull(status.getDeadServerNames());
Assert.assertEquals(1, status.getDeadServersSize());
[11/21] hbase git commit: HBASE-18623 Frequent failed to parse at EOF
warnings from WALEntryStream
Posted by st...@apache.org.
HBASE-18623 Frequent failed to parse at EOF warnings from WALEntryStream
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/70d48b11
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/70d48b11
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/70d48b11
Branch: refs/heads/HBASE-14070.HLC
Commit: 70d48b113e3b824e2804164e80edf01522c85272
Parents: 192e873
Author: Andrew Purtell <ap...@apache.org>
Authored: Fri Aug 18 17:13:51 2017 -0700
Committer: Andrew Purtell <ap...@apache.org>
Committed: Mon Aug 21 09:29:24 2017 -0700
----------------------------------------------------------------------
.../hbase/replication/regionserver/WALEntryStream.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/70d48b11/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/WALEntryStream.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/WALEntryStream.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/WALEntryStream.java
index 4f49955..3942d23 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/WALEntryStream.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/WALEntryStream.java
@@ -233,9 +233,11 @@ public class WALEntryStream implements Iterator<Entry>, Closeable, Iterable<Entr
if (trailerSize < 0) {
if (currentPosition < stat.getLen()) {
final long skippedBytes = stat.getLen() - currentPosition;
- LOG.info("Reached the end of WAL file '" + currentPath
- + "'. It was not closed cleanly, so we did not parse " + skippedBytes
- + " bytes of data.");
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Reached the end of WAL file '" + currentPath
+ + "'. It was not closed cleanly, so we did not parse " + skippedBytes
+ + " bytes of data. This is normally ok.");
+ }
metrics.incrUncleanlyClosedWALs();
metrics.incrBytesSkippedInUncleanlyClosedWALs(skippedBytes);
}
[21/21] hbase git commit: Merge branch 'm' into hlc Incorporates the
revert of HBASE-14498. Lets see if it respoonsible for timing issues seen on
this branch.
Posted by st...@apache.org.
Merge branch 'm' into hlc
Incorporates the revert of HBASE-14498. Lets see if it respoonsible for
timing issues seen on this branch.
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/4e7c55d9
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/4e7c55d9
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/4e7c55d9
Branch: refs/heads/HBASE-14070.HLC
Commit: 4e7c55d996643538a3ac85bea3d898b049672f5f
Parents: b2a1848 05f07f6
Author: Michael Stack <st...@apache.org>
Authored: Tue Aug 22 08:41:02 2017 -0700
Committer: Michael Stack <st...@apache.org>
Committed: Tue Aug 22 08:41:02 2017 -0700
----------------------------------------------------------------------
.../src/main/assembly/hadoop-two-compat.xml | 2 +
.../hadoop/hbase/filter/FuzzyRowFilter.java | 22 ++-
.../java/org/apache/hadoop/hbase/CellUtil.java | 53 +++++
.../MetricsRegionServerSourceImpl.java | 2 -
.../hadoop/hbase/IntegrationTestBase.java | 21 ++
.../hadoop/hbase/RESTApiClusterManager.java | 32 ++--
.../hadoop/hbase/TestIntegrationTestBase.java | 48 +++++
.../hbase/chaos/factories/MonkeyConstants.java | 11 ++
.../hbase/chaos/util/ChaosMonkeyRunner.java | 26 ++-
.../hadoop/hbase/rest/ResourceConfig.java | 31 ---
.../hadoop/hbase/rest/model/VersionModel.java | 4 +-
.../hadoop/hbase/rest/TestVersionResource.java | 6 +-
.../master/assignment/AssignmentManager.java | 7 +-
.../hbase/regionserver/RSRpcServices.java | 23 +--
.../hadoop/hbase/regionserver/StoreScanner.java | 5 +-
.../querymatcher/ScanQueryMatcher.java | 13 ++
.../regionserver/WALEntryStream.java | 8 +-
.../DefaultVisibilityLabelServiceImpl.java | 12 +-
.../visibility/VisibilityController.java | 4 +
.../visibility/VisibilityScanDeleteTracker.java | 19 +-
.../hbase/client/TestClientClusterStatus.java | 10 +-
.../hbase/client/TestFromClientSide3.java | 101 ++++++++++
.../filter/TestFuzzyRowFilterEndToEnd.java | 27 ++-
.../master/assignment/MockMasterServices.java | 9 +-
.../assignment/TestRogueRSAssignment.java | 192 +++++++++++++++++++
.../TestRegionServerReadRequestMetrics.java | 2 +
.../ExpAsStringVisibilityLabelServiceImpl.java | 4 +
.../TestVisibilityLabelsWithDeletes.java | 191 ++++++++++++++++++
src/main/asciidoc/_chapters/datamodel.adoc | 4 +-
src/main/asciidoc/_chapters/developer.adoc | 54 ++++++
30 files changed, 837 insertions(+), 106 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/4e7c55d9/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/4e7c55d9/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java
----------------------------------------------------------------------
diff --cc hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java
index 951f47c,a220f54..8b02998
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java
@@@ -42,9 -48,11 +42,10 @@@ import org.apache.hadoop.hbase.regionse
import org.apache.hadoop.hbase.regionserver.querymatcher.LegacyScanQueryMatcher;
import org.apache.hadoop.hbase.regionserver.querymatcher.ScanQueryMatcher;
import org.apache.hadoop.hbase.regionserver.querymatcher.UserScanQueryMatcher;
- import org.apache.hadoop.hbase.shaded.com.google.common.annotations.VisibleForTesting;
import org.apache.hadoop.hbase.util.CollectionUtils;
-import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+ import org.apache.hadoop.hbase.shaded.com.google.common.annotations.VisibleForTesting;
+
/**
* Scanner scans both the memstore and the Store. Coalesce KeyValue stream into List<KeyValue>
* for a single row.
http://git-wip-us.apache.org/repos/asf/hbase/blob/4e7c55d9/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/querymatcher/ScanQueryMatcher.java
----------------------------------------------------------------------
[18/21] hbase git commit: HBASE-18103 [AMv2] Changed master to throw
YouAreDeadException when it receives regionServerReport() with incorrect
region assignment. Added test to verify rogue region server behavior.
Posted by st...@apache.org.
HBASE-18103 [AMv2] Changed master to throw YouAreDeadException when it receives regionServerReport() with incorrect region assignment. Added test to verify rogue region server behavior.
Behavior prior to these changes is to call expireServer(), log exception and suppress it. These changes will result in RS receiving the YouAreDeadException and treating it as a fatal error. This 'fail fast' approach will help us stabilize the code. This behavior can be reconsidered later if necessary.
Signed-off-by: Michael Stack <st...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/5895538a
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/5895538a
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/5895538a
Branch: refs/heads/HBASE-14070.HLC
Commit: 5895538a32d6bd2d7153e38304523caf6ea7579c
Parents: bf343da
Author: Umesh Agashe <ua...@cloudera.com>
Authored: Fri Aug 18 14:28:00 2017 -0700
Committer: Michael Stack <st...@apache.org>
Committed: Mon Aug 21 17:23:10 2017 -0700
----------------------------------------------------------------------
.../master/assignment/AssignmentManager.java | 7 +-
.../master/assignment/MockMasterServices.java | 9 +-
.../assignment/TestRogueRSAssignment.java | 192 +++++++++++++++++++
3 files changed, 204 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/5895538a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java
index 0b23f47..6a9cfc2 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java
@@ -46,6 +46,7 @@ import org.apache.hadoop.hbase.RegionException;
import org.apache.hadoop.hbase.RegionStateListener;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.YouAreDeadException;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.client.TableState;
import org.apache.hadoop.hbase.exceptions.UnexpectedStateException;
@@ -895,7 +896,7 @@ public class AssignmentManager implements ServerListener {
* that something went wrong on the RS side.
*/
public void reportOnlineRegions(final ServerName serverName,
- final int versionNumber, final Set<byte[]> regionNames) {
+ final int versionNumber, final Set<byte[]> regionNames) throws YouAreDeadException {
if (!isRunning()) return;
if (LOG.isTraceEnabled()) {
LOG.trace("ReportOnlineRegions " + serverName + " regionCount=" + regionNames.size() +
@@ -959,7 +960,8 @@ public class AssignmentManager implements ServerListener {
}
}
- void checkOnlineRegionsReport(final ServerStateNode serverNode, final Set<byte[]> regionNames) {
+ void checkOnlineRegionsReport(final ServerStateNode serverNode, final Set<byte[]> regionNames)
+ throws YouAreDeadException {
final ServerName serverName = serverNode.getServerName();
try {
for (byte[] regionName: regionNames) {
@@ -999,6 +1001,7 @@ public class AssignmentManager implements ServerListener {
} catch (UnexpectedStateException e) {
LOG.warn("Killing " + serverName + ": " + e.getMessage());
killRegionServer(serverNode);
+ throw (YouAreDeadException)new YouAreDeadException(e.getMessage()).initCause(e);
}
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/5895538a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/MockMasterServices.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/MockMasterServices.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/MockMasterServices.java
index d558aaf..48386a6 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/MockMasterServices.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/MockMasterServices.java
@@ -34,6 +34,7 @@ import org.apache.hadoop.hbase.ServerLoad;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableDescriptors;
import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.YouAreDeadException;
import org.apache.hadoop.hbase.client.ClusterConnection;
import org.apache.hadoop.hbase.client.HConnectionTestingUtility;
import org.apache.hadoop.hbase.master.LoadBalancer;
@@ -115,8 +116,12 @@ public class MockMasterServices extends MockNoopMasterServices {
protected boolean waitServerReportEvent(ServerName serverName, Procedure proc) {
// Make a report with current state of the server 'serverName' before we call wait..
SortedSet<byte []> regions = regionsToRegionServers.get(serverName);
- getAssignmentManager().reportOnlineRegions(serverName, 0,
- regions == null? new HashSet<byte []>(): regions);
+ try {
+ getAssignmentManager().reportOnlineRegions(serverName, 0,
+ regions == null? new HashSet<byte []>(): regions);
+ } catch (YouAreDeadException e) {
+ throw new RuntimeException(e);
+ }
return super.waitServerReportEvent(serverName, proc);
}
};
http://git-wip-us.apache.org/repos/asf/hbase/blob/5895538a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestRogueRSAssignment.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestRogueRSAssignment.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestRogueRSAssignment.java
new file mode 100644
index 0000000..49eb573
--- /dev/null
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestRogueRSAssignment.java
@@ -0,0 +1,192 @@
+/*
+ *
+ * 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.master.assignment;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.HRegionInfo;
+import org.apache.hadoop.hbase.MiniHBaseCluster;
+import org.apache.hadoop.hbase.ServerName;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.YouAreDeadException;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder;
+import org.apache.hadoop.hbase.client.TableDescriptor;
+import org.apache.hadoop.hbase.client.TableDescriptorBuilder;
+import org.apache.hadoop.hbase.master.HMaster;
+import org.apache.hadoop.hbase.master.procedure.MasterProcedureConstants;
+import org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException;
+import org.apache.hadoop.hbase.shaded.com.google.protobuf.UnsafeByteOperations;
+import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
+import org.apache.hadoop.hbase.shaded.protobuf.generated.ClusterStatusProtos;
+import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos;
+import org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos;
+import org.apache.hadoop.hbase.testclassification.MasterTests;
+import org.apache.hadoop.hbase.testclassification.MediumTests;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.ExpectedException;
+import org.junit.rules.TestName;
+
+import java.io.IOException;
+import java.util.List;
+
+import static org.hamcrest.core.Is.isA;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * Tests to verify master/ assignment manager functionality against rogue RS
+ */
+@Category({MasterTests.class, MediumTests.class})
+public class TestRogueRSAssignment {
+ private static final Log LOG = LogFactory.getLog(TestRogueRSAssignment.class);
+
+ @Rule
+ public final TestName name = new TestName();
+
+ @Rule
+ public ExpectedException exception = ExpectedException.none();
+ private static final int initialRegionCount = 3;
+ private final static byte[] FAMILY = Bytes.toBytes("FAMILY");
+
+ private static final HBaseTestingUtility UTIL = new HBaseTestingUtility();
+ private static final Configuration conf = UTIL.getConfiguration();
+ private static Admin admin;
+ private static MiniHBaseCluster cluster;
+ private static HMaster master;
+
+ private static void setupConf(Configuration conf) {
+ // Reduce the maximum attempts to speed up the test
+ conf.setInt("hbase.assignment.maximum.attempts", 3);
+ conf.setInt("hbase.master.maximum.ping.server.attempts", 3);
+ conf.setInt("hbase.master.ping.server.retry.sleep.interval", 1);
+ conf.setInt(MasterProcedureConstants.MASTER_PROCEDURE_THREADS, 1);
+ }
+
+ @BeforeClass
+ public static void setupCluster() throws Exception {
+ setupConf(conf);
+ UTIL.startMiniCluster(2);
+
+ cluster = UTIL.getHBaseCluster();
+ assertNotNull(cluster);
+
+ admin = UTIL.getAdmin();
+ assertNotNull(admin);
+
+ master = cluster.getMaster();
+ assertNotNull(master);
+ }
+
+ @AfterClass
+ public static void cleanupTest() throws Exception {
+ try {
+ UTIL.shutdownMiniCluster();
+ cluster = null;
+ admin = null;
+ } catch (Exception e) {
+ LOG.warn("failure shutting down cluster", e);
+ }
+ }
+
+ @Before
+ public void setup() throws IOException {
+ // Turn off balancer
+ admin.setBalancerRunning(false, true);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ for (TableDescriptor td: UTIL.getAdmin().listTableDescriptors()) {
+ LOG.info("Tear down, remove table=" + td.getTableName());
+ UTIL.deleteTable(td.getTableName());
+ }
+ // Turn on balancer
+ admin.setBalancerRunning(true, false);
+ }
+
+ @Test(timeout = 120000)
+ public void testReportRSWithWrongRegion() throws Exception {
+ final TableName tableName = TableName.valueOf(this.name.getMethodName());
+
+ List<HRegionInfo> tableRegions = createTable(tableName);
+
+ final ServerName sn = ServerName.parseVersionedServerName(
+ ServerName.valueOf("1.example.org", 1, System.currentTimeMillis()).getVersionedBytes());
+
+ // make fake request with a region assigned to different RS
+ RegionServerStatusProtos.RegionServerReportRequest.Builder request =
+ makeRSReportRequestWithRegions(sn, tableRegions.get(1));
+
+ // sending fake request to master
+ // TODO: replace YouAreDeadException with appropriate exception as and when necessary
+ exception.expect(ServiceException.class);
+ exception.expectCause(isA(YouAreDeadException.class));
+ RegionServerStatusProtos.RegionServerReportResponse response =
+ master.getMasterRpcServices().regionServerReport(null, request.build());
+ }
+
+ private RegionServerStatusProtos.RegionServerReportRequest.Builder
+ makeRSReportRequestWithRegions(final ServerName sn, HRegionInfo... regions) {
+ ClusterStatusProtos.ServerLoad.Builder sl = ClusterStatusProtos.ServerLoad.newBuilder();
+ for (int i = 0; i < regions.length; i++) {
+ HBaseProtos.RegionSpecifier.Builder rs = HBaseProtos.RegionSpecifier.newBuilder();
+ rs.setType(HBaseProtos.RegionSpecifier.RegionSpecifierType.REGION_NAME);
+ rs.setValue(UnsafeByteOperations.unsafeWrap(regions[i].getRegionName()));
+
+ ClusterStatusProtos.RegionLoad.Builder rl = ClusterStatusProtos.RegionLoad.newBuilder()
+ .setRegionSpecifier(rs.build());
+
+ sl.addRegionLoads(i, rl.build());
+ }
+
+ return RegionServerStatusProtos.RegionServerReportRequest.newBuilder()
+ .setServer(ProtobufUtil.toServerName(sn))
+ .setLoad(sl);
+ }
+
+ private List<HRegionInfo> createTable(final TableName tableName) throws Exception {
+ TableDescriptorBuilder tdBuilder = TableDescriptorBuilder.newBuilder(tableName);
+ tdBuilder.addColumnFamily(ColumnFamilyDescriptorBuilder.newBuilder(FAMILY).build());
+
+ byte[][] rows = new byte[initialRegionCount - 1][];
+ for (int i = 0; i < rows.length; ++i) {
+ rows[i] = Bytes.toBytes(String.format("%d", i));
+ }
+ admin.createTable(tdBuilder.build(), rows);
+ return assertRegionCount(tableName, initialRegionCount);
+ }
+
+ private List<HRegionInfo> assertRegionCount(final TableName tableName, final int nregions)
+ throws Exception {
+ UTIL.waitUntilNoRegionsInTransition();
+ List<HRegionInfo> tableRegions = admin.getTableRegions(tableName);
+ assertEquals(nregions, tableRegions.size());
+ return tableRegions;
+ }
+}
[07/21] hbase git commit: HBASE-18592 [hbase-thirdparty] Doc on new
hbase-thirdparty dependency for the refguide
Posted by st...@apache.org.
HBASE-18592 [hbase-thirdparty] Doc on new hbase-thirdparty dependency for the refguide
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/b932d38b
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/b932d38b
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/b932d38b
Branch: refs/heads/HBASE-14070.HLC
Commit: b932d38b2a53c1764345fec44e1bbb38addf04ec
Parents: 56f9e1a
Author: Michael Stack <st...@apache.org>
Authored: Fri Aug 18 16:18:42 2017 -0700
Committer: Michael Stack <st...@apache.org>
Committed: Fri Aug 18 16:18:42 2017 -0700
----------------------------------------------------------------------
src/main/asciidoc/_chapters/developer.adoc | 54 +++++++++++++++++++++++++
1 file changed, 54 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/b932d38b/src/main/asciidoc/_chapters/developer.adoc
----------------------------------------------------------------------
diff --git a/src/main/asciidoc/_chapters/developer.adoc b/src/main/asciidoc/_chapters/developer.adoc
index 6a546fb..3d010b6 100644
--- a/src/main/asciidoc/_chapters/developer.adoc
+++ b/src/main/asciidoc/_chapters/developer.adoc
@@ -2116,6 +2116,60 @@ However any substantive discussion (as with any off-list project-related discuss
Misspellings and/or bad grammar is preferable to the disruption a JIRA comment edit causes: See the discussion at link:http://search-hadoop.com/?q=%5BReopened%5D+%28HBASE-451%29+Remove+HTableDescriptor+from+HRegionInfo&fc_project=HBase[Re:(HBASE-451) Remove HTableDescriptor from HRegionInfo]
+[[thirdparty]]
+=== The hbase-thirdparty dependency and shading/relocation
+
+A new project was created for the release of hbase-2.0.0. It was called
+`hbase-thirdparty`. This project exists only to provide the main hbase
+project with relocated -- or shaded -- versions of popular thirdparty
+libraries such as guava, netty, and protobuf. The mainline HBase project
+relies on the relocated versions of these libraries gotten from hbase-thirdparty
+rather than on finding these classes in their usual locations. We do this so
+we can specify whatever the version we wish. If we don't relocate, we must
+harmonize our version to match that which hadoop and/or spark uses.
+
+For developers, this means you need to be careful referring to classes from
+netty, guava, protobuf, gson, etc. (see the hbase-thirdparty pom.xml for what
+it provides). Devs must refer to the hbase-thirdparty provided classes. In
+practice, this is usually not an issue (though it can be a bit of a pain). You
+will have to hunt for the relocated version of your particular class. You'll
+find it by prepending the general relocation prefix of `org.apache.hadoop.hbase.shaded.`.
+For example if you are looking for `com.google.protobuf.Message`, the relocated
+version used by HBase internals can be found at
+`org.apache.hadoop.hbase.shaded.com.google.protobuf.Message`.
+
+For a few thirdparty libs, like protobuf (see the protobuf chapter in this book
+for the why), your IDE may give you both options -- the `com.google.protobuf.*`
+and the `org.apache.hadoop.hbase.shaded.com.google.protobuf.*` -- because both
+classes are on your CLASSPATH. Unless you are doing the particular juggling
+required in Coprocessor Endpoint development (again see above cited protobuf
+chapter), you'll want to use the shaded version, always.
+
+Of note, the relocation of netty is particular. The netty folks have put in
+place facility to aid relocation; it seems like shading netty is a popular project.
+One case of this requires the setting of a peculiar system property on the JVM
+so that classes out in the bundld shared library (.so) can be found in their
+relocated location. Here is the property that needs to be set:
+
+`-Dorg.apache.hadoop.hbase.shaded.io.netty.packagePrefix=org.apache.hadoop.hbase.shaded.`
+
+(Note that the trailing '.' is required). Starting hbase normally or when running
+test suites, the setting of this property is done for you. If you are doing something
+out of the ordinary, starting hbase from your own context, you'll need to provide
+this property on platforms that favor the bundled .so. See release notes on HBASE-18271
+for more. The complaint you see is something like the following:
+`Cause: java.lang.RuntimeException: Failed construction of Master: class org.apache.hadoop.hbase.master.HMasterorg.apache.hadoop.hbase.shaded.io.netty.channel.epoll.`
+
+The `hbase-thirdparty` project has groupid of `org.apache.hbase.thirdparty`.
+As of this writing, it provides three jars; one for netty with an artifactid of
+`hbase-thirdparty-netty`, one for protobuf at `hbase-thirdparty-protobuf` and then
+a jar for all else -- gson, guava -- at `hbase-thirdpaty-miscellaneous`.
+
+The hbase-thirdparty artifacts are a product produced by the Apache HBase
+project under the aegis of the HBase Project Management Committee. Releases
+are done via the usual voting project on the hbase dev mailing list. If issue
+in the hbase-thirdparty, use the hbase JIRA and mailing lists to post notice.
+
[[hbase.archetypes.development]]
=== Development of HBase-related Maven archetypes
[20/21] hbase git commit: HBASE-18645 Loads of tests timing out....
Revert "HBASE-14498 Master stuck in infinite loop when all Zookeeper servers
are unreachable"
Posted by st...@apache.org.
HBASE-18645 Loads of tests timing out.... Revert "HBASE-14498 Master stuck in infinite loop when all Zookeeper servers are unreachable"
This reverts commit 1ab6882f6285e0bfa2864a09208edf4f2ae4125d.
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/05f07f69
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/05f07f69
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/05f07f69
Branch: refs/heads/HBASE-14070.HLC
Commit: 05f07f692bf572be0829904d2b4ab48bbd611dde
Parents: 23ddf69
Author: Michael Stack <st...@apache.org>
Authored: Mon Aug 21 15:13:11 2017 -0700
Committer: Apekshit Sharma <ap...@apache.org>
Committed: Tue Aug 22 01:41:18 2017 -0700
----------------------------------------------------------------------
.../hbase/zookeeper/ZooKeeperWatcher.java | 85 +-------------------
.../hbase/zookeeper/TestZooKeeperWatcher.java | 47 -----------
.../hbase/regionserver/HRegionServer.java | 2 +-
3 files changed, 3 insertions(+), 131 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/05f07f69/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java
index 8266c9a..6bec352 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZooKeeperWatcher.java
@@ -26,9 +26,6 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.atomic.AtomicBoolean;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -42,7 +39,6 @@ import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.ZooKeeperConnectionException;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.security.Superusers;
-import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
@@ -80,7 +76,7 @@ public class ZooKeeperWatcher implements Watcher, Abortable, Closeable {
private final RecoverableZooKeeper recoverableZooKeeper;
// abortable in case of zk failure
- protected final Abortable abortable;
+ protected Abortable abortable;
// Used if abortable is null
private boolean aborted = false;
@@ -93,13 +89,6 @@ public class ZooKeeperWatcher implements Watcher, Abortable, Closeable {
// negotiation to complete
public CountDownLatch saslLatch = new CountDownLatch(1);
- // Connection timeout on disconnect event
- private long connWaitTimeOut;
- private AtomicBoolean connected = new AtomicBoolean(false);
- private boolean forceAbortOnZKDisconnect;
-
- // Execute service for zookeeper disconnect event watcher
- private ExecutorService zkEventWatcherExecService = null;
private final Configuration conf;
@@ -133,24 +122,6 @@ public class ZooKeeperWatcher implements Watcher, Abortable, Closeable {
public ZooKeeperWatcher(Configuration conf, String identifier,
Abortable abortable, boolean canCreateBaseZNode)
throws IOException, ZooKeeperConnectionException {
- this(conf, identifier, abortable, canCreateBaseZNode, false);
- }
-
- /**
- * Instantiate a ZooKeeper connection and watcher.
- * @param conf Configuration
- * @param identifier string that is passed to RecoverableZookeeper to be used as identifier for
- * this instance. Use null for default.
- * @param abortable Can be null if there is on error there is no host to abort: e.g. client
- * context.
- * @param canCreateBaseZNode whether create base node.
- * @param forceAbortOnZKDisconnect abort the watcher if true.
- * @throws IOException when any IO exception
- * @throws ZooKeeperConnectionException when any zookeeper connection exception
- */
- public ZooKeeperWatcher(Configuration conf, String identifier, Abortable abortable,
- boolean canCreateBaseZNode, boolean forceAbortOnZKDisconnect) throws IOException,
- ZooKeeperConnectionException {
this.conf = conf;
this.quorum = ZKConfig.getZKQuorumServersString(conf);
this.prefix = identifier;
@@ -159,9 +130,6 @@ public class ZooKeeperWatcher implements Watcher, Abortable, Closeable {
this.identifier = identifier + "0x0";
this.abortable = abortable;
this.znodePaths = new ZNodePaths(conf);
- // On Disconnected event a thread will wait for sometime (2/3 of zookeeper.session.timeout),
- // it will abort the process if no SyncConnected event reported by the time.
- connWaitTimeOut = this.conf.getLong("zookeeper.session.timeout", 90000) * 2 / 3;
PendingWatcher pendingWatcher = new PendingWatcher();
this.recoverableZooKeeper = ZKUtil.connect(conf, quorum, pendingWatcher, identifier);
pendingWatcher.prepare(this);
@@ -178,10 +146,6 @@ public class ZooKeeperWatcher implements Watcher, Abortable, Closeable {
throw zce;
}
}
- this.forceAbortOnZKDisconnect = forceAbortOnZKDisconnect;
- if (this.forceAbortOnZKDisconnect) {
- this.zkEventWatcherExecService = Executors.newSingleThreadExecutor();
- }
}
private void createBaseZNodes() throws ZooKeeperConnectionException {
@@ -562,19 +526,11 @@ public class ZooKeeperWatcher implements Watcher, Abortable, Closeable {
Long.toHexString(this.recoverableZooKeeper.getSessionId());
// Update our identifier. Otherwise ignore.
LOG.debug(this.identifier + " connected");
- connected.set(true);
break;
// Abort the server if Disconnected or Expired
case Disconnected:
- LOG.debug(prefix("Received Disconnected from ZooKeeper."));
- if (forceAbortOnZKDisconnect) {
- connected.set(false);
- ZKDisconnectEventWatcher task = new ZKDisconnectEventWatcher();
- zkEventWatcherExecService.execute(task);
- } else {
- LOG.debug("Received Disconnected from ZooKeeper, ignoring.");
- }
+ LOG.debug(prefix("Received Disconnected from ZooKeeper, ignoring"));
break;
case Expired:
@@ -597,39 +553,6 @@ public class ZooKeeperWatcher implements Watcher, Abortable, Closeable {
}
}
- /*
- * Task to watch zookeper disconnect event.
- */
- class ZKDisconnectEventWatcher implements Runnable {
- @Override
- public void run() {
- if (connected.get()) {
- return;
- }
-
- long startTime = EnvironmentEdgeManager.currentTime();
- while (EnvironmentEdgeManager.currentTime() - startTime < connWaitTimeOut) {
- if (connected.get()) {
- LOG.debug("Client got reconnected to zookeeper.");
- return;
- }
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- break;
- }
- }
-
- if (!connected.get() && abortable != null) {
- String msg =
- prefix("Couldn't connect to ZooKeeper after waiting " + connWaitTimeOut
- + " ms, aborting");
- abortable.abort(msg, new KeeperException.ConnectionLossException());
- }
- }
- }
-
/**
* Forces a synchronization of this ZooKeeper client connection.
* <p>
@@ -694,10 +617,6 @@ public class ZooKeeperWatcher implements Watcher, Abortable, Closeable {
public void close() {
try {
recoverableZooKeeper.close();
- if (zkEventWatcherExecService != null) {
- zkEventWatcherExecService.shutdown();
- zkEventWatcherExecService = null;
- }
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/05f07f69/hbase-client/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperWatcher.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperWatcher.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperWatcher.java
index 929bd98..de2ec2a 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperWatcher.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZooKeeperWatcher.java
@@ -23,22 +23,14 @@ import static org.junit.Assert.assertTrue;
import java.io.IOException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.Abortable;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.ZooKeeperConnectionException;
import org.apache.hadoop.hbase.testclassification.SmallTests;
-import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@Category({ SmallTests.class })
public class TestZooKeeperWatcher {
- private final static Log LOG = LogFactory.getLog(TestZooKeeperWatcher.class);
@Test
public void testIsClientReadable() throws ZooKeeperConnectionException, IOException {
@@ -65,43 +57,4 @@ public class TestZooKeeperWatcher {
watcher.close();
}
- @Test
- public void testConnectionEvent() throws ZooKeeperConnectionException, IOException {
- long zkSessionTimeout = 15000l;
- Configuration conf = HBaseConfiguration.create();
- conf.set("zookeeper.session.timeout", "15000");
-
- Abortable abortable = new Abortable() {
- boolean aborted = false;
-
- @Override
- public void abort(String why, Throwable e) {
- aborted = true;
- LOG.error(why, e);
- }
-
- @Override
- public boolean isAborted() {
- return aborted;
- }
- };
- ZooKeeperWatcher watcher = new ZooKeeperWatcher(conf, "testConnectionEvent", abortable, false, true);
-
- WatchedEvent event =
- new WatchedEvent(Watcher.Event.EventType.None, Watcher.Event.KeeperState.Disconnected, null);
-
- long startTime = EnvironmentEdgeManager.currentTime();
- while (!abortable.isAborted()
- && (EnvironmentEdgeManager.currentTime() - startTime < zkSessionTimeout)) {
- watcher.process(event);
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- }
- }
-
- assertTrue(abortable.isAborted());
- watcher.close();
- }
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/05f07f69/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
index 524164f..0c1814f 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
@@ -642,7 +642,7 @@ public class HRegionServer extends HasThread implements
if (!conf.getBoolean("hbase.testing.nocluster", false)) {
// Open connection to zookeeper and set primary watcher
zooKeeper = new ZooKeeperWatcher(conf, getProcessName() + ":" +
- rpcServices.isa.getPort(), this, canCreateBaseZNode(), true);
+ rpcServices.isa.getPort(), this, canCreateBaseZNode());
this.csm = (BaseCoordinatedStateManager) csm;
this.csm.initialize(this);
[09/21] hbase git commit: HBASE-18637 Update the link of 'Bending
time in HBase'
Posted by st...@apache.org.
HBASE-18637 Update the link of 'Bending time in HBase'
Signed-off-by: Chia-Ping Tsai <ch...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/820ee91f
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/820ee91f
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/820ee91f
Branch: refs/heads/HBASE-14070.HLC
Commit: 820ee91fe895a3dc6c21b141936fbcd6d0a6bb08
Parents: 13028d7
Author: Jan Hentschel <ja...@ultratendency.com>
Authored: Sun Aug 20 23:46:26 2017 +0200
Committer: Chia-Ping Tsai <ch...@gmail.com>
Committed: Mon Aug 21 15:17:40 2017 +0800
----------------------------------------------------------------------
src/main/asciidoc/_chapters/datamodel.adoc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/820ee91f/src/main/asciidoc/_chapters/datamodel.adoc
----------------------------------------------------------------------
diff --git a/src/main/asciidoc/_chapters/datamodel.adoc b/src/main/asciidoc/_chapters/datamodel.adoc
index da4143a..408057e 100644
--- a/src/main/asciidoc/_chapters/datamodel.adoc
+++ b/src/main/asciidoc/_chapters/datamodel.adoc
@@ -341,7 +341,7 @@ In particular:
* It is OK to write cells in a non-increasing version order.
Below we describe how the version dimension in HBase currently works.
-See link:https://issues.apache.org/jira/browse/HBASE-2406[HBASE-2406] for discussion of HBase versions. link:http://outerthought.org/blog/417-ot.html[Bending time in HBase] makes for a good read on the version, or time, dimension in HBase.
+See link:https://issues.apache.org/jira/browse/HBASE-2406[HBASE-2406] for discussion of HBase versions. link:https://www.ngdata.com/bending-time-in-hbase/[Bending time in HBase] makes for a good read on the version, or time, dimension in HBase.
It has more detail on versioning than is provided here.
As of this writing, the limitation _Overwriting values at existing timestamps_ mentioned in the article no longer holds in HBase.
This section is basically a synopsis of this article by Bruno Dumon.
@@ -525,7 +525,7 @@ _...create three cell versions at t1, t2 and t3, with a maximum-versions
setting of 2. So when getting all versions, only the values at t2 and t3 will be
returned. But if you delete the version at t2 or t3, the one at t1 will appear again.
Obviously, once a major compaction has run, such behavior will not be the case
- anymore..._ (See _Garbage Collection_ in link:http://outerthought.org/blog/417-ot.html[Bending time in HBase].)
+ anymore..._ (See _Garbage Collection_ in link:https://www.ngdata.com/bending-time-in-hbase/[Bending time in HBase].)
[[dm.sort]]
== Sort Order
[03/21] hbase git commit: HBASE-18518 Remove jersey1* dependencies
form project and jersey1* jars from lib dir.
Posted by st...@apache.org.
HBASE-18518 Remove jersey1* dependencies form project and jersey1* jars from lib dir.
This patch removes jersey1 dependencies form hbase REST project also
removes dead code in hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ResourceConfig.java and prevents jersey1 jars in lib dir. RESTApiClusterManager.java is modified to use jersey2.
Signed-off-by: Michael Stack <st...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/7fee03ed
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/7fee03ed
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/7fee03ed
Branch: refs/heads/HBASE-14070.HLC
Commit: 7fee03ed65af53618d206aed159ab4f2ccb464e1
Parents: 2af2b4c
Author: Samir Ahmic <ah...@gmail.com>
Authored: Sun Aug 6 16:16:18 2017 +0200
Committer: Michael Stack <st...@apache.org>
Committed: Thu Aug 17 22:06:34 2017 -0700
----------------------------------------------------------------------
.../src/main/assembly/hadoop-two-compat.xml | 2 ++
.../hadoop/hbase/RESTApiClusterManager.java | 32 ++++++++++----------
.../hadoop/hbase/rest/ResourceConfig.java | 31 -------------------
.../hadoop/hbase/rest/model/VersionModel.java | 4 +--
.../hadoop/hbase/rest/TestVersionResource.java | 6 ++--
5 files changed, 23 insertions(+), 52 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/7fee03ed/hbase-assembly/src/main/assembly/hadoop-two-compat.xml
----------------------------------------------------------------------
diff --git a/hbase-assembly/src/main/assembly/hadoop-two-compat.xml b/hbase-assembly/src/main/assembly/hadoop-two-compat.xml
index 3b8908c..8039c4d 100644
--- a/hbase-assembly/src/main/assembly/hadoop-two-compat.xml
+++ b/hbase-assembly/src/main/assembly/hadoop-two-compat.xml
@@ -59,6 +59,8 @@
<dependencySet>
<excludes>
<exclude>org.jruby:jruby-complete</exclude>
+ <exclude>com.sun.jersey:*</exclude>
+ <exclude>com.sun.jersey.contribs:*</exclude>
</excludes>
</dependencySet>
</dependencySets>
http://git-wip-us.apache.org/repos/asf/hbase/blob/7fee03ed/hbase-it/src/test/java/org/apache/hadoop/hbase/RESTApiClusterManager.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/RESTApiClusterManager.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/RESTApiClusterManager.java
index 03ba460..055b58a 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/RESTApiClusterManager.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/RESTApiClusterManager.java
@@ -18,10 +18,6 @@
package org.apache.hadoop.hbase;
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
@@ -29,7 +25,12 @@ import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.util.ReflectionUtils;
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.map.ObjectMapper;
-
+import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.Invocation;
+import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
@@ -91,7 +92,7 @@ public class RESTApiClusterManager extends Configured implements ClusterManager
private static final String API_VERSION = "v6";
// Client instances are expensive, so use the same one for all our REST queries.
- private Client client = Client.create();
+ private Client client = ClientBuilder.newClient();
// An instance of HBaseClusterManager is used for methods like the kill, resume, and suspend
// because cluster managers don't tend to implement these operations.
@@ -117,7 +118,7 @@ public class RESTApiClusterManager extends Configured implements ClusterManager
clusterName = conf.get(REST_API_CLUSTER_MANAGER_CLUSTER_NAME, DEFAULT_CLUSTER_NAME);
// Add filter to Client instance to enable server authentication.
- client.addFilter(new HTTPBasicAuthFilter(serverUsername, serverPassword));
+ client.register(HttpAuthenticationFeature.basic(serverUsername, serverPassword));
}
@Override
@@ -193,10 +194,9 @@ public class RESTApiClusterManager extends Configured implements ClusterManager
.build();
String body = "{ \"items\": [ \"" + roleName + "\" ] }";
LOG.info("Executing POST against " + uri + " with body " + body + "...");
- ClientResponse response = client.resource(uri)
- .type(MediaType.APPLICATION_JSON)
- .post(ClientResponse.class, body);
-
+ WebTarget webTarget = client.target(uri);
+ Invocation.Builder invocationBuilder = webTarget.request(MediaType.APPLICATION_JSON);
+ Response response = invocationBuilder.post(Entity.json(body));
int statusCode = response.getStatus();
if (statusCode != Response.Status.OK.getStatusCode()) {
throw new HTTPException(statusCode);
@@ -237,16 +237,16 @@ public class RESTApiClusterManager extends Configured implements ClusterManager
// Execute GET against URI, returning a JsonNode object to be traversed.
private JsonNode getJsonNodeFromURIGet(URI uri) throws IOException {
LOG.info("Executing GET against " + uri + "...");
- ClientResponse response = client.resource(uri)
- .accept(MediaType.APPLICATION_JSON_TYPE)
- .get(ClientResponse.class);
-
+ WebTarget webTarget = client.target(uri);
+ Invocation.Builder invocationBuilder = webTarget.request(MediaType.APPLICATION_JSON);
+ Response response = invocationBuilder.get();
int statusCode = response.getStatus();
if (statusCode != Response.Status.OK.getStatusCode()) {
throw new HTTPException(statusCode);
}
// This API folds information as the value to an "items" attribute.
- return new ObjectMapper().readTree(response.getEntity(String.class)).get("items");
+ return new ObjectMapper().readTree(response.readEntity(String.class)).get("items");
+
}
// This API assigns a unique role name to each host's instance of a role.
http://git-wip-us.apache.org/repos/asf/hbase/blob/7fee03ed/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ResourceConfig.java
----------------------------------------------------------------------
diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ResourceConfig.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ResourceConfig.java
deleted file mode 100644
index d397399..0000000
--- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/ResourceConfig.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *
- * 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.rest;
-
-import org.apache.hadoop.hbase.classification.InterfaceAudience;
-
-import com.sun.jersey.api.core.PackagesResourceConfig;
-
-@InterfaceAudience.Private
-public class ResourceConfig extends PackagesResourceConfig {
- public ResourceConfig() {
- super("org.apache.hadoop.hbase.rest");
- }
-}
http://git-wip-us.apache.org/repos/asf/hbase/blob/7fee03ed/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/model/VersionModel.java
----------------------------------------------------------------------
diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/model/VersionModel.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/model/VersionModel.java
index a82bb93..177e06a 100644
--- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/model/VersionModel.java
+++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/model/VersionModel.java
@@ -31,8 +31,8 @@ import org.apache.hadoop.hbase.rest.ProtobufMessageHandler;
import org.apache.hadoop.hbase.rest.RESTServlet;
import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
import org.apache.hadoop.hbase.rest.protobuf.generated.VersionMessage.Version;
+import org.glassfish.jersey.servlet.ServletContainer;
-import com.sun.jersey.spi.container.servlet.ServletContainer;
/**
* A representation of the collection of versions of the REST gateway software
@@ -75,7 +75,7 @@ public class VersionModel implements Serializable, ProtobufMessageHandler {
System.getProperty("os.version") + ' ' +
System.getProperty("os.arch");
serverVersion = context.getServerInfo();
- jerseyVersion = ServletContainer.class.getPackage()
+ jerseyVersion = ServletContainer.class.getClass().getPackage()
.getImplementationVersion();
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/7fee03ed/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestVersionResource.java
----------------------------------------------------------------------
diff --git a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestVersionResource.java b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestVersionResource.java
index 34973c2..b96a5d5 100644
--- a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestVersionResource.java
+++ b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestVersionResource.java
@@ -35,6 +35,7 @@ import org.apache.hadoop.hbase.rest.model.VersionModel;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.testclassification.RestTests;
import org.apache.hadoop.hbase.util.Bytes;
+import org.glassfish.jersey.servlet.ServletContainer;
import static org.junit.Assert.*;
@@ -42,7 +43,6 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-import com.sun.jersey.spi.container.servlet.ServletContainer;
import org.junit.experimental.categories.Category;
@Category({RestTests.class, MediumTests.class})
@@ -89,7 +89,7 @@ public class TestVersionResource {
assertNotNull(model.getServerVersion());
String jerseyVersion = model.getJerseyVersion();
assertNotNull(jerseyVersion);
- assertEquals(jerseyVersion, ServletContainer.class.getPackage()
+ assertEquals(jerseyVersion, ServletContainer.class.getClass().getPackage()
.getImplementationVersion());
}
@@ -107,7 +107,7 @@ public class TestVersionResource {
assertTrue(body.contains(System.getProperty("os.name")));
assertTrue(body.contains(System.getProperty("os.version")));
assertTrue(body.contains(System.getProperty("os.arch")));
- assertTrue(body.contains(ServletContainer.class.getPackage()
+ assertTrue(body.contains(ServletContainer.class.getClass().getPackage()
.getImplementationVersion()));
}
[10/21] hbase git commit: HBASE-18629 Enhance ChaosMonkeyRunner with
interruptibility
Posted by st...@apache.org.
HBASE-18629 Enhance ChaosMonkeyRunner with interruptibility
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/192e8730
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/192e8730
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/192e8730
Branch: refs/heads/HBASE-14070.HLC
Commit: 192e87309e387ef9fdf7f9808d221ca28ab69889
Parents: 820ee91
Author: tedyu <yu...@gmail.com>
Authored: Mon Aug 21 08:44:11 2017 -0700
Committer: tedyu <yu...@gmail.com>
Committed: Mon Aug 21 08:44:11 2017 -0700
----------------------------------------------------------------------
.../hbase/chaos/util/ChaosMonkeyRunner.java | 26 ++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/192e8730/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/util/ChaosMonkeyRunner.java
----------------------------------------------------------------------
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/util/ChaosMonkeyRunner.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/util/ChaosMonkeyRunner.java
index 82c51ad..f142321 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/util/ChaosMonkeyRunner.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/util/ChaosMonkeyRunner.java
@@ -52,6 +52,7 @@ public class ChaosMonkeyRunner extends AbstractHBaseTool {
protected boolean noClusterCleanUp = false;
private String tableName = "ChaosMonkeyRunner.tableName";
private String familyName = "ChaosMonkeyRunner.familyName";
+ private volatile boolean stop = false;
@Override
public void addOptions() {
@@ -92,9 +93,14 @@ public class ChaosMonkeyRunner extends AbstractHBaseTool {
protected int doWork() throws Exception {
setUpCluster();
getAndStartMonkey();
- while (true) {// loop here until got killed
+ while (!stop) {// loop here until got killed
Thread.sleep(10000);
}
+ return 0;
+ }
+
+ public void stopRunner() {
+ stop = true;
}
public void setUpCluster() throws Exception {
@@ -151,10 +157,26 @@ public class ChaosMonkeyRunner extends AbstractHBaseTool {
return Sets.newHashSet(familyName);
}
+ /*
+ * If caller wants to add config parameters contained in a file, the path of conf file
+ * can be passed as the first two arguments like this:
+ * -c <path-to-conf>
+ */
public static void main(String[] args) throws Exception {
Configuration conf = HBaseConfiguration.create();
+ String[] actualArgs = args;
+ if (args.length > 0 && "-c".equals(args[0])) {
+ int argCount = args.length - 2;
+ if (argCount < 0) {
+ throw new IllegalArgumentException("Missing path for -c parameter");
+ }
+ // load the resource specified by the second parameter
+ conf.addResource(args[1]);
+ actualArgs = new String[argCount];
+ System.arraycopy(args, 2, actualArgs, 0, argCount);
+ }
IntegrationTestingUtility.setUseDistributedCluster(conf);
- int ret = ToolRunner.run(conf, new ChaosMonkeyRunner(), args);
+ int ret = ToolRunner.run(conf, new ChaosMonkeyRunner(), actualArgs);
System.exit(ret);
}