accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlmar...@apache.org
Subject [09/39] accumulo git commit: Merge branch '1.6' into 1.7
Date Tue, 12 Apr 2016 13:58:26 GMT
Merge branch '1.6' into 1.7

Conflicts:
	server/tserver/src/main/java/org/apache/accumulo/tserver/InMemoryMap.java


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/f181cf6a
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/f181cf6a
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/f181cf6a

Branch: refs/heads/ACCUMULO-4173
Commit: f181cf6a90a913e5453352a56d3ab470f15b068c
Parents: 2b286ba 41e002d
Author: Josh Elser <elserj@apache.org>
Authored: Fri Apr 1 09:56:17 2016 -0400
Committer: Josh Elser <elserj@apache.org>
Committed: Fri Apr 1 09:56:17 2016 -0400

----------------------------------------------------------------------
 .../apache/accumulo/tserver/InMemoryMap.java    |  28 +-
 .../org/apache/accumulo/tserver/MemKey.java     |  10 +-
 .../accumulo/tserver/MemKeyComparator.java      |   2 +-
 .../org/apache/accumulo/tserver/NativeMap.java  |  27 +-
 .../PartialMutationSkippingIterator.java        |   2 +-
 .../org/apache/accumulo/test/InMemoryMapIT.java | 319 +++++++++++++++++++
 6 files changed, 362 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/f181cf6a/server/tserver/src/main/java/org/apache/accumulo/tserver/InMemoryMap.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f181cf6a/server/tserver/src/main/java/org/apache/accumulo/tserver/MemKey.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f181cf6a/server/tserver/src/main/java/org/apache/accumulo/tserver/MemKeyComparator.java
----------------------------------------------------------------------
diff --cc server/tserver/src/main/java/org/apache/accumulo/tserver/MemKeyComparator.java
index 739b923,0000000..a623cac
mode 100644,000000..100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/MemKeyComparator.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/MemKeyComparator.java
@@@ -1,44 -1,0 +1,44 @@@
 +/*
 + * 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.tserver;
 +
 +import java.io.Serializable;
 +import java.util.Comparator;
 +
 +import org.apache.accumulo.core.data.Key;
 +
 +class MemKeyComparator implements Comparator<Key>, Serializable {
 +
 +  private static final long serialVersionUID = 1L;
 +
 +  @Override
 +  public int compare(Key k1, Key k2) {
 +    int cmp = k1.compareTo(k2);
 +
 +    if (cmp == 0) {
 +      if (k1 instanceof MemKey)
 +        if (k2 instanceof MemKey)
-           cmp = ((MemKey) k2).kvCount - ((MemKey) k1).kvCount;
++          cmp = ((MemKey) k2).getKVCount() - ((MemKey) k1).getKVCount();
 +        else
 +          cmp = 1;
 +      else if (k2 instanceof MemKey)
 +        cmp = -1;
 +    }
 +
 +    return cmp;
 +  }
 +}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f181cf6a/server/tserver/src/main/java/org/apache/accumulo/tserver/NativeMap.java
----------------------------------------------------------------------
diff --cc server/tserver/src/main/java/org/apache/accumulo/tserver/NativeMap.java
index 6eb8e4e,7e1435e..a6f7cf1
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/NativeMap.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/NativeMap.java
@@@ -502,29 -531,17 +503,18 @@@ public class NativeMap implements Itera
        long uid = startUpdate(nmPointer, mutation.getRow());
        for (ColumnUpdate update : updates) {
          update(nmPointer, uid, update.getColumnFamily(), update.getColumnQualifier(), update.getColumnVisibility(),
update.getTimestamp(), update.isDeleted(),
-             update.getValue(), mutationCount);
+             update.getValue(), mutationCount++);
        }
- 
      }
+     return mutationCount;
    }
  
 +  @VisibleForTesting
    public void mutate(Mutation mutation, int mutationCount) {
-     wlock.lock();
-     try {
-       if (nmPointer == 0) {
-         throw new IllegalStateException("Native Map Deleted");
-       }
- 
-       modCount++;
- 
-       _mutate(mutation, mutationCount);
-     } finally {
-       wlock.unlock();
-     }
+     mutate(Collections.singletonList(mutation), mutationCount);
    }
  
 -  public void mutate(List<Mutation> mutations, int mutationCount) {
 +  void mutate(List<Mutation> mutations, int mutationCount) {
      Iterator<Mutation> iter = mutations.iterator();
  
      while (iter.hasNext()) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f181cf6a/server/tserver/src/main/java/org/apache/accumulo/tserver/PartialMutationSkippingIterator.java
----------------------------------------------------------------------
diff --cc server/tserver/src/main/java/org/apache/accumulo/tserver/PartialMutationSkippingIterator.java
index 5d0733b,0000000..3373c88
mode 100644,000000..100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/PartialMutationSkippingIterator.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/PartialMutationSkippingIterator.java
@@@ -1,54 -1,0 +1,54 @@@
 +/*
 + * 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.tserver;
 +
 +import java.io.IOException;
 +import java.util.concurrent.atomic.AtomicBoolean;
 +
 +import org.apache.accumulo.core.data.Key;
 +import org.apache.accumulo.core.data.Value;
 +import org.apache.accumulo.core.iterators.IteratorEnvironment;
 +import org.apache.accumulo.core.iterators.SkippingIterator;
 +import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
 +import org.apache.accumulo.core.iterators.system.InterruptibleIterator;
 +
 +class PartialMutationSkippingIterator extends SkippingIterator implements InterruptibleIterator
{
 +
 +  private int kvCount;
 +
 +  public PartialMutationSkippingIterator(SortedKeyValueIterator<Key,Value> source,
int maxKVCount) {
 +    setSource(source);
 +    this.kvCount = maxKVCount;
 +  }
 +
 +  @Override
 +  protected void consume() throws IOException {
-     while (getSource().hasTop() && ((MemKey) getSource().getTopKey()).kvCount >
kvCount)
++    while (getSource().hasTop() && ((MemKey) getSource().getTopKey()).getKVCount()
> kvCount)
 +      getSource().next();
 +  }
 +
 +  @Override
 +  public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) {
 +    return new PartialMutationSkippingIterator(getSource().deepCopy(env), kvCount);
 +  }
 +
 +  @Override
 +  public void setInterruptFlag(AtomicBoolean flag) {
 +    ((InterruptibleIterator) getSource()).setInterruptFlag(flag);
 +  }
 +
 +}


Mime
View raw message