Merge branch '1.8'
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/c521cf81
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/c521cf81
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/c521cf81
Branch: refs/heads/master
Commit: c521cf810b8e38ba90dcd75a3b9b27f45e829bd3
Parents: af91fbd 7f8f66d
Author: Dave Marion <dlmarion@apache.org>
Authored: Tue Jun 14 11:04:38 2016 -0400
Committer: Dave Marion <dlmarion@apache.org>
Committed: Tue Jun 14 11:04:38 2016 -0400
----------------------------------------------------------------------
.../core/conf/AccumuloConfiguration.java | 36 ++-
.../apache/accumulo/core/conf/PropertyType.java | 58 ++++-
.../core/conf/AccumuloConfigurationTest.java | 75 ++++++
.../main/asciidoc/chapters/administration.txt | 5 +-
.../java/org/apache/accumulo/proxy/Proxy.java | 4 +-
.../org/apache/accumulo/server/Accumulo.java | 4 +-
.../accumulo/server/monitor/LogService.java | 2 +-
.../accumulo/server/rpc/TServerUtils.java | 154 ++++++-----
.../org/apache/accumulo/server/util/Admin.java | 20 +-
.../accumulo/server/util/TServerUtilsTest.java | 261 +++++++++++++++++++
.../accumulo/gc/SimpleGarbageCollector.java | 13 +-
.../java/org/apache/accumulo/master/Master.java | 2 +-
.../accumulo/monitor/EmbeddedWebServer.java | 4 +
.../org/apache/accumulo/monitor/Monitor.java | 65 ++---
.../org/apache/accumulo/tracer/TraceServer.java | 21 +-
.../accumulo/test/functional/ZombieTServer.java | 4 +-
.../test/performance/thrift/NullTserver.java | 6 +-
17 files changed, 595 insertions(+), 139 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/c521cf81/core/src/main/java/org/apache/accumulo/core/conf/AccumuloConfiguration.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/c521cf81/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java
----------------------------------------------------------------------
diff --cc core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java
index bd80700,f08ab5b..5cba0be
--- a/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java
@@@ -25,8 -24,16 +25,11 @@@ import java.util.regex.Matcher
import java.util.regex.Pattern;
import org.apache.accumulo.core.Constants;
+ import org.apache.accumulo.core.util.Pair;
import org.apache.hadoop.fs.Path;
+ import org.slf4j.Logger;
+ import org.slf4j.LoggerFactory;
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-import com.google.common.collect.Collections2;
-
/**
* Types of {@link Property} values. Each type has a short name, a description, and a regex
which valid values match. All of these fields are optional.
*/
@@@ -52,8 -59,10 +55,10 @@@ public enum PropertyType
+ "Examples of valid host lists are 'localhost:2000,www.example.com,10.10.1.1:500'
and 'localhost'.\n"
+ "Examples of invalid host lists are '', ':1000', and 'localhost:80000'"),
- PORT("port", new Bounds(1024, 65535).or(in(true, "0")),
- "An positive integer in the range 1024-65535, not already in use or specified elsewhere
in the configuration"),
+ @SuppressWarnings("unchecked")
- PORT("port", Predicates.or(new Bounds(1024, 65535), in(true, "0"), new PortRange("\\d{4,5}-\\d{4,5}")),
++ PORT("port", or(new Bounds(1024, 65535), in(true, "0"), new PortRange("\\d{4,5}-\\d{4,5}")),
+ "An positive integer in the range 1024-65535 (not already in use or specified elsewhere
in the configuration),\n"
+ + "zero to indicate any open ephemeral port, or a range of positive integers specified
as M-N"),
COUNT("count", new Bounds(0, Integer.MAX_VALUE), "A non-negative integer in the range
of 0-" + Integer.MAX_VALUE),
@@@ -113,15 -126,21 +118,20 @@@
* @return true if value is valid or null, or if this type has no regex
*/
public boolean isValidFormat(String value) {
- return predicate.apply(value);
+ return predicate.test(value);
+ }
+
++ @SuppressWarnings("unchecked")
++ private static Predicate<String> or(final Predicate<String>... others) {
++ return (x) -> Arrays.stream(others).anyMatch(y -> y.test(x));
+ }
+
- private static Predicate<String> in(final boolean caseSensitive, final String...
strings) {
- List<String> allowedSet = Arrays.asList(strings);
+ private static Predicate<String> in(final boolean caseSensitive, final String...
allowedSet) {
if (caseSensitive) {
- return Predicates.in(allowedSet);
+ return x -> Arrays.stream(allowedSet).anyMatch(y -> (x == null && y
== null) || (x != null && x.equals(y)));
} else {
- Function<String,String> toLower = new Function<String,String>() {
- @Override
- public String apply(final String input) {
- return input == null ? null : input.toLowerCase();
- }
- };
- return Predicates.compose(Predicates.in(Collections2.transform(allowedSet, toLower)),
toLower);
+ Function<String,String> toLower = x -> x == null ? null : x.toLowerCase();
+ return x -> Arrays.stream(allowedSet).map(toLower).anyMatch(y -> (x == null
&& y == null) || (x != null && toLower.apply(x).equals(y)));
}
}
@@@ -241,4 -267,46 +251,46 @@@
}
+ public static class PortRange extends Matches {
+
+ private static final Logger log = LoggerFactory.getLogger(PortRange.class);
+
+ public PortRange(final String pattern) {
+ super(pattern);
+ }
+
+ @Override
- public boolean apply(final String input) {
- if (super.apply(input)) {
++ public boolean test(final String input) {
++ if (super.test(input)) {
+ try {
+ PortRange.parse(input);
+ return true;
+ } catch (IllegalArgumentException e) {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ public static Pair<Integer,Integer> parse(String portRange) {
+ int idx = portRange.indexOf('-');
+ if (idx != -1) {
+ int low = Integer.parseInt(portRange.substring(0, idx));
+ if (low < 1024) {
+ log.error("Invalid port number for low end of the range, using 1024");
+ low = 1024;
+ }
+ int high = Integer.parseInt(portRange.substring(idx + 1));
+ if (high > 65535) {
+ log.error("Invalid port number for high end of the range, using 65535");
+ high = 65535;
+ }
+ return new Pair<Integer,Integer>(low, high);
+ }
+ throw new IllegalArgumentException("Invalid port range specification, must use M-N
notation.");
+ }
+
+ }
+
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/c521cf81/server/gc/src/main/java/org/apache/accumulo/gc/SimpleGarbageCollector.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/c521cf81/server/master/src/main/java/org/apache/accumulo/master/Master.java
----------------------------------------------------------------------
|