accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [25/53] [abbrv] ACCUMULO-658 consistent package names to avoid overlapped sealed jars
Date Fri, 06 Sep 2013 01:48:53 GMT
http://git-wip-us.apache.org/repos/asf/accumulo/blob/fc9363a0/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java
new file mode 100644
index 0000000..7fd2766
--- /dev/null
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java
@@ -0,0 +1,430 @@
+/*
+ * 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.log;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.data.KeyExtent;
+import org.apache.accumulo.core.data.Mutation;
+import org.apache.accumulo.core.util.UtilWaitThread;
+import org.apache.accumulo.server.fs.VolumeManager;
+import org.apache.accumulo.tserver.Tablet;
+import org.apache.accumulo.tserver.TabletMutations;
+import org.apache.accumulo.tserver.TabletServer;
+import org.apache.accumulo.tserver.Tablet.CommitSession;
+import org.apache.accumulo.tserver.log.DfsLogger.LoggerOperation;
+import org.apache.hadoop.fs.Path;
+import org.apache.log4j.Logger;
+
+/**
+ * Central logging facility for the TServerInfo.
+ * 
+ * Forwards in-memory updates to remote logs, carefully writing the same data to every log, while maintaining the maximum thread parallelism for greater
+ * performance. As new logs are used and minor compactions are performed, the metadata table is kept up-to-date.
+ * 
+ */
+public class TabletServerLogger {
+  
+  private static final Logger log = Logger.getLogger(TabletServerLogger.class);
+  
+  private final AtomicLong logSizeEstimate = new AtomicLong();
+  private final long maxSize;
+  
+  private final TabletServer tserver;
+  
+  // The current log set: always updated to a new set with every change of loggers
+  private final List<DfsLogger> loggers = new ArrayList<DfsLogger>();
+  
+  // The current generation of logSet.
+  // Because multiple threads can be using a log set at one time, a log
+  // failure is likely to affect multiple threads, who will all attempt to
+  // create a new logSet. This will cause many unnecessary updates to the
+  // metadata table.
+  // We'll use this generational counter to determine if another thread has
+  // already fetched a new logSet.
+  private AtomicInteger logSetId = new AtomicInteger();
+  
+  // Use a ReadWriteLock to allow multiple threads to use the log set, but obtain a write lock to change them
+  private final ReentrantReadWriteLock logSetLock = new ReentrantReadWriteLock();
+  
+  private final AtomicInteger seqGen = new AtomicInteger();
+  
+  private static boolean enabled(Tablet tablet) {
+    return tablet.getTableConfiguration().getBoolean(Property.TABLE_WALOG_ENABLED);
+  }
+  
+  private static boolean enabled(CommitSession commitSession) {
+    return enabled(commitSession.getTablet());
+  }
+  
+  static private abstract class TestCallWithWriteLock {
+    abstract boolean test();
+    
+    abstract void withWriteLock() throws IOException;
+  }
+  
+  /**
+   * Pattern taken from the documentation for ReentrantReadWriteLock
+   * 
+   * @param rwlock
+   *          lock to use
+   * @param code
+   *          a test/work pair
+   * @throws IOException
+   */
+  private static void testLockAndRun(final ReadWriteLock rwlock, TestCallWithWriteLock code) throws IOException {
+    // Get a read lock
+    rwlock.readLock().lock();
+    try {
+      // does some condition exist that needs the write lock?
+      if (code.test()) {
+        // Yes, let go of the readlock
+        rwlock.readLock().unlock();
+        // Grab the write lock
+        rwlock.writeLock().lock();
+        try {
+          // double-check the condition, since we let go of the lock
+          if (code.test()) {
+            // perform the work with with write lock held
+            code.withWriteLock();
+          }
+        } finally {
+          // regain the readlock
+          rwlock.readLock().lock();
+          // unlock the write lock
+          rwlock.writeLock().unlock();
+        }
+      }
+    } finally {
+      // always let go of the lock
+      rwlock.readLock().unlock();
+    }
+  }
+  
+  public TabletServerLogger(TabletServer tserver, long maxSize) {
+    this.tserver = tserver;
+    this.maxSize = maxSize;
+  }
+  
+  private int initializeLoggers(final List<DfsLogger> copy) throws IOException {
+    final int[] result = {-1};
+    testLockAndRun(logSetLock, new TestCallWithWriteLock() {
+      boolean test() {
+        copy.clear();
+        copy.addAll(loggers);
+        if (!loggers.isEmpty())
+          result[0] = logSetId.get();
+        return loggers.isEmpty();
+      }
+      
+      void withWriteLock() throws IOException {
+        try {
+          createLoggers();
+          copy.clear();
+          copy.addAll(loggers);
+          if (copy.size() > 0)
+            result[0] = logSetId.get();
+          else
+            result[0] = -1;
+        } catch (IOException e) {
+          log.error("Unable to create loggers", e);
+        }
+      }
+    });
+    return result[0];
+  }
+  
+  public void getLoggers(Set<String> loggersOut) {
+    logSetLock.readLock().lock();
+    try {
+      for (DfsLogger logger : loggers) {
+        loggersOut.add(logger.toString());
+      }
+    } finally {
+      logSetLock.readLock().unlock();
+    }
+  }
+  
+  synchronized private void createLoggers() throws IOException {
+    if (!logSetLock.isWriteLockedByCurrentThread()) {
+      throw new IllegalStateException("createLoggers should be called with write lock held!");
+    }
+    
+    if (loggers.size() != 0) {
+      throw new IllegalStateException("createLoggers should not be called when loggers.size() is " + loggers.size());
+    }
+    
+    try {
+      DfsLogger alog = new DfsLogger(tserver.getServerConfig());
+      alog.open(tserver.getClientAddressString());
+      loggers.add(alog);
+      logSetId.incrementAndGet();
+      return;
+    } catch (Exception t) {
+      throw new RuntimeException(t);
+    }
+  }
+  
+  public void resetLoggers() throws IOException {
+    logSetLock.writeLock().lock();
+    try {
+      close();
+    } finally {
+      logSetLock.writeLock().unlock();
+    }
+  }
+  
+  synchronized private void close() throws IOException {
+    if (!logSetLock.isWriteLockedByCurrentThread()) {
+      throw new IllegalStateException("close should be called with write lock held!");
+    }
+    try {
+      for (DfsLogger logger : loggers) {
+        try {
+          logger.close();
+        } catch (DfsLogger.LogClosedException ex) {
+          // ignore
+        } catch (Throwable ex) {
+          log.error("Unable to cleanly close log " + logger.getFileName() + ": " + ex);
+        }
+      }
+      loggers.clear();
+      logSizeEstimate.set(0);
+    } catch (Throwable t) {
+      throw new IOException(t);
+    }
+  }
+  
+  interface Writer {
+    LoggerOperation write(DfsLogger logger, int seq) throws Exception;
+  }
+  
+  private int write(CommitSession commitSession, boolean mincFinish, Writer writer) throws IOException {
+    List<CommitSession> sessions = Collections.singletonList(commitSession);
+    return write(sessions, mincFinish, writer);
+  }
+  
+  private int write(Collection<CommitSession> sessions, boolean mincFinish, Writer writer) throws IOException {
+    // Work very hard not to lock this during calls to the outside world
+    int currentLogSet = logSetId.get();
+    
+    int seq = -1;
+    
+    int attempt = 0;
+    boolean success = false;
+    while (!success) {
+      try {
+        // get a reference to the loggers that no other thread can touch
+        ArrayList<DfsLogger> copy = new ArrayList<DfsLogger>();
+        currentLogSet = initializeLoggers(copy);
+        
+        // add the logger to the log set for the memory in the tablet,
+        // update the metadata table if we've never used this tablet
+        
+        if (currentLogSet == logSetId.get()) {
+          for (CommitSession commitSession : sessions) {
+            if (commitSession.beginUpdatingLogsUsed(copy, mincFinish)) {
+              try {
+                // Scribble out a tablet definition and then write to the metadata table
+                defineTablet(commitSession);
+                if (currentLogSet == logSetId.get())
+                  tserver.addLoggersToMetadata(copy, commitSession.getExtent(), commitSession.getLogId());
+              } finally {
+                commitSession.finishUpdatingLogsUsed();
+              }
+            }
+          }
+        }
+        
+        // Make sure that the logs haven't changed out from underneath our copy
+        if (currentLogSet == logSetId.get()) {
+          
+          // write the mutation to the logs
+          seq = seqGen.incrementAndGet();
+          if (seq < 0)
+            throw new RuntimeException("Logger sequence generator wrapped!  Onos!!!11!eleven");
+          ArrayList<LoggerOperation> queuedOperations = new ArrayList<LoggerOperation>(copy.size());
+          for (DfsLogger wal : copy) {
+            LoggerOperation lop = writer.write(wal, seq);
+            if (lop != null)
+              queuedOperations.add(lop);
+          }
+          
+          for (LoggerOperation lop : queuedOperations) {
+            lop.await();
+          }
+          
+          // double-check: did the log set change?
+          success = (currentLogSet == logSetId.get());
+        }
+      } catch (DfsLogger.LogClosedException ex) {
+        log.debug("Logs closed while writing, retrying " + (attempt + 1));
+      } catch (Exception t) {
+        log.error("Unexpected error writing to log, retrying attempt " + (attempt + 1), t);
+        UtilWaitThread.sleep(100);
+      } finally {
+        attempt++;
+      }
+      // Some sort of write failure occurred. Grab the write lock and reset the logs.
+      // But since multiple threads will attempt it, only attempt the reset when
+      // the logs haven't changed.
+      final int finalCurrent = currentLogSet;
+      if (!success) {
+        testLockAndRun(logSetLock, new TestCallWithWriteLock() {
+          
+          @Override
+          boolean test() {
+            return finalCurrent == logSetId.get();
+          }
+          
+          @Override
+          void withWriteLock() throws IOException {
+            close();
+          }
+        });
+      }
+    }
+    // if the log gets too big, reset it .. grab the write lock first
+    logSizeEstimate.addAndGet(4 * 3); // event, tid, seq overhead
+    testLockAndRun(logSetLock, new TestCallWithWriteLock() {
+      boolean test() {
+        return logSizeEstimate.get() > maxSize;
+      }
+      
+      void withWriteLock() throws IOException {
+        close();
+      }
+    });
+    return seq;
+  }
+  
+  public int defineTablet(final CommitSession commitSession) throws IOException {
+    // scribble this into the metadata tablet, too.
+    if (!enabled(commitSession))
+      return -1;
+    return write(commitSession, false, new Writer() {
+      @Override
+      public LoggerOperation write(DfsLogger logger, int ignored) throws Exception {
+        logger.defineTablet(commitSession.getWALogSeq(), commitSession.getLogId(), commitSession.getExtent());
+        return null;
+      }
+    });
+  }
+  
+  public int log(final CommitSession commitSession, final int tabletSeq, final Mutation m) throws IOException {
+    if (!enabled(commitSession))
+      return -1;
+    int seq = write(commitSession, false, new Writer() {
+      @Override
+      public LoggerOperation write(DfsLogger logger, int ignored) throws Exception {
+        return logger.log(tabletSeq, commitSession.getLogId(), m);
+      }
+    });
+    logSizeEstimate.addAndGet(m.numBytes());
+    return seq;
+  }
+  
+  public int logManyTablets(Map<CommitSession,List<Mutation>> mutations) throws IOException {
+    
+    final Map<CommitSession,List<Mutation>> loggables = new HashMap<CommitSession,List<Mutation>>(mutations);
+    for (CommitSession t : mutations.keySet()) {
+      if (!enabled(t))
+        loggables.remove(t);
+    }
+    if (loggables.size() == 0)
+      return -1;
+    
+    int seq = write(loggables.keySet(), false, new Writer() {
+      @Override
+      public LoggerOperation write(DfsLogger logger, int ignored) throws Exception {
+        List<TabletMutations> copy = new ArrayList<TabletMutations>(loggables.size());
+        for (Entry<CommitSession,List<Mutation>> entry : loggables.entrySet()) {
+          CommitSession cs = entry.getKey();
+          copy.add(new TabletMutations(cs.getLogId(), cs.getWALogSeq(), entry.getValue()));
+        }
+        return logger.logManyTablets(copy);
+      }
+    });
+    for (List<Mutation> entry : loggables.values()) {
+      if (entry.size() < 1)
+        throw new IllegalArgumentException("logManyTablets: logging empty mutation list");
+      for (Mutation m : entry) {
+        logSizeEstimate.addAndGet(m.numBytes());
+      }
+    }
+    return seq;
+  }
+  
+  public void minorCompactionFinished(final CommitSession commitSession, final String fullyQualifiedFileName, final int walogSeq) throws IOException {
+    
+    if (!enabled(commitSession))
+      return;
+    
+    long t1 = System.currentTimeMillis();
+    
+    int seq = write(commitSession, true, new Writer() {
+      @Override
+      public LoggerOperation write(DfsLogger logger, int ignored) throws Exception {
+        logger.minorCompactionFinished(walogSeq, commitSession.getLogId(), fullyQualifiedFileName);
+        return null;
+      }
+    });
+    
+    long t2 = System.currentTimeMillis();
+    
+    log.debug(" wrote MinC finish  " + seq + ": writeTime:" + (t2 - t1) + "ms ");
+  }
+  
+  public int minorCompactionStarted(final CommitSession commitSession, final int seq, final String fullyQualifiedFileName) throws IOException {
+    if (!enabled(commitSession))
+      return -1;
+    write(commitSession, false, new Writer() {
+      @Override
+      public LoggerOperation write(DfsLogger logger, int ignored) throws Exception {
+        logger.minorCompactionStarted(seq, commitSession.getLogId(), fullyQualifiedFileName);
+        return null;
+      }
+    });
+    return seq;
+  }
+  
+  public void recover(VolumeManager fs, Tablet tablet, List<Path> logs, Set<String> tabletFiles, MutationReceiver mr) throws IOException {
+    if (!enabled(tablet))
+      return;
+    try {
+      SortedLogRecovery recovery = new SortedLogRecovery(fs);
+      KeyExtent extent = tablet.getExtent();
+      recovery.recover(extent, logs, tabletFiles, mr);
+    } catch (Exception e) {
+      throw new IOException(e);
+    }
+  }
+  
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/fc9363a0/server/tserver/src/main/java/org/apache/accumulo/tserver/logger/LogReader.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/logger/LogReader.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/logger/LogReader.java
index 2b3863d..528ebbf 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/logger/LogReader.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/logger/LogReader.java
@@ -32,8 +32,8 @@ import org.apache.accumulo.core.data.KeyExtent;
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.server.fs.VolumeManager;
 import org.apache.accumulo.server.fs.VolumeManagerImpl;
-import org.apache.accumulo.server.tabletserver.log.DfsLogger;
-import org.apache.accumulo.server.tabletserver.log.MultiReader;
+import org.apache.accumulo.tserver.log.DfsLogger;
+import org.apache.accumulo.tserver.log.MultiReader;
 import org.apache.hadoop.fs.FSDataInputStream;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.Text;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/fc9363a0/server/tserver/src/main/java/org/apache/accumulo/tserver/mastermessage/MasterMessage.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/mastermessage/MasterMessage.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/mastermessage/MasterMessage.java
new file mode 100644
index 0000000..ecca3ce
--- /dev/null
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/mastermessage/MasterMessage.java
@@ -0,0 +1,28 @@
+/*
+ * 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.mastermessage;
+
+import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
+import org.apache.accumulo.core.master.thrift.MasterClientService;
+import org.apache.accumulo.core.security.thrift.TCredentials;
+import org.apache.thrift.TException;
+
+public interface MasterMessage {
+  
+  void send(TCredentials info, String serverName, MasterClientService.Iface client) throws TException, ThriftSecurityException;
+  
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/fc9363a0/server/tserver/src/main/java/org/apache/accumulo/tserver/mastermessage/SplitReportMessage.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/mastermessage/SplitReportMessage.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/mastermessage/SplitReportMessage.java
new file mode 100644
index 0000000..f71cbe2
--- /dev/null
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/mastermessage/SplitReportMessage.java
@@ -0,0 +1,55 @@
+/*
+ * 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.mastermessage;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.apache.accumulo.trace.instrument.Tracer;
+import org.apache.accumulo.core.client.impl.Translator;
+import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
+import org.apache.accumulo.core.data.KeyExtent;
+import org.apache.accumulo.core.master.thrift.MasterClientService;
+import org.apache.accumulo.core.master.thrift.TabletSplit;
+import org.apache.accumulo.core.security.thrift.TCredentials;
+import org.apache.hadoop.io.Text;
+import org.apache.thrift.TException;
+
+public class SplitReportMessage implements MasterMessage {
+  Map<KeyExtent,Text> extents;
+  KeyExtent old_extent;
+  
+  public SplitReportMessage(KeyExtent old_extent, Map<KeyExtent,Text> newExtents) {
+    this.old_extent = old_extent;
+    extents = new TreeMap<KeyExtent,Text>(newExtents);
+  }
+  
+  public SplitReportMessage(KeyExtent old_extent, KeyExtent ne1, Text np1, KeyExtent ne2, Text np2) {
+    this.old_extent = old_extent;
+    extents = new TreeMap<KeyExtent,Text>();
+    extents.put(ne1, np1);
+    extents.put(ne2, np2);
+  }
+  
+  public void send(TCredentials credentials, String serverName, MasterClientService.Iface client) throws TException, ThriftSecurityException {
+    TabletSplit split = new TabletSplit();
+    split.oldTablet = old_extent.toThrift();
+    split.newTablets = Translator.translate(extents.keySet(), Translator.KET);
+    client.reportSplitExtent(Tracer.traceInfo(), credentials, serverName, split);
+  }
+  
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/fc9363a0/server/tserver/src/main/java/org/apache/accumulo/tserver/mastermessage/TabletStatusMessage.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/mastermessage/TabletStatusMessage.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/mastermessage/TabletStatusMessage.java
new file mode 100644
index 0000000..b168625
--- /dev/null
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/mastermessage/TabletStatusMessage.java
@@ -0,0 +1,40 @@
+/*
+ * 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.mastermessage;
+
+import org.apache.accumulo.trace.instrument.Tracer;
+import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
+import org.apache.accumulo.core.data.KeyExtent;
+import org.apache.accumulo.core.master.thrift.TabletLoadState;
+import org.apache.accumulo.core.master.thrift.MasterClientService.Iface;
+import org.apache.accumulo.core.security.thrift.TCredentials;
+import org.apache.thrift.TException;
+
+public class TabletStatusMessage implements MasterMessage {
+  
+  private KeyExtent extent;
+  private TabletLoadState status;
+  
+  public TabletStatusMessage(TabletLoadState status, KeyExtent extent) {
+    this.extent = extent;
+    this.status = status;
+  }
+  
+  public void send(TCredentials auth, String serverName, Iface client) throws TException, ThriftSecurityException {
+    client.reportTabletStatus(Tracer.traceInfo(), auth, serverName, status, extent.toThrift());
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/fc9363a0/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMBean.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMBean.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMBean.java
new file mode 100644
index 0000000..228e743
--- /dev/null
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMBean.java
@@ -0,0 +1,50 @@
+/*
+ * 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.metrics;
+
+public interface TabletServerMBean {
+  
+  public int getOnlineCount();
+  
+  public int getOpeningCount();
+  
+  public int getUnopenedCount();
+  
+  public int getMajorCompactions();
+  
+  public int getMajorCompactionsQueued();
+  
+  public int getMinorCompactions();
+  
+  public int getMinorCompactionsQueued();
+  
+  public long getEntries();
+  
+  public long getEntriesInMemory();
+  
+  public long getQueries();
+  
+  public long getIngest();
+  
+  public long getTotalMinorCompactions();
+  
+  public double getHoldTime();
+  
+  public String getName();
+  
+  public double getAverageFilesPerTablet();
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/fc9363a0/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMinCMetrics.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMinCMetrics.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMinCMetrics.java
new file mode 100644
index 0000000..a89bb45
--- /dev/null
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMinCMetrics.java
@@ -0,0 +1,88 @@
+/*
+ * 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.metrics;
+
+import javax.management.ObjectName;
+
+import org.apache.accumulo.server.metrics.AbstractMetricsImpl;
+
+public class TabletServerMinCMetrics extends AbstractMetricsImpl implements TabletServerMinCMetricsMBean {
+  
+  static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(TabletServerMinCMetrics.class);
+  
+  private static final String METRICS_PREFIX = "tserver.minc";
+  
+  private static ObjectName OBJECT_NAME = null;
+  
+  public TabletServerMinCMetrics() {
+    super();
+    reset();
+    try {
+      OBJECT_NAME = new ObjectName("accumulo.server.metrics:service=TServerInfo,name=TabletServerMinCMetricsMBean,instance=" + Thread.currentThread().getName());
+    } catch (Exception e) {
+      log.error("Exception setting MBean object name", e);
+    }
+  }
+  
+  @Override
+  protected ObjectName getObjectName() {
+    return OBJECT_NAME;
+  }
+  
+  @Override
+  protected String getMetricsPrefix() {
+    return METRICS_PREFIX;
+  }
+  
+  public long getMinorCompactionMinTime() {
+    return this.getMetricMin(minc);
+  }
+  
+  public long getMinorCompactionAvgTime() {
+    return this.getMetricAvg(minc);
+  }
+  
+  public long getMinorCompactionCount() {
+    return this.getMetricCount(minc);
+  }
+  
+  public long getMinorCompactionMaxTime() {
+    return this.getMetricMax(minc);
+  }
+  
+  public long getMinorCompactionQueueAvgTime() {
+    return this.getMetricAvg(queue);
+  }
+  
+  public long getMinorCompactionQueueCount() {
+    return this.getMetricCount(queue);
+  }
+  
+  public long getMinorCompactionQueueMaxTime() {
+    return this.getMetricMax(queue);
+  }
+  
+  public long getMinorCompactionQueueMinTime() {
+    return this.getMetricMin(minc);
+  }
+  
+  public void reset() {
+    createMetric("minc");
+    createMetric("queue");
+  }
+  
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/fc9363a0/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMinCMetricsMBean.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMinCMetricsMBean.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMinCMetricsMBean.java
new file mode 100644
index 0000000..4541701
--- /dev/null
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerMinCMetricsMBean.java
@@ -0,0 +1,42 @@
+/*
+ * 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.metrics;
+
+public interface TabletServerMinCMetricsMBean {
+  
+  public static final String minc = "minc";
+  public static final String queue = "queue";
+  
+  public long getMinorCompactionCount();
+  
+  public long getMinorCompactionAvgTime();
+  
+  public long getMinorCompactionMinTime();
+  
+  public long getMinorCompactionMaxTime();
+  
+  public long getMinorCompactionQueueCount();
+  
+  public long getMinorCompactionQueueAvgTime();
+  
+  public long getMinorCompactionQueueMinTime();
+  
+  public long getMinorCompactionQueueMaxTime();
+  
+  public void reset();
+  
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/fc9363a0/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerScanMetrics.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerScanMetrics.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerScanMetrics.java
new file mode 100644
index 0000000..8612c0c
--- /dev/null
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerScanMetrics.java
@@ -0,0 +1,88 @@
+/*
+ * 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.metrics;
+
+import javax.management.ObjectName;
+
+import org.apache.accumulo.server.metrics.AbstractMetricsImpl;
+
+public class TabletServerScanMetrics extends AbstractMetricsImpl implements TabletServerScanMetricsMBean {
+  
+  static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(TabletServerScanMetrics.class);
+  
+  public static final String METRICS_PREFIX = "tserver.scan";
+  
+  public static ObjectName OBJECT_NAME = null;
+  
+  public TabletServerScanMetrics() {
+    super();
+    reset();
+    try {
+      OBJECT_NAME = new ObjectName("accumulo.server.metrics:service=TServerInfo,name=TabletServerScanMetricsMBean,instance=" + Thread.currentThread().getName());
+    } catch (Exception e) {
+      log.error("Exception setting MBean object name", e);
+    }
+  }
+  
+  @Override
+  protected ObjectName getObjectName() {
+    return OBJECT_NAME;
+  }
+  
+  @Override
+  protected String getMetricsPrefix() {
+    return METRICS_PREFIX;
+  }
+  
+  public long getResultAvgSize() {
+    return this.getMetricAvg(resultSize);
+  }
+  
+  public long getResultCount() {
+    return this.getMetricCount(resultSize);
+  }
+  
+  public long getResultMaxSize() {
+    return this.getMetricMax(resultSize);
+  }
+  
+  public long getResultMinSize() {
+    return this.getMetricMin(resultSize);
+  }
+  
+  public long getScanAvgTime() {
+    return this.getMetricAvg(scan);
+  }
+  
+  public long getScanCount() {
+    return this.getMetricCount(scan);
+  }
+  
+  public long getScanMaxTime() {
+    return this.getMetricMax(scan);
+  }
+  
+  public long getScanMinTime() {
+    return this.getMetricMin(scan);
+  }
+  
+  public void reset() {
+    createMetric(scan);
+    createMetric(resultSize);
+  }
+  
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/fc9363a0/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerScanMetricsMBean.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerScanMetricsMBean.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerScanMetricsMBean.java
new file mode 100644
index 0000000..4bcf188
--- /dev/null
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerScanMetricsMBean.java
@@ -0,0 +1,42 @@
+/*
+ * 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.metrics;
+
+public interface TabletServerScanMetricsMBean {
+  
+  public static final String scan = "scan";
+  public static final String resultSize = "result";
+  
+  public long getScanCount();
+  
+  public long getScanAvgTime();
+  
+  public long getScanMinTime();
+  
+  public long getScanMaxTime();
+  
+  public long getResultCount();
+  
+  public long getResultAvgSize();
+  
+  public long getResultMinSize();
+  
+  public long getResultMaxSize();
+  
+  public void reset();
+  
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/fc9363a0/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerUpdateMetrics.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerUpdateMetrics.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerUpdateMetrics.java
new file mode 100644
index 0000000..b23fb1a
--- /dev/null
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerUpdateMetrics.java
@@ -0,0 +1,134 @@
+/*
+ * 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.metrics;
+
+import javax.management.ObjectName;
+
+import org.apache.accumulo.server.metrics.AbstractMetricsImpl;
+
+public class TabletServerUpdateMetrics extends AbstractMetricsImpl implements TabletServerUpdateMetricsMBean {
+  
+  static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(TabletServerUpdateMetrics.class);
+  
+  private static final String METRICS_PREFIX = "tserver.update";
+  
+  private static ObjectName OBJECT_NAME = null;
+  
+  public TabletServerUpdateMetrics() {
+    super();
+    reset();
+    try {
+      OBJECT_NAME = new ObjectName("accumulo.server.metrics:service=TServerInfo,name=TabletServerUpdateMetricsMBean,instance="
+          + Thread.currentThread().getName());
+    } catch (Exception e) {
+      log.error("Exception setting MBean object name", e);
+    }
+  }
+  
+  @Override
+  protected ObjectName getObjectName() {
+    return OBJECT_NAME;
+  }
+  
+  @Override
+  protected String getMetricsPrefix() {
+    return METRICS_PREFIX;
+  }
+  
+  public long getPermissionErrorCount() {
+    return this.getMetricCount(permissionErrors);
+  }
+  
+  public long getUnknownTabletErrorCount() {
+    return this.getMetricCount(unknownTabletErrors);
+  }
+  
+  public long getMutationArrayAvgSize() {
+    return this.getMetricAvg(mutationArraySize);
+  }
+  
+  public long getMutationArrayMinSize() {
+    return this.getMetricMin(mutationArraySize);
+  }
+  
+  public long getMutationArrayMaxSize() {
+    return this.getMetricMax(mutationArraySize);
+  }
+  
+  public long getCommitPrepCount() {
+    return this.getMetricCount(commitPrep);
+  }
+  
+  public long getCommitPrepMinTime() {
+    return this.getMetricMin(commitPrep);
+  }
+  
+  public long getCommitPrepMaxTime() {
+    return this.getMetricMax(commitPrep);
+  }
+  
+  public long getCommitPrepAvgTime() {
+    return this.getMetricAvg(commitPrep);
+  }
+  
+  public long getConstraintViolationCount() {
+    return this.getMetricCount(constraintViolations);
+  }
+  
+  public long getWALogWriteCount() {
+    return this.getMetricCount(waLogWriteTime);
+  }
+  
+  public long getWALogWriteMinTime() {
+    return this.getMetricMin(waLogWriteTime);
+  }
+  
+  public long getWALogWriteMaxTime() {
+    return this.getMetricMax(waLogWriteTime);
+  }
+  
+  public long getWALogWriteAvgTime() {
+    return this.getMetricAvg(waLogWriteTime);
+  }
+  
+  public long getCommitCount() {
+    return this.getMetricCount(commitTime);
+  }
+  
+  public long getCommitMinTime() {
+    return this.getMetricMin(commitTime);
+  }
+  
+  public long getCommitMaxTime() {
+    return this.getMetricMax(commitTime);
+  }
+  
+  public long getCommitAvgTime() {
+    return this.getMetricAvg(commitTime);
+  }
+  
+  public void reset() {
+    createMetric(permissionErrors);
+    createMetric(unknownTabletErrors);
+    createMetric(mutationArraySize);
+    createMetric(commitPrep);
+    createMetric(constraintViolations);
+    createMetric(waLogWriteTime);
+    createMetric(commitTime);
+  }
+  
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/fc9363a0/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerUpdateMetricsMBean.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerUpdateMetricsMBean.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerUpdateMetricsMBean.java
new file mode 100644
index 0000000..7e3b506
--- /dev/null
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/metrics/TabletServerUpdateMetricsMBean.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.tserver.metrics;
+
+public interface TabletServerUpdateMetricsMBean {
+  
+  public final static String permissionErrors = "permissionErrors";
+  public final static String unknownTabletErrors = "unknownTabletErrors";
+  public final static String mutationArraySize = "mutationArraysSize";
+  public final static String commitPrep = "commitPrep";
+  public final static String constraintViolations = "constraintViolations";
+  public final static String waLogWriteTime = "waLogWriteTime";
+  public final static String commitTime = "commitTime";
+  
+  public long getPermissionErrorCount();
+  
+  public long getUnknownTabletErrorCount();
+  
+  public long getMutationArrayAvgSize();
+  
+  public long getMutationArrayMinSize();
+  
+  public long getMutationArrayMaxSize();
+  
+  public long getCommitPrepCount();
+  
+  public long getCommitPrepMinTime();
+  
+  public long getCommitPrepMaxTime();
+  
+  public long getCommitPrepAvgTime();
+  
+  public long getConstraintViolationCount();
+  
+  public long getWALogWriteCount();
+  
+  public long getWALogWriteMinTime();
+  
+  public long getWALogWriteMaxTime();
+  
+  public long getWALogWriteAvgTime();
+  
+  public long getCommitCount();
+  
+  public long getCommitMinTime();
+  
+  public long getCommitMaxTime();
+  
+  public long getCommitAvgTime();
+  
+  public void reset();
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/fc9363a0/server/tserver/src/test/java/org/apache/accumulo/server/tabletserver/CheckTabletMetadataTest.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/test/java/org/apache/accumulo/server/tabletserver/CheckTabletMetadataTest.java b/server/tserver/src/test/java/org/apache/accumulo/server/tabletserver/CheckTabletMetadataTest.java
deleted file mode 100644
index aa7e7a4..0000000
--- a/server/tserver/src/test/java/org/apache/accumulo/server/tabletserver/CheckTabletMetadataTest.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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.server.tabletserver;
-
-import java.util.TreeMap;
-
-import org.apache.accumulo.core.data.Key;
-import org.apache.accumulo.core.data.KeyExtent;
-import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
-import org.apache.accumulo.core.util.ColumnFQ;
-import org.apache.accumulo.master.state.TServerInstance;
-import org.apache.hadoop.io.Text;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class CheckTabletMetadataTest {
-  
-  private static Key nk(String row, ColumnFQ cfq) {
-    return new Key(new Text(row), cfq.getColumnFamily(), cfq.getColumnQualifier());
-  }
-  
-  private static Key nk(String row, Text cf, String cq) {
-    return new Key(row, cf.toString(), cq);
-  }
-  
-  private static void put(TreeMap<Key,Value> tabletMeta, String row, ColumnFQ cfq, byte[] val) {
-    Key k = new Key(new Text(row), cfq.getColumnFamily(), cfq.getColumnQualifier());
-    tabletMeta.put(k, new Value(val));
-  }
-  
-  private static void put(TreeMap<Key,Value> tabletMeta, String row, Text cf, String cq, String val) {
-    Key k = new Key(new Text(row), cf, new Text(cq));
-    tabletMeta.put(k, new Value(val.getBytes()));
-  }
-  
-  private static void assertFail(TreeMap<Key,Value> tabletMeta, KeyExtent ke, TServerInstance tsi) {
-    try {
-      Assert.assertNull(TabletServer.checkTabletMetadata(ke, tsi, tabletMeta, ke.getMetadataEntry()));
-    } catch (Exception e) {
-      
-    }
-  }
-  
-  private static void assertFail(TreeMap<Key,Value> tabletMeta, KeyExtent ke, TServerInstance tsi, Key keyToDelete) {
-    TreeMap<Key,Value> copy = new TreeMap<Key,Value>(tabletMeta);
-    Assert.assertNotNull(copy.remove(keyToDelete));
-    try {
-      Assert.assertNull(TabletServer.checkTabletMetadata(ke, tsi, copy, ke.getMetadataEntry()));
-    } catch (Exception e) {
-      
-    }
-  }
-  
-  @Test
-  public void testBadTabletMetadata() throws Exception {
-    
-    KeyExtent ke = new KeyExtent(new Text("1"), null, null);
-    
-    TreeMap<Key,Value> tabletMeta = new TreeMap<Key,Value>();
-    
-    put(tabletMeta, "1<", TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN, KeyExtent.encodePrevEndRow(null).get());
-    put(tabletMeta, "1<", TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN, "/t1".getBytes());
-    put(tabletMeta, "1<", TabletsSection.ServerColumnFamily.TIME_COLUMN, "M0".getBytes());
-    put(tabletMeta, "1<", TabletsSection.FutureLocationColumnFamily.NAME, "4", "127.0.0.1:9997");
-    
-    TServerInstance tsi = new TServerInstance("127.0.0.1:9997", 4);
-    
-    Assert.assertNotNull(TabletServer.checkTabletMetadata(ke, tsi, tabletMeta, ke.getMetadataEntry()));
-    
-    assertFail(tabletMeta, ke, new TServerInstance("127.0.0.1:9998", 4));
-    assertFail(tabletMeta, ke, new TServerInstance("127.0.0.1:9998", 5));
-    assertFail(tabletMeta, ke, new TServerInstance("127.0.0.1:9997", 5));
-    assertFail(tabletMeta, ke, new TServerInstance("127.0.0.2:9997", 4));
-    assertFail(tabletMeta, ke, new TServerInstance("127.0.0.2:9997", 5));
-    
-    assertFail(tabletMeta, new KeyExtent(new Text("1"), null, new Text("m")), tsi);
-    
-    assertFail(tabletMeta, new KeyExtent(new Text("1"), new Text("r"), new Text("m")), tsi);
-    
-    assertFail(tabletMeta, ke, tsi, nk("1<", TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN));
-    
-    assertFail(tabletMeta, ke, tsi, nk("1<", TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN));
-    
-    assertFail(tabletMeta, ke, tsi, nk("1<", TabletsSection.ServerColumnFamily.TIME_COLUMN));
-    
-    assertFail(tabletMeta, ke, tsi, nk("1<", TabletsSection.FutureLocationColumnFamily.NAME, "4"));
-    
-    TreeMap<Key,Value> copy = new TreeMap<Key,Value>(tabletMeta);
-    put(copy, "1<", TabletsSection.CurrentLocationColumnFamily.NAME, "4", "127.0.0.1:9997");
-    assertFail(copy, ke, tsi);
-    assertFail(copy, ke, tsi, nk("1<", TabletsSection.FutureLocationColumnFamily.NAME, "4"));
-    
-    copy = new TreeMap<Key,Value>(tabletMeta);
-    put(copy, "1<", TabletsSection.CurrentLocationColumnFamily.NAME, "5", "127.0.0.1:9998");
-    assertFail(copy, ke, tsi);
-    put(copy, "1<", TabletsSection.CurrentLocationColumnFamily.NAME, "6", "127.0.0.1:9999");
-    assertFail(copy, ke, tsi);
-    
-    copy = new TreeMap<Key,Value>(tabletMeta);
-    put(copy, "1<", TabletsSection.FutureLocationColumnFamily.NAME, "5", "127.0.0.1:9998");
-    assertFail(copy, ke, tsi);
-    
-    assertFail(new TreeMap<Key,Value>(), ke, tsi);
-    
-  }
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/fc9363a0/server/tserver/src/test/java/org/apache/accumulo/server/tabletserver/InMemoryMapTest.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/test/java/org/apache/accumulo/server/tabletserver/InMemoryMapTest.java b/server/tserver/src/test/java/org/apache/accumulo/server/tabletserver/InMemoryMapTest.java
deleted file mode 100644
index fd5e661..0000000
--- a/server/tserver/src/test/java/org/apache/accumulo/server/tabletserver/InMemoryMapTest.java
+++ /dev/null
@@ -1,492 +0,0 @@
-/*
- * 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.server.tabletserver;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-
-import junit.framework.TestCase;
-
-import org.apache.accumulo.core.data.ArrayByteSequence;
-import org.apache.accumulo.core.data.ByteSequence;
-import org.apache.accumulo.core.data.Key;
-import org.apache.accumulo.core.data.Mutation;
-import org.apache.accumulo.core.data.Range;
-import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
-import org.apache.accumulo.core.iterators.system.ColumnFamilySkippingIterator;
-import org.apache.accumulo.core.util.LocalityGroupUtil;
-import org.apache.accumulo.server.client.HdfsZooInstance;
-import org.apache.accumulo.server.conf.ZooConfiguration;
-import org.apache.accumulo.server.tabletserver.InMemoryMap.MemoryIterator;
-import org.apache.hadoop.io.Text;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.junit.Before;
-
-public class InMemoryMapTest extends TestCase {
-  
-  @Before
-  public void setUp() throws Exception {
-    // suppress log messages having to do with not having an instance
-    Logger.getLogger(ZooConfiguration.class).setLevel(Level.OFF);
-    Logger.getLogger(HdfsZooInstance.class).setLevel(Level.OFF);
-  }
-  
-  public void mutate(InMemoryMap imm, String row, String column, long ts) {
-    Mutation m = new Mutation(new Text(row));
-    String[] sa = column.split(":");
-    m.putDelete(new Text(sa[0]), new Text(sa[1]), ts);
-    
-    imm.mutate(Collections.singletonList(m));
-  }
-  
-  public void mutate(InMemoryMap imm, String row, String column, long ts, String value) {
-    Mutation m = new Mutation(new Text(row));
-    String[] sa = column.split(":");
-    m.put(new Text(sa[0]), new Text(sa[1]), ts, new Value(value.getBytes()));
-    
-    imm.mutate(Collections.singletonList(m));
-  }
-  
-  static Key nk(String row, String column, long ts) {
-    String[] sa = column.split(":");
-    Key k = new Key(new Text(row), new Text(sa[0]), new Text(sa[1]), ts);
-    return k;
-  }
-  
-  static void ae(SortedKeyValueIterator<Key,Value> dc, String row, String column, int ts, String val) throws IOException {
-    assertTrue(dc.hasTop());
-    assertEquals(nk(row, column, ts), dc.getTopKey());
-    assertEquals(new Value(val.getBytes()), dc.getTopValue());
-    dc.next();
-    
-  }
-  
-  static Set<ByteSequence> newCFSet(String... cfs) {
-    HashSet<ByteSequence> cfSet = new HashSet<ByteSequence>();
-    for (String cf : cfs) {
-      cfSet.add(new ArrayByteSequence(cf));
-    }
-    return cfSet;
-  }
-
-  public void test2() throws Exception {
-    InMemoryMap imm = new InMemoryMap(false, "/tmp");
-    
-    MemoryIterator ski1 = imm.skvIterator();
-    mutate(imm, "r1", "foo:cq1", 3, "bar1");
-    MemoryIterator ski2 = imm.skvIterator();
-    
-    ski1.seek(new Range(), LocalityGroupUtil.EMPTY_CF_SET, false);
-    assertFalse(ski1.hasTop());
-    
-    ski2.seek(new Range(), LocalityGroupUtil.EMPTY_CF_SET, false);
-    assertTrue(ski2.hasTop());
-    ae(ski2, "r1", "foo:cq1", 3, "bar1");
-    assertFalse(ski2.hasTop());
-    
-  }
-  
-  public void test3() throws Exception {
-    InMemoryMap imm = new InMemoryMap(false, "/tmp");
-    
-    mutate(imm, "r1", "foo:cq1", 3, "bar1");
-    mutate(imm, "r1", "foo:cq1", 3, "bar2");
-    MemoryIterator ski1 = imm.skvIterator();
-    mutate(imm, "r1", "foo:cq1", 3, "bar3");
-    
-    mutate(imm, "r3", "foo:cq1", 3, "bar9");
-    mutate(imm, "r3", "foo:cq1", 3, "bara");
-    
-    MemoryIterator ski2 = imm.skvIterator();
-    
-    ski1.seek(new Range(new Text("r1")), LocalityGroupUtil.EMPTY_CF_SET, false);
-    ae(ski1, "r1", "foo:cq1", 3, "bar2");
-    ae(ski1, "r1", "foo:cq1", 3, "bar1");
-    assertFalse(ski1.hasTop());
-    
-    ski2.seek(new Range(new Text("r3")), LocalityGroupUtil.EMPTY_CF_SET, false);
-    ae(ski2, "r3", "foo:cq1", 3, "bara");
-    ae(ski2, "r3", "foo:cq1", 3, "bar9");
-    assertFalse(ski1.hasTop());
-    
-  }
-  
-  public void test4() throws Exception {
-    InMemoryMap imm = new InMemoryMap(false, "/tmp");
-    
-    mutate(imm, "r1", "foo:cq1", 3, "bar1");
-    mutate(imm, "r1", "foo:cq1", 3, "bar2");
-    MemoryIterator ski1 = imm.skvIterator();
-    mutate(imm, "r1", "foo:cq1", 3, "bar3");
-    
-    imm.delete(0);
-    
-    ski1.seek(new Range(new Text("r1")), LocalityGroupUtil.EMPTY_CF_SET, false);
-    ae(ski1, "r1", "foo:cq1", 3, "bar2");
-    ae(ski1, "r1", "foo:cq1", 3, "bar1");
-    assertFalse(ski1.hasTop());
-    
-    ski1.seek(new Range(new Text("r1")), LocalityGroupUtil.EMPTY_CF_SET, false);
-    ae(ski1, "r1", "foo:cq1", 3, "bar2");
-    ae(ski1, "r1", "foo:cq1", 3, "bar1");
-    assertFalse(ski1.hasTop());
-    
-    ski1.seek(new Range(new Text("r2")), LocalityGroupUtil.EMPTY_CF_SET, false);
-    assertFalse(ski1.hasTop());
-    
-    ski1.seek(new Range(nk("r1", "foo:cq1", 3), null), LocalityGroupUtil.EMPTY_CF_SET, false);
-    ae(ski1, "r1", "foo:cq1", 3, "bar2");
-    ae(ski1, "r1", "foo:cq1", 3, "bar1");
-    assertFalse(ski1.hasTop());
-    
-    ski1.close();
-  }
-  
-  public void test5() throws Exception {
-    InMemoryMap imm = new InMemoryMap(false, "/tmp");
-    
-    mutate(imm, "r1", "foo:cq1", 3, "bar1");
-    mutate(imm, "r1", "foo:cq1", 3, "bar2");
-    mutate(imm, "r1", "foo:cq1", 3, "bar3");
-    
-    MemoryIterator ski1 = imm.skvIterator();
-    ski1.seek(new Range(new Text("r1")), LocalityGroupUtil.EMPTY_CF_SET, false);
-    ae(ski1, "r1", "foo:cq1", 3, "bar3");
-    
-    imm.delete(0);
-    
-    ae(ski1, "r1", "foo:cq1", 3, "bar2");
-    ae(ski1, "r1", "foo:cq1", 3, "bar1");
-    assertFalse(ski1.hasTop());
-    
-    ski1.close();
-    
-    imm = new InMemoryMap(false, "/tmp");
-    
-    mutate(imm, "r1", "foo:cq1", 3, "bar1");
-    mutate(imm, "r1", "foo:cq2", 3, "bar2");
-    mutate(imm, "r1", "foo:cq3", 3, "bar3");
-    
-    ski1 = imm.skvIterator();
-    ski1.seek(new Range(new Text("r1")), LocalityGroupUtil.EMPTY_CF_SET, false);
-    ae(ski1, "r1", "foo:cq1", 3, "bar1");
-    
-    imm.delete(0);
-    
-    ae(ski1, "r1", "foo:cq2", 3, "bar2");
-    ae(ski1, "r1", "foo:cq3", 3, "bar3");
-    assertFalse(ski1.hasTop());
-    
-    ski1.close();
-  }
-  
-  public void test6() throws Exception {
-    InMemoryMap imm = new InMemoryMap(false, "/tmp");
-    
-    mutate(imm, "r1", "foo:cq1", 3, "bar1");
-    mutate(imm, "r1", "foo:cq2", 3, "bar2");
-    mutate(imm, "r1", "foo:cq3", 3, "bar3");
-    mutate(imm, "r1", "foo:cq4", 3, "bar4");
-    
-    MemoryIterator ski1 = imm.skvIterator();
-    
-    mutate(imm, "r1", "foo:cq5", 3, "bar5");
-    
-    SortedKeyValueIterator<Key,Value> dc = ski1.deepCopy(null);
-    
-    ski1.seek(new Range(nk("r1", "foo:cq1", 3), null), LocalityGroupUtil.EMPTY_CF_SET, false);
-    ae(ski1, "r1", "foo:cq1", 3, "bar1");
-    
-    dc.seek(new Range(nk("r1", "foo:cq2", 3), null), LocalityGroupUtil.EMPTY_CF_SET, false);
-    ae(dc, "r1", "foo:cq2", 3, "bar2");
-    
-    imm.delete(0);
-    
-    ae(ski1, "r1", "foo:cq2", 3, "bar2");
-    ae(dc, "r1", "foo:cq3", 3, "bar3");
-    ae(ski1, "r1", "foo:cq3", 3, "bar3");
-    ae(dc, "r1", "foo:cq4", 3, "bar4");
-    ae(ski1, "r1", "foo:cq4", 3, "bar4");
-    assertFalse(ski1.hasTop());
-    assertFalse(dc.hasTop());
-    
-    ski1.seek(new Range(nk("r1", "foo:cq3", 3), null), LocalityGroupUtil.EMPTY_CF_SET, false);
-    
-    dc.seek(new Range(nk("r1", "foo:cq4", 3), null), LocalityGroupUtil.EMPTY_CF_SET, false);
-    ae(dc, "r1", "foo:cq4", 3, "bar4");
-    assertFalse(dc.hasTop());
-    
-    ae(ski1, "r1", "foo:cq3", 3, "bar3");
-    ae(ski1, "r1", "foo:cq4", 3, "bar4");
-    assertFalse(ski1.hasTop());
-    assertFalse(dc.hasTop());
-    
-    ski1.close();
-  }
-  
-  public void testBug1() throws Exception {
-    InMemoryMap imm = new InMemoryMap(false, "/tmp");
-    
-    for (int i = 0; i < 20; i++) {
-      mutate(imm, "r1", "foo:cq" + i, 3, "bar" + i);
-    }
-    
-    for (int i = 0; i < 20; i++) {
-      mutate(imm, "r2", "foo:cq" + i, 3, "bar" + i);
-    }
-    
-    MemoryIterator ski1 = imm.skvIterator();
-    ColumnFamilySkippingIterator cfsi = new ColumnFamilySkippingIterator(ski1);
-    
-    imm.delete(0);
-    
-    ArrayList<ByteSequence> columns = new ArrayList<ByteSequence>();
-    columns.add(new ArrayByteSequence("bar"));
-    
-    // this seek resulted in an infinite loop before a bug was fixed
-    cfsi.seek(new Range("r1"), columns, true);
-    
-    assertFalse(cfsi.hasTop());
-    
-    ski1.close();
-  }
-  
-  public void testSeekBackWards() throws Exception {
-    InMemoryMap imm = new InMemoryMap(false, "/tmp");
-    
-    mutate(imm, "r1", "foo:cq1", 3, "bar1");
-    mutate(imm, "r1", "foo:cq2", 3, "bar2");
-    mutate(imm, "r1", "foo:cq3", 3, "bar3");
-    mutate(imm, "r1", "foo:cq4", 3, "bar4");
-    
-    MemoryIterator skvi1 = imm.skvIterator();
-    
-    skvi1.seek(new Range(nk("r1", "foo:cq3", 3), null), LocalityGroupUtil.EMPTY_CF_SET, false);
-    ae(skvi1, "r1", "foo:cq3", 3, "bar3");
-    
-    skvi1.seek(new Range(nk("r1", "foo:cq1", 3), null), LocalityGroupUtil.EMPTY_CF_SET, false);
-    ae(skvi1, "r1", "foo:cq1", 3, "bar1");
-    
-  }
-  
-  public void testDuplicateKey() throws Exception {
-    InMemoryMap imm = new InMemoryMap(false, "/tmp");
-    
-    Mutation m = new Mutation(new Text("r1"));
-    m.put(new Text("foo"), new Text("cq"), 3, new Value("v1".getBytes()));
-    m.put(new Text("foo"), new Text("cq"), 3, new Value("v2".getBytes()));
-    imm.mutate(Collections.singletonList(m));
-    
-    MemoryIterator skvi1 = imm.skvIterator();
-    skvi1.seek(new Range(), LocalityGroupUtil.EMPTY_CF_SET, false);
-    ae(skvi1, "r1", "foo:cq", 3, "v2");
-    ae(skvi1, "r1", "foo:cq", 3, "v1");
-  }
-  
-  private static final Logger log = Logger.getLogger(InMemoryMapTest.class);
-  
-  static long sum(long[] counts) {
-    long result = 0;
-    for (int i = 0; i < counts.length; i++)
-      result += counts[i];
-    return result;
-  }
-  
-  // @Test - hard to get this timing test to run well on apache build machines
-  public void parallelWriteSpeed() throws InterruptedException {
-    List<Double> timings = new ArrayList<Double>();
-    for (int threads : new int[] {1, 2, 16, /* 64, 256 */}) {
-      final long now = System.currentTimeMillis();
-      final long counts[] = new long[threads];
-      final InMemoryMap imm = new InMemoryMap(false, "/tmp");
-      ExecutorService e = Executors.newFixedThreadPool(threads);
-      for (int j = 0; j < threads; j++) {
-        final int threadId = j;
-        e.execute(new Runnable() {
-          @Override
-          public void run() {
-            while (System.currentTimeMillis() - now < 1000) {
-              for (int k = 0; k < 1000; k++) {
-                Mutation m = new Mutation("row");
-                m.put("cf", "cq", new Value("v".getBytes()));
-                List<Mutation> mutations = Collections.singletonList(m);
-                imm.mutate(mutations);
-                counts[threadId]++;
-              }
-            }
-          }
-        });
-      }
-      e.shutdown();
-      e.awaitTermination(10, TimeUnit.SECONDS);
-      imm.delete(10000);
-      double mutationsPerSecond = sum(counts) / ((System.currentTimeMillis() - now) / 1000.);
-      timings.add(mutationsPerSecond);
-      log.info(String.format("%.1f mutations per second with %d threads", mutationsPerSecond, threads));
-    }
-    // verify that more threads doesn't go a lot faster, or a lot slower than one thread
-    for (int i = 0; i < timings.size(); i++) {
-      double ratioFirst = timings.get(0) / timings.get(i);
-      assertTrue(ratioFirst < 3);
-      assertTrue(ratioFirst > 0.3);
-    }
-  }
-  
-  public void testLocalityGroups() throws Exception {
-    
-    Map<String,Set<ByteSequence>> lggroups1 = new HashMap<String,Set<ByteSequence>>();
-    lggroups1.put("lg1", newCFSet("cf1", "cf2"));
-    lggroups1.put("lg2", newCFSet("cf3", "cf4"));
-    
-    InMemoryMap imm = new InMemoryMap(lggroups1, false, "/tmp");
-    
-    Mutation m1 = new Mutation("r1");
-    m1.put("cf1", "x", 2, "1");
-    m1.put("cf1", "y", 2, "2");
-    m1.put("cf3", "z", 2, "3");
-    m1.put("foo", "b", 2, "9");
-    
-    Mutation m2 = new Mutation("r2");
-    m2.put("cf2", "x", 3, "5");
-    
-    Mutation m3 = new Mutation("r3");
-    m3.put("foo", "b", 4, "6");
-    
-    Mutation m4 = new Mutation("r4");
-    m4.put("foo", "b", 5, "7");
-    m4.put("cf4", "z", 5, "8");
-    
-    Mutation m5 = new Mutation("r5");
-    m5.put("cf3", "z", 6, "A");
-    m5.put("cf4", "z", 6, "B");
-    
-    imm.mutate(Arrays.asList(m1, m2, m3, m4, m5));
-    
-    MemoryIterator iter1 = imm.skvIterator();
-    
-    seekLocalityGroups(iter1);
-    SortedKeyValueIterator<Key,Value> dc1 = iter1.deepCopy(null);
-    seekLocalityGroups(dc1);
-    
-    assertTrue(imm.getNumEntries() == 10);
-    assertTrue(imm.estimatedSizeInBytes() > 0);
-
-    imm.delete(0);
-
-    seekLocalityGroups(iter1);
-    seekLocalityGroups(dc1);
-    // TODO uncomment following when ACCUMULO-1628 is fixed
-    // seekLocalityGroups(iter1.deepCopy(null));
-  }
-
-  private void seekLocalityGroups(SortedKeyValueIterator<Key,Value> iter1) throws IOException {
-    iter1.seek(new Range(), newCFSet("cf1"), true);
-    ae(iter1, "r1", "cf1:x", 2, "1");
-    ae(iter1, "r1", "cf1:y", 2, "2");
-    ae(iter1, "r2", "cf2:x", 3, "5");
-    assertFalse(iter1.hasTop());
-    
-    iter1.seek(new Range("r2", "r4"), newCFSet("cf1"), true);
-    ae(iter1, "r2", "cf2:x", 3, "5");
-    assertFalse(iter1.hasTop());
-
-    iter1.seek(new Range(), newCFSet("cf3"), true);
-    ae(iter1, "r1", "cf3:z", 2, "3");
-    ae(iter1, "r4", "cf4:z", 5, "8");
-    ae(iter1, "r5", "cf3:z", 6, "A");
-    ae(iter1, "r5", "cf4:z", 6, "B");
-    assertFalse(iter1.hasTop());
-    
-    iter1.seek(new Range(), newCFSet("foo"), true);
-    ae(iter1, "r1", "foo:b", 2, "9");
-    ae(iter1, "r3", "foo:b", 4, "6");
-    ae(iter1, "r4", "foo:b", 5, "7");
-    assertFalse(iter1.hasTop());
-    
-    iter1.seek(new Range(), newCFSet("cf1", "cf3"), true);
-    ae(iter1, "r1", "cf1:x", 2, "1");
-    ae(iter1, "r1", "cf1:y", 2, "2");
-    ae(iter1, "r1", "cf3:z", 2, "3");
-    ae(iter1, "r2", "cf2:x", 3, "5");
-    ae(iter1, "r4", "cf4:z", 5, "8");
-    ae(iter1, "r5", "cf3:z", 6, "A");
-    ae(iter1, "r5", "cf4:z", 6, "B");
-    assertFalse(iter1.hasTop());
-    
-    iter1.seek(new Range("r2", "r4"), newCFSet("cf1", "cf3"), true);
-    ae(iter1, "r2", "cf2:x", 3, "5");
-    ae(iter1, "r4", "cf4:z", 5, "8");
-    assertFalse(iter1.hasTop());
-
-    iter1.seek(new Range(), newCFSet("cf1", "cf3", "foo"), true);
-    assertAll(iter1);
-    
-    iter1.seek(new Range("r1", "r2"), newCFSet("cf1", "cf3", "foo"), true);
-    ae(iter1, "r1", "cf1:x", 2, "1");
-    ae(iter1, "r1", "cf1:y", 2, "2");
-    ae(iter1, "r1", "cf3:z", 2, "3");
-    ae(iter1, "r1", "foo:b", 2, "9");
-    ae(iter1, "r2", "cf2:x", 3, "5");
-    assertFalse(iter1.hasTop());
-
-    iter1.seek(new Range(), LocalityGroupUtil.EMPTY_CF_SET, false);
-    assertAll(iter1);
-    
-    iter1.seek(new Range(), newCFSet("cf1"), false);
-    assertAll(iter1);
-    
-    iter1.seek(new Range(), newCFSet("cf1", "cf2"), false);
-    ae(iter1, "r1", "cf3:z", 2, "3");
-    ae(iter1, "r1", "foo:b", 2, "9");
-    ae(iter1, "r3", "foo:b", 4, "6");
-    ae(iter1, "r4", "cf4:z", 5, "8");
-    ae(iter1, "r4", "foo:b", 5, "7");
-    ae(iter1, "r5", "cf3:z", 6, "A");
-    ae(iter1, "r5", "cf4:z", 6, "B");
-    assertFalse(iter1.hasTop());
-
-    iter1.seek(new Range("r2"), newCFSet("cf1", "cf3", "foo"), true);
-    ae(iter1, "r2", "cf2:x", 3, "5");
-    assertFalse(iter1.hasTop());
-  }
-
-  private void assertAll(SortedKeyValueIterator<Key,Value> iter1) throws IOException {
-    ae(iter1, "r1", "cf1:x", 2, "1");
-    ae(iter1, "r1", "cf1:y", 2, "2");
-    ae(iter1, "r1", "cf3:z", 2, "3");
-    ae(iter1, "r1", "foo:b", 2, "9");
-    ae(iter1, "r2", "cf2:x", 3, "5");
-    ae(iter1, "r3", "foo:b", 4, "6");
-    ae(iter1, "r4", "cf4:z", 5, "8");
-    ae(iter1, "r4", "foo:b", 5, "7");
-    ae(iter1, "r5", "cf3:z", 6, "A");
-    ae(iter1, "r5", "cf4:z", 6, "B");
-    assertFalse(iter1.hasTop());
-  }
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/fc9363a0/server/tserver/src/test/java/org/apache/accumulo/server/tabletserver/log/MultiReaderTest.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/test/java/org/apache/accumulo/server/tabletserver/log/MultiReaderTest.java b/server/tserver/src/test/java/org/apache/accumulo/server/tabletserver/log/MultiReaderTest.java
deleted file mode 100644
index c69baa4..0000000
--- a/server/tserver/src/test/java/org/apache/accumulo/server/tabletserver/log/MultiReaderTest.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * 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.server.tabletserver.log;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-
-import org.apache.accumulo.server.fs.VolumeManager;
-import org.apache.accumulo.server.fs.VolumeManagerImpl;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.io.BytesWritable;
-import org.apache.hadoop.io.IntWritable;
-import org.apache.hadoop.io.MapFile.Writer;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-
-public class MultiReaderTest {
-  
-  VolumeManager fs;
-  TemporaryFolder root = new TemporaryFolder();
-  
-  @Before
-  public void setUp() throws Exception {
-    // quiet log messages about compress.CodecPool
-    Logger.getRootLogger().setLevel(Level.ERROR);
-    fs = VolumeManagerImpl.getLocal();
-    root.create();
-    String path = root.getRoot().getAbsolutePath();
-    Path root = new Path("file://" + path + "/manyMaps");
-    fs.mkdirs(root);
-    fs.create(new Path(root, "finished")).close();
-    FileSystem ns = fs.getDefaultVolume();
-    Writer writer = new Writer(ns.getConf(), ns, new Path(root, "odd").toString(), IntWritable.class, BytesWritable.class);
-    BytesWritable value = new BytesWritable("someValue".getBytes());
-    for (int i = 1; i < 1000; i += 2) {
-      writer.append(new IntWritable(i), value);
-    }
-    writer.close();
-    writer = new Writer(ns.getConf(), ns, new Path(root, "even").toString(), IntWritable.class, BytesWritable.class);
-    for (int i = 0; i < 1000; i += 2) {
-      if (i == 10)
-        continue;
-      writer.append(new IntWritable(i), value);
-    }
-    writer.close();
-  }
-  
-  @After
-  public void tearDown() throws Exception {
-    root.create();
-  }
-  
-  private void scan(MultiReader reader, int start) throws IOException {
-    IntWritable key = new IntWritable();
-    BytesWritable value = new BytesWritable();
-    
-    for (int i = start + 1; i < 1000; i++) {
-      if (i == 10)
-        continue;
-      assertTrue(reader.next(key, value));
-      assertEquals(i, key.get());
-    }
-  }
-  
-  private void scanOdd(MultiReader reader, int start) throws IOException {
-    IntWritable key = new IntWritable();
-    BytesWritable value = new BytesWritable();
-    
-    for (int i = start + 2; i < 1000; i += 2) {
-      assertTrue(reader.next(key, value));
-      assertEquals(i, key.get());
-    }
-  }
-  
-  @Test
-  public void testMultiReader() throws IOException {
-    Path manyMaps = new Path("file://" + root.getRoot().getAbsolutePath() + "/manyMaps");
-    MultiReader reader = new MultiReader(fs, manyMaps);
-    IntWritable key = new IntWritable();
-    BytesWritable value = new BytesWritable();
-    
-    for (int i = 0; i < 1000; i++) {
-      if (i == 10)
-        continue;
-      assertTrue(reader.next(key, value));
-      assertEquals(i, key.get());
-    }
-    assertEquals(value.compareTo(new BytesWritable("someValue".getBytes())), 0);
-    assertFalse(reader.next(key, value));
-    
-    key.set(500);
-    assertTrue(reader.seek(key));
-    scan(reader, 500);
-    key.set(10);
-    assertFalse(reader.seek(key));
-    scan(reader, 10);
-    key.set(1000);
-    assertFalse(reader.seek(key));
-    assertFalse(reader.next(key, value));
-    key.set(-1);
-    assertFalse(reader.seek(key));
-    key.set(0);
-    assertTrue(reader.next(key, value));
-    assertEquals(0, key.get());
-    reader.close();
-    
-    fs.deleteRecursively(new Path(manyMaps, "even"));
-    reader = new MultiReader(fs, manyMaps);
-    key.set(501);
-    assertTrue(reader.seek(key));
-    scanOdd(reader, 501);
-    key.set(1000);
-    assertFalse(reader.seek(key));
-    assertFalse(reader.next(key, value));
-    key.set(-1);
-    assertFalse(reader.seek(key));
-    key.set(1);
-    assertTrue(reader.next(key, value));
-    assertEquals(1, key.get());
-    reader.close();
-    
-  }
-  
-}


Mime
View raw message