Merge branch '1.6.0-SNAPSHOT' Conflicts: core/src/main/java/org/apache/accumulo/core/conf/DefaultConfiguration.java core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/86ed88a1 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/86ed88a1 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/86ed88a1 Branch: refs/heads/master Commit: 86ed88a169c14e7fc9c673804ee6240e07a02336 Parents: 2849cbd 40299f8 Author: Christopher Tubbs <ctubb...@apache.org> Authored: Thu Mar 27 15:06:10 2014 -0400 Committer: Christopher Tubbs <ctubb...@apache.org> Committed: Thu Mar 27 15:06:10 2014 -0400 ---------------------------------------------------------------------- .../accumulo/core/conf/ConfigurationDocGen.java | 341 +++++++++++++++++++ .../core/conf/DefaultConfiguration.java | 131 +------ .../org/apache/accumulo/core/conf/Property.java | 135 ++++---- .../apache/accumulo/core/conf/PropertyType.java | 66 ++-- .../accumulo/core/conf/config-header.html | 90 +++++ .../apache/accumulo/core/conf/config-header.tex | 99 ++++++ .../org/apache/accumulo/core/conf/config.html | 90 ----- .../apache/accumulo/core/conf/PropertyTest.java | 49 +-- docs/pom.xml | 41 +++ .../accumulo_user_manual.tex | 8 +- .../chapters/administration.tex | 70 ++-- .../accumulo_user_manual/chapters/analytics.tex | 88 ++--- .../accumulo_user_manual/chapters/clients.tex | 92 ++--- .../chapters/development_clients.tex | 44 +-- .../chapters/high_speed_ingest.tex | 18 +- .../chapters/multivolume.tex | 12 +- .../accumulo_user_manual/chapters/security.tex | 30 +- .../accumulo_user_manual/chapters/shell.tex | 43 +-- .../chapters/table_configuration.tex | 219 +++++------- .../chapters/table_design.tex | 60 ++-- .../chapters/troubleshooting.tex | 215 ++++++------ .../impl/MiniAccumuloConfigImpl.java | 6 +- .../accumulo/monitor/servlets/trace/Basic.java | 2 +- .../org/apache/accumulo/tracer/TraceServer.java | 58 ++-- .../classloader/vfs/AccumuloVFSClassLoader.java | 115 +++---- 25 files changed, 1152 insertions(+), 970 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/86ed88a1/core/src/main/java/org/apache/accumulo/core/conf/DefaultConfiguration.java ---------------------------------------------------------------------- diff --cc core/src/main/java/org/apache/accumulo/core/conf/DefaultConfiguration.java index a98d794,030e88a..843d126 --- a/core/src/main/java/org/apache/accumulo/core/conf/DefaultConfiguration.java +++ b/core/src/main/java/org/apache/accumulo/core/conf/DefaultConfiguration.java @@@ -24,27 -22,13 +22,23 @@@ import java.io.UnsupportedEncodingExcep import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; - import java.util.TreeMap; import org.apache.accumulo.core.Constants; - import org.apache.log4j.Logger; +/** + * An {@link AccumuloConfiguration} that contains only default values for + * properties. This class is a singleton. + */ public class DefaultConfiguration extends AccumuloConfiguration { private static DefaultConfiguration instance = null; - private static Logger log = Logger.getLogger(DefaultConfiguration.class); private Map<String,String> resolvedProps = null; + /** + * Gets an instance of this class. + * + * @return default configuration + * @throws RuntimeException if the default configuration is invalid + */ synchronized public static DefaultConfiguration getInstance() { if (instance == null) { instance = new DefaultConfiguration(); @@@ -76,128 -60,11 +70,13 @@@ props.put(entry.getKey(), entry.getValue()); } - /* - * Used by the monitor to show configuration properties + /** - * Generates HTML documentation on the default configuration. ++ * Generates HTML documentation on the default configuration. Used by the monitor to show configuration properties. + * + * @param doc stream to write HTML to */ protected static void generateDocumentation(PrintStream doc) { - // read static content from resources and output - InputStream data = DefaultConfiguration.class.getResourceAsStream("config.html"); - if (data != null) { - byte[] buffer = new byte[1024]; - int n; - try { - while ((n = data.read(buffer)) > 0) - doc.print(new String(buffer, 0, n, Constants.UTF8)); - } catch (IOException e) { - e.printStackTrace(); - return; - } finally { - try { - data.close(); - } catch (IOException ex) { - log.error(ex, ex); - } - } - } - doc.println(); - - ArrayList<Property> prefixes = new ArrayList<Property>(); - TreeMap<String,Property> sortedProps = new TreeMap<String,Property>(); - for (Property prop : Property.values()) { - if (prop.isExperimental()) - continue; - - if (prop.getType().equals(PropertyType.PREFIX)) - prefixes.add(prop); - else - sortedProps.put(prop.getKey(), prop); - } - - int indentDepth = 2; - doc.println(indent(indentDepth++) + "<p>Jump to: "); - String delimiter = ""; - for (Property prefix : prefixes) { - if (prefix.isExperimental()) - continue; - - doc.print(delimiter + "<a href='#" + prefix.name() + "'>" + prefix.getKey() + "*</a>"); - delimiter = " | "; - } - doc.println(indent(--indentDepth) + "</p>"); - - doc.println(indent(indentDepth++) + "<table>"); - for (Property prefix : prefixes) { - - if (prefix.isExperimental()) - continue; - - boolean isDeprecated = prefix.isDeprecated(); - - doc.println(indent(indentDepth) + "<tr><td colspan='5'" + (isDeprecated ? " class='deprecated'" : "") + "><a id='" + prefix.name() + "' class='large'>" - + prefix.getKey() + "*</a></td></tr>"); - doc.println(indent(indentDepth) + "<tr><td colspan='5'" + (isDeprecated ? " class='deprecated'" : "") + "><i>" - + (isDeprecated ? "<b><i>Deprecated.</i></b> " : "") + prefix.getDescription() + "</i></td></tr>"); - if (!prefix.equals(Property.TABLE_CONSTRAINT_PREFIX) && !prefix.equals(Property.TABLE_ITERATOR_PREFIX) - && !prefix.equals(Property.TABLE_LOCALITY_GROUP_PREFIX)) - doc.println(indent(indentDepth) + "<tr><th>Property</th><th>Type</th><th>Zookeeper Mutable</th><th>Default Value</th><th>Description</th></tr>"); - - boolean highlight = true; - for (Property prop : sortedProps.values()) { - if (prop.isExperimental()) - continue; - - isDeprecated = prefix.isDeprecated() || prop.isDeprecated(); - - if (prop.getKey().startsWith(prefix.getKey())) { - doc.println(indent(indentDepth++) + "<tr" + (highlight ? " class='highlight'" : "") + ">"); - highlight = !highlight; - doc.println(indent(indentDepth) + "<td" + (isDeprecated ? " class='deprecated'" : "") + ">" + prop.getKey() + "</td>"); - doc.println(indent(indentDepth) + "<td" + (isDeprecated ? " class='deprecated'" : "") + "><b><a href='#" + prop.getType().name() + "'>" - + prop.getType().toString().replaceAll(" ", " ") + "</a></b></td>"); - String zoo = "no"; - if (Property.isValidZooPropertyKey(prop.getKey())) { - zoo = "yes"; - if (Property.isFixedZooPropertyKey(prop)) { - zoo = "yes but requires restart of the " + prop.getKey().split("[.]")[0]; - } - } - doc.println(indent(indentDepth) + "<td" + (isDeprecated ? " class='deprecated'" : "") + ">" + zoo + "</td>"); - doc.println(indent(indentDepth) + "<td" + (isDeprecated ? " class='deprecated'" : "") + "><pre>" - + (prop.getRawDefaultValue().isEmpty() ? " " : prop.getRawDefaultValue().replaceAll(" ", " ")) + "</pre></td>"); - doc.println(indent(indentDepth) + "<td" + (isDeprecated ? " class='deprecated'" : "") + ">" + (isDeprecated ? "<b><i>Deprecated.</i></b> " : "") - + prop.getDescription() + "</td>"); - doc.println(indent(--indentDepth) + "</tr>"); - } - } - } - doc.println(indent(--indentDepth) + "</table>"); - - doc.println(indent(indentDepth) + "<h1>Property Type Descriptions</h1>"); - doc.println(indent(indentDepth++) + "<table>"); - doc.println(indent(indentDepth) + "<tr><th>Property Type</th><th>Description</th></tr>"); - boolean highlight = true; - for (PropertyType type : PropertyType.values()) { - if (type.equals(PropertyType.PREFIX)) - continue; - doc.println(indent(indentDepth++) + "<tr " + (highlight ? "class='highlight'" : "") + ">"); - highlight = !highlight; - doc.println(indent(indentDepth) + "<td><h3><a id='" + type.name() + "'>" + type + "</a></h3></td>"); - doc.println(indent(indentDepth) + "<td>" + type.getFormatDescription() + "</td>"); - doc.println(indent(--indentDepth) + "</tr>"); - } - doc.println(indent(--indentDepth) + "</table>"); - doc.println(indent(--indentDepth) + "</body>"); - doc.println(indent(--indentDepth) + "</html>"); - doc.close(); - } - - private static String indent(int depth) { - StringBuilder sb = new StringBuilder(); - for (int d = 0; d < depth; d++) - sb.append(" "); - return sb.toString(); + new ConfigurationDocGen(doc).generateHtml(); } /* http://git-wip-us.apache.org/repos/asf/accumulo/blob/86ed88a1/core/src/main/java/org/apache/accumulo/core/conf/Property.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/86ed88a1/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 98fb56a,7b6a926..50ee21c --- a/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java +++ b/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java @@@ -22,37 -22,32 +22,36 @@@ import java.util.regex.Pattern import org.apache.accumulo.core.Constants; import org.apache.hadoop.fs.Path; +/** + * 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. + */ public enum PropertyType { PREFIX(null, null, null), - + TIMEDURATION("duration", "\\d{1," + Long.toString(Long.MAX_VALUE).length() + "}(?:ms|s|m|h|d)?", - "A non-negative integer optionally followed by a unit of time (whitespace disallowed), as in 30s.<br />" - + "If no unit of time is specified, seconds are assumed. Valid units are 'ms', 's', 'm', 'h' for milliseconds, seconds, minutes, and hours.<br />" - + "Examples of valid durations are '600', '30s', '45m', '30000ms', '3d', and '1h'.<br />" - + "Examples of invalid durations are '1w', '1h30m', '1s 200ms', 'ms', '', and 'a'.<br />" - + "Unless otherwise stated, the max value for the duration represented in milliseconds is " + Long.MAX_VALUE), - DATETIME("date/time", "(?:19|20)\\d{12}[A-Z]{3}", "A date/time string in the format: YYYYMMDDhhmmssTTT where TTT is the 3 character time zone"), - MEMORY("memory", "\\d{1," + Long.toString(Long.MAX_VALUE).length() + "}(?:B|K|M|G)?", - "A positive integer optionally followed by a unit of memory (whitespace disallowed), as in 2G.<br />" - + "If no unit is specified, bytes are assumed. Valid units are 'B', 'K', 'M', 'G', for bytes, kilobytes, megabytes, and gigabytes.<br />" - + "Examples of valid memories are '1024', '20B', '100K', '1500M', '2G'.<br />" - + "Examples of invalid memories are '1M500K', '1M 2K', '1MB', '1.5G', '1,024K', '', and 'a'.<br />" + "A non-negative integer optionally followed by a unit of time (whitespace disallowed), as in 30s.\n" + + "If no unit of time is specified, seconds are assumed. Valid units are 'ms', 's', 'm', 'h' for milliseconds, seconds, minutes, and hours.\n" + + "Examples of valid durations are '600', '30s', '45m', '30000ms', '3d', and '1h'.\n" + + "Examples of invalid durations are '1w', '1h30m', '1s 200ms', 'ms', '', and 'a'.\n" + + "Unless otherwise stated, the max value for the duration represented in milliseconds is " + Long.MAX_VALUE), DATETIME("date/time", + "(?:19|20)\\d{12}[A-Z]{3}", "A date/time string in the format: YYYYMMDDhhmmssTTT where TTT is the 3 character time zone"), MEMORY("memory", "\\d{1," + + Long.toString(Long.MAX_VALUE).length() + "}(?:B|K|M|G)?", + "A positive integer optionally followed by a unit of memory (whitespace disallowed), as in 2G.\n" + + "If no unit is specified, bytes are assumed. Valid units are 'B', 'K', 'M', 'G', for bytes, kilobytes, megabytes, and gigabytes.\n" + + "Examples of valid memories are '1024', '20B', '100K', '1500M', '2G'.\n" + + "Examples of invalid memories are '1M500K', '1M 2K', '1MB', '1.5G', '1,024K', '', and 'a'.\n" + "Unless otherwise stated, the max value for the memory represented in bytes is " + Long.MAX_VALUE), - + HOSTLIST("host list", "[\\w-]+(?:\\.[\\w-]+)*(?:\\:\\d{1,5})?(?:,[\\w-]+(?:\\.[\\w-]+)*(?:\\:\\d{1,5})?)*", - "A comma-separated list of hostnames or ip addresses, with optional port numbers.<br />" - + "Examples of valid host lists are 'localhost:2000,www.example.com,10.10.1.1:500' and 'localhost'.<br />" + "A comma-separated list of hostnames or ip addresses, with optional port numbers.\n" + + "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", "\\d{1,5}", "An positive integer in the range 1024-65535, not already in use or specified elsewhere in the configuration"), - COUNT("count", "\\d{1,10}", "A non-negative integer in the range of 0-" + Integer.MAX_VALUE), - FRACTION("fraction/percentage", "\\d*(?:\\.\\d+)?%?", - "A floating point number that represents either a fraction or, if suffixed with the '%' character, a percentage.<br />" - + "Examples of valid fractions/percentages are '10', '1000%', '0.05', '5%', '0.2%', '0.0005'.<br />" + + PORT("port", "\\d{1,5}", "An positive integer in the range 1024-65535, not already in use or specified elsewhere in the configuration"), COUNT("count", + "\\d{1,10}", "A non-negative integer in the range of 0-" + Integer.MAX_VALUE), FRACTION("fraction/percentage", "\\d*(?:\\.\\d+)?%?", + "A floating point number that represents either a fraction or, if suffixed with the '%' character, a percentage.\n" + + "Examples of valid fractions/percentages are '10', '1000%', '0.05', '5%', '0.2%', '0.0005'.\n" + "Examples of invalid fractions/percentages are '', '10 percent', 'Hulk Hogan'"), PATH("path", ".*", @@@ -86,12 -80,7 +84,12 @@@ public String toString() { return shortname; } - + + /** + * Gets the description of this type. + * + * @return description + */ String getFormatDescription() { return format; } http://git-wip-us.apache.org/repos/asf/accumulo/blob/86ed88a1/docs/pom.xml ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/86ed88a1/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java ---------------------------------------------------------------------- diff --cc server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java index 7aab5cd,67f2739..ed10582 --- a/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java +++ b/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java @@@ -225,9 -225,9 +225,9 @@@ public class TraceServer implements Wat registerInZooKeeper(sock.getInetAddress().getHostAddress() + ":" + sock.getLocalPort()); writer = new AtomicReference<BatchWriter>(this.connector.createBatchWriter(table, new BatchWriterConfig().setMaxLatency(5, TimeUnit.SECONDS))); } - + public void run() throws Exception { - SimpleTimer.getInstance().schedule(new Runnable() { + SimpleTimer.getInstance(serverConfiguration.getConfiguration()).schedule(new Runnable() { @Override public void run() { flush();