You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2015/10/25 02:15:23 UTC
[1/3] accumulo git commit: ACCUMULO-4037 Avoid an extra Key creation
in TimeSettingIterator.
Repository: accumulo
Updated Branches:
refs/heads/1.7 071c5071f -> a1d3c9286
refs/heads/master 04e91398b -> dfbb3c299
ACCUMULO-4037 Avoid an extra Key creation in TimeSettingIterator.
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/a1d3c928
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/a1d3c928
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/a1d3c928
Branch: refs/heads/1.7
Commit: a1d3c9286d42a1c0e1556dfce27c2f0f1590dc34
Parents: 071c507
Author: Josh Elser <el...@apache.org>
Authored: Sat Oct 24 21:14:33 2015 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Sat Oct 24 21:14:33 2015 -0400
----------------------------------------------------------------------
.../iterators/system/TimeSettingIterator.java | 2 +-
.../system/TimeSettingIteratorTest.java | 31 ++++++++++++++++++--
2 files changed, 29 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a1d3c928/core/src/main/java/org/apache/accumulo/core/iterators/system/TimeSettingIterator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/system/TimeSettingIterator.java b/core/src/main/java/org/apache/accumulo/core/iterators/system/TimeSettingIterator.java
index 3e1b7a9..298ff23 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/system/TimeSettingIterator.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/system/TimeSettingIterator.java
@@ -42,7 +42,7 @@ public class TimeSettingIterator implements InterruptibleIterator {
@Override
public Key getTopKey() {
- Key key = new Key(source.getTopKey());
+ Key key = source.getTopKey();
key.setTimestamp(time);
return key;
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a1d3c928/core/src/test/java/org/apache/accumulo/core/iterators/system/TimeSettingIteratorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/system/TimeSettingIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/system/TimeSettingIteratorTest.java
index 783dbc0..3dbe7ca 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/system/TimeSettingIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/system/TimeSettingIteratorTest.java
@@ -19,16 +19,20 @@ package org.apache.accumulo.core.iterators.system;
import java.util.HashSet;
import java.util.TreeMap;
-import junit.framework.TestCase;
-
import org.apache.accumulo.core.data.ByteSequence;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.iterators.SortedMapIterator;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
-public class TimeSettingIteratorTest extends TestCase {
+public class TimeSettingIteratorTest {
+ @Test
public void test1() throws Exception {
TreeMap<Key,Value> tm1 = new TreeMap<Key,Value>();
@@ -81,4 +85,25 @@ public class TimeSettingIteratorTest extends TestCase {
assertFalse(tsi.hasTop());
}
+ @Test
+ public void testAvoidKeyCopy() throws Exception {
+ TreeMap<Key,Value> tm1 = new TreeMap<Key,Value>();
+ final Key k = new Key("r0", "cf1", "cq1", 9l);
+
+ tm1.put(k, new Value("v0".getBytes()));
+
+ TimeSettingIterator tsi = new TimeSettingIterator(new SortedMapIterator(tm1), 50);
+
+ tsi.seek(new Range(), new HashSet<ByteSequence>(), false);
+
+ assertTrue(tsi.hasTop());
+ final Key topKey = tsi.getTopKey();
+ assertTrue("Expected the topKey to be the same object", k == topKey);
+ assertEquals(new Key("r0", "cf1", "cq1", 50l), topKey);
+ assertEquals("v0", tsi.getTopValue().toString());
+ tsi.next();
+
+ assertFalse(tsi.hasTop());
+ }
+
}
[2/3] accumulo git commit: ACCUMULO-4037 Avoid an extra Key creation
in TimeSettingIterator.
Posted by el...@apache.org.
ACCUMULO-4037 Avoid an extra Key creation in TimeSettingIterator.
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/a1d3c928
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/a1d3c928
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/a1d3c928
Branch: refs/heads/master
Commit: a1d3c9286d42a1c0e1556dfce27c2f0f1590dc34
Parents: 071c507
Author: Josh Elser <el...@apache.org>
Authored: Sat Oct 24 21:14:33 2015 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Sat Oct 24 21:14:33 2015 -0400
----------------------------------------------------------------------
.../iterators/system/TimeSettingIterator.java | 2 +-
.../system/TimeSettingIteratorTest.java | 31 ++++++++++++++++++--
2 files changed, 29 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a1d3c928/core/src/main/java/org/apache/accumulo/core/iterators/system/TimeSettingIterator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/system/TimeSettingIterator.java b/core/src/main/java/org/apache/accumulo/core/iterators/system/TimeSettingIterator.java
index 3e1b7a9..298ff23 100644
--- a/core/src/main/java/org/apache/accumulo/core/iterators/system/TimeSettingIterator.java
+++ b/core/src/main/java/org/apache/accumulo/core/iterators/system/TimeSettingIterator.java
@@ -42,7 +42,7 @@ public class TimeSettingIterator implements InterruptibleIterator {
@Override
public Key getTopKey() {
- Key key = new Key(source.getTopKey());
+ Key key = source.getTopKey();
key.setTimestamp(time);
return key;
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/a1d3c928/core/src/test/java/org/apache/accumulo/core/iterators/system/TimeSettingIteratorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/system/TimeSettingIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/system/TimeSettingIteratorTest.java
index 783dbc0..3dbe7ca 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/system/TimeSettingIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/system/TimeSettingIteratorTest.java
@@ -19,16 +19,20 @@ package org.apache.accumulo.core.iterators.system;
import java.util.HashSet;
import java.util.TreeMap;
-import junit.framework.TestCase;
-
import org.apache.accumulo.core.data.ByteSequence;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.iterators.SortedMapIterator;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
-public class TimeSettingIteratorTest extends TestCase {
+public class TimeSettingIteratorTest {
+ @Test
public void test1() throws Exception {
TreeMap<Key,Value> tm1 = new TreeMap<Key,Value>();
@@ -81,4 +85,25 @@ public class TimeSettingIteratorTest extends TestCase {
assertFalse(tsi.hasTop());
}
+ @Test
+ public void testAvoidKeyCopy() throws Exception {
+ TreeMap<Key,Value> tm1 = new TreeMap<Key,Value>();
+ final Key k = new Key("r0", "cf1", "cq1", 9l);
+
+ tm1.put(k, new Value("v0".getBytes()));
+
+ TimeSettingIterator tsi = new TimeSettingIterator(new SortedMapIterator(tm1), 50);
+
+ tsi.seek(new Range(), new HashSet<ByteSequence>(), false);
+
+ assertTrue(tsi.hasTop());
+ final Key topKey = tsi.getTopKey();
+ assertTrue("Expected the topKey to be the same object", k == topKey);
+ assertEquals(new Key("r0", "cf1", "cq1", 50l), topKey);
+ assertEquals("v0", tsi.getTopValue().toString());
+ tsi.next();
+
+ assertFalse(tsi.hasTop());
+ }
+
}
[3/3] accumulo git commit: Merge branch '1.7'
Posted by el...@apache.org.
Merge branch '1.7'
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/dfbb3c29
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/dfbb3c29
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/dfbb3c29
Branch: refs/heads/master
Commit: dfbb3c2990feed1e9b88e29537dd12d27426686c
Parents: 04e9139 a1d3c92
Author: Josh Elser <el...@apache.org>
Authored: Sat Oct 24 21:15:12 2015 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Sat Oct 24 21:15:12 2015 -0400
----------------------------------------------------------------------
.../iterators/system/TimeSettingIterator.java | 2 +-
.../system/TimeSettingIteratorTest.java | 31 ++++++++++++++++++--
2 files changed, 29 insertions(+), 4 deletions(-)
----------------------------------------------------------------------