You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2013/06/19 00:50:55 UTC
svn commit: r1494358 [1/4] - in /accumulo/trunk:
core/src/main/java/org/apache/accumulo/core/
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/clie...
Author: ctubbsii
Date: Tue Jun 18 22:50:53 2013
New Revision: 1494358
URL: http://svn.apache.org/r1494358
Log:
ACCUMULO-1516 Organize Metadata/Root tablet constants into their respective utility files; moved other constants to areas more appropriate to their existance
Added:
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/RootTable.java
Modified:
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/Constants.java
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/MetadataLocationObtainer.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/TabletLocator.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/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/mock/MockAccumulo.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/Merge.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/TableDiskUsage.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/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/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/CompactRange.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/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/LargestFirstMemoryManager.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/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/MetadataTable.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/TabletIterator.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/GCLotsOfCandidatesTest.java
accumulo/trunk/test/src/main/java/org/apache/accumulo/test/QueryMetadataTable.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/PermissionsTest.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/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
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/Constants.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/Constants.java?rev=1494358&r1=1494357&r2=1494358&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/Constants.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/Constants.java Tue Jun 18 22:50:53 2013
@@ -18,13 +18,7 @@ package org.apache.accumulo.core;
import java.nio.charset.Charset;
-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.security.Authorizations;
-import org.apache.accumulo.core.util.ColumnFQ;
-import org.apache.hadoop.io.Text;
public class Constants {
public static final Charset UTF8 = Charset.forName("UTF-8");
@@ -43,12 +37,6 @@ public class Constants {
public static final String ZTABLE_COMPACT_ID = "/compact-id";
public static final String ZTABLE_COMPACT_CANCEL_ID = "/compact-cancel-id";
- public static final String ZROOT_TABLET = "/root_tablet";
- public static final String ZROOT_TABLET_LOCATION = ZROOT_TABLET + "/location";
- public static final String ZROOT_TABLET_FUTURE_LOCATION = ZROOT_TABLET + "/future_location";
- public static final String ZROOT_TABLET_LAST_LOCATION = ZROOT_TABLET + "/lastlocation";
- public static final String ZROOT_TABLET_WALOGS = ZROOT_TABLET + "/walogs";
-
public static final String ZMASTERS = "/masters";
public static final String ZMASTER_LOCK = ZMASTERS + "/lock";
public static final String ZMASTER_GOAL_STATE = ZMASTERS + "/goal_state";
@@ -78,62 +66,17 @@ public class Constants {
public static final String ZHDFS_RESERVATIONS = "/hdfs_reservations";
public static final String ZRECOVERY = "/recovery";
- public static final String METADATA_TABLE_ID = "!0";
- public static final String METADATA_TABLE_NAME = "!METADATA";
+ /**
+ * Initial tablet directory name for the default tablet in all tables
+ */
public static final String DEFAULT_TABLET_LOCATION = "/default_tablet";
- public static final String TABLE_TABLET_LOCATION = "/table_info";
- public static final String ZTABLE_LOCKS = "/table_locks";
- // reserved keyspace is any row that begins with a tilde '~' character
- public static final Key METADATA_RESERVED_KEYSPACE_START_KEY = new Key(new Text(new byte[] {'~'}));
- public static final String METADATA_DELETE_FLAG_PREFIX = "~del";
- public static final String METADATA_DELETE_FLAG_FOR_METADATA_PREFIX = "!!" + METADATA_DELETE_FLAG_PREFIX;
- public static final Range METADATA_DELETES_KEYSPACE = new Range(new Key(new Text(METADATA_DELETE_FLAG_PREFIX)), true, new Key(new Text("~dem")), false);
- public static final Range METADATA_DELETES_FOR_METADATA_KEYSPACE = new Range(new Key(new Text(METADATA_DELETE_FLAG_FOR_METADATA_PREFIX)), true, new Key(
- new Text("!!~dem")), false);
- public static final String METADATA_BLIP_FLAG_PREFIX = "~blip"; // BLIP = bulk load in progress
- public static final Range METADATA_BLIP_KEYSPACE = new Range(new Key(new Text(METADATA_BLIP_FLAG_PREFIX)), true, new Key(new Text("~bliq")), false);
-
- public static final Text METADATA_SERVER_COLUMN_FAMILY = new Text("srv");
- public static final Text METADATA_TABLET_COLUMN_FAMILY = new Text("~tab"); // this needs to sort after all other column families for that tablet
- public static final Text METADATA_CURRENT_LOCATION_COLUMN_FAMILY = new Text("loc");
- public static final Text METADATA_FUTURE_LOCATION_COLUMN_FAMILY = new Text("future");
- public static final Text METADATA_LAST_LOCATION_COLUMN_FAMILY = new Text("last");
- public static final Text METADATA_BULKFILE_COLUMN_FAMILY = new Text("loaded"); // temporary marker that indicates a tablet loaded a bulk file
- public static final Text METADATA_CLONED_COLUMN_FAMILY = new Text("!cloned"); // temporary marker that indicates a tablet was successfully cloned
-
- // README : very important that prevRow sort last to avoid race conditions between
- // garbage collector and split
- public static final ColumnFQ METADATA_PREV_ROW_COLUMN = new ColumnFQ(METADATA_TABLET_COLUMN_FAMILY, new Text("~pr")); // this needs to sort after everything
- // else for that tablet
- public static final ColumnFQ METADATA_OLD_PREV_ROW_COLUMN = new ColumnFQ(METADATA_TABLET_COLUMN_FAMILY, new Text("oldprevrow"));
- public static final ColumnFQ METADATA_DIRECTORY_COLUMN = new ColumnFQ(METADATA_SERVER_COLUMN_FAMILY, new Text("dir"));
- public static final ColumnFQ METADATA_TIME_COLUMN = new ColumnFQ(METADATA_SERVER_COLUMN_FAMILY, new Text("time"));
- public static final ColumnFQ METADATA_FLUSH_COLUMN = new ColumnFQ(METADATA_SERVER_COLUMN_FAMILY, new Text("flush"));
- public static final ColumnFQ METADATA_COMPACT_COLUMN = new ColumnFQ(METADATA_SERVER_COLUMN_FAMILY, new Text("compact"));
- public static final ColumnFQ METADATA_SPLIT_RATIO_COLUMN = new ColumnFQ(METADATA_TABLET_COLUMN_FAMILY, new Text("splitRatio"));
- public static final ColumnFQ METADATA_LOCK_COLUMN = new ColumnFQ(METADATA_SERVER_COLUMN_FAMILY, new Text("lock"));
-
- public static final Text METADATA_DATAFILE_COLUMN_FAMILY = new Text("file");
- public static final Text METADATA_SCANFILE_COLUMN_FAMILY = new Text("scan");
- public static final Text METADATA_LOG_COLUMN_FAMILY = new Text("log");
- public static final Text METADATA_CHOPPED_COLUMN_FAMILY = new Text("chopped");
- public static final ColumnFQ METADATA_CHOPPED_COLUMN = new ColumnFQ(METADATA_CHOPPED_COLUMN_FAMILY, new Text("chopped"));
-
- public static final Range NON_ROOT_METADATA_KEYSPACE = new Range(
- new Key(KeyExtent.getMetadataEntry(new Text(METADATA_TABLE_ID), null)).followingKey(PartialKey.ROW), true, METADATA_RESERVED_KEYSPACE_START_KEY, false);
- public static final Range METADATA_KEYSPACE = new Range(new Key(new Text(METADATA_TABLE_ID)), true, METADATA_RESERVED_KEYSPACE_START_KEY, false);
-
- public static final KeyExtent ROOT_TABLET_EXTENT = new KeyExtent(new Text(METADATA_TABLE_ID), KeyExtent.getMetadataEntry(new Text(METADATA_TABLE_ID), null),
- null);
- public static final Range METADATA_ROOT_TABLET_KEYSPACE = new Range(ROOT_TABLET_EXTENT.getMetadataEntry(), false, KeyExtent.getMetadataEntry(new Text(
- METADATA_TABLE_ID), null), true);
+ public static final String ZTABLE_LOCKS = "/table_locks";
public static final String BULK_PREFIX = "b-";
- // note: all times are in milliseconds
-
- public static final int SCAN_BATCH_SIZE = 1000; // this affects the table client caching of metadata
+ // this affects the table client caching of metadata
+ public static final int SCAN_BATCH_SIZE = 1000;
// Security configuration
public static final String PW_HASH_ALGORITHM = "SHA-256";
@@ -144,10 +87,7 @@ public class Constants {
@Deprecated
public static final Authorizations NO_AUTHS = Authorizations.EMPTY;
- public static final int DEFAULT_MINOR_COMPACTION_MAX_SLEEP_TIME = 60 * 3; // in seconds
-
public static final int MAX_DATA_TO_PRINT = 64;
- public static final int TSERV_MINC_MAXCONCURRENT_NUMWAITING_MULTIPLIER = 2;
public static final String CORE_PACKAGE_NAME = "org.apache.accumulo.core";
public static final String VALID_TABLE_NAME_REGEX = "^\\w+$";
public static final String MAPFILE_EXTENSION = "map";
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=1494358&r1=1494357&r2=1494358&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 Tue Jun 18 22:50:53 2013
@@ -36,6 +36,7 @@ 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.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;
@@ -174,7 +175,7 @@ public class ZooKeeperInstance implement
@Override
public String getRootTabletLocation() {
- String zRootLocPath = ZooUtil.getRoot(this) + Constants.ZROOT_TABLET_LOCATION;
+ String zRootLocPath = ZooUtil.getRoot(this) + RootTable.ZROOT_TABLET_LOCATION;
OpTimer opTimer = new OpTimer(log, Level.TRACE).start("Looking up root tablet location in zookeeper.");
byte[] loc = zooCache.get(zRootLocPath);
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=1494358&r1=1494357&r2=1494358&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 Tue Jun 18 22:50:53 2013
@@ -154,7 +154,7 @@ public class TableOperationsImpl extends
@Override
public boolean exists(String tableName) {
ArgumentChecker.notNull(tableName);
- if (tableName.equals(Constants.METADATA_TABLE_NAME))
+ if (tableName.equals(MetadataTable.NAME))
return true;
OpTimer opTimer = new OpTimer(log, Level.TRACE).start("Checking if table " + tableName + "exists...");
Modified: 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/client/impl/MetadataLocationObtainer.java?rev=1494358&r1=1494357&r2=1494358&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/client/impl/MetadataLocationObtainer.java Tue Jun 18 22:50:53 2013
@@ -66,8 +66,8 @@ public class MetadataLocationObtainer im
this.instance = instance;
locCols = new TreeSet<Column>();
- locCols.add(new Column(TextUtil.getBytes(Constants.METADATA_CURRENT_LOCATION_COLUMN_FAMILY), null, null));
- locCols.add(Constants.METADATA_PREV_ROW_COLUMN.toColumn());
+ locCols.add(new Column(TextUtil.getBytes(MetadataTable.CURRENT_LOCATION_COLUMN_FAMILY), null, null));
+ locCols.add(MetadataTable.PREV_ROW_COLUMN.toColumn());
columns = new ArrayList<Column>(locCols);
}
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=1494358&r1=1494357&r2=1494358&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 Tue Jun 18 22:50:53 2013
@@ -60,6 +60,7 @@ 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;
@@ -246,7 +247,7 @@ class OfflineIterator implements Iterato
}
private Pair<KeyExtent,String> getTabletFiles(Range nextRange, List<String> relFiles) throws TableNotFoundException {
- Scanner scanner = conn.createScanner(Constants.METADATA_TABLE_NAME, Authorizations.EMPTY);
+ Scanner scanner = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
scanner.setBatchSize(100);
scanner.setRange(nextRange);
@@ -260,16 +261,16 @@ class OfflineIterator implements Iterato
Entry<Key,Value> entry = row.next();
Key key = entry.getKey();
- if (key.getColumnFamily().equals(Constants.METADATA_DATAFILE_COLUMN_FAMILY)) {
+ if (key.getColumnFamily().equals(MetadataTable.DATAFILE_COLUMN_FAMILY)) {
relFiles.add(key.getColumnQualifier().toString());
}
- if (key.getColumnFamily().equals(Constants.METADATA_CURRENT_LOCATION_COLUMN_FAMILY)
- || key.getColumnFamily().equals(Constants.METADATA_FUTURE_LOCATION_COLUMN_FAMILY)) {
+ if (key.getColumnFamily().equals(MetadataTable.CURRENT_LOCATION_COLUMN_FAMILY)
+ || key.getColumnFamily().equals(MetadataTable.FUTURE_LOCATION_COLUMN_FAMILY)) {
location = entry.getValue().toString();
}
- if (Constants.METADATA_PREV_ROW_COLUMN.hasColumns(key)) {
+ if (MetadataTable.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=1494358&r1=1494357&r2=1494358&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 Tue Jun 18 22:50:53 2013
@@ -21,7 +21,6 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
-import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.Instance;
@@ -30,6 +29,7 @@ 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.security.thrift.TCredentials;
+import org.apache.accumulo.core.util.RootTable;
import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.hadoop.io.Text;
@@ -54,7 +54,7 @@ public class RootTabletLocator extends T
String rootTabletLocation = instance.getRootTabletLocation();
if (rootTabletLocation != null) {
for (Range range : ranges) {
- TabletLocatorImpl.addRange(binnedRanges, rootTabletLocation, Constants.ROOT_TABLET_EXTENT, range);
+ TabletLocatorImpl.addRange(binnedRanges, rootTabletLocation, RootTable.ROOT_TABLET_EXTENT, range);
}
}
return Collections.emptyList();
@@ -78,7 +78,7 @@ public class RootTabletLocator extends T
row = new Text(row);
row.append(new byte[] {0}, 0, 1);
}
- if (!Constants.ROOT_TABLET_EXTENT.contains(row)) {
+ if (!RootTable.ROOT_TABLET_EXTENT.contains(row)) {
throw new AccumuloException("Tried to locate row out side of root tablet " + row);
}
String location = instance.getRootTabletLocation();
@@ -88,7 +88,7 @@ public class RootTabletLocator extends T
location = instance.getRootTabletLocation();
}
if (location != null)
- return new TabletLocation(Constants.ROOT_TABLET_EXTENT, location);
+ return new TabletLocation(RootTable.ROOT_TABLET_EXTENT, location);
return null;
}
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=1494358&r1=1494357&r2=1494358&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 Tue Jun 18 22:50:53 2013
@@ -24,7 +24,6 @@ import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
-import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.Instance;
@@ -34,6 +33,7 @@ import org.apache.accumulo.core.data.Mut
import org.apache.accumulo.core.data.Range;
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.hadoop.io.Text;
public abstract class TabletLocator {
@@ -90,7 +90,7 @@ public abstract class TabletLocator {
private static HashMap<LocatorKey,TabletLocator> locators = new HashMap<LocatorKey,TabletLocator>();
- private static final Text ROOT_TABLET_MDE = KeyExtent.getMetadataEntry(new Text(Constants.METADATA_TABLE_ID), null);
+ private static final Text ROOT_TABLET_MDE = KeyExtent.getMetadataEntry(new Text(MetadataTable.ID), null);
public static synchronized TabletLocator getInstance(Instance instance, Text tableId) {
LocatorKey key = new LocatorKey(instance.getInstanceID(), tableId);
@@ -100,9 +100,9 @@ public abstract class TabletLocator {
if (tl == null) {
MetadataLocationObtainer mlo = new MetadataLocationObtainer(instance);
- if (tableId.toString().equals(Constants.METADATA_TABLE_ID)) {
+ if (tableId.toString().equals(MetadataTable.ID)) {
RootTabletLocator rootTabletLocator = new RootTabletLocator(instance);
- tl = new TabletLocatorImpl(new Text(Constants.METADATA_TABLE_ID), rootTabletLocator, mlo) {
+ tl = new TabletLocatorImpl(new Text(MetadataTable.ID), rootTabletLocator, mlo) {
@Override
public TabletLocation _locateTablet(Text row, boolean skipRow, boolean retry, boolean lock, TCredentials credentials) throws AccumuloException, AccumuloSecurityException,
TableNotFoundException {
@@ -117,7 +117,7 @@ public abstract class TabletLocator {
}
};
} else {
- TabletLocator rootTabletCache = getInstance(instance, new Text(Constants.METADATA_TABLE_ID));
+ TabletLocator rootTabletCache = getInstance(instance, new Text(MetadataTable.ID));
tl = new TabletLocatorImpl(tableId, rootTabletCache, mlo);
}
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=1494358&r1=1494357&r2=1494358&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 Tue Jun 18 22:50:53 2013
@@ -35,7 +35,6 @@ import java.util.concurrent.ExecutorServ
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
-import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.BatchWriterConfig;
@@ -61,6 +60,7 @@ import org.apache.accumulo.core.tabletse
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;
@@ -673,7 +673,7 @@ public class TabletServerBatchWriter {
// assume an IOError communicating with !METADATA tablet
failedMutations.add(mutationsToProcess);
} catch (AccumuloSecurityException e) {
- updateAuthorizationFailures(Collections.singletonMap(new KeyExtent(new Text(Constants.METADATA_TABLE_ID), null, null),
+ updateAuthorizationFailures(Collections.singletonMap(new KeyExtent(new Text(MetadataTable.ID), null, null),
SecurityErrorCode.valueOf(e.getSecurityErrorCode().name())));
} catch (TableDeletedException e) {
updateUnknownErrors(e.getMessage(), e);
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=1494358&r1=1494357&r2=1494358&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 Tue Jun 18 22:50:53 2013
@@ -28,7 +28,6 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.ClientSideIteratorScanner;
@@ -57,6 +56,7 @@ import org.apache.accumulo.core.master.s
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;
@@ -686,11 +686,11 @@ public abstract class InputFormatBase<K,
startRow = new Text();
Range metadataRange = new Range(new KeyExtent(new Text(tableId), startRow, null).getMetadataEntry(), true, null, false);
- Scanner scanner = conn.createScanner(Constants.METADATA_TABLE_NAME, Authorizations.EMPTY);
- Constants.METADATA_PREV_ROW_COLUMN.fetch(scanner);
- scanner.fetchColumnFamily(Constants.METADATA_LAST_LOCATION_COLUMN_FAMILY);
- scanner.fetchColumnFamily(Constants.METADATA_CURRENT_LOCATION_COLUMN_FAMILY);
- scanner.fetchColumnFamily(Constants.METADATA_FUTURE_LOCATION_COLUMN_FAMILY);
+ 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);
scanner.setRange(metadataRange);
RowIterator rowIter = new RowIterator(scanner);
@@ -707,16 +707,16 @@ public abstract class InputFormatBase<K,
Entry<Key,Value> entry = row.next();
Key key = entry.getKey();
- if (key.getColumnFamily().equals(Constants.METADATA_LAST_LOCATION_COLUMN_FAMILY)) {
+ if (key.getColumnFamily().equals(MetadataTable.LAST_LOCATION_COLUMN_FAMILY)) {
last = entry.getValue().toString();
}
- if (key.getColumnFamily().equals(Constants.METADATA_CURRENT_LOCATION_COLUMN_FAMILY)
- || key.getColumnFamily().equals(Constants.METADATA_FUTURE_LOCATION_COLUMN_FAMILY)) {
+ if (key.getColumnFamily().equals(MetadataTable.CURRENT_LOCATION_COLUMN_FAMILY)
+ || key.getColumnFamily().equals(MetadataTable.FUTURE_LOCATION_COLUMN_FAMILY)) {
location = entry.getValue().toString();
}
- if (Constants.METADATA_PREV_ROW_COLUMN.hasColumns(key)) {
+ if (MetadataTable.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=1494358&r1=1494357&r2=1494358&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 Tue Jun 18 22:50:53 2013
@@ -36,7 +36,6 @@ import java.util.Map.Entry;
import java.util.Set;
import java.util.StringTokenizer;
-import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.ClientSideIteratorScanner;
@@ -68,6 +67,7 @@ import org.apache.accumulo.core.master.s
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;
@@ -710,11 +710,11 @@ public abstract class InputFormatBase<K,
startRow = new Text();
Range metadataRange = new Range(new KeyExtent(new Text(tableId), startRow, null).getMetadataEntry(), true, null, false);
- Scanner scanner = conn.createScanner(Constants.METADATA_TABLE_NAME, Authorizations.EMPTY);
- Constants.METADATA_PREV_ROW_COLUMN.fetch(scanner);
- scanner.fetchColumnFamily(Constants.METADATA_LAST_LOCATION_COLUMN_FAMILY);
- scanner.fetchColumnFamily(Constants.METADATA_CURRENT_LOCATION_COLUMN_FAMILY);
- scanner.fetchColumnFamily(Constants.METADATA_FUTURE_LOCATION_COLUMN_FAMILY);
+ 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);
scanner.setRange(metadataRange);
RowIterator rowIter = new RowIterator(scanner);
@@ -731,16 +731,16 @@ public abstract class InputFormatBase<K,
Entry<Key,Value> entry = row.next();
Key key = entry.getKey();
- if (key.getColumnFamily().equals(Constants.METADATA_LAST_LOCATION_COLUMN_FAMILY)) {
+ if (key.getColumnFamily().equals(MetadataTable.LAST_LOCATION_COLUMN_FAMILY)) {
last = entry.getValue().toString();
}
- if (key.getColumnFamily().equals(Constants.METADATA_CURRENT_LOCATION_COLUMN_FAMILY)
- || key.getColumnFamily().equals(Constants.METADATA_FUTURE_LOCATION_COLUMN_FAMILY)) {
+ if (key.getColumnFamily().equals(MetadataTable.CURRENT_LOCATION_COLUMN_FAMILY)
+ || key.getColumnFamily().equals(MetadataTable.FUTURE_LOCATION_COLUMN_FAMILY)) {
location = entry.getValue().toString();
}
- if (Constants.METADATA_PREV_ROW_COLUMN.hasColumns(key)) {
+ if (MetadataTable.PREV_ROW_COLUMN.hasColumns(key)) {
extent = new KeyExtent(key.getRow(), entry.getValue());
}
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=1494358&r1=1494357&r2=1494358&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 Tue Jun 18 22:50:53 2013
@@ -22,7 +22,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.SortedSet;
-import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.BatchScanner;
import org.apache.accumulo.core.client.admin.TimeType;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
@@ -30,6 +29,7 @@ import org.apache.accumulo.core.data.Mut
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.hadoop.fs.FileSystem;
import org.apache.hadoop.io.Text;
@@ -47,7 +47,7 @@ public class MockAccumulo {
MockUser root = new MockUser("root", new PasswordToken(new byte[0]), Authorizations.EMPTY);
root.permissions.add(SystemPermission.SYSTEM);
users.put(root.name, root);
- createTable("root", Constants.METADATA_TABLE_NAME, true, TimeType.LOGICAL);
+ createTable("root", MetadataTable.NAME, true, TimeType.LOGICAL);
}
public FileSystem getFileSystem() {
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=1494358&r1=1494357&r2=1494358&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 Tue Jun 18 22:50:53 2013
@@ -39,9 +39,10 @@ import java.util.TreeSet;
import java.util.UUID;
import java.util.WeakHashMap;
-import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.data.thrift.TKeyExtent;
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;
@@ -395,7 +396,7 @@ public class KeyExtent implements Writab
public static Mutation getPrevRowUpdateMutation(KeyExtent ke) {
Mutation m = new Mutation(ke.getMetadataEntry());
- Constants.METADATA_PREV_ROW_COLUMN.put(m, encodePrevEndRow(ke.getPrevEndRow()));
+ MetadataTable.PREV_ROW_COLUMN.put(m, encodePrevEndRow(ke.getPrevEndRow()));
return m;
}
@@ -774,10 +775,10 @@ public class KeyExtent implements Writab
}
public boolean isMeta() {
- return getTableId().toString().equals(Constants.METADATA_TABLE_ID);
+ return getTableId().toString().equals(MetadataTable.ID);
}
public boolean isRootTablet() {
- return this.compareTo(Constants.ROOT_TABLET_EXTENT) == 0;
+ return this.compareTo(RootTable.ROOT_TABLET_EXTENT) == 0;
}
}
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/Merge.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/Merge.java?rev=1494358&r1=1494357&r2=1494358&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/Merge.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/Merge.java Tue Jun 18 22:50:53 2013
@@ -21,7 +21,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
-import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.cli.ClientOnRequiredTable;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.Scanner;
@@ -121,7 +120,7 @@ public class Merge {
public void mergomatic(Connector conn, String table, Text start, Text end, long goalSize, boolean force) throws MergeException {
try {
- if (table.equals(Constants.METADATA_TABLE_NAME)) {
+ if (table.equals(MetadataTable.NAME)) {
throw new IllegalArgumentException("cannot merge tablets on the metadata table");
}
List<Size> sizes = new ArrayList<Size>();
@@ -212,13 +211,13 @@ public class Merge {
Scanner scanner;
try {
tableId = Tables.getTableId(conn.getInstance(), tablename);
- scanner = conn.createScanner(Constants.METADATA_TABLE_NAME, Authorizations.EMPTY);
+ scanner = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
} catch (Exception e) {
throw new MergeException(e);
}
scanner.setRange(new KeyExtent(new Text(tableId), end, start).toMetadataRange());
- scanner.fetchColumnFamily(Constants.METADATA_DATAFILE_COLUMN_FAMILY);
- Constants.METADATA_PREV_ROW_COLUMN.fetch(scanner);
+ scanner.fetchColumnFamily(MetadataTable.DATAFILE_COLUMN_FAMILY);
+ MetadataTable.PREV_ROW_COLUMN.fetch(scanner);
final Iterator<Entry<Key,Value>> iterator = scanner.iterator();
Iterator<Size> result = new Iterator<Size>() {
@@ -234,12 +233,12 @@ public class Merge {
while (iterator.hasNext()) {
Entry<Key,Value> entry = iterator.next();
Key key = entry.getKey();
- if (key.getColumnFamily().equals(Constants.METADATA_DATAFILE_COLUMN_FAMILY)) {
+ if (key.getColumnFamily().equals(MetadataTable.DATAFILE_COLUMN_FAMILY)) {
String[] sizeEntries = new String(entry.getValue().get()).split(",");
if (sizeEntries.length == 2) {
tabletSize += Long.parseLong(sizeEntries[0]);
}
- } else if (Constants.METADATA_PREV_ROW_COLUMN.hasColumns(key)) {
+ } else if (MetadataTable.PREV_ROW_COLUMN.hasColumns(key)) {
KeyExtent extent = new KeyExtent(key.getRow(), entry.getValue());
return new Size(extent, tabletSize);
}
Modified: 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/util/MetadataTable.java?rev=1494358&r1=1494357&r2=1494358&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/util/MetadataTable.java Tue Jun 18 22:50:53 2013
@@ -26,7 +26,6 @@ import java.util.SortedMap;
import java.util.SortedSet;
import java.util.TreeMap;
-import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.Instance;
@@ -44,6 +43,68 @@ import org.apache.accumulo.core.security
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_KEYSPACE_START_KEY = new Key(new Text(new byte[] {'~'}));
+ public static final String DELETE_FLAG_PREFIX = "~del";
+ public static final Range DELETES_KEYSPACE = new Range(new Key(new Text(DELETE_FLAG_PREFIX)), 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 final Range NON_ROOT_KEYSPACE = new Range(new Key(KeyExtent.getMetadataEntry(new Text(ID), null)).followingKey(PartialKey.ROW), true,
+ RESERVED_KEYSPACE_START_KEY, false);
+ public static final Range KEYSPACE = new Range(new Key(new Text(ID)), true, RESERVED_KEYSPACE_START_KEY, false);
+
public static class DataFileValue {
private long size;
private long numEntries;
@@ -153,12 +214,12 @@ public class MetadataTable {
colq = key.getColumnQualifier(colq);
// interpret the row id as a key extent
- if (colf.equals(Constants.METADATA_CURRENT_LOCATION_COLUMN_FAMILY) || colf.equals(Constants.METADATA_FUTURE_LOCATION_COLUMN_FAMILY)) {
+ 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 (Constants.METADATA_PREV_ROW_COLUMN.equals(colf, colq)) {
+ } else if (PREV_ROW_COLUMN.equals(colf, colq)) {
prevRow = new Value(val);
}
@@ -209,11 +270,10 @@ public class MetadataTable {
SortedSet<KeyExtent> tablets) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
String tableId = isTid ? table : Tables.getNameToIdMap(instance).get(table);
- Scanner scanner = instance.getConnector(credentials.getPrincipal(), CredentialHelper.extractToken(credentials)).createScanner(
- Constants.METADATA_TABLE_NAME, Authorizations.EMPTY);
+ Scanner scanner = instance.getConnector(credentials.getPrincipal(), CredentialHelper.extractToken(credentials)).createScanner(NAME, Authorizations.EMPTY);
- Constants.METADATA_PREV_ROW_COLUMN.fetch(scanner);
- scanner.fetchColumnFamily(Constants.METADATA_CURRENT_LOCATION_COLUMN_FAMILY);
+ 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);
@@ -249,11 +309,11 @@ public class MetadataTable {
if (!(new KeyExtent(entry.getKey().getRow(), (Text) null)).getTableId().toString().equals(tableId))
break;
- if (Constants.METADATA_PREV_ROW_COLUMN.equals(colf, colq)) {
+ if (PREV_ROW_COLUMN.equals(colf, colq)) {
currentKeyExtent = new KeyExtent(entry.getKey().getRow(), entry.getValue());
tablets.add(currentKeyExtent);
haveExtent = true;
- } else if (colf.equals(Constants.METADATA_CURRENT_LOCATION_COLUMN_FAMILY)) {
+ } else if (colf.equals(CURRENT_LOCATION_COLUMN_FAMILY)) {
location = entry.getValue().toString();
haveLocation = true;
}
Added: 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/util/RootTable.java?rev=1494358&view=auto
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/RootTable.java (added)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/RootTable.java Tue Jun 18 22:50:53 2013
@@ -0,0 +1,45 @@
+/*
+ * 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.util;
+
+import org.apache.accumulo.core.data.Key;
+import org.apache.accumulo.core.data.KeyExtent;
+import org.apache.accumulo.core.data.Range;
+import org.apache.hadoop.io.Text;
+
+/**
+ *
+ */
+public class RootTable {
+
+ public static final String ID = "!!R";
+ public static final String NAME = "!!ROOT";
+
+ public static final String ZROOT_TABLET = "/root_tablet";
+ public static final String ZROOT_TABLET_LOCATION = ZROOT_TABLET + "/location";
+ public static final String ZROOT_TABLET_FUTURE_LOCATION = ZROOT_TABLET + "/future_location";
+ public static final String ZROOT_TABLET_LAST_LOCATION = ZROOT_TABLET + "/lastlocation";
+ public static final String ZROOT_TABLET_WALOGS = ZROOT_TABLET + "/walogs";
+
+ public static final String DELETE_FLAG_PREFIX = "!!" + MetadataTable.DELETE_FLAG_PREFIX;
+ public static final Range DELETES_KEYSPACE = new Range(new Key(new Text(DELETE_FLAG_PREFIX)), true, new Key(new Text("!!~dem")), false);
+ public static final KeyExtent ROOT_TABLET_EXTENT = new KeyExtent(new Text(MetadataTable.ID), KeyExtent.getMetadataEntry(new Text(MetadataTable.ID), null),
+ null);
+ public static final Range KEYSPACE = new Range(ROOT_TABLET_EXTENT.getMetadataEntry(), false, KeyExtent.getMetadataEntry(new Text(
+ MetadataTable.ID), null), true);
+
+}
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/TableDiskUsage.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/TableDiskUsage.java?rev=1494358&r1=1494357&r2=1494358&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/TableDiskUsage.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/TableDiskUsage.java Tue Jun 18 22:50:53 2013
@@ -31,7 +31,6 @@ import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
-import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.client.TableNotFoundException;
@@ -142,11 +141,11 @@ public class TableDiskUsage {
for (String tableId : tableIds) {
Scanner mdScanner = null;
try {
- mdScanner = conn.createScanner(Constants.METADATA_TABLE_NAME, Authorizations.EMPTY);
+ mdScanner = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
} catch (TableNotFoundException e) {
throw new RuntimeException(e);
}
- mdScanner.fetchColumnFamily(Constants.METADATA_DATAFILE_COLUMN_FAMILY);
+ mdScanner.fetchColumnFamily(MetadataTable.DATAFILE_COLUMN_FAMILY);
mdScanner.setRange(new KeyExtent(new Text(tableId), null, null).toMetadataRange());
if (!mdScanner.iterator().hasNext()) {
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/FlushCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/FlushCommand.java?rev=1494358&r1=1494357&r2=1494358&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/FlushCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/FlushCommand.java Tue Jun 18 22:50:53 2013
@@ -16,10 +16,10 @@
*/
package org.apache.accumulo.core.util.shell.commands;
-import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.util.MetadataTable;
import org.apache.accumulo.core.util.shell.Shell;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Option;
@@ -41,9 +41,9 @@ public class FlushCommand extends TableO
protected void doTableOp(final Shell shellState, final String tableName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
shellState.getConnector().tableOperations().flush(tableName, startRow, endRow, wait);
Shell.log.info("Flush of table " + tableName + (wait ? " completed." : " initiated..."));
- if (tableName.equals(Constants.METADATA_TABLE_NAME)) {
- Shell.log.info(" May need to flush " + Constants.METADATA_TABLE_NAME + " table multiple times.");
- Shell.log.info(" Flushing " + Constants.METADATA_TABLE_NAME + " causes writes to itself and");
+ if (tableName.equals(MetadataTable.NAME)) {
+ Shell.log.info(" May need to flush " + MetadataTable.NAME + " table multiple times.");
+ Shell.log.info(" Flushing " + MetadataTable.NAME + " causes writes to itself and");
Shell.log.info(" minor compactions, which also cause writes to itself.");
Shell.log.info(" Check the monitor web page and give it time to settle.");
}
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/GetSplitsCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/GetSplitsCommand.java?rev=1494358&r1=1494357&r2=1494358&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/GetSplitsCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/GetSplitsCommand.java Tue Jun 18 22:50:53 2013
@@ -22,7 +22,6 @@ import java.security.NoSuchAlgorithmExce
import java.util.Iterator;
import java.util.Map.Entry;
-import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.Scanner;
@@ -32,6 +31,7 @@ import org.apache.accumulo.core.data.Key
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.util.MetadataTable;
import org.apache.accumulo.core.util.TextUtil;
import org.apache.accumulo.core.util.format.BinaryFormatter;
import org.apache.accumulo.core.util.shell.Shell;
@@ -69,15 +69,15 @@ public class GetSplitsCommand extends Co
p.print(encode(encode, row));
}
} else {
- final Scanner scanner = shellState.getConnector().createScanner(Constants.METADATA_TABLE_NAME, Authorizations.EMPTY);
- Constants.METADATA_PREV_ROW_COLUMN.fetch(scanner);
+ final Scanner scanner = shellState.getConnector().createScanner(MetadataTable.NAME, Authorizations.EMPTY);
+ MetadataTable.PREV_ROW_COLUMN.fetch(scanner);
final Text start = new Text(shellState.getConnector().tableOperations().tableIdMap().get(tableName));
final Text end = new Text(start);
end.append(new byte[] {'<'}, 0, 1);
scanner.setRange(new Range(start, end));
for (Iterator<Entry<Key,Value>> iterator = scanner.iterator(); iterator.hasNext();) {
final Entry<Key,Value> next = iterator.next();
- if (Constants.METADATA_PREV_ROW_COLUMN.hasColumns(next.getKey())) {
+ if (MetadataTable.PREV_ROW_COLUMN.hasColumns(next.getKey())) {
KeyExtent extent = new KeyExtent(next.getKey().getRow(), next.getValue());
final String pr = encode(encode, extent.getPrevEndRow());
final String er = encode(encode, extent.getEndRow());
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OfflineCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OfflineCommand.java?rev=1494358&r1=1494357&r2=1494358&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OfflineCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OfflineCommand.java Tue Jun 18 22:50:53 2013
@@ -16,10 +16,10 @@
*/
package org.apache.accumulo.core.util.shell.commands;
-import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.util.MetadataTable;
import org.apache.accumulo.core.util.shell.Shell;
public class OfflineCommand extends TableOperation {
@@ -29,8 +29,8 @@ public class OfflineCommand extends Tabl
}
protected void doTableOp(final Shell shellState, final String tableName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
- if (tableName.equals(Constants.METADATA_TABLE_NAME)) {
- Shell.log.info(" You cannot take the " + Constants.METADATA_TABLE_NAME + " offline.");
+ if (tableName.equals(MetadataTable.NAME)) {
+ Shell.log.info(" You cannot take the " + MetadataTable.NAME + " offline.");
} else {
Shell.log.info("Attempting to begin taking " + tableName + " offline");
shellState.getConnector().tableOperations().offline(tableName);
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OnlineCommand.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OnlineCommand.java?rev=1494358&r1=1494357&r2=1494358&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OnlineCommand.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/OnlineCommand.java Tue Jun 18 22:50:53 2013
@@ -16,10 +16,10 @@
*/
package org.apache.accumulo.core.util.shell.commands;
-import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.util.MetadataTable;
import org.apache.accumulo.core.util.shell.Shell;
public class OnlineCommand extends TableOperation {
@@ -29,8 +29,8 @@ public class OnlineCommand extends Table
}
protected void doTableOp(final Shell shellState, final String tableName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
- if (tableName.equals(Constants.METADATA_TABLE_NAME)) {
- Shell.log.info(" The " + Constants.METADATA_TABLE_NAME + " is always online.");
+ if (tableName.equals(MetadataTable.NAME)) {
+ Shell.log.info(" The " + MetadataTable.NAME + " is always online.");
} else {
Shell.log.info("Attempting to begin bringing " + tableName + " online");
shellState.getConnector().tableOperations().online(tableName);
Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java?rev=1494358&r1=1494357&r2=1494358&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java (original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java Tue Jun 18 22:50:53 2013
@@ -31,7 +31,6 @@ import java.util.TreeMap;
import junit.framework.TestCase;
-import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.Connector;
@@ -51,12 +50,13 @@ import org.apache.accumulo.core.data.Val
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.RootTable;
import org.apache.hadoop.io.Text;
public class TabletLocatorImplTest extends TestCase {
- private static final KeyExtent RTE = Constants.ROOT_TABLET_EXTENT;
- private static final KeyExtent MTE = new KeyExtent(new Text(Constants.METADATA_TABLE_ID), null, RTE.getEndRow());
+ private static final KeyExtent RTE = RootTable.ROOT_TABLET_EXTENT;
+ private static final KeyExtent MTE = new KeyExtent(new Text(MetadataTable.ID), null, RTE.getEndRow());
private static TCredentials credential = null;
static KeyExtent nke(String t, String er, String per) {
@@ -138,7 +138,7 @@ public class TabletLocatorImplTest exten
TestInstance testInstance = new TestInstance("instance1", "tserver1");
RootTabletLocator rtl = new RootTabletLocator(testInstance);
- TabletLocatorImpl rootTabletCache = new TabletLocatorImpl(new Text(Constants.METADATA_TABLE_ID), rtl, ttlo);
+ TabletLocatorImpl rootTabletCache = new TabletLocatorImpl(new Text(MetadataTable.ID), rtl, ttlo);
TabletLocatorImpl tab1TabletCache = new TabletLocatorImpl(new Text(table), rootTabletCache, ttlo);
setLocation(tservers, rootTabLoc, RTE, MTE, metaTabLoc);
@@ -606,11 +606,11 @@ public class TabletLocatorImplTest exten
if (location != null) {
if (instance == null)
instance = "";
- Key lk = new Key(mr, Constants.METADATA_CURRENT_LOCATION_COLUMN_FAMILY, new Text(instance));
+ Key lk = new Key(mr, MetadataTable.CURRENT_LOCATION_COLUMN_FAMILY, new Text(instance));
tabletData.put(lk, new Value(location.getBytes()));
}
- Key pk = new Key(mr, Constants.METADATA_PREV_ROW_COLUMN.getColumnFamily(), Constants.METADATA_PREV_ROW_COLUMN.getColumnQualifier());
+ Key pk = new Key(mr, MetadataTable.PREV_ROW_COLUMN.getColumnFamily(), MetadataTable.PREV_ROW_COLUMN.getColumnQualifier());
tabletData.put(pk, per);
}
@@ -648,7 +648,7 @@ public class TabletLocatorImplTest exten
TestInstance testInstance = new TestInstance("instance1", "tserver1");
RootTabletLocator rtl = new RootTabletLocator(testInstance);
- TabletLocatorImpl rootTabletCache = new TabletLocatorImpl(new Text(Constants.METADATA_TABLE_ID), rtl, ttlo);
+ TabletLocatorImpl rootTabletCache = new TabletLocatorImpl(new Text(MetadataTable.ID), rtl, ttlo);
TabletLocatorImpl tab1TabletCache = new TabletLocatorImpl(new Text("tab1"), rootTabletCache, ttlo);
locateTabletTest(tab1TabletCache, "r1", null, null, credential);
@@ -726,8 +726,8 @@ public class TabletLocatorImplTest exten
locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver3", credential);
// simulate the !METADATA table splitting
- KeyExtent mte1 = new KeyExtent(new Text(Constants.METADATA_TABLE_ID), tab1e21.getMetadataEntry(), RTE.getEndRow());
- KeyExtent mte2 = new KeyExtent(new Text(Constants.METADATA_TABLE_ID), null, tab1e21.getMetadataEntry());
+ KeyExtent mte1 = new KeyExtent(new Text(MetadataTable.ID), tab1e21.getMetadataEntry(), RTE.getEndRow());
+ KeyExtent mte2 = new KeyExtent(new Text(MetadataTable.ID), null, tab1e21.getMetadataEntry());
setLocation(tservers, "tserver4", RTE, mte1, "tserver5");
setLocation(tservers, "tserver4", RTE, mte2, "tserver6");
@@ -765,8 +765,8 @@ public class TabletLocatorImplTest exten
locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver9", credential);
// simulate a hole in the !METADATA table, caused by a partial split
- KeyExtent mte11 = new KeyExtent(new Text(Constants.METADATA_TABLE_ID), tab1e1.getMetadataEntry(), RTE.getEndRow());
- KeyExtent mte12 = new KeyExtent(new Text(Constants.METADATA_TABLE_ID), tab1e21.getMetadataEntry(), tab1e1.getMetadataEntry());
+ KeyExtent mte11 = new KeyExtent(new Text(MetadataTable.ID), tab1e1.getMetadataEntry(), RTE.getEndRow());
+ KeyExtent mte12 = new KeyExtent(new Text(MetadataTable.ID), tab1e21.getMetadataEntry(), tab1e1.getMetadataEntry());
deleteServer(tservers, "tserver10");
setLocation(tservers, "tserver4", RTE, mte12, "tserver10");
setLocation(tservers, "tserver10", mte12, tab1e21, "tserver12");
@@ -1172,15 +1172,15 @@ public class TabletLocatorImplTest exten
public void testBug1() throws Exception {
// a bug that occurred while running continuous ingest
- KeyExtent mte1 = new KeyExtent(new Text(Constants.METADATA_TABLE_ID), new Text("0;0bc"), RTE.getEndRow());
- KeyExtent mte2 = new KeyExtent(new Text(Constants.METADATA_TABLE_ID), null, new Text("0;0bc"));
+ KeyExtent mte1 = new KeyExtent(new Text(MetadataTable.ID), new Text("0;0bc"), RTE.getEndRow());
+ KeyExtent mte2 = new KeyExtent(new Text(MetadataTable.ID), null, new Text("0;0bc"));
TServers tservers = new TServers();
TestTabletLocationObtainer ttlo = new TestTabletLocationObtainer(tservers);
TestInstance testInstance = new TestInstance("instance1", "tserver1");
RootTabletLocator rtl = new RootTabletLocator(testInstance);
- TabletLocatorImpl rootTabletCache = new TabletLocatorImpl(new Text(Constants.METADATA_TABLE_ID), rtl, ttlo);
+ TabletLocatorImpl rootTabletCache = new TabletLocatorImpl(new Text(MetadataTable.ID), rtl, ttlo);
TabletLocatorImpl tab0TabletCache = new TabletLocatorImpl(new Text("0"), rootTabletCache, ttlo);
setLocation(tservers, "tserver1", RTE, mte1, "tserver2");
@@ -1199,15 +1199,15 @@ public class TabletLocatorImplTest exten
public void testBug2() throws Exception {
// a bug that occurred while running a functional test
- KeyExtent mte1 = new KeyExtent(new Text(Constants.METADATA_TABLE_ID), new Text("~"), RTE.getEndRow());
- KeyExtent mte2 = new KeyExtent(new Text(Constants.METADATA_TABLE_ID), null, new Text("~"));
+ KeyExtent mte1 = new KeyExtent(new Text(MetadataTable.ID), new Text("~"), RTE.getEndRow());
+ KeyExtent mte2 = new KeyExtent(new Text(MetadataTable.ID), null, new Text("~"));
TServers tservers = new TServers();
TestTabletLocationObtainer ttlo = new TestTabletLocationObtainer(tservers);
TestInstance testInstance = new TestInstance("instance1", "tserver1");
RootTabletLocator rtl = new RootTabletLocator(testInstance);
- TabletLocatorImpl rootTabletCache = new TabletLocatorImpl(new Text(Constants.METADATA_TABLE_ID), rtl, ttlo);
+ TabletLocatorImpl rootTabletCache = new TabletLocatorImpl(new Text(MetadataTable.ID), rtl, ttlo);
TabletLocatorImpl tab0TabletCache = new TabletLocatorImpl(new Text("0"), rootTabletCache, ttlo);
setLocation(tservers, "tserver1", RTE, mte1, "tserver2");
@@ -1224,11 +1224,11 @@ public class TabletLocatorImplTest exten
// this test reproduces a problem where empty metadata tablets, that were created by user tablets being merged away, caused locating tablets to fail
public void testBug3() throws Exception {
- KeyExtent mte1 = new KeyExtent(new Text(Constants.METADATA_TABLE_ID), new Text("1;c"), RTE.getEndRow());
- KeyExtent mte2 = new KeyExtent(new Text(Constants.METADATA_TABLE_ID), new Text("1;f"), new Text("1;c"));
- KeyExtent mte3 = new KeyExtent(new Text(Constants.METADATA_TABLE_ID), new Text("1;j"), new Text("1;f"));
- KeyExtent mte4 = new KeyExtent(new Text(Constants.METADATA_TABLE_ID), new Text("1;r"), new Text("1;j"));
- KeyExtent mte5 = new KeyExtent(new Text(Constants.METADATA_TABLE_ID), null, new Text("1;r"));
+ KeyExtent mte1 = new KeyExtent(new Text(MetadataTable.ID), new Text("1;c"), RTE.getEndRow());
+ KeyExtent mte2 = new KeyExtent(new Text(MetadataTable.ID), new Text("1;f"), new Text("1;c"));
+ KeyExtent mte3 = new KeyExtent(new Text(MetadataTable.ID), new Text("1;j"), new Text("1;f"));
+ KeyExtent mte4 = new KeyExtent(new Text(MetadataTable.ID), new Text("1;r"), new Text("1;j"));
+ KeyExtent mte5 = new KeyExtent(new Text(MetadataTable.ID), null, new Text("1;r"));
KeyExtent ke1 = new KeyExtent(new Text("1"), null, null);
@@ -1238,7 +1238,7 @@ public class TabletLocatorImplTest exten
RootTabletLocator rtl = new RootTabletLocator(testInstance);
- TabletLocatorImpl rootTabletCache = new TabletLocatorImpl(new Text(Constants.METADATA_TABLE_ID), rtl, ttlo);
+ TabletLocatorImpl rootTabletCache = new TabletLocatorImpl(new Text(MetadataTable.ID), rtl, ttlo);
TabletLocatorImpl tab0TabletCache = new TabletLocatorImpl(new Text("1"), rootTabletCache, ttlo);
setLocation(tservers, "tserver1", RTE, mte1, "tserver2");
Modified: accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java?rev=1494358&r1=1494357&r2=1494358&view=diff
==============================================================================
--- accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java (original)
+++ accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java Tue Jun 18 22:50:53 2013
@@ -40,7 +40,6 @@ import java.util.Set;
import java.util.TreeMap;
import java.util.UUID;
-import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.security.tokens.PasswordToken;
import org.apache.accumulo.core.conf.DefaultConfiguration;
import org.apache.accumulo.core.conf.Property;
@@ -51,6 +50,7 @@ import org.apache.accumulo.core.iterator
import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
import org.apache.accumulo.core.iterators.user.SummingCombiner;
import org.apache.accumulo.core.iterators.user.VersioningIterator;
+import org.apache.accumulo.core.util.MetadataTable;
import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.examples.simple.constraints.NumericValueConstraint;
import org.apache.accumulo.minicluster.MiniAccumuloCluster;
@@ -1111,7 +1111,7 @@ public class SimpleTest {
ScanOptions opt = new ScanOptions();
opt.range = new Range(start, true, end, false);
opt.columns = Collections.singletonList(new ScanColumn(s2bb("file")));
- String scanner = client.createScanner(creds, Constants.METADATA_TABLE_NAME, opt);
+ String scanner = client.createScanner(creds, MetadataTable.NAME, opt);
int result = 0;
while (true) {
ScanResult more = client.nextK(scanner, 100);
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/ServerConstants.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/ServerConstants.java?rev=1494358&r1=1494357&r2=1494358&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/ServerConstants.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/ServerConstants.java Tue Jun 18 22:50:53 2013
@@ -16,10 +16,9 @@
*/
package org.apache.accumulo.server;
-import static org.apache.accumulo.core.Constants.METADATA_TABLE_ID;
-import static org.apache.accumulo.core.Constants.ZROOT_TABLET;
-
import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.util.MetadataTable;
+import org.apache.accumulo.core.util.RootTable;
import org.apache.accumulo.server.conf.ServerConfiguration;
import org.apache.hadoop.fs.Path;
@@ -56,15 +55,15 @@ public class ServerConstants {
}
public static String getMetadataTableDir() {
- return getTablesDir() + "/" + METADATA_TABLE_ID;
+ return getTablesDir() + "/" + MetadataTable.ID;
}
public static String getRootTableDir() {
- return getTablesDir() + "/" + METADATA_TABLE_ID;
+ return getTablesDir() + "/" + MetadataTable.ID;
}
public static String getRootTabletDir() {
- return getRootTableDir() + ZROOT_TABLET;
+ return getRootTableDir() + RootTable.ZROOT_TABLET;
}
}
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/client/BulkImporter.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/client/BulkImporter.java?rev=1494358&r1=1494357&r2=1494358&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/client/BulkImporter.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/client/BulkImporter.java Tue Jun 18 22:50:53 2013
@@ -32,7 +32,6 @@ import java.util.concurrent.ExecutorServ
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
-import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.Instance;
@@ -56,6 +55,7 @@ import org.apache.accumulo.core.security
import org.apache.accumulo.core.tabletserver.thrift.TabletClientService;
import org.apache.accumulo.core.util.CachedConfiguration;
import org.apache.accumulo.core.util.LoggingRunnable;
+import org.apache.accumulo.core.util.MetadataTable;
import org.apache.accumulo.core.util.NamingThreadFactory;
import org.apache.accumulo.core.util.StopWatch;
import org.apache.accumulo.core.util.ThriftUtil;
@@ -281,7 +281,7 @@ public class BulkImporter {
log.debug("BULK IMPORT TIMING STATISTICS");
log.debug(String.format("Examine map files : %,10.2f secs %6.2f%s", timer.getSecs(Timers.EXAMINE_MAP_FILES), 100.0 * timer.get(Timers.EXAMINE_MAP_FILES)
/ timer.get(Timers.TOTAL), "%"));
- log.debug(String.format("Query %-14s : %,10.2f secs %6.2f%s", Constants.METADATA_TABLE_NAME, timer.getSecs(Timers.QUERY_METADATA),
+ log.debug(String.format("Query %-14s : %,10.2f secs %6.2f%s", MetadataTable.NAME, timer.getSecs(Timers.QUERY_METADATA),
100.0 * timer.get(Timers.QUERY_METADATA) / timer.get(Timers.TOTAL), "%"));
log.debug(String.format("Import Map Files : %,10.2f secs %6.2f%s", timer.getSecs(Timers.IMPORT_MAP_FILES), 100.0 * timer.get(Timers.IMPORT_MAP_FILES)
/ timer.get(Timers.TOTAL), "%"));
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java?rev=1494358&r1=1494357&r2=1494358&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java Tue Jun 18 22:50:53 2013
@@ -36,6 +36,7 @@ import org.apache.accumulo.core.security
import org.apache.accumulo.core.security.thrift.TCredentials;
import org.apache.accumulo.core.util.ByteBufferUtil;
import org.apache.accumulo.core.util.OpTimer;
+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.zookeeper.ZooUtil;
@@ -80,7 +81,7 @@ public class HdfsZooInstance implements
@Override
public String getRootTabletLocation() {
- String zRootLocPath = ZooUtil.getRoot(this) + Constants.ZROOT_TABLET_LOCATION;
+ String zRootLocPath = ZooUtil.getRoot(this) + RootTable.ZROOT_TABLET_LOCATION;
OpTimer opTimer = new OpTimer(log, Level.TRACE).start("Looking up root tablet location in zoocache.");
Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java?rev=1494358&r1=1494357&r2=1494358&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java Tue Jun 18 22:50:53 2013
@@ -29,6 +29,7 @@ import org.apache.accumulo.core.data.Key
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.util.ColumnFQ;
+import org.apache.accumulo.core.util.MetadataTable;
import org.apache.accumulo.core.util.MetadataTable.DataFileValue;
import org.apache.accumulo.core.zookeeper.ZooUtil;
import org.apache.accumulo.fate.zookeeper.TransactionWatcher.Arbitrator;
@@ -54,14 +55,14 @@ public class MetadataConstraints impleme
}
}
- private static final HashSet<ColumnFQ> validColumnQuals = new HashSet<ColumnFQ>(Arrays.asList(new ColumnFQ[] {Constants.METADATA_PREV_ROW_COLUMN,
- Constants.METADATA_OLD_PREV_ROW_COLUMN, Constants.METADATA_DIRECTORY_COLUMN, Constants.METADATA_SPLIT_RATIO_COLUMN, Constants.METADATA_TIME_COLUMN,
- Constants.METADATA_LOCK_COLUMN, Constants.METADATA_FLUSH_COLUMN, Constants.METADATA_COMPACT_COLUMN}));
-
- private static final HashSet<Text> validColumnFams = new HashSet<Text>(Arrays.asList(new Text[] {Constants.METADATA_BULKFILE_COLUMN_FAMILY,
- Constants.METADATA_LOG_COLUMN_FAMILY, Constants.METADATA_SCANFILE_COLUMN_FAMILY, Constants.METADATA_DATAFILE_COLUMN_FAMILY,
- Constants.METADATA_CURRENT_LOCATION_COLUMN_FAMILY, Constants.METADATA_LAST_LOCATION_COLUMN_FAMILY, Constants.METADATA_FUTURE_LOCATION_COLUMN_FAMILY,
- Constants.METADATA_CHOPPED_COLUMN_FAMILY, Constants.METADATA_CLONED_COLUMN_FAMILY}));
+ private static final HashSet<ColumnFQ> validColumnQuals = new HashSet<ColumnFQ>(Arrays.asList(new ColumnFQ[] {MetadataTable.PREV_ROW_COLUMN,
+ MetadataTable.OLD_PREV_ROW_COLUMN, MetadataTable.DIRECTORY_COLUMN, MetadataTable.SPLIT_RATIO_COLUMN, MetadataTable.TIME_COLUMN,
+ MetadataTable.LOCK_COLUMN, MetadataTable.FLUSH_COLUMN, MetadataTable.COMPACT_COLUMN}));
+
+ private static final HashSet<Text> validColumnFams = new HashSet<Text>(Arrays.asList(new Text[] {MetadataTable.BULKFILE_COLUMN_FAMILY,
+ MetadataTable.LOG_COLUMN_FAMILY, MetadataTable.SCANFILE_COLUMN_FAMILY, MetadataTable.DATAFILE_COLUMN_FAMILY,
+ MetadataTable.CURRENT_LOCATION_COLUMN_FAMILY, MetadataTable.LAST_LOCATION_COLUMN_FAMILY, MetadataTable.FUTURE_LOCATION_COLUMN_FAMILY,
+ MetadataTable.CHOPPED_COLUMN_FAMILY, MetadataTable.CLONED_COLUMN_FAMILY}));
private static boolean isValidColumn(ColumnUpdate cu) {
@@ -138,7 +139,7 @@ public class MetadataConstraints impleme
}
// ensure row is not less than Constants.METADATA_TABLE_ID
- if (new Text(row).compareTo(new Text(Constants.METADATA_TABLE_ID)) < 0) {
+ if (new Text(row).compareTo(new Text(MetadataTable.ID)) < 0) {
violations = addViolation(violations, 5);
}
@@ -154,11 +155,11 @@ public class MetadataConstraints impleme
continue;
}
- if (columnUpdate.getValue().length == 0 && !columnFamily.equals(Constants.METADATA_SCANFILE_COLUMN_FAMILY)) {
+ if (columnUpdate.getValue().length == 0 && !columnFamily.equals(MetadataTable.SCANFILE_COLUMN_FAMILY)) {
violations = addViolation(violations, 6);
}
- if (columnFamily.equals(Constants.METADATA_DATAFILE_COLUMN_FAMILY)) {
+ if (columnFamily.equals(MetadataTable.DATAFILE_COLUMN_FAMILY)) {
try {
DataFileValue dfv = new DataFileValue(columnUpdate.getValue());
@@ -170,9 +171,9 @@ public class MetadataConstraints impleme
} catch (ArrayIndexOutOfBoundsException aiooe) {
violations = addViolation(violations, 1);
}
- } else if (columnFamily.equals(Constants.METADATA_SCANFILE_COLUMN_FAMILY)) {
+ } else if (columnFamily.equals(MetadataTable.SCANFILE_COLUMN_FAMILY)) {
- } else if (columnFamily.equals(Constants.METADATA_BULKFILE_COLUMN_FAMILY)) {
+ } else if (columnFamily.equals(MetadataTable.BULKFILE_COLUMN_FAMILY)) {
if (!columnUpdate.isDeleted() && !checkedBulk) {
// splits, which also write the time reference, are allowed to write this reference even when
// the transaction is not running because the other half of the tablet is holding a reference
@@ -190,13 +191,13 @@ public class MetadataConstraints impleme
int otherTidCount = 0;
for (ColumnUpdate update : mutation.getUpdates()) {
- if (new ColumnFQ(update).equals(Constants.METADATA_DIRECTORY_COLUMN)) {
+ if (new ColumnFQ(update).equals(MetadataTable.DIRECTORY_COLUMN)) {
isSplitMutation = true;
- } else if (new Text(update.getColumnFamily()).equals(Constants.METADATA_CURRENT_LOCATION_COLUMN_FAMILY)) {
+ } else if (new Text(update.getColumnFamily()).equals(MetadataTable.CURRENT_LOCATION_COLUMN_FAMILY)) {
isLocationMutation = true;
- } else if (new Text(update.getColumnFamily()).equals(Constants.METADATA_DATAFILE_COLUMN_FAMILY)) {
+ } else if (new Text(update.getColumnFamily()).equals(MetadataTable.DATAFILE_COLUMN_FAMILY)) {
dataFiles.add(new Text(update.getColumnQualifier()));
- } else if (new Text(update.getColumnFamily()).equals(Constants.METADATA_BULKFILE_COLUMN_FAMILY)) {
+ } else if (new Text(update.getColumnFamily()).equals(MetadataTable.BULKFILE_COLUMN_FAMILY)) {
loadedFiles.add(new Text(update.getColumnQualifier()));
if (!new String(update.getValue()).equals(tidString)) {
@@ -222,7 +223,7 @@ public class MetadataConstraints impleme
} else {
if (!isValidColumn(columnUpdate)) {
violations = addViolation(violations, 2);
- } else if (new ColumnFQ(columnUpdate).equals(Constants.METADATA_PREV_ROW_COLUMN) && columnUpdate.getValue().length > 0
+ } else if (new ColumnFQ(columnUpdate).equals(MetadataTable.PREV_ROW_COLUMN) && columnUpdate.getValue().length > 0
&& (violations == null || !violations.contains((short) 4))) {
KeyExtent ke = new KeyExtent(new Text(mutation.getRow()), (Text) null);
@@ -233,7 +234,7 @@ public class MetadataConstraints impleme
if (!prevEndRowLessThanEndRow) {
violations = addViolation(violations, 3);
}
- } else if (new ColumnFQ(columnUpdate).equals(Constants.METADATA_LOCK_COLUMN)) {
+ } else if (new ColumnFQ(columnUpdate).equals(MetadataTable.LOCK_COLUMN)) {
if (zooCache == null) {
zooCache = new ZooCache();
}
@@ -284,9 +285,9 @@ public class MetadataConstraints impleme
case 4:
return "Invalid metadata row format";
case 5:
- return "Row can not be less than " + Constants.METADATA_TABLE_ID;
+ return "Row can not be less than " + MetadataTable.ID;
case 6:
- return "Empty values are not allowed for any " + Constants.METADATA_TABLE_NAME + " column";
+ return "Empty values are not allowed for any " + MetadataTable.NAME + " column";
case 7:
return "Lock not held in zookeeper by writer";
case 8: