accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject svn commit: r1499510 [1/7] - in /accumulo/trunk: core/src/main/java/org/apache/accumulo/core/client/ core/src/main/java/org/apache/accumulo/core/client/admin/ core/src/main/java/org/apache/accumulo/core/client/impl/ core/src/main/java/org/apache/accumu...
Date Wed, 03 Jul 2013 18:32:53 GMT
Author: ctubbsii
Date: Wed Jul  3 18:32:51 2013
New Revision: 1499510

URL: http://svn.apache.org/r1499510
Log:
ACCUMULO-1481 : Add tests for splitting/merging root table; refactor to consolidate metadata constants and structures in an organized way; begin consolidating metadata ops into a servicer interface to abstract the code that actually does the servicing of metadata for all tables; remove some special cases for checking for metadata tables/root tablet that no longer apply; make mock work with root table; fix SimpleGarbageCollector to confirm candidates for deletion by checking the root table as well as the regular metadata table

Added:
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/MetadataLocationObtainer.java
      - copied, changed from r1498548, accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/MetadataLocationObtainer.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/MetadataServicer.java   (with props)
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/MetadataTable.java
      - copied, changed from r1497021, accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/MetadataTable.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/RootTable.java
      - copied, changed from r1497021, accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/RootTable.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForMetadataTable.java   (with props)
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForRootTable.java   (with props)
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForUserTables.java   (with props)
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/TableMetadataServicer.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/schema/
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/schema/DataFileValue.java   (with props)
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/schema/MetadataSchema.java   (with props)
    accumulo/trunk/core/src/test/java/org/apache/accumulo/core/metadata/
    accumulo/trunk/core/src/test/java/org/apache/accumulo/core/metadata/MetadataServicerTest.java
      - copied, changed from r1497400, accumulo/trunk/core/src/test/java/org/apache/accumulo/core/util/MetadataTableTest.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java
      - copied, changed from r1497021, accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java
Removed:
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/MetadataLocationObtainer.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/MetadataTable.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/RootTable.java
    accumulo/trunk/core/src/test/java/org/apache/accumulo/core/util/MetadataTableTest.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java
Modified:
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/RootTabletLocator.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerOptions.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocatorImpl.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/Writer.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapred/InputFormatBase.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputFormatBase.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/util/InputConfigurator.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockAccumulo.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/data/KeyExtent.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/ColumnFQ.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/Merge.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/FlushCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/GetSplitsCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OfflineCommand.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OnlineCommand.java
    accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java
    accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/ServerConstants.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/client/BulkImporter.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/gc/GarbageCollectWriteAheadLogs.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/iterators/MetadataBulkLoadFilter.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/Master.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/TabletGroupWatcher.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/balancer/ChaoticLoadBalancer.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/state/MergeStats.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/state/MetaDataStateStore.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/state/MetaDataTableScanner.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/state/RootTabletStateStore.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/state/TServerInstance.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/state/ZooTabletStateStore.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/BulkImport.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/CloneTable.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/CompactRange.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/CreateTable.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/DeleteTable.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/ExportTable.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/ImportTable.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tableOps/TableRangeOp.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/metanalysis/FilterMeta.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/metanalysis/IndexMeta.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/metanalysis/PrintEvents.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/TablesServlet.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/problems/ProblemReport.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/problems/ProblemReports.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/AuditedSecurityOperation.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/handler/ZKAuthorizor.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/Compactor.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/FileManager.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/MinorCompactor.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/Tablet.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletIteratorEnvironment.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServerResourceManager.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/AddFilesWithMissingEntries.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/Admin.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/CheckForMetadataProblems.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/FindOfflineTablets.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/LocalityCheck.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/OfflineMetadataScanner.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/RemoveEntriesForMissingFiles.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/TableDiskUsage.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/TabletIterator.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/VerifyTabletAssignments.java
    accumulo/trunk/server/src/test/java/org/apache/accumulo/server/constraints/MetadataConstraintsTest.java
    accumulo/trunk/server/src/test/java/org/apache/accumulo/server/gc/TestConfirmDeletes.java
    accumulo/trunk/server/src/test/java/org/apache/accumulo/server/iterators/MetadataBulkLoadFilterTest.java
    accumulo/trunk/server/src/test/java/org/apache/accumulo/server/master/TestMergeState.java
    accumulo/trunk/server/src/test/java/org/apache/accumulo/server/master/state/RootTabletStateStoreTest.java
    accumulo/trunk/server/src/test/java/org/apache/accumulo/server/tabletserver/CheckTabletMetadataTest.java
    accumulo/trunk/server/src/test/java/org/apache/accumulo/server/util/CloneTest.java
    accumulo/trunk/server/src/test/java/org/apache/accumulo/server/util/TabletIteratorTest.java
    accumulo/trunk/test/src/main/java/org/apache/accumulo/test/QueryMetadataTable.java
    accumulo/trunk/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java
    accumulo/trunk/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousStatsCollector.java
    accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTest.java
    accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryTest.java
    accumulo/trunk/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java
    accumulo/trunk/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java
    accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/AddSplits.java
    accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CheckBalance.java
    accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Merge.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/MetaSplitTest.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/TestAccumuloSplitRecovery.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/VolumeTest.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/CompactionIT.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/MergeMetaIT.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/PermissionsIT.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ReadWriteIT.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/SplitIT.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/TableIT.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/TimeoutIT.java

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java Wed Jul  3 18:32:51 2013
@@ -30,13 +30,13 @@ import org.apache.accumulo.core.client.s
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.file.FileUtil;
+import org.apache.accumulo.core.metadata.RootTable;
 import org.apache.accumulo.core.security.CredentialHelper;
 import org.apache.accumulo.core.security.thrift.TCredentials;
 import org.apache.accumulo.core.util.ArgumentChecker;
 import org.apache.accumulo.core.util.ByteBufferUtil;
 import org.apache.accumulo.core.util.CachedConfiguration;
 import org.apache.accumulo.core.util.OpTimer;
-import org.apache.accumulo.core.util.RootTable;
 import org.apache.accumulo.core.util.TextUtil;
 import org.apache.accumulo.core.zookeeper.ZooUtil;
 import org.apache.accumulo.fate.zookeeper.ZooCache;

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java Wed Jul  3 18:32:51 2013
@@ -81,6 +81,9 @@ import org.apache.accumulo.core.iterator
 import org.apache.accumulo.core.master.state.tables.TableState;
 import org.apache.accumulo.core.master.thrift.MasterClientService;
 import org.apache.accumulo.core.master.thrift.TableOperation;
+import org.apache.accumulo.core.metadata.MetadataServicer;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.metadata.RootTable;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.security.CredentialHelper;
 import org.apache.accumulo.core.security.thrift.TCredentials;
@@ -90,11 +93,9 @@ import org.apache.accumulo.core.util.Arg
 import org.apache.accumulo.core.util.ByteBufferUtil;
 import org.apache.accumulo.core.util.CachedConfiguration;
 import org.apache.accumulo.core.util.LocalityGroupUtil;
-import org.apache.accumulo.core.util.MetadataTable;
 import org.apache.accumulo.core.util.NamingThreadFactory;
 import org.apache.accumulo.core.util.OpTimer;
 import org.apache.accumulo.core.util.Pair;
-import org.apache.accumulo.core.util.RootTable;
 import org.apache.accumulo.core.util.StringUtil;
 import org.apache.accumulo.core.util.TextUtil;
 import org.apache.accumulo.core.util.ThriftUtil;
@@ -436,7 +437,7 @@ public class TableOperationsImpl extends
   
   private void addSplits(String tableName, SortedSet<Text> partitionKeys, String tableId) throws AccumuloException, AccumuloSecurityException,
       TableNotFoundException, AccumuloServerException {
-    TabletLocator tabLocator = TabletLocator.getInstance(instance, new Text(tableId));
+    TabletLocator tabLocator = TabletLocator.getLocator(instance, new Text(tableId));
     
     for (Text split : partitionKeys) {
       boolean successful = false;
@@ -543,38 +544,34 @@ public class TableOperationsImpl extends
     ArgumentChecker.notNull(tableName);
     
     String tableId = Tables.getTableId(instance, tableName);
-    if (RootTable.ID.equals(tableId))
-      return Collections.emptyList();
     
-    SortedSet<KeyExtent> tablets = new TreeSet<KeyExtent>();
-    Map<KeyExtent,String> locations = new TreeMap<KeyExtent,String>();
+    TreeMap<KeyExtent,String> tabletLocations = new TreeMap<KeyExtent,String>();
     
     while (true) {
       try {
-        tablets.clear();
-        locations.clear();
+        tabletLocations.clear();
         // the following method throws AccumuloException for some conditions that should be retried
-        MetadataTable.getEntries(instance, credentials, tableId, true, locations, tablets);
+        MetadataServicer.forTableId(instance, credentials, tableId).getTabletLocations(tabletLocations);
         break;
       } catch (AccumuloSecurityException ase) {
         throw ase;
-      } catch (Throwable t) {
+      } catch (Exception e) {
         if (!Tables.exists(instance, tableId)) {
           throw new TableNotFoundException(tableId, tableName, null);
         }
         
-        if (t instanceof RuntimeException && t.getCause() instanceof AccumuloSecurityException) {
-          throw (AccumuloSecurityException) t.getCause();
+        if (e instanceof RuntimeException && e.getCause() instanceof AccumuloSecurityException) {
+          throw (AccumuloSecurityException) e.getCause();
         }
         
-        log.info(t.getMessage() + " ... retrying ...");
+        log.info(e.getMessage() + " ... retrying ...");
         UtilWaitThread.sleep(3000);
       }
     }
     
-    ArrayList<Text> endRows = new ArrayList<Text>(tablets.size());
+    ArrayList<Text> endRows = new ArrayList<Text>(tabletLocations.size());
     
-    for (KeyExtent ke : tablets)
+    for (KeyExtent ke : tabletLocations.keySet())
       if (ke.getEndRow() != null)
         endRows.add(ke.getEndRow());
     
@@ -1039,7 +1036,7 @@ public class TableOperationsImpl extends
     
     Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new HashMap<String,Map<KeyExtent,List<Range>>>();
     String tableId = Tables.getTableId(instance, tableName);
-    TabletLocator tl = TabletLocator.getInstance(instance, new Text(tableId));
+    TabletLocator tl = TabletLocator.getLocator(instance, new Text(tableId));
     // its possible that the cache could contain complete, but old information about a tables tablets... so clear it
     tl.invalidateCache();
     while (!tl.binRanges(Collections.singletonList(range), binnedRanges, credentials).isEmpty()) {
@@ -1181,7 +1178,7 @@ public class TableOperationsImpl extends
   @Override
   public void clearLocatorCache(String tableName) throws TableNotFoundException {
     ArgumentChecker.notNull(tableName);
-    TabletLocator tabLocator = TabletLocator.getInstance(instance, new Text(Tables.getTableId(instance, tableName)));
+    TabletLocator tabLocator = TabletLocator.getLocator(instance, new Text(Tables.getTableId(instance, tableName)));
     tabLocator.invalidateCache();
   }
   

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java Wed Jul  3 18:32:51 2013
@@ -53,6 +53,9 @@ import org.apache.accumulo.core.iterator
 import org.apache.accumulo.core.iterators.system.MultiIterator;
 import org.apache.accumulo.core.iterators.system.VisibilityFilter;
 import org.apache.accumulo.core.master.state.tables.TableState;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.security.ColumnVisibility;
 import org.apache.accumulo.core.security.CredentialHelper;
@@ -60,7 +63,6 @@ import org.apache.accumulo.core.security
 import org.apache.accumulo.core.util.ArgumentChecker;
 import org.apache.accumulo.core.util.CachedConfiguration;
 import org.apache.accumulo.core.util.LocalityGroupUtil;
-import org.apache.accumulo.core.util.MetadataTable;
 import org.apache.accumulo.core.util.Pair;
 import org.apache.accumulo.core.util.UtilWaitThread;
 import org.apache.commons.lang.NotImplementedException;
@@ -230,7 +232,7 @@ class OfflineIterator implements Iterato
     
     if (currentExtent != null && !extent.isPreviousExtent(currentExtent))
       throw new AccumuloException(" " + currentExtent + " is not previous extent " + extent);
-
+    
     String tablesDir = instance.getConfiguration().get(Property.INSTANCE_DFS_DIR) + "/tables";
     String[] volumes = instance.getConfiguration().get(Property.INSTANCE_VOLUMES).split(",");
     if (volumes.length > 1) {
@@ -271,16 +273,16 @@ class OfflineIterator implements Iterato
       Entry<Key,Value> entry = row.next();
       Key key = entry.getKey();
       
-      if (key.getColumnFamily().equals(MetadataTable.DATAFILE_COLUMN_FAMILY)) {
+      if (key.getColumnFamily().equals(DataFileColumnFamily.NAME)) {
         relFiles.add(key.getColumnQualifier().toString());
       }
       
-      if (key.getColumnFamily().equals(MetadataTable.CURRENT_LOCATION_COLUMN_FAMILY)
-          || key.getColumnFamily().equals(MetadataTable.FUTURE_LOCATION_COLUMN_FAMILY)) {
+      if (key.getColumnFamily().equals(TabletsSection.CurrentLocationColumnFamily.NAME)
+          || key.getColumnFamily().equals(TabletsSection.FutureLocationColumnFamily.NAME)) {
         location = entry.getValue().toString();
       }
       
-      if (MetadataTable.PREV_ROW_COLUMN.hasColumns(key)) {
+      if (TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.hasColumns(key)) {
         extent = new KeyExtent(key.getRow(), entry.getValue());
       }
       

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/RootTabletLocator.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/RootTabletLocator.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/RootTabletLocator.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/RootTabletLocator.java Wed Jul  3 18:32:51 2013
@@ -28,8 +28,8 @@ import org.apache.accumulo.core.client.T
 import org.apache.accumulo.core.data.KeyExtent;
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.Range;
+import org.apache.accumulo.core.metadata.RootTable;
 import org.apache.accumulo.core.security.thrift.TCredentials;
-import org.apache.accumulo.core.util.RootTable;
 import org.apache.accumulo.core.util.UtilWaitThread;
 import org.apache.hadoop.io.Text;
 

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerOptions.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerOptions.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerOptions.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerOptions.java Wed Jul  3 18:32:51 2013
@@ -46,7 +46,7 @@ public class ScannerOptions implements S
   protected SortedSet<Column> fetchedColumns = new TreeSet<Column>();
   
   protected long timeOut = Long.MAX_VALUE;
-
+  
   private String regexIterName = null;
   
   protected ScannerOptions() {}
@@ -102,7 +102,7 @@ public class ScannerOptions implements S
     
     serverSideIteratorOptions.remove(iteratorName);
   }
-    
+  
   /**
    * Override any existing options on the given named iterator
    */
@@ -190,7 +190,7 @@ public class ScannerOptions implements S
     if (timeOut < 0) {
       throw new IllegalArgumentException("TimeOut must be positive : " + timeOut);
     }
-
+    
     if (timeout == 0)
       this.timeOut = Long.MAX_VALUE;
     else
@@ -201,7 +201,7 @@ public class ScannerOptions implements S
   public long getTimeout(TimeUnit timeunit) {
     return timeunit.convert(timeOut, TimeUnit.MILLISECONDS);
   }
-
+  
   @Override
   public void close() {
     // Nothing needs to be closed

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java Wed Jul  3 18:32:51 2013
@@ -31,10 +31,11 @@ import org.apache.accumulo.core.client.T
 import org.apache.accumulo.core.data.KeyExtent;
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.Range;
+import org.apache.accumulo.core.metadata.MetadataLocationObtainer;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.metadata.RootTable;
 import org.apache.accumulo.core.security.thrift.TCredentials;
 import org.apache.accumulo.core.util.ArgumentChecker;
-import org.apache.accumulo.core.util.MetadataTable;
-import org.apache.accumulo.core.util.RootTable;
 import org.apache.hadoop.io.Text;
 
 public abstract class TabletLocator {
@@ -91,7 +92,7 @@ public abstract class TabletLocator {
   
   private static HashMap<LocatorKey,TabletLocator> locators = new HashMap<LocatorKey,TabletLocator>();
   
-  public static synchronized TabletLocator getInstance(Instance instance, Text tableId) {
+  public static synchronized TabletLocator getLocator(Instance instance, Text tableId) {
     
     LocatorKey key = new LocatorKey(instance.getInstanceID(), tableId);
     TabletLocator tl = locators.get(key);
@@ -101,9 +102,9 @@ public abstract class TabletLocator {
       if (tableId.toString().equals(RootTable.ID)) {
         tl = new RootTabletLocator(instance);
       } else if (tableId.toString().equals(MetadataTable.ID)) {
-        tl = new TabletLocatorImpl(new Text(MetadataTable.ID), getInstance(instance, new Text(RootTable.ID)), mlo);
+        tl = new TabletLocatorImpl(new Text(MetadataTable.ID), getLocator(instance, new Text(RootTable.ID)), mlo);
       } else {
-        tl = new TabletLocatorImpl(tableId, getInstance(instance, new Text(MetadataTable.ID)), mlo);
+        tl = new TabletLocatorImpl(tableId, getLocator(instance, new Text(MetadataTable.ID)), mlo);
       }
       locators.put(key, tl);
     }

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocatorImpl.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocatorImpl.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocatorImpl.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocatorImpl.java Wed Jul  3 18:32:51 2013
@@ -399,7 +399,7 @@ public class TabletLocatorImpl extends T
     
     if (ptl != null) {
       TabletLocations locations = locationObtainer.lookupTablet(ptl, metadataRow, lastTabletRow, parent, credentials);
-      while (locations != null && locations.getLocations().isEmpty() && locations.getLocationless().isEmpty() && !ptl.tablet_extent.isRootTablet()) {
+      while (locations != null && locations.getLocations().isEmpty() && locations.getLocationless().isEmpty()) {
         // try the next tablet, the current tablet does not have any tablets that overlap the row
         Text er = ptl.tablet_extent.getEndRow();
         if (er != null && er.compareTo(lastTabletRow) < 0) {

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java Wed Jul  3 18:32:51 2013
@@ -144,7 +144,7 @@ public class TabletServerBatchReaderIter
     this.options = new ScannerOptions(scannerOptions);
     resultsQueue = new ArrayBlockingQueue<List<Entry<Key,Value>>>(numThreads);
     
-    this.locator = new TimeoutTabletLocator(TabletLocator.getInstance(instance, new Text(table)), timeout);
+    this.locator = new TimeoutTabletLocator(TabletLocator.getLocator(instance, new Text(table)), timeout);
     
     timeoutTrackers = Collections.synchronizedMap(new HashMap<String,TabletServerBatchReaderIterator.TimeoutTracker>());
     timedoutServers = Collections.synchronizedSet(new HashSet<String>());
@@ -604,7 +604,7 @@ public class TabletServerBatchReaderIter
     }
   }
   
-  static void doLookup(String server, Map<KeyExtent,List<Range>> requested, Map<KeyExtent,List<Range>> failures, Map<KeyExtent,List<Range>> unscanned,
+  public static void doLookup(String server, Map<KeyExtent,List<Range>> requested, Map<KeyExtent,List<Range>> failures, Map<KeyExtent,List<Range>> unscanned,
       ResultReceiver receiver, List<Column> columns, TCredentials credentials, ScannerOptions options, Authorizations authorizations, AccumuloConfiguration conf)
       throws IOException, AccumuloSecurityException, AccumuloServerException {
     doLookup(server, requested, failures, unscanned, receiver, columns, credentials, options, authorizations, conf, new TimeoutTracker(Long.MAX_VALUE));

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java Wed Jul  3 18:32:51 2013
@@ -55,12 +55,12 @@ import org.apache.accumulo.core.data.Mut
 import org.apache.accumulo.core.data.thrift.TMutation;
 import org.apache.accumulo.core.data.thrift.UpdateErrors;
 import org.apache.accumulo.core.master.state.tables.TableState;
+import org.apache.accumulo.core.metadata.MetadataTable;
 import org.apache.accumulo.core.security.thrift.TCredentials;
 import org.apache.accumulo.core.tabletserver.thrift.ConstraintViolationException;
 import org.apache.accumulo.core.tabletserver.thrift.NoSuchScanIDException;
 import org.apache.accumulo.core.tabletserver.thrift.NotServingTabletException;
 import org.apache.accumulo.core.tabletserver.thrift.TabletClientService;
-import org.apache.accumulo.core.util.MetadataTable;
 import org.apache.accumulo.core.util.SimpleThreadPool;
 import org.apache.accumulo.core.util.ThriftUtil;
 import org.apache.accumulo.trace.instrument.Span;
@@ -631,7 +631,7 @@ public class TabletServerBatchWriter {
     private TabletLocator getLocator(String tableId) {
       TabletLocator ret = locators.get(tableId);
       if (ret == null) {
-        ret = TabletLocator.getInstance(instance, new Text(tableId));
+        ret = TabletLocator.getLocator(instance, new Text(tableId));
         ret = new TimeoutTabletLocator(ret, timeout);
         locators.put(tableId, ret);
       }
@@ -831,7 +831,7 @@ public class TabletServerBatchWriter {
             tables.add(ke.getTableId().toString());
           
           for (String table : tables)
-            TabletLocator.getInstance(instance, new Text(table)).invalidateCache(location);
+            TabletLocator.getLocator(instance, new Text(table)).invalidateCache(location);
           
           failedMutations.add(location, tsm);
         } finally {
@@ -868,7 +868,7 @@ public class TabletServerBatchWriter {
               client.update(tinfo, credentials, entry.getKey().toThrift(), entry.getValue().get(0).toThrift());
             } catch (NotServingTabletException e) {
               allFailures.addAll(entry.getKey().getTableId().toString(), entry.getValue());
-              TabletLocator.getInstance(instance, new Text(entry.getKey().getTableId())).invalidateCache(entry.getKey());
+              TabletLocator.getLocator(instance, new Text(entry.getKey().getTableId())).invalidateCache(entry.getKey());
             } catch (ConstraintViolationException e) {
               updatedConstraintViolations(Translator.translate(e.violationSummaries, Translator.TCVST));
             }
@@ -909,7 +909,7 @@ public class TabletServerBatchWriter {
               
               String table = failedExtent.getTableId().toString();
               
-              TabletLocator.getInstance(instance, new Text(table)).invalidateCache(failedExtent);
+              TabletLocator.getLocator(instance, new Text(table)).invalidateCache(failedExtent);
               
               ArrayList<Mutation> mutations = (ArrayList<Mutation>) tabMuts.get(failedExtent);
               allFailures.addAll(table, mutations.subList(numCommitted, mutations.size()));

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java Wed Jul  3 18:32:51 2013
@@ -66,8 +66,6 @@ import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
 import org.apache.thrift.TApplicationException;
 import org.apache.thrift.TException;
-import org.apache.thrift.TServiceClient;
-
 
 public class ThriftScanner {
   private static final Logger log = Logger.getLogger(ThriftScanner.class);
@@ -80,7 +78,7 @@ public class ThriftScanner {
     }
   }
   
-  static boolean getBatchFromServer(TCredentials credentials, Range range, KeyExtent extent, String server, SortedMap<Key,Value> results,
+  public static boolean getBatchFromServer(TCredentials credentials, Range range, KeyExtent extent, String server, SortedMap<Key,Value> results,
       SortedSet<Column> fetchedColumns, List<IterInfo> serverSideIteratorList, Map<String,Map<String,String>> serverSideIteratorOptions, int size,
       Authorizations authorizations, boolean retry, AccumuloConfiguration conf) throws AccumuloException, AccumuloSecurityException, NotServingTabletException {
     if (server == null)
@@ -111,7 +109,7 @@ public class ThriftScanner {
         
         return isr.result.more;
       } finally {
-        ThriftUtil.returnClient((TServiceClient) client);
+        ThriftUtil.returnClient(client);
       }
     } catch (TApplicationException tae) {
       throw new AccumuloServerException(server, tae);
@@ -122,7 +120,7 @@ public class ThriftScanner {
       throw new AccumuloSecurityException(e.user, e.code, e);
     } catch (TException e) {
       log.debug("Error getting transport to " + server + " : " + e);
-    } 
+    }
     
     throw new AccumuloException("getBatchFromServer: failed");
   }
@@ -213,8 +211,8 @@ public class ThriftScanner {
           
           Span locateSpan = Trace.start("scan:locateTablet");
           try {
-            loc = TabletLocator.getInstance(instance, scanState.tableId).locateTablet(scanState.startRow, scanState.skipStartRow, false, credentials);
-
+            loc = TabletLocator.getLocator(instance, scanState.tableId).locateTablet(scanState.startRow, scanState.skipStartRow, false, credentials);
+            
             if (loc == null) {
               if (!Tables.exists(instance, scanState.tableId.toString()))
                 throw new TableDeletedException(scanState.tableId.toString());
@@ -281,7 +279,7 @@ public class ThriftScanner {
             log.trace(error);
           lastError = error;
           
-          TabletLocator.getInstance(instance, scanState.tableId).invalidateCache(loc.tablet_extent);
+          TabletLocator.getLocator(instance, scanState.tableId).invalidateCache(loc.tablet_extent);
           loc = null;
           
           // no need to try the current scan id somewhere else
@@ -327,7 +325,7 @@ public class ThriftScanner {
           
           UtilWaitThread.sleep(100);
         } catch (TException e) {
-          TabletLocator.getInstance(instance, scanState.tableId).invalidateCache(loc.tablet_location);
+          TabletLocator.getLocator(instance, scanState.tableId).invalidateCache(loc.tablet_location);
           error = "Scan failed, thrift error " + e.getClass().getName() + "  " + e.getMessage() + " " + loc;
           if (!error.equals(lastError))
             log.debug(error);
@@ -443,7 +441,7 @@ public class ThriftScanner {
     } catch (ThriftSecurityException e) {
       throw new AccumuloSecurityException(e.user, e.code, e);
     } finally {
-      ThriftUtil.returnClient((TServiceClient) client);
+      ThriftUtil.returnClient(client);
       Thread.currentThread().setName(old);
     }
   }

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/Writer.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/Writer.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/Writer.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/Writer.java Wed Jul  3 18:32:51 2013
@@ -84,7 +84,7 @@ public class Writer {
       throw new IllegalArgumentException("Can not add empty mutations");
     
     while (true) {
-      TabletLocation tabLoc = TabletLocator.getInstance(instance, table).locateTablet(new Text(m.getRow()), false, true, credentials);
+      TabletLocation tabLoc = TabletLocator.getLocator(instance, table).locateTablet(new Text(m.getRow()), false, true, credentials);
       
       if (tabLoc == null) {
         log.trace("No tablet location found for row " + new String(m.getRow()));
@@ -97,10 +97,10 @@ public class Writer {
         return;
       } catch (NotServingTabletException e) {
         log.trace("Not serving tablet, server = " + tabLoc.tablet_location);
-        TabletLocator.getInstance(instance, table).invalidateCache(tabLoc.tablet_extent);
+        TabletLocator.getLocator(instance, table).invalidateCache(tabLoc.tablet_extent);
       } catch (TException e) {
         log.error("error sending update to " + tabLoc.tablet_location + ": " + e);
-        TabletLocator.getInstance(instance, table).invalidateCache(tabLoc.tablet_extent);
+        TabletLocator.getLocator(instance, table).invalidateCache(tabLoc.tablet_extent);
       } 
       
       UtilWaitThread.sleep(500);

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapred/InputFormatBase.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapred/InputFormatBase.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapred/InputFormatBase.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapred/InputFormatBase.java Wed Jul  3 18:32:51 2013
@@ -53,10 +53,11 @@ import org.apache.accumulo.core.data.Par
 import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.master.state.tables.TableState;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.security.CredentialHelper;
 import org.apache.accumulo.core.security.thrift.TCredentials;
-import org.apache.accumulo.core.util.MetadataTable;
 import org.apache.accumulo.core.util.Pair;
 import org.apache.accumulo.core.util.UtilWaitThread;
 import org.apache.hadoop.io.Text;
@@ -687,10 +688,10 @@ public abstract class InputFormatBase<K,
       
       Range metadataRange = new Range(new KeyExtent(new Text(tableId), startRow, null).getMetadataEntry(), true, null, false);
       Scanner scanner = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-      MetadataTable.PREV_ROW_COLUMN.fetch(scanner);
-      scanner.fetchColumnFamily(MetadataTable.LAST_LOCATION_COLUMN_FAMILY);
-      scanner.fetchColumnFamily(MetadataTable.CURRENT_LOCATION_COLUMN_FAMILY);
-      scanner.fetchColumnFamily(MetadataTable.FUTURE_LOCATION_COLUMN_FAMILY);
+      TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.fetch(scanner);
+      scanner.fetchColumnFamily(TabletsSection.LastLocationColumnFamily.NAME);
+      scanner.fetchColumnFamily(TabletsSection.CurrentLocationColumnFamily.NAME);
+      scanner.fetchColumnFamily(TabletsSection.FutureLocationColumnFamily.NAME);
       scanner.setRange(metadataRange);
       
       RowIterator rowIter = new RowIterator(scanner);
@@ -707,16 +708,16 @@ public abstract class InputFormatBase<K,
           Entry<Key,Value> entry = row.next();
           Key key = entry.getKey();
           
-          if (key.getColumnFamily().equals(MetadataTable.LAST_LOCATION_COLUMN_FAMILY)) {
+          if (key.getColumnFamily().equals(TabletsSection.LastLocationColumnFamily.NAME)) {
             last = entry.getValue().toString();
           }
           
-          if (key.getColumnFamily().equals(MetadataTable.CURRENT_LOCATION_COLUMN_FAMILY)
-              || key.getColumnFamily().equals(MetadataTable.FUTURE_LOCATION_COLUMN_FAMILY)) {
+          if (key.getColumnFamily().equals(TabletsSection.CurrentLocationColumnFamily.NAME)
+              || key.getColumnFamily().equals(TabletsSection.FutureLocationColumnFamily.NAME)) {
             location = entry.getValue().toString();
           }
           
-          if (MetadataTable.PREV_ROW_COLUMN.hasColumns(key)) {
+          if (TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.hasColumns(key)) {
             extent = new KeyExtent(key.getRow(), entry.getValue());
           }
           

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputFormatBase.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputFormatBase.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputFormatBase.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/InputFormatBase.java Wed Jul  3 18:32:51 2013
@@ -64,10 +64,11 @@ import org.apache.accumulo.core.data.Ran
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.iterators.user.VersioningIterator;
 import org.apache.accumulo.core.master.state.tables.TableState;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.security.CredentialHelper;
 import org.apache.accumulo.core.security.thrift.TCredentials;
-import org.apache.accumulo.core.util.MetadataTable;
 import org.apache.accumulo.core.util.Pair;
 import org.apache.accumulo.core.util.UtilWaitThread;
 import org.apache.hadoop.conf.Configuration;
@@ -711,10 +712,10 @@ public abstract class InputFormatBase<K,
       
       Range metadataRange = new Range(new KeyExtent(new Text(tableId), startRow, null).getMetadataEntry(), true, null, false);
       Scanner scanner = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-      MetadataTable.PREV_ROW_COLUMN.fetch(scanner);
-      scanner.fetchColumnFamily(MetadataTable.LAST_LOCATION_COLUMN_FAMILY);
-      scanner.fetchColumnFamily(MetadataTable.CURRENT_LOCATION_COLUMN_FAMILY);
-      scanner.fetchColumnFamily(MetadataTable.FUTURE_LOCATION_COLUMN_FAMILY);
+      TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.fetch(scanner);
+      scanner.fetchColumnFamily(TabletsSection.LastLocationColumnFamily.NAME);
+      scanner.fetchColumnFamily(TabletsSection.CurrentLocationColumnFamily.NAME);
+      scanner.fetchColumnFamily(TabletsSection.FutureLocationColumnFamily.NAME);
       scanner.setRange(metadataRange);
       
       RowIterator rowIter = new RowIterator(scanner);
@@ -731,16 +732,16 @@ public abstract class InputFormatBase<K,
           Entry<Key,Value> entry = row.next();
           Key key = entry.getKey();
           
-          if (key.getColumnFamily().equals(MetadataTable.LAST_LOCATION_COLUMN_FAMILY)) {
+          if (key.getColumnFamily().equals(TabletsSection.LastLocationColumnFamily.NAME)) {
             last = entry.getValue().toString();
           }
           
-          if (key.getColumnFamily().equals(MetadataTable.CURRENT_LOCATION_COLUMN_FAMILY)
-              || key.getColumnFamily().equals(MetadataTable.FUTURE_LOCATION_COLUMN_FAMILY)) {
+          if (key.getColumnFamily().equals(TabletsSection.CurrentLocationColumnFamily.NAME)
+              || key.getColumnFamily().equals(TabletsSection.FutureLocationColumnFamily.NAME)) {
             location = entry.getValue().toString();
           }
           
-          if (MetadataTable.PREV_ROW_COLUMN.hasColumns(key)) {
+          if (TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.hasColumns(key)) {
             extent = new KeyExtent(key.getRow(), entry.getValue());
           }
           

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/util/InputConfigurator.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/util/InputConfigurator.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/util/InputConfigurator.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/util/InputConfigurator.java Wed Jul  3 18:32:51 2013
@@ -480,7 +480,7 @@ public class InputConfigurator extends C
       return new MockTabletLocator();
     Instance instance = getInstance(implementingClass, conf);
     String tableName = getInputTableName(implementingClass, conf);
-    return TabletLocator.getInstance(instance, new Text(Tables.getTableId(instance, tableName)));
+    return TabletLocator.getLocator(instance, new Text(Tables.getTableId(instance, tableName)));
   }
   
   // InputFormat doesn't have the equivalent of OutputFormat's checkOutputSpecs(JobContext job)

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockAccumulo.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockAccumulo.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockAccumulo.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockAccumulo.java Wed Jul  3 18:32:51 2013
@@ -26,11 +26,11 @@ import org.apache.accumulo.core.client.B
 import org.apache.accumulo.core.client.admin.TimeType;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.data.Mutation;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.metadata.RootTable;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.security.SystemPermission;
 import org.apache.accumulo.core.security.TablePermission;
-import org.apache.accumulo.core.util.MetadataTable;
-import org.apache.accumulo.core.util.RootTable;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.io.Text;
 

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java Wed Jul  3 18:32:51 2013
@@ -46,6 +46,8 @@ import org.apache.accumulo.core.data.Ran
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.file.FileOperations;
 import org.apache.accumulo.core.file.FileSKVIterator;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.metadata.RootTable;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.security.ColumnVisibility;
 import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader;
@@ -122,7 +124,7 @@ public class MockTableOperations extends
       throw new TableNotFoundException(tableName, tableName, "");
     return acu.getSplits(tableName);
   }
-
+  
   @Override
   public Collection<Text> listSplits(String tableName, int maxSplits) throws TableNotFoundException {
     return listSplits(tableName);
@@ -297,20 +299,25 @@ public class MockTableOperations extends
   public Map<String,String> tableIdMap() {
     Map<String,String> result = new HashMap<String,String>();
     for (String table : acu.tables.keySet()) {
-      result.put(table, table);
+      if (RootTable.NAME.equals(table))
+        result.put(table, RootTable.ID);
+      else if (MetadataTable.NAME.equals(table))
+        result.put(table, MetadataTable.ID);
+      else
+        result.put(table, table);
     }
     return result;
   }
-
+  
   @Override
   public List<DiskUsage> getDiskUsage(Set<String> tables) throws AccumuloException, AccumuloSecurityException {
-
+    
     List<DiskUsage> diskUsages = new ArrayList<DiskUsage>();
     diskUsages.add(new DiskUsage(new TreeSet<String>(tables), 0l));
-
+    
     return diskUsages;
   }
-
+  
   @Override
   public void merge(String tableName, Text start, Text end) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
     if (!exists(tableName))

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/data/KeyExtent.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/data/KeyExtent.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/data/KeyExtent.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/data/KeyExtent.java Wed Jul  3 18:32:51 2013
@@ -40,9 +40,11 @@ import java.util.UUID;
 import java.util.WeakHashMap;
 
 import org.apache.accumulo.core.data.thrift.TKeyExtent;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.metadata.RootTable;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
 import org.apache.accumulo.core.util.ByteBufferUtil;
-import org.apache.accumulo.core.util.MetadataTable;
-import org.apache.accumulo.core.util.RootTable;
 import org.apache.accumulo.core.util.TextUtil;
 import org.apache.hadoop.io.BinaryComparable;
 import org.apache.hadoop.io.Text;
@@ -128,18 +130,8 @@ public class KeyExtent implements Writab
     return getMetadataEntry(getTableId(), getEndRow());
   }
   
-  public static Text getMetadataEntry(Text table, Text row) {
-    Text entry = new Text(table);
-    
-    if (row == null) {
-      entry.append(new byte[] {'<'}, 0, 1);
-    } else {
-      entry.append(new byte[] {';'}, 0, 1);
-      entry.append(row.getBytes(), 0, row.getLength());
-    }
-    
-    return entry;
-    
+  public static Text getMetadataEntry(Text tableId, Text endRow) {
+    return MetadataSchema.TabletsSection.getRow(tableId, endRow);
   }
   
   // constructor for loading extents from metadata rows
@@ -398,7 +390,7 @@ public class KeyExtent implements Writab
   
   public static Mutation getPrevRowUpdateMutation(KeyExtent ke) {
     Mutation m = new Mutation(ke.getMetadataEntry());
-    MetadataTable.PREV_ROW_COLUMN.put(m, encodePrevEndRow(ke.getPrevEndRow()));
+    TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.put(m, encodePrevEndRow(ke.getPrevEndRow()));
     return m;
   }
   

Copied: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/MetadataLocationObtainer.java (from r1498548, accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/MetadataLocationObtainer.java)
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/MetadataLocationObtainer.java?p2=accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/MetadataLocationObtainer.java&p1=accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/MetadataLocationObtainer.java&r1=1498548&r2=1499510&rev=1499510&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/MetadataLocationObtainer.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/MetadataLocationObtainer.java Wed Jul  3 18:32:51 2013
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.accumulo.core.client.impl;
+package org.apache.accumulo.core.metadata;
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -32,10 +32,15 @@ import org.apache.accumulo.core.Constant
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.Instance;
+import org.apache.accumulo.core.client.impl.AccumuloServerException;
+import org.apache.accumulo.core.client.impl.ScannerOptions;
+import org.apache.accumulo.core.client.impl.TabletLocator;
 import org.apache.accumulo.core.client.impl.TabletLocator.TabletLocation;
 import org.apache.accumulo.core.client.impl.TabletLocator.TabletLocations;
 import org.apache.accumulo.core.client.impl.TabletLocatorImpl.TabletLocationObtainer;
+import org.apache.accumulo.core.client.impl.TabletServerBatchReaderIterator;
 import org.apache.accumulo.core.client.impl.TabletServerBatchReaderIterator.ResultReceiver;
+import org.apache.accumulo.core.client.impl.ThriftScanner;
 import org.apache.accumulo.core.data.Column;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.KeyExtent;
@@ -44,10 +49,10 @@ import org.apache.accumulo.core.data.Ran
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.data.thrift.IterInfo;
 import org.apache.accumulo.core.iterators.user.WholeRowIterator;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.security.thrift.TCredentials;
 import org.apache.accumulo.core.tabletserver.thrift.NotServingTabletException;
-import org.apache.accumulo.core.util.MetadataTable;
 import org.apache.accumulo.core.util.OpTimer;
 import org.apache.accumulo.core.util.Pair;
 import org.apache.accumulo.core.util.TextUtil;
@@ -61,13 +66,13 @@ public class MetadataLocationObtainer im
   private ArrayList<Column> columns;
   private Instance instance;
   
-  MetadataLocationObtainer(Instance instance) {
+  public MetadataLocationObtainer(Instance instance) {
     
     this.instance = instance;
     
     locCols = new TreeSet<Column>();
-    locCols.add(new Column(TextUtil.getBytes(MetadataTable.CURRENT_LOCATION_COLUMN_FAMILY), null, null));
-    locCols.add(MetadataTable.PREV_ROW_COLUMN.toColumn());
+    locCols.add(new Column(TextUtil.getBytes(TabletsSection.CurrentLocationColumnFamily.NAME), null, null));
+    locCols.add(TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.toColumn());
     columns = new ArrayList<Column>(locCols);
   }
   
@@ -113,7 +118,7 @@ public class MetadataLocationObtainer im
       
       // System.out.println("results "+results.keySet());
       
-      Pair<SortedMap<KeyExtent,Text>,List<KeyExtent>> metadata = MetadataTable.getMetadataLocationEntries(results);
+      Pair<SortedMap<KeyExtent,Text>,List<KeyExtent>> metadata = MetadataLocationObtainer.getMetadataLocationEntries(results);
       
       for (Entry<KeyExtent,Text> entry : metadata.getFirst().entrySet()) {
         list.add(new TabletLocation(entry.getKey(), entry.getValue().toString()));
@@ -170,11 +175,15 @@ public class MetadataLocationObtainer im
       }
     };
     
-    ScannerOptions opts = new ScannerOptions();
-    opts.fetchedColumns = locCols;
-    opts.serverSideIteratorList = new ArrayList<IterInfo>();
-    opts.serverSideIteratorList.add(new IterInfo(10000, WholeRowIterator.class.getName(), "WRI")); // see comment in lookupTablet about why iterator is
-                                                                                                   // used
+    ScannerOptions opts = new ScannerOptions() {
+      ScannerOptions setOpts() {
+        this.fetchedColumns = locCols;
+        this.serverSideIteratorList = new ArrayList<IterInfo>();
+        // see comment in lookupTablet about why iterator is used
+        this.serverSideIteratorList.add(new IterInfo(10000, WholeRowIterator.class.getName(), "WRI"));
+        return this;
+      }
+    }.setOpts();
     
     Map<KeyExtent,List<Range>> unscanned = new HashMap<KeyExtent,List<Range>>();
     Map<KeyExtent,List<Range>> failures = new HashMap<KeyExtent,List<Range>>();
@@ -195,7 +204,7 @@ public class MetadataLocationObtainer im
       throw e;
     }
     
-    SortedMap<KeyExtent,Text> metadata = MetadataTable.getMetadataLocationEntries(results).getFirst();
+    SortedMap<KeyExtent,Text> metadata = MetadataLocationObtainer.getMetadataLocationEntries(results).getFirst();
     
     for (Entry<KeyExtent,Text> entry : metadata.entrySet()) {
       list.add(new TabletLocation(entry.getKey(), entry.getValue().toString()));
@@ -203,4 +212,58 @@ public class MetadataLocationObtainer im
     
     return list;
   }
+  
+  public static Pair<SortedMap<KeyExtent,Text>,List<KeyExtent>> getMetadataLocationEntries(SortedMap<Key,Value> entries) {
+    Key key;
+    Value val;
+    Text location = null;
+    Value prevRow = null;
+    KeyExtent ke;
+    
+    SortedMap<KeyExtent,Text> results = new TreeMap<KeyExtent,Text>();
+    ArrayList<KeyExtent> locationless = new ArrayList<KeyExtent>();
+    
+    Text lastRowFromKey = new Text();
+    
+    // text obj below is meant to be reused in loop for efficiency
+    Text colf = new Text();
+    Text colq = new Text();
+    
+    for (Entry<Key,Value> entry : entries.entrySet()) {
+      key = entry.getKey();
+      val = entry.getValue();
+      
+      if (key.compareRow(lastRowFromKey) != 0) {
+        prevRow = null;
+        location = null;
+        key.getRow(lastRowFromKey);
+      }
+      
+      colf = key.getColumnFamily(colf);
+      colq = key.getColumnQualifier(colq);
+      
+      // interpret the row id as a key extent
+      if (colf.equals(TabletsSection.CurrentLocationColumnFamily.NAME) || colf.equals(TabletsSection.FutureLocationColumnFamily.NAME)) {
+        if (location != null) {
+          throw new IllegalStateException("Tablet has multiple locations : " + lastRowFromKey);
+        }
+        location = new Text(val.toString());
+      } else if (TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.equals(colf, colq)) {
+        prevRow = new Value(val);
+      }
+      
+      if (prevRow != null) {
+        ke = new KeyExtent(key.getRow(), prevRow);
+        if (location != null)
+          results.put(ke, location);
+        else
+          locationless.add(ke);
+        
+        location = null;
+        prevRow = null;
+      }
+    }
+    
+    return new Pair<SortedMap<KeyExtent,Text>,List<KeyExtent>>(results, locationless);
+  }
 }

Added: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/MetadataServicer.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/MetadataServicer.java?rev=1499510&view=auto
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/MetadataServicer.java (added)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/MetadataServicer.java Wed Jul  3 18:32:51 2013
@@ -0,0 +1,67 @@
+/*
+ * 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.core.metadata;
+
+import java.util.SortedMap;
+
+import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.AccumuloSecurityException;
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.Instance;
+import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.data.KeyExtent;
+import org.apache.accumulo.core.security.CredentialHelper;
+import org.apache.accumulo.core.security.thrift.TCredentials;
+import org.apache.accumulo.core.util.ArgumentChecker;
+
+/**
+ * Provides a consolidated API for handling table metadata
+ */
+public abstract class MetadataServicer {
+  
+  public static MetadataServicer forTableName(Instance instance, TCredentials credentials, String tableName) throws AccumuloException,
+      AccumuloSecurityException {
+    ArgumentChecker.notNull(tableName);
+    Connector conn = instance.getConnector(credentials.getPrincipal(), CredentialHelper.extractToken(credentials));
+    return forTableId(instance, credentials, conn.tableOperations().tableIdMap().get(tableName));
+  }
+  
+  public static MetadataServicer forTableId(Instance instance, TCredentials credentials, String tableId) {
+    ArgumentChecker.notNull(tableId);
+    if (RootTable.ID.equals(tableId))
+      return new ServicerForRootTable(instance, credentials);
+    else if (MetadataTable.ID.equals(tableId))
+      return new ServicerForMetadataTable(instance, credentials);
+    else
+      return new ServicerForUserTables(instance, credentials, tableId);
+  }
+  
+  /**
+   * 
+   * @return the table id of the table currently being serviced
+   */
+  public abstract String getServicedTableId();
+  
+  /**
+   * Populate the provided data structure with the known tablets for the table being serviced
+   * 
+   * @param tablets
+   *          A mapping of all known tablets to their location (if available, null otherwise)
+   */
+  public abstract void getTabletLocations(SortedMap<KeyExtent,String> tablets) throws AccumuloException, AccumuloSecurityException, TableNotFoundException;
+  
+}

Propchange: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/MetadataServicer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/MetadataTable.java (from r1497021, accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/MetadataTable.java)
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/MetadataTable.java?p2=accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/MetadataTable.java&p1=accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/MetadataTable.java&r1=1497021&r2=1499510&rev=1499510&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/MetadataTable.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/MetadataTable.java Wed Jul  3 18:32:51 2013
@@ -14,387 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.accumulo.core.util;
+package org.apache.accumulo.core.metadata;
 
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.SortedMap;
-import java.util.SortedSet;
-import java.util.TreeMap;
-
-import org.apache.accumulo.core.client.AccumuloException;
-import org.apache.accumulo.core.client.AccumuloSecurityException;
-import org.apache.accumulo.core.client.Instance;
-import org.apache.accumulo.core.client.Scanner;
-import org.apache.accumulo.core.client.TableNotFoundException;
-import org.apache.accumulo.core.client.impl.Tables;
-import org.apache.accumulo.core.data.Key;
-import org.apache.accumulo.core.data.KeyExtent;
-import org.apache.accumulo.core.data.PartialKey;
-import org.apache.accumulo.core.data.Range;
-import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.security.CredentialHelper;
-import org.apache.accumulo.core.security.thrift.TCredentials;
-import org.apache.hadoop.io.Text;
 
 public class MetadataTable {
   
   public static final String ID = "!0";
   public static final String NAME = "!METADATA";
   
-  /**
-   * Initial tablet directory name
-   */
-  public static final String TABLE_TABLET_LOCATION = "/table_info";
-  
-  /**
-   * Reserved keyspace is any row that begins with a tilde '~' character
-   */
-  public static final Key RESERVED_RANGE_START_KEY = new Key(new Text(new byte[] {'~'}));
-  public static final Range NON_ROOT_KEYSPACE = new Range(null, false, RESERVED_RANGE_START_KEY, false);
-  public static final Range KEYSPACE = new Range(new Key(new Text(ID)), true, RESERVED_RANGE_START_KEY, false);
-  public static final Range DELETED_RANGE = new Range(new Key(new Text("~del")), true, new Key(new Text("~dem")), false);
-  public static final String BLIP_FLAG_PREFIX = "~blip"; // BLIP = bulk load in progress
-  public static final Range BLIP_KEYSPACE = new Range(new Key(new Text(BLIP_FLAG_PREFIX)), true, new Key(new Text("~bliq")), false);
-  
-  public static final Text CURRENT_LOCATION_COLUMN_FAMILY = new Text("loc");
-  public static final Text FUTURE_LOCATION_COLUMN_FAMILY = new Text("future");
-  public static final Text LAST_LOCATION_COLUMN_FAMILY = new Text("last");
-  /**
-   * Temporary marker that indicates a tablet loaded a bulk file
-   */
-  public static final Text BULKFILE_COLUMN_FAMILY = new Text("loaded");
-  
-  /**
-   * Temporary marker that indicates a tablet was successfully cloned
-   */
-  public static final Text CLONED_COLUMN_FAMILY = new Text("!cloned");
-  
-  /**
-   * This needs to sort after all other column families for that tablet, because the {@link #PREV_ROW_COLUMN} sits in this and that needs to sort last because
-   * the {@link SimpleGarbageCollector} relies on this.
-   */
-  public static final Text TABLET_COLUMN_FAMILY = new Text("~tab");
-  
-  /**
-   * README : very important that prevRow sort last to avoid race conditions between garbage collector and split this needs to sort after everything else for
-   * that tablet
-   */
-  public static final ColumnFQ PREV_ROW_COLUMN = new ColumnFQ(TABLET_COLUMN_FAMILY, new Text("~pr"));
-  public static final ColumnFQ OLD_PREV_ROW_COLUMN = new ColumnFQ(TABLET_COLUMN_FAMILY, new Text("oldprevrow"));
-  public static final ColumnFQ SPLIT_RATIO_COLUMN = new ColumnFQ(TABLET_COLUMN_FAMILY, new Text("splitRatio"));
-  
-  public static final Text SERVER_COLUMN_FAMILY = new Text("srv");
-  public static final ColumnFQ DIRECTORY_COLUMN = new ColumnFQ(SERVER_COLUMN_FAMILY, new Text("dir"));
-  public static final ColumnFQ TIME_COLUMN = new ColumnFQ(SERVER_COLUMN_FAMILY, new Text("time"));
-  public static final ColumnFQ FLUSH_COLUMN = new ColumnFQ(SERVER_COLUMN_FAMILY, new Text("flush"));
-  public static final ColumnFQ COMPACT_COLUMN = new ColumnFQ(SERVER_COLUMN_FAMILY, new Text("compact"));
-  public static final ColumnFQ LOCK_COLUMN = new ColumnFQ(SERVER_COLUMN_FAMILY, new Text("lock"));
-  
-  public static final Text DATAFILE_COLUMN_FAMILY = new Text("file");
-  public static final Text SCANFILE_COLUMN_FAMILY = new Text("scan");
-  public static final Text LOG_COLUMN_FAMILY = new Text("log");
-  public static final Text CHOPPED_COLUMN_FAMILY = new Text("chopped");
-  public static final ColumnFQ CHOPPED_COLUMN = new ColumnFQ(CHOPPED_COLUMN_FAMILY, new Text("chopped"));
-  
-  public static class DataFileValue {
-    private long size;
-    private long numEntries;
-    private long time = -1;
-    
-    public DataFileValue(long size, long numEntries, long time) {
-      this.size = size;
-      this.numEntries = numEntries;
-      this.time = time;
-    }
-    
-    public DataFileValue(long size, long numEntries) {
-      this.size = size;
-      this.numEntries = numEntries;
-      this.time = -1;
-    }
-    
-    public DataFileValue(byte[] encodedDFV) {
-      String[] ba = new String(encodedDFV).split(",");
-      
-      size = Long.parseLong(ba[0]);
-      numEntries = Long.parseLong(ba[1]);
-      
-      if (ba.length == 3)
-        time = Long.parseLong(ba[2]);
-      else
-        time = -1;
-    }
-    
-    public long getSize() {
-      return size;
-    }
-    
-    public long getNumEntries() {
-      return numEntries;
-    }
-    
-    public boolean isTimeSet() {
-      return time >= 0;
-    }
-    
-    public long getTime() {
-      return time;
-    }
-    
-    public byte[] encode() {
-      if (time >= 0)
-        return ("" + size + "," + numEntries + "," + time).getBytes();
-      return ("" + size + "," + numEntries).getBytes();
-    }
-    
-    @Override
-    public boolean equals(Object o) {
-      if (o instanceof DataFileValue) {
-        DataFileValue odfv = (DataFileValue) o;
-        
-        return size == odfv.size && numEntries == odfv.numEntries;
-      }
-      
-      return false;
-    }
-    
-    @Override
-    public int hashCode() {
-      return Long.valueOf(size + numEntries).hashCode();
-    }
-    
-    @Override
-    public String toString() {
-      return size + " " + numEntries;
-    }
-    
-    public void setTime(long time) {
-      if (time < 0)
-        throw new IllegalArgumentException();
-      this.time = time;
-    }
-  }
-  
-  public static Pair<SortedMap<KeyExtent,Text>,List<KeyExtent>> getMetadataLocationEntries(SortedMap<Key,Value> entries) {
-    Key key;
-    Value val;
-    Text location = null;
-    Value prevRow = null;
-    KeyExtent ke;
-    
-    SortedMap<KeyExtent,Text> results = new TreeMap<KeyExtent,Text>();
-    ArrayList<KeyExtent> locationless = new ArrayList<KeyExtent>();
-    
-    Text lastRowFromKey = new Text();
-    
-    // text obj below is meant to be reused in loop for efficiency
-    Text colf = new Text();
-    Text colq = new Text();
-    
-    for (Entry<Key,Value> entry : entries.entrySet()) {
-      key = entry.getKey();
-      val = entry.getValue();
-      
-      if (key.compareRow(lastRowFromKey) != 0) {
-        prevRow = null;
-        location = null;
-        key.getRow(lastRowFromKey);
-      }
-      
-      colf = key.getColumnFamily(colf);
-      colq = key.getColumnQualifier(colq);
-      
-      // interpret the row id as a key extent
-      if (colf.equals(CURRENT_LOCATION_COLUMN_FAMILY) || colf.equals(FUTURE_LOCATION_COLUMN_FAMILY)) {
-        if (location != null) {
-          throw new IllegalStateException("Tablet has multiple locations : " + lastRowFromKey);
-        }
-        location = new Text(val.toString());
-      } else if (PREV_ROW_COLUMN.equals(colf, colq)) {
-        prevRow = new Value(val);
-      }
-      
-      if (prevRow != null) {
-        ke = new KeyExtent(key.getRow(), prevRow);
-        if (location != null)
-          results.put(ke, location);
-        else
-          locationless.add(ke);
-        
-        location = null;
-        prevRow = null;
-      }
-    }
-    
-    return new Pair<SortedMap<KeyExtent,Text>,List<KeyExtent>>(results, locationless);
-  }
-  
-  public static SortedMap<Text,SortedMap<ColumnFQ,Value>> getTabletEntries(SortedMap<Key,Value> tabletKeyValues, List<ColumnFQ> columns) {
-    TreeMap<Text,SortedMap<ColumnFQ,Value>> tabletEntries = new TreeMap<Text,SortedMap<ColumnFQ,Value>>();
-    
-    HashSet<ColumnFQ> colSet = null;
-    if (columns != null) {
-      colSet = new HashSet<ColumnFQ>(columns);
-    }
-    
-    for (Entry<Key,Value> entry : tabletKeyValues.entrySet()) {
-      
-      if (columns != null && !colSet.contains(new ColumnFQ(entry.getKey()))) {
-        continue;
-      }
-      
-      Text row = entry.getKey().getRow();
-      
-      SortedMap<ColumnFQ,Value> colVals = tabletEntries.get(row);
-      if (colVals == null) {
-        colVals = new TreeMap<ColumnFQ,Value>();
-        tabletEntries.put(row, colVals);
-      }
-      
-      colVals.put(new ColumnFQ(entry.getKey()), entry.getValue());
-    }
-    
-    return tabletEntries;
-  }
-  
-  public static void getEntries(Instance instance, TCredentials credentials, String table, boolean isTid, Map<KeyExtent,String> locations,
-      SortedSet<KeyExtent> tablets) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
-    String tableId = isTid ? table : Tables.getNameToIdMap(instance).get(table);
-    
-    String systemTableToRead = tableId.equals(ID) ? RootTable.NAME : NAME;
-    Scanner scanner = instance.getConnector(credentials.getPrincipal(), CredentialHelper.extractToken(credentials)).createScanner(systemTableToRead,
-        Authorizations.EMPTY);
-    
-    PREV_ROW_COLUMN.fetch(scanner);
-    scanner.fetchColumnFamily(CURRENT_LOCATION_COLUMN_FAMILY);
-    
-    // position at first entry in metadata table for given table
-    KeyExtent ke = new KeyExtent(new Text(tableId), new Text(), null);
-    Key startKey = new Key(ke.getMetadataEntry());
-    ke = new KeyExtent(new Text(tableId), null, null);
-    Key endKey = new Key(ke.getMetadataEntry()).followingKey(PartialKey.ROW);
-    scanner.setRange(new Range(startKey, endKey));
-    
-    Text colf = new Text();
-    Text colq = new Text();
-    
-    KeyExtent currentKeyExtent = null;
-    String location = null;
-    Text row = null;
-    // acquire this tables METADATA table entries
-    boolean haveExtent = false;
-    boolean haveLocation = false;
-    for (Entry<Key,Value> entry : scanner) {
-      if (row != null) {
-        if (!row.equals(entry.getKey().getRow())) {
-          currentKeyExtent = null;
-          haveExtent = false;
-          haveLocation = false;
-          row = entry.getKey().getRow();
-        }
-      } else
-        row = entry.getKey().getRow();
-      
-      colf = entry.getKey().getColumnFamily(colf);
-      colq = entry.getKey().getColumnQualifier(colq);
-      
-      // stop scanning metadata table when another table is reached
-      if (!(new KeyExtent(entry.getKey().getRow(), (Text) null)).getTableId().toString().equals(tableId))
-        break;
-      
-      if (PREV_ROW_COLUMN.equals(colf, colq)) {
-        currentKeyExtent = new KeyExtent(entry.getKey().getRow(), entry.getValue());
-        tablets.add(currentKeyExtent);
-        haveExtent = true;
-      } else if (colf.equals(CURRENT_LOCATION_COLUMN_FAMILY)) {
-        location = entry.getValue().toString();
-        haveLocation = true;
-      }
-      
-      if (haveExtent && haveLocation) {
-        locations.put(currentKeyExtent, location);
-        haveExtent = false;
-        haveLocation = false;
-        currentKeyExtent = null;
-      }
-    }
-    
-    validateEntries(tableId, tablets);
-  }
-  
-  public static void validateEntries(String tableId, SortedSet<KeyExtent> tablets) throws AccumuloException {
-    // sanity check of metadata table entries
-    // make sure tablets has no holes, and that it starts and ends w/ null
-    if (tablets.size() == 0)
-      throw new AccumuloException("No entries found in metadata table for table " + tableId);
-    
-    if (tablets.first().getPrevEndRow() != null)
-      throw new AccumuloException("Problem with metadata table, first entry for table " + tableId + "- " + tablets.first() + " - has non null prev end row");
-    
-    if (tablets.last().getEndRow() != null)
-      throw new AccumuloException("Problem with metadata table, last entry for table " + tableId + "- " + tablets.first() + " - has non null end row");
-    
-    Iterator<KeyExtent> tabIter = tablets.iterator();
-    Text lastEndRow = tabIter.next().getEndRow();
-    while (tabIter.hasNext()) {
-      KeyExtent tabke = tabIter.next();
-      
-      if (tabke.getPrevEndRow() == null)
-        throw new AccumuloException("Problem with metadata table, it has null prev end row in middle of table " + tabke);
-      
-      if (!tabke.getPrevEndRow().equals(lastEndRow))
-        throw new AccumuloException("Problem with metadata table, it has a hole " + tabke.getPrevEndRow() + " != " + lastEndRow);
-      
-      lastEndRow = tabke.getEndRow();
-    }
-    
-    // end METADATA table sanity check
-  }
-  
-  public static boolean isContiguousRange(KeyExtent ke, SortedSet<KeyExtent> children) {
-    if (children.size() == 0)
-      return false;
-    
-    if (children.size() == 1)
-      return children.first().equals(ke);
-    
-    Text per = children.first().getPrevEndRow();
-    Text er = children.last().getEndRow();
-    
-    boolean perEqual = (per == ke.getPrevEndRow() || per != null && ke.getPrevEndRow() != null && ke.getPrevEndRow().compareTo(per) == 0);
-    
-    boolean erEqual = (er == ke.getEndRow() || er != null && ke.getEndRow() != null && ke.getEndRow().compareTo(er) == 0);
-    
-    if (!perEqual || !erEqual)
-      return false;
-    
-    Iterator<KeyExtent> iter = children.iterator();
-    
-    Text lastEndRow = iter.next().getEndRow();
-    
-    while (iter.hasNext()) {
-      KeyExtent cke = iter.next();
-      
-      per = cke.getPrevEndRow();
-      
-      // something in the middle should not be null
-      
-      if (per == null || lastEndRow == null)
-        return false;
-      
-      if (per.compareTo(lastEndRow) != 0)
-        return false;
-      
-      lastEndRow = cke.getEndRow();
-    }
-    
-    return true;
-  }
-  
 }

Copied: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/RootTable.java (from r1497021, accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/RootTable.java)
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/RootTable.java?p2=accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/RootTable.java&p1=accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/RootTable.java&r1=1497021&r2=1499510&rev=1499510&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/RootTable.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/RootTable.java Wed Jul  3 18:32:51 2013
@@ -14,10 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.accumulo.core.util;
+package org.apache.accumulo.core.metadata;
 
 import org.apache.accumulo.core.data.KeyExtent;
-import org.apache.accumulo.core.data.Range;
 import org.apache.hadoop.io.Text;
 
 /**
@@ -28,8 +27,14 @@ public class RootTable {
   public static final String ID = "!!R";
   public static final String NAME = "!!ROOT";
   
+  /**
+   * DFS location relative to the Accumulo directory
+   */
   public static final String ROOT_TABLET_LOCATION = "/root_tablet";
   
+  /**
+   * ZK path relative to the instance directory for information about the root tablet
+   */
   public static final String ZROOT_TABLET = ROOT_TABLET_LOCATION;
   public static final String ZROOT_TABLET_LOCATION = ZROOT_TABLET + "/location";
   public static final String ZROOT_TABLET_FUTURE_LOCATION = ZROOT_TABLET + "/future_location";
@@ -37,6 +42,5 @@ public class RootTable {
   public static final String ZROOT_TABLET_WALOGS = ZROOT_TABLET + "/walogs";
   
   public static final KeyExtent EXTENT = new KeyExtent(new Text(ID), null, null);
-  public static final Range METADATA_TABLETS_RANGE = new Range(null, false, MetadataTable.RESERVED_RANGE_START_KEY, false);
   
 }

Added: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForMetadataTable.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForMetadataTable.java?rev=1499510&view=auto
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForMetadataTable.java (added)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForMetadataTable.java Wed Jul  3 18:32:51 2013
@@ -0,0 +1,32 @@
+/*
+ * 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.core.metadata;
+
+import org.apache.accumulo.core.client.Instance;
+import org.apache.accumulo.core.security.thrift.TCredentials;
+
+/**
+ * A metadata servicer for the metadata table (which holds metadata for user tables).<br />
+ * The metadata table's metadata is serviced in the root table.
+ */
+class ServicerForMetadataTable extends TableMetadataServicer {
+  
+  public ServicerForMetadataTable(Instance instance, TCredentials credentials) {
+    super(instance, credentials, RootTable.NAME, MetadataTable.ID);
+  }
+  
+}

Propchange: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForMetadataTable.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForRootTable.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForRootTable.java?rev=1499510&view=auto
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForRootTable.java (added)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForRootTable.java Wed Jul  3 18:32:51 2013
@@ -0,0 +1,49 @@
+/*
+ * 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.core.metadata;
+
+import java.util.SortedMap;
+
+import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.AccumuloSecurityException;
+import org.apache.accumulo.core.client.Instance;
+import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.data.KeyExtent;
+import org.apache.accumulo.core.security.thrift.TCredentials;
+
+/**
+ * A metadata servicer for the root table.<br />
+ * The root table's metadata is serviced in zookeeper.
+ */
+class ServicerForRootTable extends MetadataServicer {
+  
+  private Instance instance;
+  
+  public ServicerForRootTable(Instance instance, TCredentials credentials) {
+    this.instance = instance;
+  }
+  
+  @Override
+  public String getServicedTableId() {
+    return RootTable.ID;
+  }
+  
+  @Override
+  public void getTabletLocations(SortedMap<KeyExtent,String> tablets) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
+    tablets.put(RootTable.EXTENT, instance.getRootTabletLocation());
+  }
+}

Propchange: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForRootTable.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message