You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ec...@apache.org on 2014/01/03 16:13:36 UTC
[1/2] git commit: ACCUMULO-1743 added trace check of conditional
writes
Updated Branches:
refs/heads/1.6.0-SNAPSHOT a89d97a00 -> 1873fc565
ACCUMULO-1743 added trace check of conditional writes
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/51f84de0
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/51f84de0
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/51f84de0
Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 51f84de0ec2435e70c37846c7f363bfce3ebca00
Parents: a56b766
Author: Eric Newton <er...@gmail.com>
Authored: Fri Jan 3 10:13:17 2014 -0500
Committer: Eric Newton <er...@gmail.com>
Committed: Fri Jan 3 10:13:17 2014 -0500
----------------------------------------------------------------------
.../accumulo/test/ConditionalWriterIT.java | 62 +++++++++++++++++++-
1 file changed, 61 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/51f84de0/test/src/test/java/org/apache/accumulo/test/ConditionalWriterIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/ConditionalWriterIT.java b/test/src/test/java/org/apache/accumulo/test/ConditionalWriterIT.java
index f72510d..ea66b68 100644
--- a/test/src/test/java/org/apache/accumulo/test/ConditionalWriterIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/ConditionalWriterIT.java
@@ -17,6 +17,8 @@
package org.apache.accumulo.test;
+import static org.junit.Assert.*;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -66,12 +68,19 @@ import org.apache.accumulo.core.iterators.user.VersioningIterator;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.ColumnVisibility;
import org.apache.accumulo.core.security.TablePermission;
+import org.apache.accumulo.core.trace.DistributedTrace;
+import org.apache.accumulo.core.trace.TraceDump;
+import org.apache.accumulo.core.trace.TraceDump.Printer;
import org.apache.accumulo.core.util.FastFormat;
import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.examples.simple.constraints.AlphaNumKeyConstraint;
+import org.apache.accumulo.fate.zookeeper.ZooReader;
import org.apache.accumulo.test.functional.BadIterator;
import org.apache.accumulo.test.functional.SimpleMacIT;
import org.apache.accumulo.test.functional.SlowIterator;
+import org.apache.accumulo.trace.instrument.Span;
+import org.apache.accumulo.trace.instrument.Trace;
+import org.apache.accumulo.tracer.TraceServer;
import org.apache.hadoop.io.Text;
import org.junit.Assert;
import org.junit.Test;
@@ -91,7 +100,7 @@ public class ConditionalWriterIT extends SimpleMacIT {
ConditionalWriter cw = conn.createConditionalWriter(tableName, new ConditionalWriterConfig());
- // mutation conditional on column tx:seq not exiting
+ // mutation conditional on column tx:seq not existing
ConditionalMutation cm0 = new ConditionalMutation("99006", new Condition("tx", "seq"));
cm0.put("name", "last", "doe");
cm0.put("name", "first", "john");
@@ -1182,4 +1191,55 @@ public class ConditionalWriterIT extends SimpleMacIT {
cw.write(cm1);
}
+
+ @Test(timeout = 60 * 1000)
+ public void testTrace() throws Exception {
+
+ Process tracer = getStaticCluster().exec(TraceServer.class);
+ Connector conn = getConnector();
+ String tableName = getTableNames(1)[0];
+
+ conn.tableOperations().create(tableName);
+ conn.tableOperations().deleteRows("trace", null, null);
+
+ DistributedTrace.enable(conn.getInstance(), new ZooReader(conn.getInstance().getZooKeepers(), 30*1000), "testTrace", "localhost");
+ Span root = Trace.on("traceTest");
+ ConditionalWriter cw = conn.createConditionalWriter(tableName, new ConditionalWriterConfig());
+
+ // mutation conditional on column tx:seq not exiting
+ ConditionalMutation cm0 = new ConditionalMutation("99006", new Condition("tx", "seq"));
+ cm0.put("name", "last", "doe");
+ cm0.put("name", "first", "john");
+ cm0.put("tx", "seq", "1");
+ Assert.assertEquals(Status.ACCEPTED, cw.write(cm0).getStatus());
+ root.stop();
+
+ final Scanner scanner = conn.createScanner("trace", Authorizations.EMPTY);
+ scanner.setRange(new Range(new Text(Long.toHexString(root.traceId()))));
+ while (true) {
+ final StringBuffer finalBuffer = new StringBuffer();
+ int traceCount = TraceDump.printTrace(scanner, new Printer() {
+ @Override
+ public void print(final String line) {
+ try {
+ finalBuffer.append(line).append("\n");
+ } catch (Exception ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+ });
+ if (traceCount > 0) {
+ int lastPos = 0;
+ for (String part : "traceTest, startScan,startConditionalUpdate,conditionalUpdate,Check conditions,apply conditional mutations".split(","))
+ {
+ int pos = finalBuffer.toString().indexOf(part);
+ assertTrue(pos > 0);
+ assertTrue(pos > lastPos);
+ lastPos = pos;
+ }
+ break;
+ }
+ }
+ tracer.destroy();
+ }
}
[2/2] git commit: Merge branch '1.6.0-SNAPSHOT' of
https://git-wip-us.apache.org/repos/asf/accumulo into 1.6.0-SNAPSHOT
Posted by ec...@apache.org.
Merge branch '1.6.0-SNAPSHOT' of https://git-wip-us.apache.org/repos/asf/accumulo into 1.6.0-SNAPSHOT
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/1873fc56
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/1873fc56
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/1873fc56
Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 1873fc5658ef3413ffc3d36d88ff4f5ea5d85266
Parents: 51f84de a89d97a
Author: Eric Newton <er...@gmail.com>
Authored: Fri Jan 3 10:13:45 2014 -0500
Committer: Eric Newton <er...@gmail.com>
Committed: Fri Jan 3 10:13:45 2014 -0500
----------------------------------------------------------------------
.../core/client/mapred/AbstractInputFormat.java | 2 +-
.../core/client/mapreduce/AbstractInputFormat.java | 2 +-
pom.xml | 16 ++++++++--------
3 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------