You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2013/11/01 01:56:32 UTC
[53/54] ACCUMULO-210 Create separate RPMs
http://git-wip-us.apache.org/repos/asf/accumulo/blob/05d5921c/server/extras/pom.xml
----------------------------------------------------------------------
diff --git a/server/extras/pom.xml b/server/extras/pom.xml
new file mode 100644
index 0000000..8413f4b
--- /dev/null
+++ b/server/extras/pom.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.accumulo</groupId>
+ <artifactId>accumulo-project</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>accumulo-server-extras</artifactId>
+ <name>Extra Server Utilities</name>
+ <description>A library of additional tools to work with Apache Accumulo.</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.accumulo</groupId>
+ <artifactId>accumulo-master</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.accumulo</groupId>
+ <artifactId>accumulo-tserver</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <profiles>
+ <profile>
+ <id>rpm</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>rpm-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build-rpm</id>
+ <goals>
+ <goal>attached-rpm</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <requires>
+ <require>jre >= 1.6.0</require>
+ <require>accumulo-tserver = %{version}-%{release}</require>
+ </requires>
+ <mappings>
+ <mapping>
+ <directory>%{_javadir}/accumulo</directory>
+ <artifact />
+ </mapping>
+ </mappings>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
http://git-wip-us.apache.org/repos/asf/accumulo/blob/05d5921c/server/extras/src/main/java/org/apache/accumulo/utils/metanalysis/FilterMeta.java
----------------------------------------------------------------------
diff --git a/server/extras/src/main/java/org/apache/accumulo/utils/metanalysis/FilterMeta.java b/server/extras/src/main/java/org/apache/accumulo/utils/metanalysis/FilterMeta.java
new file mode 100644
index 0000000..ac56c99
--- /dev/null
+++ b/server/extras/src/main/java/org/apache/accumulo/utils/metanalysis/FilterMeta.java
@@ -0,0 +1,93 @@
+/*
+ * 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.accumulo.utils.metanalysis;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.util.CachedConfiguration;
+import org.apache.accumulo.tserver.logger.LogEvents;
+import org.apache.accumulo.tserver.logger.LogFileKey;
+import org.apache.accumulo.tserver.logger.LogFileValue;
+import org.apache.hadoop.conf.Configured;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.mapreduce.Job;
+import org.apache.hadoop.mapreduce.Mapper;
+import org.apache.hadoop.util.Tool;
+import org.apache.hadoop.util.ToolRunner;
+
+/**
+ * A map reduce job that takes a set of walogs and filters out all non metadata table events.
+ */
+public class FilterMeta extends Configured implements Tool {
+
+ public static class FilterMapper extends Mapper<LogFileKey,LogFileValue,LogFileKey,LogFileValue> {
+ private Set<Integer> tabletIds;
+
+ @Override
+ protected void setup(Context context) throws java.io.IOException, java.lang.InterruptedException {
+ tabletIds = new HashSet<Integer>();
+ }
+
+ @Override
+ public void map(LogFileKey key, LogFileValue value, Context context) throws IOException, InterruptedException {
+ if (key.event == LogEvents.OPEN) {
+ context.write(key, value);
+ } else if (key.event == LogEvents.DEFINE_TABLET && key.tablet.getTableId().toString().equals(MetadataTable.ID)) {
+ tabletIds.add(key.tid);
+ context.write(key, value);
+ } else if ((key.event == LogEvents.MUTATION || key.event == LogEvents.MANY_MUTATIONS) && tabletIds.contains(key.tid)) {
+ context.write(key, value);
+ }
+ }
+ }
+
+ @Override
+ public int run(String[] args) throws Exception {
+
+ String jobName = this.getClass().getSimpleName() + "_" + System.currentTimeMillis();
+
+ @SuppressWarnings("deprecation")
+ Job job = new Job(getConf(), jobName);
+ job.setJarByClass(this.getClass());
+
+ Path paths[] = new Path[args.length - 1];
+ for (int i = 0; i < paths.length; i++) {
+ paths[i] = new Path(args[i]);
+ }
+
+ job.setInputFormatClass(LogFileInputFormat.class);
+ LogFileInputFormat.setInputPaths(job, paths);
+
+ job.setOutputFormatClass(LogFileOutputFormat.class);
+ LogFileOutputFormat.setOutputPath(job, new Path(args[args.length - 1]));
+
+ job.setMapperClass(FilterMapper.class);
+
+ job.setNumReduceTasks(0);
+
+ job.waitForCompletion(true);
+ return job.isSuccessful() ? 0 : 1;
+ }
+
+ public static void main(String[] args) throws Exception {
+ int res = ToolRunner.run(CachedConfiguration.getInstance(), new FilterMeta(), args);
+ System.exit(res);
+ }
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/05d5921c/server/extras/src/main/java/org/apache/accumulo/utils/metanalysis/FindTablet.java
----------------------------------------------------------------------
diff --git a/server/extras/src/main/java/org/apache/accumulo/utils/metanalysis/FindTablet.java b/server/extras/src/main/java/org/apache/accumulo/utils/metanalysis/FindTablet.java
new file mode 100644
index 0000000..773c41a
--- /dev/null
+++ b/server/extras/src/main/java/org/apache/accumulo/utils/metanalysis/FindTablet.java
@@ -0,0 +1,66 @@
+/*
+ * 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.accumulo.utils.metanalysis;
+
+import java.util.Map.Entry;
+
+import org.apache.accumulo.core.client.Scanner;
+import org.apache.accumulo.core.data.Key;
+import org.apache.accumulo.core.data.KeyExtent;
+import org.apache.accumulo.core.data.Range;
+import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.util.TextUtil;
+import org.apache.accumulo.server.cli.ClientOpts;
+import org.apache.hadoop.io.Text;
+
+import com.beust.jcommander.Parameter;
+
+/**
+ * Finds tablet creation events.
+ */
+public class FindTablet {
+
+ static public class Opts extends ClientOpts {
+ @Parameter(names = {"-r", "--row"}, required = true, description = "find tablets that contain this row")
+ String row = null;
+
+ @Parameter(names = "--tableId", required = true, description = "table id")
+ String tableId = null;
+ }
+
+ public static void main(String[] args) throws Exception {
+ Opts opts = new Opts();
+ opts.parseArgs(FindTablet.class.getName(), args);
+
+ findContainingTablets(opts);
+ }
+
+ private static void findContainingTablets(Opts opts) throws Exception {
+ Range range = new KeyExtent(new Text(opts.tableId), null, null).toMetadataRange();
+
+ Scanner scanner = opts.getConnector().createScanner("createEvents", opts.auths);
+ scanner.setRange(range);
+
+ Text row = new Text(opts.row);
+ for (Entry<Key,Value> entry : scanner) {
+ KeyExtent ke = new KeyExtent(entry.getKey().getRow(), new Value(TextUtil.getBytes(entry.getKey().getColumnFamily())));
+ if (ke.contains(row)) {
+ System.out.println(entry.getKey().getColumnQualifier() + " " + ke + " " + entry.getValue());
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/05d5921c/server/extras/src/main/java/org/apache/accumulo/utils/metanalysis/IndexMeta.java
----------------------------------------------------------------------
diff --git a/server/extras/src/main/java/org/apache/accumulo/utils/metanalysis/IndexMeta.java b/server/extras/src/main/java/org/apache/accumulo/utils/metanalysis/IndexMeta.java
new file mode 100644
index 0000000..8e7b221
--- /dev/null
+++ b/server/extras/src/main/java/org/apache/accumulo/utils/metanalysis/IndexMeta.java
@@ -0,0 +1,177 @@
+/*
+ * 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.accumulo.utils.metanalysis;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.TableExistsException;
+import org.apache.accumulo.core.client.mapreduce.AccumuloOutputFormat;
+import org.apache.accumulo.core.data.ColumnUpdate;
+import org.apache.accumulo.core.data.KeyExtent;
+import org.apache.accumulo.core.data.Mutation;
+import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
+import org.apache.accumulo.core.util.CachedConfiguration;
+import org.apache.accumulo.server.cli.ClientOpts;
+import org.apache.accumulo.tserver.logger.LogEvents;
+import org.apache.accumulo.tserver.logger.LogFileKey;
+import org.apache.accumulo.tserver.logger.LogFileValue;
+import org.apache.hadoop.conf.Configured;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.io.Text;
+import org.apache.hadoop.io.WritableUtils;
+import org.apache.hadoop.mapreduce.Job;
+import org.apache.hadoop.mapreduce.Mapper;
+import org.apache.hadoop.util.Tool;
+import org.apache.hadoop.util.ToolRunner;
+import org.apache.log4j.Logger;
+
+import com.beust.jcommander.Parameter;
+
+/**
+ * A map reduce job that takes write ahead logs containing mutations for the metadata table and indexes them into Accumulo tables for analysis.
+ *
+ */
+
+public class IndexMeta extends Configured implements Tool {
+
+ public static class IndexMapper extends Mapper<LogFileKey,LogFileValue,Text,Mutation> {
+ private static final Text CREATE_EVENTS_TABLE = new Text("createEvents");
+ private static final Text TABLET_EVENTS_TABLE = new Text("tabletEvents");
+ private Map<Integer,KeyExtent> tabletIds = new HashMap<Integer,KeyExtent>();
+ private String uuid = null;
+
+ @Override
+ protected void setup(Context context) throws java.io.IOException, java.lang.InterruptedException {
+ tabletIds = new HashMap<Integer,KeyExtent>();
+ uuid = null;
+ }
+
+ @Override
+ public void map(LogFileKey key, LogFileValue value, Context context) throws IOException, InterruptedException {
+ if (key.event == LogEvents.OPEN) {
+ uuid = key.tserverSession;
+ } else if (key.event == LogEvents.DEFINE_TABLET) {
+ if (key.tablet.getTableId().toString().equals(MetadataTable.ID)) {
+ tabletIds.put(key.tid, new KeyExtent(key.tablet));
+ }
+ } else if ((key.event == LogEvents.MUTATION || key.event == LogEvents.MANY_MUTATIONS) && tabletIds.containsKey(key.tid)) {
+ for (Mutation m : value.mutations) {
+ index(context, m, uuid, tabletIds.get(key.tid));
+ }
+ }
+ }
+
+ void index(Context context, Mutation m, String logFile, KeyExtent metaTablet) throws IOException, InterruptedException {
+ List<ColumnUpdate> columnsUpdates = m.getUpdates();
+
+ Text prevRow = null;
+ long timestamp = 0;
+
+ if (m.getRow().length > 0 && m.getRow()[0] == '~') {
+ return;
+ }
+
+ for (ColumnUpdate cu : columnsUpdates) {
+ if (TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.equals(new Text(cu.getColumnFamily()), new Text(cu.getColumnQualifier())) && !cu.isDeleted()) {
+ prevRow = new Text(cu.getValue());
+ }
+
+ timestamp = cu.getTimestamp();
+ }
+
+ byte[] serMut = WritableUtils.toByteArray(m);
+
+ if (prevRow != null) {
+ Mutation createEvent = new Mutation(new Text(m.getRow()));
+ createEvent.put(prevRow, new Text(String.format("%020d", timestamp)), new Value(metaTablet.toString().getBytes()));
+ context.write(CREATE_EVENTS_TABLE, createEvent);
+ }
+
+ Mutation tabletEvent = new Mutation(new Text(m.getRow()));
+ tabletEvent.put(new Text(String.format("%020d", timestamp)), new Text("mut"), new Value(serMut));
+ tabletEvent.put(new Text(String.format("%020d", timestamp)), new Text("mtab"), new Value(metaTablet.toString().getBytes()));
+ tabletEvent.put(new Text(String.format("%020d", timestamp)), new Text("log"), new Value(logFile.getBytes()));
+ context.write(TABLET_EVENTS_TABLE, tabletEvent);
+ }
+ }
+
+ static class Opts extends ClientOpts {
+ @Parameter(description = "<logfile> { <logfile> ...}")
+ List<String> logFiles = new ArrayList<String>();
+ }
+
+ @Override
+ public int run(String[] args) throws Exception {
+ Opts opts = new Opts();
+ opts.parseArgs(IndexMeta.class.getName(), args);
+
+ String jobName = this.getClass().getSimpleName() + "_" + System.currentTimeMillis();
+
+ @SuppressWarnings("deprecation")
+ Job job = new Job(getConf(), jobName);
+ job.setJarByClass(this.getClass());
+
+ List<String> logFiles = Arrays.asList(args).subList(4, args.length);
+ Path paths[] = new Path[logFiles.size()];
+ int count = 0;
+ for (String logFile : logFiles) {
+ paths[count++] = new Path(logFile);
+ }
+
+ job.setInputFormatClass(LogFileInputFormat.class);
+ LogFileInputFormat.setInputPaths(job, paths);
+
+ job.setNumReduceTasks(0);
+
+ job.setOutputFormatClass(AccumuloOutputFormat.class);
+ AccumuloOutputFormat.setZooKeeperInstance(job, opts.instance, opts.zookeepers);
+ AccumuloOutputFormat.setConnectorInfo(job, opts.principal, opts.getToken());
+ AccumuloOutputFormat.setCreateTables(job, false);
+
+ job.setMapperClass(IndexMapper.class);
+
+ Connector conn = opts.getConnector();
+
+ try {
+ conn.tableOperations().create("createEvents");
+ } catch (TableExistsException tee) {
+ Logger.getLogger(IndexMeta.class).warn("Table createEvents exists");
+ }
+
+ try {
+ conn.tableOperations().create("tabletEvents");
+ } catch (TableExistsException tee) {
+ Logger.getLogger(IndexMeta.class).warn("Table tabletEvents exists");
+ }
+
+ job.waitForCompletion(true);
+ return job.isSuccessful() ? 0 : 1;
+ }
+
+ public static void main(String[] args) throws Exception {
+ int res = ToolRunner.run(CachedConfiguration.getInstance(), new IndexMeta(), args);
+ System.exit(res);
+ }
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/05d5921c/server/extras/src/main/java/org/apache/accumulo/utils/metanalysis/LogFileInputFormat.java
----------------------------------------------------------------------
diff --git a/server/extras/src/main/java/org/apache/accumulo/utils/metanalysis/LogFileInputFormat.java b/server/extras/src/main/java/org/apache/accumulo/utils/metanalysis/LogFileInputFormat.java
new file mode 100644
index 0000000..603bf71
--- /dev/null
+++ b/server/extras/src/main/java/org/apache/accumulo/utils/metanalysis/LogFileInputFormat.java
@@ -0,0 +1,116 @@
+/*
+ * 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.accumulo.utils.metanalysis;
+
+import java.io.EOFException;
+import java.io.IOException;
+
+import org.apache.accumulo.tserver.logger.LogFileKey;
+import org.apache.accumulo.tserver.logger.LogFileValue;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FSDataInputStream;
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.mapreduce.InputSplit;
+import org.apache.hadoop.mapreduce.JobContext;
+import org.apache.hadoop.mapreduce.RecordReader;
+import org.apache.hadoop.mapreduce.TaskAttemptContext;
+import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
+import org.apache.hadoop.mapreduce.lib.input.FileSplit;
+
+/**
+ * Input format for Accumulo write ahead logs
+ */
+public class LogFileInputFormat extends FileInputFormat<LogFileKey,LogFileValue> {
+
+ private static class LogFileRecordReader extends RecordReader<LogFileKey,LogFileValue> {
+
+ private FSDataInputStream fsdis;
+ private LogFileKey key;
+ private LogFileValue value;
+ private long length;
+
+ @Override
+ public void close() throws IOException {
+ fsdis.close();
+ }
+
+ @Override
+ public LogFileKey getCurrentKey() throws IOException, InterruptedException {
+ return key;
+ }
+
+ @Override
+ public LogFileValue getCurrentValue() throws IOException, InterruptedException {
+ return value;
+ }
+
+ @Override
+ public float getProgress() throws IOException, InterruptedException {
+ float progress = (length - fsdis.getPos()) / (float) length;
+ if (progress < 0)
+ return 0;
+ return progress;
+ }
+
+ @Override
+ public void initialize(InputSplit is, TaskAttemptContext context) throws IOException, InterruptedException {
+ FileSplit fileSplit = (FileSplit) is;
+
+ Configuration conf = new Configuration();
+ FileSystem fs = FileSystem.get(conf);
+
+ key = new LogFileKey();
+ value = new LogFileValue();
+
+ fsdis = fs.open(fileSplit.getPath());
+ FileStatus status = fs.getFileStatus(fileSplit.getPath());
+ length = status.getLen();
+ }
+
+ @Override
+ public boolean nextKeyValue() throws IOException, InterruptedException {
+ if (key == null)
+ return false;
+
+ try {
+ key.readFields(fsdis);
+ value.readFields(fsdis);
+ return true;
+ } catch (EOFException ex) {
+ key = null;
+ value = null;
+ return false;
+ }
+ }
+
+ }
+
+
+ @Override
+ public RecordReader<LogFileKey,LogFileValue> createRecordReader(InputSplit arg0, TaskAttemptContext arg1) throws IOException, InterruptedException {
+ return new LogFileRecordReader();
+ }
+
+ @Override
+ protected boolean isSplitable(JobContext context, Path filename) {
+ return false;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/05d5921c/server/extras/src/main/java/org/apache/accumulo/utils/metanalysis/LogFileOutputFormat.java
----------------------------------------------------------------------
diff --git a/server/extras/src/main/java/org/apache/accumulo/utils/metanalysis/LogFileOutputFormat.java b/server/extras/src/main/java/org/apache/accumulo/utils/metanalysis/LogFileOutputFormat.java
new file mode 100644
index 0000000..cccb89e
--- /dev/null
+++ b/server/extras/src/main/java/org/apache/accumulo/utils/metanalysis/LogFileOutputFormat.java
@@ -0,0 +1,66 @@
+/*
+ * 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.accumulo.utils.metanalysis;
+
+import java.io.IOException;
+
+import org.apache.accumulo.tserver.logger.LogFileKey;
+import org.apache.accumulo.tserver.logger.LogFileValue;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FSDataOutputStream;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.mapreduce.RecordWriter;
+import org.apache.hadoop.mapreduce.TaskAttemptContext;
+import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
+
+/**
+ * Output format for Accumulo write ahead logs.
+ */
+public class LogFileOutputFormat extends FileOutputFormat<LogFileKey,LogFileValue> {
+
+ private static class LogFileRecordWriter extends RecordWriter<LogFileKey,LogFileValue> {
+
+ private FSDataOutputStream out;
+
+ public LogFileRecordWriter(Path outputPath) throws IOException {
+ Configuration conf = new Configuration();
+ FileSystem fs = FileSystem.get(conf);
+
+ out = fs.create(outputPath);
+ }
+
+ @Override
+ public void close(TaskAttemptContext arg0) throws IOException, InterruptedException {
+ out.close();
+ }
+
+ @Override
+ public void write(LogFileKey key, LogFileValue val) throws IOException, InterruptedException {
+ key.write(out);
+ val.write(out);
+ }
+
+ }
+
+ @Override
+ public RecordWriter<LogFileKey,LogFileValue> getRecordWriter(TaskAttemptContext context) throws IOException, InterruptedException {
+ Path outputPath = getDefaultWorkFile(context, "");
+ return new LogFileRecordWriter(outputPath);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/05d5921c/server/extras/src/main/java/org/apache/accumulo/utils/metanalysis/PrintEvents.java
----------------------------------------------------------------------
diff --git a/server/extras/src/main/java/org/apache/accumulo/utils/metanalysis/PrintEvents.java b/server/extras/src/main/java/org/apache/accumulo/utils/metanalysis/PrintEvents.java
new file mode 100644
index 0000000..fc6c18a
--- /dev/null
+++ b/server/extras/src/main/java/org/apache/accumulo/utils/metanalysis/PrintEvents.java
@@ -0,0 +1,99 @@
+/*
+ * 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.accumulo.utils.metanalysis;
+
+import java.io.ByteArrayInputStream;
+import java.io.DataInputStream;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map.Entry;
+
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.Scanner;
+import org.apache.accumulo.core.data.ColumnUpdate;
+import org.apache.accumulo.core.data.Key;
+import org.apache.accumulo.core.data.Mutation;
+import org.apache.accumulo.core.data.PartialKey;
+import org.apache.accumulo.core.data.Range;
+import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.server.cli.ClientOpts;
+import org.apache.accumulo.tserver.logger.LogFileValue;
+import org.apache.hadoop.io.Text;
+
+import com.beust.jcommander.Parameter;
+
+/**
+ * Looks up and prints mutations indexed by IndexMeta
+ */
+public class PrintEvents {
+
+ static class Opts extends ClientOpts {
+ @Parameter(names = {"-t", "--tableId"}, description = "table id", required = true)
+ String tableId;
+ @Parameter(names = {"-e", "--endRow"}, description = "end row")
+ String endRow;
+ @Parameter(names = {"-t", "--time"}, description = "time, in milliseconds", required = true)
+ long time;
+ }
+
+ public static void main(String[] args) throws Exception {
+ Opts opts = new Opts();
+ opts.parseArgs(PrintEvents.class.getName(), args);
+
+ Connector conn = opts.getConnector();
+
+ printEvents(conn, opts.tableId, opts.endRow, opts.time);
+ }
+
+ private static void printEvents(Connector conn, String tableId, String endRow, Long time) throws Exception {
+ Scanner scanner = conn.createScanner("tabletEvents", new Authorizations());
+ String metaRow = tableId + (endRow == null ? "<" : ";" + endRow);
+ scanner.setRange(new Range(new Key(metaRow, String.format("%020d", time)), true, new Key(metaRow).followingKey(PartialKey.ROW), false));
+ int count = 0;
+
+ String lastLog = null;
+
+ loop1: for (Entry<Key,Value> entry : scanner) {
+ if (entry.getKey().getColumnQualifier().toString().equals("log")) {
+ if (lastLog == null || !lastLog.equals(entry.getValue().toString()))
+ System.out.println("Log : " + entry.getValue());
+ lastLog = entry.getValue().toString();
+ } else if (entry.getKey().getColumnQualifier().toString().equals("mut")) {
+ DataInputStream dis = new DataInputStream(new ByteArrayInputStream(entry.getValue().get()));
+ Mutation m = new Mutation();
+ m.readFields(dis);
+
+ LogFileValue lfv = new LogFileValue();
+ lfv.mutations = Collections.singletonList(m);
+
+ System.out.println(LogFileValue.format(lfv, 1));
+
+ List<ColumnUpdate> columnsUpdates = m.getUpdates();
+ for (ColumnUpdate cu : columnsUpdates) {
+ if (TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.equals(new Text(cu.getColumnFamily()), new Text(cu.getColumnQualifier())) && count > 0) {
+ System.out.println("Saw change to prevrow, stopping printing events.");
+ break loop1;
+ }
+ }
+ count++;
+ }
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/05d5921c/server/extras/src/main/java/org/apache/accumulo/utils/metanalysis/package-info.java
----------------------------------------------------------------------
diff --git a/server/extras/src/main/java/org/apache/accumulo/utils/metanalysis/package-info.java b/server/extras/src/main/java/org/apache/accumulo/utils/metanalysis/package-info.java
new file mode 100644
index 0000000..3c15884
--- /dev/null
+++ b/server/extras/src/main/java/org/apache/accumulo/utils/metanalysis/package-info.java
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+/**
+ * Provides programs to analyze metadata mutations written to write ahead logs.
+ *
+ * <p>
+ * These programs can be used when write ahead logs are archived. The best way to find
+ * which write ahead logs contain metadata mutations is to grep the tablet server logs.
+ * Grep for events where walogs were added to metadata tablets, then take the unique set
+ * of walogs.
+ *
+ * <p>
+ * To use these programs, use IndexMeta to index the metadata mutations in walogs into
+ * Accumulo tables. Then use FindTable and PrintEvents to analyze those indexes.
+ * FilterMetaiallows filtering walogs down to just metadata events. This is useful for the
+ * case where the walogs need to be exported from the cluster for analysis.
+ *
+ * @since 1.5
+ */
+package org.apache.accumulo.utils.metanalysis;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/05d5921c/server/gc/pom.xml
----------------------------------------------------------------------
diff --git a/server/gc/pom.xml b/server/gc/pom.xml
index 4a79b6f..476489b 100644
--- a/server/gc/pom.xml
+++ b/server/gc/pom.xml
@@ -25,94 +25,13 @@
</parent>
<artifactId>accumulo-gc</artifactId>
<name>GC Server</name>
+ <description>The garbage collecting server for Apache Accumulo to clean up unused files.</description>
<dependencies>
<dependency>
- <groupId>com.beust</groupId>
- <artifactId>jcommander</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- </dependency>
- <dependency>
- <groupId>jline</groupId>
- <artifactId>jline</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.accumulo</groupId>
- <artifactId>accumulo-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.accumulo</groupId>
- <artifactId>accumulo-fate</artifactId>
- </dependency>
- <dependency>
<groupId>org.apache.accumulo</groupId>
<artifactId>accumulo-server-base</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.accumulo</groupId>
- <artifactId>accumulo-start</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.accumulo</groupId>
- <artifactId>accumulo-trace</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.thrift</groupId>
- <artifactId>libthrift</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-configuration</groupId>
- <artifactId>commons-configuration</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-client</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
@@ -128,4 +47,54 @@
<scope>test</scope>
</dependency>
</dependencies>
+ <profiles>
+ <profile>
+ <id>rpm</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>rpm-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build-rpm</id>
+ <goals>
+ <goal>attached-rpm</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <requires>
+ <require>jre >= 1.6.0</require>
+ <require>accumulo-server-base = %{version}-%{release}</require>
+ </requires>
+ <postinstallScriptlet>
+ <script>/sbin/chkconfig --add ${project.artifactId}</script>
+ </postinstallScriptlet>
+ <preremoveScriptlet>
+ <script>if [ $$1 -eq 0 ]; then /sbin/service ${project.artifactId} stop &>/dev/null || : ; /sbin/chkconfig --del ${project.artifactId}; fi</script>
+ </preremoveScriptlet>
+ <mappings>
+ <mapping>
+ <directory>%{_javadir}/accumulo</directory>
+ <artifact />
+ </mapping>
+ <mapping>
+ <directory>%{_initddir}</directory>
+ <directoryIncluded>false</directoryIncluded>
+ <filemode>755</filemode>
+ <sources>
+ <source>
+ <location>src/main/packaging/etc/init.d/${project.artifactId}</location>
+ </source>
+ </sources>
+ </mapping>
+ </mappings>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
http://git-wip-us.apache.org/repos/asf/accumulo/blob/05d5921c/server/gc/src/main/packaging/etc/init.d/accumulo-gc
----------------------------------------------------------------------
diff --git a/server/gc/src/main/packaging/etc/init.d/accumulo-gc b/server/gc/src/main/packaging/etc/init.d/accumulo-gc
new file mode 100755
index 0000000..8ddd524
--- /dev/null
+++ b/server/gc/src/main/packaging/etc/init.d/accumulo-gc
@@ -0,0 +1,159 @@
+#! /bin/sh
+# chkconfig: 2345 21 20
+### BEGIN INIT INFO
+# Provides: accumulo-gc
+# Required-Start: $network $local_fs
+# Required-Stop: $network $local_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: accumulo garbage collector process
+# Description: The accumulo garbage collector handles cleanup of old walogs and files in hdfs
+### END INIT INFO
+
+# 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.
+
+# Do NOT "set -e"
+install -d -m 0775 -o root -g accumulo /var/run/accumulo
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/share/accumulo/bin
+DESC="Accumulo Garbage Collector"
+NAME=accumulo-gc
+ACCUMULO_PROC=gc
+DAEMON=/usr/share/accumulo/bin/start-server.sh
+IP=`ifconfig | grep inet[^6] | awk '{print $2}' | sed 's/addr://' | grep -v 0.0.0.0 | grep -v 127.0.0.1 | head -n 1`
+DAEMON_ARGS="$IP gc \"garbage collector\""
+PIDFILE=/var/run/accumulo/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+
+# Read configuration variable file if it is present
+[ -r /etc/default/accumulo ] && . /etc/default/accumulo
+
+# Load the VERBOSE setting and other rcS variables
+if [ -f /lib/init/vars.sh ]; then
+ . /lib/init/vars.sh
+else
+ log_daemon_msg() { logger "$@"; }
+ log_end_msg() { [ $1 -eq 0 ] && RES=OK; logger ${RES:=FAIL}; }
+fi
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
+# and status_of_proc is working.
+. /lib/lsb/init-functions
+
+#
+# Function that starts the daemon/service
+#
+do_start() {
+ TARGET_USER_NAME="ACCUMULO_USER"
+ TARGET_USER=$(eval "echo \$$TARGET_USER_NAME")
+
+ # Return
+ # 0 if daemon has been started
+ # 1 if daemon was already running
+ # 2 if daemon could not be started
+
+ if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 1; fi
+
+ su -s /bin/sh $TARGET_USER -c "$DAEMON $DAEMON_ARGS > /dev/null || return 1"
+
+ if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 0; fi
+ return 2
+ # Add code here, if necessary, that waits for the process to be ready
+ # to handle requests from services started subsequently which depend
+ # on this one. As a last resort, sleep for some time.
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+ # Return
+ # 0 if daemon has been stopped
+ # 1 if daemon was already stopped
+ # 2 if daemon could not be stopped
+ # other if a failure occurred
+
+ if [ ! "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 1; fi
+
+ jps -m | grep $ACCUMULO_PROC | awk '{print $1}' | xargs kill -9
+
+ if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 2; fi
+
+ return 0;
+}
+
+case "$1" in
+ start)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+ do_start
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ stop)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ status)
+ status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+ ;;
+ #reload|force-reload)
+ #
+ # If do_reload() is not implemented then leave this commented out
+ # and leave 'force-reload' as an alias for 'restart'.
+ #
+ #log_daemon_msg "Reloading $DESC" "$NAME"
+ #do_reload
+ #log_end_msg $?
+ #;;
+ restart|force-reload)
+ #
+ # If the "reload" option is implemented then remove the
+ # 'force-reload' alias
+ #
+ log_daemon_msg "Restarting $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1)
+ do_start
+ case "$?" in
+ 0) log_end_msg 0 ;;
+ 1) log_end_msg 1 ;; # Old process is still running
+ *) log_end_msg 1 ;; # Failed to start
+ esac
+ ;;
+ *)
+ # Failed to stop
+ log_end_msg 1
+ ;;
+ esac
+ ;;
+ *)
+ #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
+ echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
+ exit 3
+ ;;
+esac
+
+:
http://git-wip-us.apache.org/repos/asf/accumulo/blob/05d5921c/server/master/pom.xml
----------------------------------------------------------------------
diff --git a/server/master/pom.xml b/server/master/pom.xml
index 6785943..eec3b78 100644
--- a/server/master/pom.xml
+++ b/server/master/pom.xml
@@ -25,94 +25,13 @@
</parent>
<artifactId>accumulo-master</artifactId>
<name>Master Server</name>
+ <description>The master server for Apache Accumulo for load balacing and other system-wide operations.</description>
<dependencies>
<dependency>
- <groupId>com.beust</groupId>
- <artifactId>jcommander</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- </dependency>
- <dependency>
- <groupId>jline</groupId>
- <artifactId>jline</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.accumulo</groupId>
- <artifactId>accumulo-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.accumulo</groupId>
- <artifactId>accumulo-fate</artifactId>
- </dependency>
- <dependency>
<groupId>org.apache.accumulo</groupId>
<artifactId>accumulo-server-base</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.accumulo</groupId>
- <artifactId>accumulo-start</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.accumulo</groupId>
- <artifactId>accumulo-trace</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.thrift</groupId>
- <artifactId>libthrift</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-configuration</groupId>
- <artifactId>commons-configuration</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-client</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
@@ -128,4 +47,54 @@
<scope>test</scope>
</dependency>
</dependencies>
+ <profiles>
+ <profile>
+ <id>rpm</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>rpm-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build-rpm</id>
+ <goals>
+ <goal>attached-rpm</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <requires>
+ <require>jre >= 1.6.0</require>
+ <require>accumulo-server-base = %{version}-%{release}</require>
+ </requires>
+ <postinstallScriptlet>
+ <script>/sbin/chkconfig --add ${project.artifactId}</script>
+ </postinstallScriptlet>
+ <preremoveScriptlet>
+ <script>if [ $$1 -eq 0 ]; then /sbin/service ${project.artifactId} stop &>/dev/null || : ; /sbin/chkconfig --del ${project.artifactId}; fi</script>
+ </preremoveScriptlet>
+ <mappings>
+ <mapping>
+ <directory>%{_javadir}/accumulo</directory>
+ <artifact />
+ </mapping>
+ <mapping>
+ <directory>%{_initddir}</directory>
+ <directoryIncluded>false</directoryIncluded>
+ <filemode>755</filemode>
+ <sources>
+ <source>
+ <location>src/main/packaging/etc/init.d/${project.artifactId}</location>
+ </source>
+ </sources>
+ </mapping>
+ </mappings>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
http://git-wip-us.apache.org/repos/asf/accumulo/blob/05d5921c/server/master/src/main/packaging/etc/init.d/accumulo-master
----------------------------------------------------------------------
diff --git a/server/master/src/main/packaging/etc/init.d/accumulo-master b/server/master/src/main/packaging/etc/init.d/accumulo-master
new file mode 100755
index 0000000..bbc3081
--- /dev/null
+++ b/server/master/src/main/packaging/etc/init.d/accumulo-master
@@ -0,0 +1,160 @@
+#! /bin/sh
+# chkconfig: 2345 21 19
+### BEGIN INIT INFO
+# Provides: accumulo-master
+# Required-Start: $network $local_fs hadoop-namenode zookeeper-server
+# Required-Stop: $network $local_fs accumulo-slave
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: accumulo master process
+# Description: The accumulo master manages tablet assignment and balance to accumulo
+### END INIT INFO
+
+# 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.
+
+# Do NOT "set -e"
+install -d -m 0775 -o root -g accumulo /var/run/accumulo
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/share/accumulo/bin
+DESC="Accumulo Master"
+NAME=accumulo-master
+ACCUMULO_PROC=master
+DAEMON=/usr/share/accumulo/bin/start-server.sh
+IP=`ifconfig | grep inet[^6] | awk '{print $2}' | sed 's/addr://' | grep -v 0.0.0.0 | grep -v 127.0.0.1 | head -n 1`
+DAEMON_ARGS="$IP master"
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+
+# Read configuration variable file if it is present
+[ -r /etc/default/accumulo ] && . /etc/default/accumulo
+
+# Load the VERBOSE setting and other rcS variables
+if [ -f /lib/init/vars.sh ]; then
+ . /lib/init/vars.sh
+else
+ log_daemon_msg() { logger "$@"; }
+ log_end_msg() { [ $1 -eq 0 ] && RES=OK; logger ${RES:=FAIL}; }
+fi
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
+# and status_of_proc is working.
+. /lib/lsb/init-functions
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+ TARGET_USER_NAME="ACCUMULO_USER"
+ TARGET_USER=$(eval "echo \$$TARGET_USER_NAME")
+ # Return
+ # 0 if daemon has been started
+ # 1 if daemon was already running
+ # 2 if daemon could not be started
+
+ if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 1; fi
+
+ su -s /bin/sh $TARGET_USER -c "/usr/share/accumulo/bin/accumulo org.apache.accumulo.master.state.SetGoalState NORMAL"
+ su -s /bin/sh $TARGET_USER -c "$DAEMON $DAEMON_ARGS > /dev/null || return 1"
+
+ if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 0; fi
+ return 2
+ # Add code here, if necessary, that waits for the process to be ready
+ # to handle requests from services started subsequently which depend
+ # on this one. As a last resort, sleep for some time.
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+ # Return
+ # 0 if daemon has been stopped
+ # 1 if daemon was already stopped
+ # 2 if daemon could not be stopped
+ # other if a failure occurred
+
+ if [ ! "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 1; fi
+
+ jps -m | grep $ACCUMULO_PROC | awk '{print $1}' | xargs kill -9
+
+ if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 2; fi
+
+ return 0;
+}
+
+case "$1" in
+ start)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+ do_start
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ stop)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ status)
+ status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+ ;;
+ #reload|force-reload)
+ #
+ # If do_reload() is not implemented then leave this commented out
+ # and leave 'force-reload' as an alias for 'restart'.
+ #
+ #log_daemon_msg "Reloading $DESC" "$NAME"
+ #do_reload
+ #log_end_msg $?
+ #;;
+ restart|force-reload)
+ #
+ # If the "reload" option is implemented then remove the
+ # 'force-reload' alias
+ #
+ log_daemon_msg "Restarting $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1)
+ do_start
+ case "$?" in
+ 0) log_end_msg 0 ;;
+ 1) log_end_msg 1 ;; # Old process is still running
+ *) log_end_msg 1 ;; # Failed to start
+ esac
+ ;;
+ *)
+ # Failed to stop
+ log_end_msg 1
+ ;;
+ esac
+ ;;
+ *)
+ #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
+ echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
+ exit 3
+ ;;
+esac
+
+:
http://git-wip-us.apache.org/repos/asf/accumulo/blob/05d5921c/server/monitor/pom.xml
----------------------------------------------------------------------
diff --git a/server/monitor/pom.xml b/server/monitor/pom.xml
index 6f6a147..836e3e6 100644
--- a/server/monitor/pom.xml
+++ b/server/monitor/pom.xml
@@ -25,94 +25,13 @@
</parent>
<artifactId>accumulo-monitor</artifactId>
<name>Monitor Server</name>
+ <description>A web server for monitoring Apache Accumulo.</description>
<dependencies>
<dependency>
- <groupId>com.beust</groupId>
- <artifactId>jcommander</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- </dependency>
- <dependency>
- <groupId>jline</groupId>
- <artifactId>jline</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.accumulo</groupId>
- <artifactId>accumulo-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.accumulo</groupId>
- <artifactId>accumulo-fate</artifactId>
- </dependency>
- <dependency>
<groupId>org.apache.accumulo</groupId>
<artifactId>accumulo-server-base</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.accumulo</groupId>
- <artifactId>accumulo-start</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.accumulo</groupId>
- <artifactId>accumulo-trace</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.thrift</groupId>
- <artifactId>libthrift</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-configuration</groupId>
- <artifactId>commons-configuration</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-client</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
@@ -143,4 +62,55 @@
</plugins>
</pluginManagement>
</build>
+ <profiles>
+ <profile>
+ <id>rpm</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>rpm-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build-rpm</id>
+ <goals>
+ <goal>attached-rpm</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <copyright>ASL 2.0 and MIT</copyright>
+ <requires>
+ <require>jre >= 1.6.0</require>
+ <require>accumulo-server-base = %{version}-%{release}</require>
+ </requires>
+ <postinstallScriptlet>
+ <script>/sbin/chkconfig --add ${project.artifactId}</script>
+ </postinstallScriptlet>
+ <preremoveScriptlet>
+ <script>if [ $$1 -eq 0 ]; then /sbin/service ${project.artifactId} stop &>/dev/null || : ; /sbin/chkconfig --del ${project.artifactId}; fi</script>
+ </preremoveScriptlet>
+ <mappings>
+ <mapping>
+ <directory>%{_javadir}/accumulo</directory>
+ <artifact />
+ </mapping>
+ <mapping>
+ <directory>%{_initddir}</directory>
+ <directoryIncluded>false</directoryIncluded>
+ <filemode>755</filemode>
+ <sources>
+ <source>
+ <location>src/main/packaging/etc/init.d/${project.artifactId}</location>
+ </source>
+ </sources>
+ </mapping>
+ </mappings>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
http://git-wip-us.apache.org/repos/asf/accumulo/blob/05d5921c/server/monitor/src/main/packaging/etc/init.d/accumulo-monitor
----------------------------------------------------------------------
diff --git a/server/monitor/src/main/packaging/etc/init.d/accumulo-monitor b/server/monitor/src/main/packaging/etc/init.d/accumulo-monitor
new file mode 100755
index 0000000..9c45339
--- /dev/null
+++ b/server/monitor/src/main/packaging/etc/init.d/accumulo-monitor
@@ -0,0 +1,159 @@
+#! /bin/sh
+# chkconfig: 2345 21 20
+### BEGIN INIT INFO
+# Provides: accumulo-monitor
+# Required-Start: $network $local_fs
+# Required-Stop: $network $local_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: accumulo monitor process on 50095
+# Description: The accumulo monitor provides a convenient mechanism for monitoring accumulo
+### END INIT INFO
+
+# 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.
+
+# Do NOT "set -e"
+install -d -m 0775 -o root -g accumulo /var/run/accumulo
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/share/accumulo/bin
+DESC="Accumulo Monitor"
+NAME=accumulo-monitor
+ACCUMULO_PROC=monitor
+DAEMON=/usr/share/accumulo/bin/start-server.sh
+IP=`ifconfig | grep inet[^6] | awk '{print $2}' | sed 's/addr://' | grep -v 0.0.0.0 | grep -v 127.0.0.1 | head -n 1`
+DAEMON_ARGS="$IP monitor"
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+
+# Read configuration variable file if it is present
+[ -r /etc/default/accumulo ] && . /etc/default/accumulo
+
+# Load the VERBOSE setting and other rcS variables
+if [ -f /lib/init/vars.sh ]; then
+ . /lib/init/vars.sh
+else
+ log_daemon_msg() { logger "$@"; }
+ log_end_msg() { [ $1 -eq 0 ] && RES=OK; logger ${RES:=FAIL}; }
+fi
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
+# and status_of_proc is working.
+. /lib/lsb/init-functions
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+ TARGET_USER_NAME="ACCUMULO_MONITOR_USER"
+ TARGET_USER=$(eval "echo \$$TARGET_USER_NAME")
+ # Return
+ # 0 if daemon has been started
+ # 1 if daemon was already running
+ # 2 if daemon could not be started
+
+ if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 1; fi
+
+ su -s /bin/sh $TARGET_USER -c "$DAEMON $DAEMON_ARGS > /dev/null || return 1"
+
+ if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 0; fi
+ return 2
+ # Add code here, if necessary, that waits for the process to be ready
+ # to handle requests from services started subsequently which depend
+ # on this one. As a last resort, sleep for some time.
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+ # Return
+ # 0 if daemon has been stopped
+ # 1 if daemon was already stopped
+ # 2 if daemon could not be stopped
+ # other if a failure occurred
+
+ if [ ! "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 1; fi
+
+ jps -m | grep $ACCUMULO_PROC | awk '{print $1}' | xargs kill -9
+
+ if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 2; fi
+
+ return 0;
+}
+
+case "$1" in
+ start)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+ do_start
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ stop)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ status)
+ status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+ ;;
+ #reload|force-reload)
+ #
+ # If do_reload() is not implemented then leave this commented out
+ # and leave 'force-reload' as an alias for 'restart'.
+ #
+ #log_daemon_msg "Reloading $DESC" "$NAME"
+ #do_reload
+ #log_end_msg $?
+ #;;
+ restart|force-reload)
+ #
+ # If the "reload" option is implemented then remove the
+ # 'force-reload' alias
+ #
+ log_daemon_msg "Restarting $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1)
+ do_start
+ case "$?" in
+ 0) log_end_msg 0 ;;
+ 1) log_end_msg 1 ;; # Old process is still running
+ *) log_end_msg 1 ;; # Failed to start
+ esac
+ ;;
+ *)
+ # Failed to stop
+ log_end_msg 1
+ ;;
+ esac
+ ;;
+ *)
+ #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
+ echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
+ exit 3
+ ;;
+esac
+
+:
http://git-wip-us.apache.org/repos/asf/accumulo/blob/05d5921c/server/native/pom.xml
----------------------------------------------------------------------
diff --git a/server/native/pom.xml b/server/native/pom.xml
index 1ec4d9d..a085655 100644
--- a/server/native/pom.xml
+++ b/server/native/pom.xml
@@ -26,11 +26,27 @@
<artifactId>accumulo-native</artifactId>
<packaging>pom</packaging>
<name>Native Libraries</name>
+ <description>C++ native libraries for improved performance in Apache Accumulo.</description>
<dependencies>
<dependency>
<groupId>org.apache.accumulo</groupId>
<artifactId>accumulo-tserver</artifactId>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
@@ -72,6 +88,89 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>test-native-libs</id>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <phase>integration-test</phase>
+ <configuration>
+ <executable>make</executable>
+ <workingDirectory>${project.build.directory}/${project.artifactId}-${project.version}/${project.artifactId}-${project.version}</workingDirectory>
+ <arguments>
+ <argument>test</argument>
+ </arguments>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
+ <profiles>
+ <profile>
+ <id>rpm</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build-native-libs-for-rpm</id>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <executable>make</executable>
+ <workingDirectory>${project.build.directory}/${project.artifactId}-${project.version}/${project.artifactId}-${project.version}</workingDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>rpm-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build-rpm</id>
+ <goals>
+ <goal>attached-rpm</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <requires>
+ <require>accumulo-core = %{version}-%{release}</require>
+ <require>accumulo-tserver = %{version}-%{release}</require>
+ </requires>
+ <postinstallScriptlet>
+ <script>/sbin/ldconfig</script>
+ </postinstallScriptlet>
+ <postremoveScriptlet>
+ <script>/sbin/ldconfig</script>
+ </postremoveScriptlet>
+ <needarch>x86_64</needarch>
+ <mappings>
+ <mapping>
+ <directory>%{_libdir}</directory>
+ <directoryIncluded>false</directoryIncluded>
+ <sources>
+ <source>
+ <location>${project.build.directory}/${project.artifactId}-${project.version}/${project.artifactId}-${project.version}/libaccumulo.so</location>
+ </source>
+ </sources>
+ </mapping>
+ </mappings>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
http://git-wip-us.apache.org/repos/asf/accumulo/blob/05d5921c/server/native/src/main/assemblies/component.xml
----------------------------------------------------------------------
diff --git a/server/native/src/main/assemblies/component.xml b/server/native/src/main/assemblies/component.xml
index 3f2f993..8baa7c8 100644
--- a/server/native/src/main/assemblies/component.xml
+++ b/server/native/src/main/assemblies/component.xml
@@ -25,6 +25,12 @@
<fileMode>0644</fileMode>
</fileSet>
<fileSet>
+ <directory>src/test/c++/nativeMap</directory>
+ <outputDirectory>testNativeMap</outputDirectory>
+ <directoryMode>0755</directoryMode>
+ <fileMode>0644</fileMode>
+ </fileSet>
+ <fileSet>
<directory>src/main/resources</directory>
<outputDirectory>.</outputDirectory>
<directoryMode>0755</directoryMode>
http://git-wip-us.apache.org/repos/asf/accumulo/blob/05d5921c/server/native/src/main/resources/Makefile
----------------------------------------------------------------------
diff --git a/server/native/src/main/resources/Makefile b/server/native/src/main/resources/Makefile
index 01a109b..e016471 100644
--- a/server/native/src/main/resources/Makefile
+++ b/server/native/src/main/resources/Makefile
@@ -15,27 +15,37 @@
SRCS=$(wildcard nativeMap/*.cc)
HDRS=$(wildcard nativeMap/*.h) $(wildcard javah/*.h)
+TESTSRCS=$(wildcard testNativeMap/*.cc)
CXX=g++
ifeq ($(shell uname),Linux)
JAVA_HOME=$(shell dirname $$(dirname $$(readlink -ef $$(which javah))))
NATIVE_LIB := libaccumulo.so
- CXXFLAGS=-g -fPIC -shared -O2 -fno-omit-frame-pointer -fno-strict-aliasing -Wall -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -Ijavah
+ CXXFLAGS=-m64 -g -fPIC -shared -O2 -fno-omit-frame-pointer -fno-strict-aliasing -Wall -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -Ijavah
endif
ifeq ($(shell uname),Darwin)
JAVA_HOME=$(shell /usr/libexec/java_home)
NATIVE_LIB:= libaccumulo.jnilib
- CXXFLAGS=-m64 -dynamiclib -O3 -I$(JAVA_HOME)/include -Ijavah
+ # Update flags for OSX-10.9 and Xcode 5.0.1
+ # I think that we should be able to remove the `-undefined dynamic_lookup` option,
+ # but I don't know exactly how to go about this.
+ CXXFLAGS=-m64 -dynamiclib -undefined dynamic_lookup -O3 -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin -I/usr/include/c++/4.2.1 -Ijavah
endif
all : $(NATIVE_LIB)
$(NATIVE_LIB) : $(SRCS) $(HDRS)
- $(CXX) $(CXXFLAGS) -m64 -o $@ $(SRCS)
+ $(CXX) $(CXXFLAGS) -o $@ $(SRCS)
-test : testJavaHome
+test : $(NATIVE_LIB) testJavaHome runTests
testJavaHome :
@echo JAVA_HOME is $(JAVA_HOME)
+runTests : clean $(TESTSRCS) $(NATIVE_LIB)
+ $(CXX) -g -Wall -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -InativeMap -o $@ $(TESTSRCS) $(NATIVE_LIB)
+ LD_LIBRARY_PATH=./ ./$@ 20 20 20 20 20 20 20 20 true
+
+clean :
+ rm -f $(NATIVE_LIB) runTests
http://git-wip-us.apache.org/repos/asf/accumulo/blob/05d5921c/server/tracer/pom.xml
----------------------------------------------------------------------
diff --git a/server/tracer/pom.xml b/server/tracer/pom.xml
index 854c1d3..bbe7c6f 100644
--- a/server/tracer/pom.xml
+++ b/server/tracer/pom.xml
@@ -25,94 +25,13 @@
</parent>
<artifactId>accumulo-tracer</artifactId>
<name>Tracer Server</name>
+ <description>The tracer server for Apache Accumulo to listen for, and store, distributed tracing messages.</description>
<dependencies>
<dependency>
- <groupId>com.beust</groupId>
- <artifactId>jcommander</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- </dependency>
- <dependency>
- <groupId>jline</groupId>
- <artifactId>jline</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.accumulo</groupId>
- <artifactId>accumulo-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.accumulo</groupId>
- <artifactId>accumulo-fate</artifactId>
- </dependency>
- <dependency>
<groupId>org.apache.accumulo</groupId>
<artifactId>accumulo-server-base</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.accumulo</groupId>
- <artifactId>accumulo-start</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.accumulo</groupId>
- <artifactId>accumulo-trace</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.thrift</groupId>
- <artifactId>libthrift</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-configuration</groupId>
- <artifactId>commons-configuration</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-client</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
@@ -128,4 +47,54 @@
<scope>test</scope>
</dependency>
</dependencies>
+ <profiles>
+ <profile>
+ <id>rpm</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>rpm-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build-rpm</id>
+ <goals>
+ <goal>attached-rpm</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <requires>
+ <require>jre >= 1.6.0</require>
+ <require>accumulo-server-base = %{version}-%{release}</require>
+ </requires>
+ <postinstallScriptlet>
+ <script>/sbin/chkconfig --add ${project.artifactId}</script>
+ </postinstallScriptlet>
+ <preremoveScriptlet>
+ <script>if [ $$1 -eq 0 ]; then /sbin/service ${project.artifactId} stop &>/dev/null || : ; /sbin/chkconfig --del ${project.artifactId}; fi</script>
+ </preremoveScriptlet>
+ <mappings>
+ <mapping>
+ <directory>%{_javadir}/accumulo</directory>
+ <artifact />
+ </mapping>
+ <mapping>
+ <directory>%{_initddir}</directory>
+ <directoryIncluded>false</directoryIncluded>
+ <filemode>755</filemode>
+ <sources>
+ <source>
+ <location>src/main/packaging/etc/init.d/${project.artifactId}</location>
+ </source>
+ </sources>
+ </mapping>
+ </mappings>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
http://git-wip-us.apache.org/repos/asf/accumulo/blob/05d5921c/server/tracer/src/main/packaging/etc/init.d/accumulo-tracer
----------------------------------------------------------------------
diff --git a/server/tracer/src/main/packaging/etc/init.d/accumulo-tracer b/server/tracer/src/main/packaging/etc/init.d/accumulo-tracer
new file mode 100755
index 0000000..dd74391
--- /dev/null
+++ b/server/tracer/src/main/packaging/etc/init.d/accumulo-tracer
@@ -0,0 +1,159 @@
+#! /bin/sh
+# chkconfig: 2345 21 20
+### BEGIN INIT INFO
+# Provides: accumulo-tracer
+# Required-Start: $network $local_fs zookeeper-server
+# Required-Stop: $network $local_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: accumulo tracer
+# Description: The accumulo tracer provides a mechanism for tracing accumulo calls
+### END INIT INFO
+
+# 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.
+
+# Do NOT "set -e"
+install -d -m 0775 -o root -g accumulo /var/run/accumulo
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/share/accumulo/bin
+DESC="Accumulo Tracer"
+NAME=accumulo-tracer
+ACCUMULO_PROC=tracer
+DAEMON=/usr/share/accumulo/bin/start-server.sh
+IP=`ifconfig | grep inet[^6] | awk '{print $2}' | sed 's/addr://' | grep -v 0.0.0.0 | grep -v 127.0.0.1 | head -n 1`
+DAEMON_ARGS="$IP tracer"
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+
+# Read configuration variable file if it is present
+[ -r /etc/default/accumulo ] && . /etc/default/accumulo
+
+# Load the VERBOSE setting and other rcS variables
+if [ -f /lib/init/vars.sh ]; then
+ . /lib/init/vars.sh
+else
+ log_daemon_msg() { logger "$@"; }
+ log_end_msg() { [ $1 -eq 0 ] && RES=OK; logger ${RES:=FAIL}; }
+fi
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
+# and status_of_proc is working.
+. /lib/lsb/init-functions
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+ TARGET_USER_NAME="ACCUMULO_TRACER_USER"
+ TARGET_USER=$(eval "echo \$$TARGET_USER_NAME")
+ # Return
+ # 0 if daemon has been started
+ # 1 if daemon was already running
+ # 2 if daemon could not be started
+
+ if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 1; fi
+
+ su -s /bin/sh $TARGET_USER -c "$DAEMON $DAEMON_ARGS > /dev/null || return 1"
+
+ if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 0; fi
+ return 2
+ # Add code here, if necessary, that waits for the process to be ready
+ # to handle requests from services started subsequently which depend
+ # on this one. As a last resort, sleep for some time.
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+ # Return
+ # 0 if daemon has been stopped
+ # 1 if daemon was already stopped
+ # 2 if daemon could not be stopped
+ # other if a failure occurred
+
+ if [ ! "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 1; fi
+
+ jps -m | grep $ACCUMULO_PROC | awk '{print $1}' | xargs kill -9
+
+ if [ "`jps -m | grep $ACCUMULO_PROC`" ] ; then return 2; fi
+
+ return 0;
+}
+
+case "$1" in
+ start)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+ do_start
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ stop)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ status)
+ status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+ ;;
+ #reload|force-reload)
+ #
+ # If do_reload() is not implemented then leave this commented out
+ # and leave 'force-reload' as an alias for 'restart'.
+ #
+ #log_daemon_msg "Reloading $DESC" "$NAME"
+ #do_reload
+ #log_end_msg $?
+ #;;
+ restart|force-reload)
+ #
+ # If the "reload" option is implemented then remove the
+ # 'force-reload' alias
+ #
+ log_daemon_msg "Restarting $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1)
+ do_start
+ case "$?" in
+ 0) log_end_msg 0 ;;
+ 1) log_end_msg 1 ;; # Old process is still running
+ *) log_end_msg 1 ;; # Failed to start
+ esac
+ ;;
+ *)
+ # Failed to stop
+ log_end_msg 1
+ ;;
+ esac
+ ;;
+ *)
+ #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
+ echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
+ exit 3
+ ;;
+esac
+
+:
http://git-wip-us.apache.org/repos/asf/accumulo/blob/05d5921c/server/tserver/pom.xml
----------------------------------------------------------------------
diff --git a/server/tserver/pom.xml b/server/tserver/pom.xml
index 7acace2..05f8f9f 100644
--- a/server/tserver/pom.xml
+++ b/server/tserver/pom.xml
@@ -25,94 +25,13 @@
</parent>
<artifactId>accumulo-tserver</artifactId>
<name>Tablet Server</name>
+ <description>The tablet server for Apache Accumulo to host tablets of data tables.</description>
<dependencies>
<dependency>
- <groupId>com.beust</groupId>
- <artifactId>jcommander</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- </dependency>
- <dependency>
- <groupId>jline</groupId>
- <artifactId>jline</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.accumulo</groupId>
- <artifactId>accumulo-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.accumulo</groupId>
- <artifactId>accumulo-fate</artifactId>
- </dependency>
- <dependency>
<groupId>org.apache.accumulo</groupId>
<artifactId>accumulo-server-base</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.accumulo</groupId>
- <artifactId>accumulo-start</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.accumulo</groupId>
- <artifactId>accumulo-trace</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.thrift</groupId>
- <artifactId>libthrift</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-configuration</groupId>
- <artifactId>commons-configuration</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-client</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
@@ -128,4 +47,54 @@
<scope>test</scope>
</dependency>
</dependencies>
+ <profiles>
+ <profile>
+ <id>rpm</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>rpm-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build-rpm</id>
+ <goals>
+ <goal>attached-rpm</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <requires>
+ <require>jre >= 1.6.0</require>
+ <require>accumulo-server-base = %{version}-%{release}</require>
+ </requires>
+ <postinstallScriptlet>
+ <script>/sbin/chkconfig --add ${project.artifactId}</script>
+ </postinstallScriptlet>
+ <preremoveScriptlet>
+ <script>if [ $$1 -eq 0 ]; then /sbin/service ${project.artifactId} stop &>/dev/null || : ; /sbin/chkconfig --del ${project.artifactId}; fi</script>
+ </preremoveScriptlet>
+ <mappings>
+ <mapping>
+ <directory>%{_javadir}/accumulo</directory>
+ <artifact />
+ </mapping>
+ <mapping>
+ <directory>%{_initddir}</directory>
+ <directoryIncluded>false</directoryIncluded>
+ <filemode>755</filemode>
+ <sources>
+ <source>
+ <location>src/main/packaging/etc/init.d/${project.artifactId}</location>
+ </source>
+ </sources>
+ </mapping>
+ </mappings>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>