Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6733F18152 for ; Sat, 20 Feb 2016 02:58:36 +0000 (UTC) Received: (qmail 55652 invoked by uid 500); 20 Feb 2016 02:58:36 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 55552 invoked by uid 500); 20 Feb 2016 02:58:36 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 55332 invoked by uid 99); 20 Feb 2016 02:58:35 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 20 Feb 2016 02:58:35 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D4D76E0AA0; Sat, 20 Feb 2016 02:58:35 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ctubbsii@apache.org To: commits@accumulo.apache.org Date: Sat, 20 Feb 2016 02:58:39 -0000 Message-Id: <55b610c552594f76baf8466c917972a1@git.apache.org> In-Reply-To: <13ee6fd4d2114449bea6c61c6f0198a3@git.apache.org> References: <13ee6fd4d2114449bea6c61c6f0198a3@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [5/5] accumulo git commit: ACCUMULO-4145 Eliminate Text wrapping of tableIDs ACCUMULO-4145 Eliminate Text wrapping of tableIDs Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/a14bc292 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/a14bc292 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/a14bc292 Branch: refs/heads/master Commit: a14bc292d2271a4d369d2b3f04cd49e6efc36280 Parents: e205502 Author: Christopher Tubbs Authored: Thu Feb 18 18:56:54 2016 -0500 Committer: Christopher Tubbs Committed: Fri Feb 19 21:57:30 2016 -0500 ---------------------------------------------------------------------- .../core/client/impl/ActiveCompactionImpl.java | 5 +- .../core/client/impl/ActiveScanImpl.java | 9 +- .../core/client/impl/BatchWriterImpl.java | 12 +- .../core/client/impl/ConditionalWriterImpl.java | 2 +- .../client/impl/MultiTableBatchWriterImpl.java | 10 +- .../core/client/impl/OfflineIterator.java | 4 +- .../client/impl/ReplicationOperationsImpl.java | 22 +- .../accumulo/core/client/impl/ScannerImpl.java | 11 +- .../core/client/impl/ScannerIterator.java | 5 +- .../core/client/impl/TableOperationsImpl.java | 14 +- .../core/client/impl/TabletLocator.java | 14 +- .../core/client/impl/TabletLocatorImpl.java | 6 +- .../client/impl/TabletServerBatchReader.java | 10 +- .../impl/TabletServerBatchReaderIterator.java | 25 +- .../client/impl/TabletServerBatchWriter.java | 24 +- .../core/client/impl/ThriftScanner.java | 23 +- .../accumulo/core/client/impl/Writer.java | 22 +- .../client/mapred/AccumuloOutputFormat.java | 5 +- .../client/mapreduce/AccumuloOutputFormat.java | 5 +- .../mapreduce/lib/impl/InputConfigurator.java | 6 +- .../client/mock/impl/MockTabletLocator.java | 2 +- .../apache/accumulo/core/data/KeyExtent.java | 12 +- .../accumulo/core/data/impl/KeyExtent.java | 58 +-- .../accumulo/core/data/impl/TabletIdImpl.java | 4 +- .../accumulo/core/metadata/RootTable.java | 5 +- .../core/metadata/schema/MetadataSchema.java | 12 +- .../core/replication/ReplicationSchema.java | 27 +- .../org/apache/accumulo/core/util/Merge.java | 2 +- .../client/impl/TableOperationsImplTest.java | 3 +- .../core/client/impl/TabletLocatorImplTest.java | 56 +-- .../accumulo/core/data/KeyExtentTest.java | 8 +- .../apache/accumulo/core/data/RangeTest.java | 21 +- .../accumulo/core/file/rfile/RFileTest.java | 4 +- .../core/iterators/IteratorUtilTest.java | 11 +- .../iterators/system/MultiIteratorTest.java | 6 +- .../ReplicationConfigurationUtilTest.java | 12 +- .../core/replication/ReplicationSchemaTest.java | 14 +- .../apache/accumulo/core/util/MergeTest.java | 2 +- .../simple/client/RandomBatchWriter.java | 5 +- .../examples/simple/client/RowOperations.java | 10 +- .../simple/mapreduce/TeraSortIngest.java | 6 +- .../examples/simple/shard/ContinuousQuery.java | 4 +- .../accumulo/server/client/BulkImporter.java | 2 +- .../server/conf/ServerConfigurationFactory.java | 2 +- .../server/conf/TableConfiguration.java | 16 +- .../apache/accumulo/server/fs/VolumeUtil.java | 2 +- .../apache/accumulo/server/init/Initialize.java | 2 +- .../server/master/balancer/GroupBalancer.java | 5 +- .../master/balancer/TableLoadBalancer.java | 4 +- .../master/state/TabletStateChangeIterator.java | 9 +- .../accumulo/server/problems/ProblemReport.java | 36 +- .../problems/ProblemReportingIterator.java | 12 +- .../tabletserver/LargestFirstMemoryManager.java | 9 +- .../org/apache/accumulo/server/util/Admin.java | 12 +- .../server/util/CheckForMetadataProblems.java | 2 +- .../server/util/FindOfflineTablets.java | 6 +- .../server/util/MasterMetadataUtil.java | 4 +- .../accumulo/server/util/MetadataTableUtil.java | 39 +- .../util/RemoveEntriesForMissingFiles.java | 3 +- .../server/util/ReplicationTableUtil.java | 6 +- .../accumulo/server/util/TableDiskUsage.java | 3 +- .../accumulo/server/util/TabletIterator.java | 7 +- .../server/client/BulkImporterTest.java | 11 +- .../balancer/ChaoticLoadBalancerTest.java | 6 +- .../balancer/DefaultLoadBalancerTest.java | 12 +- .../master/balancer/GroupBalancerTest.java | 2 +- .../master/balancer/TableLoadBalancerTest.java | 6 +- .../server/master/state/MergeInfoTest.java | 24 +- .../server/problems/ProblemReportTest.java | 44 +-- .../problems/ProblemReportingIteratorTest.java | 4 +- .../accumulo/server/util/AdminCommandsTest.java | 2 +- .../server/util/ReplicationTableUtilTest.java | 6 +- .../accumulo/gc/GarbageCollectionTest.java | 4 +- .../java/org/apache/accumulo/master/Master.java | 39 +- .../master/MasterClientServiceHandler.java | 2 +- .../accumulo/master/TabletGroupWatcher.java | 24 +- .../master/replication/FinishedWorkUpdater.java | 4 +- .../master/replication/StatusMaker.java | 10 +- .../accumulo/master/replication/WorkMaker.java | 8 +- .../accumulo/master/state/MergeStats.java | 2 +- .../accumulo/master/state/TableStats.java | 13 +- .../accumulo/master/tableOps/CleanUp.java | 3 +- .../master/tableOps/CompactionDriver.java | 2 +- .../accumulo/master/tableOps/CopyFailed.java | 3 +- .../master/tableOps/PopulateMetadata.java | 3 +- .../master/tableOps/PopulateMetadataTable.java | 2 +- .../accumulo/master/tableOps/TableRangeOp.java | 10 +- .../master/tableOps/TableRangeOpWait.java | 9 +- .../master/tableOps/WriteExportFiles.java | 5 +- .../master/state/RootTabletStateStoreTest.java | 3 +- .../monitor/servlets/TServersServlet.java | 2 +- .../monitor/servlets/TablesServlet.java | 4 +- .../org/apache/accumulo/monitor/util/Table.java | 20 +- .../org/apache/accumulo/tracer/TraceServer.java | 18 +- .../apache/accumulo/tserver/FileManager.java | 6 +- .../apache/accumulo/tserver/TabletServer.java | 29 +- .../compaction/MajorCompactionRequest.java | 9 - .../accumulo/tserver/logger/LogReader.java | 2 +- .../replication/AccumuloReplicaSystem.java | 6 +- .../tserver/session/SessionManager.java | 11 +- .../accumulo/tserver/tablet/Compactor.java | 4 +- .../tserver/tablet/DatafileManager.java | 6 +- .../accumulo/tserver/tablet/MinorCompactor.java | 12 +- .../apache/accumulo/tserver/tablet/Tablet.java | 9 +- .../accumulo/tserver/AssignmentWatcherTest.java | 3 +- .../tserver/CheckTabletMetadataTest.java | 6 +- .../tserver/LargestFirstMemoryManagerTest.java | 4 +- .../DefaultCompactionStrategyTest.java | 3 +- .../SizeLimitCompactionStrategyTest.java | 3 +- .../ConfigurableCompactionStrategyTest.java | 3 +- .../accumulo/tserver/log/LogEntryTest.java | 2 +- .../tserver/log/SortedLogRecoveryTest.java | 2 +- .../accumulo/tserver/logger/LogFileTest.java | 2 +- .../replication/AccumuloReplicaSystemTest.java | 14 +- .../java/org/apache/accumulo/test/CloneIT.java | 18 +- .../accumulo/test/ConditionalWriterIT.java | 22 +- .../org/apache/accumulo/test/LocatorIT.java | 2 +- .../test/MasterRepairsDualAssignmentIT.java | 4 +- .../accumulo/test/MetaConstraintRetryIT.java | 3 +- .../MissingWalHeaderCompletesRecoveryIT.java | 6 +- .../accumulo/test/QueryMetadataTable.java | 2 +- .../apache/accumulo/test/SplitRecoveryIT.java | 4 +- .../java/org/apache/accumulo/test/VolumeIT.java | 4 +- .../apache/accumulo/test/WrongTabletTest.java | 2 +- .../continuous/ContinuousStatsCollector.java | 3 +- .../accumulo/test/functional/CompactionIT.java | 5 +- .../test/functional/MasterAssignmentIT.java | 3 +- .../accumulo/test/functional/MergeIT.java | 6 +- .../accumulo/test/functional/SplitIT.java | 3 +- .../test/functional/SplitRecoveryIT.java | 4 +- .../accumulo/test/functional/TableIT.java | 3 +- .../functional/TabletStateChangeIteratorIT.java | 8 +- .../CloseWriteAheadLogReferencesIT.java | 2 +- .../accumulo/test/master/MergeStateIT.java | 2 +- .../metadata/MetadataBatchScanTest.java | 2 +- .../performance/scan/CollectTabletStats.java | 2 +- .../test/performance/thrift/NullTserver.java | 3 +- .../accumulo/test/proxy/SimpleProxyBase.java | 364 +++++++++---------- .../RemoveCompleteReplicationRecordsIT.java | 27 +- .../test/replication/ReplicationIT.java | 5 +- .../ReplicationOperationsImplIT.java | 46 +-- .../replication/SequentialWorkAssignerIT.java | 16 +- .../test/replication/StatusCombinerMacIT.java | 5 +- .../test/replication/StatusMakerIT.java | 6 +- .../replication/UnorderedWorkAssignerIT.java | 4 +- ...UnusedWalDoesntCloseReplicationStatusIT.java | 4 +- 146 files changed, 827 insertions(+), 905 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/a14bc292/core/src/main/java/org/apache/accumulo/core/client/impl/ActiveCompactionImpl.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ActiveCompactionImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ActiveCompactionImpl.java index 1e429c8..838baa9 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/ActiveCompactionImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ActiveCompactionImpl.java @@ -28,6 +28,7 @@ import org.apache.accumulo.core.data.TabletId; import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.data.impl.TabletIdImpl; import org.apache.accumulo.core.data.thrift.IterInfo; +import org.apache.hadoop.io.Text; /** * @@ -45,14 +46,14 @@ public class ActiveCompactionImpl extends ActiveCompaction { @Override public String getTable() throws TableNotFoundException { - return Tables.getTableName(instance, new KeyExtent(tac.getExtent()).getTableId().toString()); + return Tables.getTableName(instance, new KeyExtent(tac.getExtent()).getTableId()); } @Override @Deprecated public org.apache.accumulo.core.data.KeyExtent getExtent() { KeyExtent ke = new KeyExtent(tac.getExtent()); - org.apache.accumulo.core.data.KeyExtent oke = new org.apache.accumulo.core.data.KeyExtent(ke.getTableId(), ke.getEndRow(), ke.getPrevEndRow()); + org.apache.accumulo.core.data.KeyExtent oke = new org.apache.accumulo.core.data.KeyExtent(new Text(ke.getTableId()), ke.getEndRow(), ke.getPrevEndRow()); return oke; } http://git-wip-us.apache.org/repos/asf/accumulo/blob/a14bc292/core/src/main/java/org/apache/accumulo/core/client/impl/ActiveScanImpl.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ActiveScanImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ActiveScanImpl.java index 429f8cd..7015303 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/ActiveScanImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ActiveScanImpl.java @@ -32,6 +32,7 @@ import org.apache.accumulo.core.data.impl.TabletIdImpl; import org.apache.accumulo.core.data.thrift.IterInfo; import org.apache.accumulo.core.data.thrift.TColumn; import org.apache.accumulo.core.security.Authorizations; +import org.apache.hadoop.io.Text; /** * A class that contains information about an ActiveScan @@ -42,7 +43,7 @@ public class ActiveScanImpl extends ActiveScan { private long scanId; private String client; - private String table; + private String tableName; private long age; private long idle; private ScanType type; @@ -60,7 +61,7 @@ public class ActiveScanImpl extends ActiveScan { this.user = activeScan.user; this.age = activeScan.age; this.idle = activeScan.idleTime; - this.table = Tables.getTableName(instance, activeScan.tableId); + this.tableName = Tables.getTableName(instance, activeScan.tableId); this.type = ScanType.valueOf(activeScan.getType().name()); this.state = ScanState.valueOf(activeScan.state.name()); this.extent = new KeyExtent(activeScan.extent); @@ -95,7 +96,7 @@ public class ActiveScanImpl extends ActiveScan { @Override public String getTable() { - return table; + return tableName; } @Override @@ -121,7 +122,7 @@ public class ActiveScanImpl extends ActiveScan { @Override @Deprecated public org.apache.accumulo.core.data.KeyExtent getExtent() { - return new org.apache.accumulo.core.data.KeyExtent(extent.getTableId(), extent.getEndRow(), extent.getPrevEndRow()); + return new org.apache.accumulo.core.data.KeyExtent(new Text(extent.getTableId()), extent.getEndRow(), extent.getPrevEndRow()); } @Override http://git-wip-us.apache.org/repos/asf/accumulo/blob/a14bc292/core/src/main/java/org/apache/accumulo/core/client/impl/BatchWriterImpl.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/BatchWriterImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/BatchWriterImpl.java index c173333..7096187 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/BatchWriterImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/BatchWriterImpl.java @@ -25,28 +25,28 @@ import org.apache.accumulo.core.data.Mutation; public class BatchWriterImpl implements BatchWriter { - private final String table; + private final String tableId; private final TabletServerBatchWriter bw; - public BatchWriterImpl(ClientContext context, String table, BatchWriterConfig config) { + public BatchWriterImpl(ClientContext context, String tableId, BatchWriterConfig config) { checkArgument(context != null, "context is null"); - checkArgument(table != null, "table is null"); + checkArgument(tableId != null, "tableId is null"); if (config == null) config = new BatchWriterConfig(); - this.table = table; + this.tableId = tableId; this.bw = new TabletServerBatchWriter(context, config); } @Override public void addMutation(Mutation m) throws MutationsRejectedException { checkArgument(m != null, "m is null"); - bw.addMutation(table, m); + bw.addMutation(tableId, m); } @Override public void addMutations(Iterable iterable) throws MutationsRejectedException { checkArgument(iterable != null, "iterable is null"); - bw.addMutation(table, iterable.iterator()); + bw.addMutation(tableId, iterable.iterator()); } @Override http://git-wip-us.apache.org/repos/asf/accumulo/blob/a14bc292/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java index c9ef101..00140e9 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java @@ -388,7 +388,7 @@ class ConditionalWriterImpl implements ConditionalWriter { this.auths = config.getAuthorizations(); this.ve = new VisibilityEvaluator(config.getAuthorizations()); this.threadPool = new ScheduledThreadPoolExecutor(config.getMaxWriteThreads(), new NamingThreadFactory(this.getClass().getSimpleName())); - this.locator = TabletLocator.getLocator(context, new Text(tableId)); + this.locator = TabletLocator.getLocator(context, tableId); this.serverQueues = new HashMap(); this.tableId = tableId; this.timeout = config.getTimeout(TimeUnit.MILLISECONDS); http://git-wip-us.apache.org/repos/asf/accumulo/blob/a14bc292/core/src/main/java/org/apache/accumulo/core/client/impl/MultiTableBatchWriterImpl.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/MultiTableBatchWriterImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/MultiTableBatchWriterImpl.java index 5d13eda..6f700a3 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/MultiTableBatchWriterImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/MultiTableBatchWriterImpl.java @@ -53,21 +53,21 @@ public class MultiTableBatchWriterImpl implements MultiTableBatchWriter { private class TableBatchWriter implements BatchWriter { - private String table; + private String tableId; - TableBatchWriter(String table) { - this.table = table; + TableBatchWriter(String tableId) { + this.tableId = tableId; } @Override public void addMutation(Mutation m) throws MutationsRejectedException { checkArgument(m != null, "m is null"); - bw.addMutation(table, m); + bw.addMutation(tableId, m); } @Override public void addMutations(Iterable iterable) throws MutationsRejectedException { - bw.addMutation(table, iterable.iterator()); + bw.addMutation(tableId, iterable.iterator()); } @Override http://git-wip-us.apache.org/repos/asf/accumulo/blob/a14bc292/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineIterator.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineIterator.java b/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineIterator.java index 9cce089..487af11 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineIterator.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineIterator.java @@ -221,7 +221,7 @@ class OfflineIterator implements Iterator> { else startRow = new Text(); - nextRange = new Range(new KeyExtent(new Text(tableId), startRow, null).getMetadataEntry(), true, null, false); + nextRange = new Range(new KeyExtent(tableId, startRow, null).getMetadataEntry(), true, null, false); } else { if (currentExtent.getEndRow() == null) { @@ -256,7 +256,7 @@ class OfflineIterator implements Iterator> { KeyExtent extent = eloc.getFirst(); - if (!extent.getTableId().toString().equals(tableId)) { + if (!extent.getTableId().equals(tableId)) { throw new AccumuloException(" did not find tablets for table " + tableId + " " + extent); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/a14bc292/core/src/main/java/org/apache/accumulo/core/client/impl/ReplicationOperationsImpl.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ReplicationOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ReplicationOperationsImpl.java index 25d26a8..ab6160e 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/ReplicationOperationsImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ReplicationOperationsImpl.java @@ -16,6 +16,7 @@ */ package org.apache.accumulo.core.client.impl; +import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly; import static java.util.Objects.requireNonNull; import java.util.Collections; @@ -51,8 +52,6 @@ import org.apache.hadoop.io.Text; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly; - public class ReplicationOperationsImpl implements ReplicationOperations { private static final Logger log = LoggerFactory.getLogger(ReplicationOperationsImpl.class); @@ -118,22 +117,22 @@ public class ReplicationOperationsImpl implements ReplicationOperations { }); } - protected Text getTableId(Connector conn, String tableName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { + protected String getTableId(Connector conn, String tableName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { TableOperations tops = conn.tableOperations(); if (!conn.tableOperations().exists(tableName)) { throw new TableNotFoundException(null, tableName, null); } - String strTableId = null; - while (null == strTableId) { - strTableId = tops.tableIdMap().get(tableName); - if (null == strTableId) { + String tableId = null; + while (null == tableId) { + tableId = tops.tableIdMap().get(tableName); + if (null == tableId) { sleepUninterruptibly(200, TimeUnit.MILLISECONDS); } } - return new Text(strTableId); + return tableId; } @Override @@ -143,13 +142,13 @@ public class ReplicationOperationsImpl implements ReplicationOperations { log.debug("Collecting referenced files for replication of table {}", tableName); Connector conn = context.getConnector(); - Text tableId = getTableId(conn, tableName); + String tableId = getTableId(conn, tableName); log.debug("Found id of {} for name {}", tableId, tableName); // Get the WALs currently referenced by the table BatchScanner metaBs = conn.createBatchScanner(MetadataTable.NAME, Authorizations.EMPTY, 4); - metaBs.setRanges(Collections.singleton(MetadataSchema.TabletsSection.getRange(tableId.toString()))); + metaBs.setRanges(Collections.singleton(MetadataSchema.TabletsSection.getRange(tableId))); metaBs.fetchColumnFamily(LogColumnFamily.NAME); Set wals = new HashSet<>(); try { @@ -168,8 +167,7 @@ public class ReplicationOperationsImpl implements ReplicationOperations { try { Text buffer = new Text(); for (Entry entry : metaBs) { - ReplicationSection.getTableId(entry.getKey(), buffer); - if (buffer.equals(tableId)) { + if (tableId.equals(ReplicationSection.getTableId(entry.getKey()))) { ReplicationSection.getFile(entry.getKey(), buffer); wals.add(buffer.toString()); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/a14bc292/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerImpl.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerImpl.java index 09edc4a..89406f4 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerImpl.java @@ -28,7 +28,6 @@ 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.hadoop.io.Text; /** * provides scanner functionality @@ -47,7 +46,7 @@ public class ScannerImpl extends ScannerOptions implements Scanner { private final ClientContext context; private Authorizations authorizations; - private Text table; + private String tableId; private int size; @@ -55,12 +54,12 @@ public class ScannerImpl extends ScannerOptions implements Scanner { private boolean isolated = false; private long readaheadThreshold = Constants.SCANNER_DEFAULT_READAHEAD_THRESHOLD; - public ScannerImpl(ClientContext context, String table, Authorizations authorizations) { + public ScannerImpl(ClientContext context, String tableId, Authorizations authorizations) { checkArgument(context != null, "context is null"); - checkArgument(table != null, "table is null"); + checkArgument(tableId != null, "tableId is null"); checkArgument(authorizations != null, "authorizations is null"); this.context = context; - this.table = new Text(table); + this.tableId = tableId; this.range = new Range((Key) null, (Key) null); this.authorizations = authorizations; @@ -93,7 +92,7 @@ public class ScannerImpl extends ScannerOptions implements Scanner { @Override public synchronized Iterator> iterator() { - return new ScannerIterator(context, table, authorizations, range, size, getTimeOut(), this, isolated, readaheadThreshold); + return new ScannerIterator(context, tableId, authorizations, range, size, getTimeOut(), this, isolated, readaheadThreshold); } @Override http://git-wip-us.apache.org/repos/asf/accumulo/blob/a14bc292/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerIterator.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerIterator.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerIterator.java index d6512f0..18b90e0 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerIterator.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerIterator.java @@ -40,7 +40,6 @@ 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.NamingThreadFactory; -import org.apache.hadoop.io.Text; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -49,7 +48,6 @@ public class ScannerIterator implements Iterator> { private static final Logger log = LoggerFactory.getLogger(ScannerIterator.class); // scanner options - private Text tableId; private int timeOut; // scanner state @@ -106,9 +104,8 @@ public class ScannerIterator implements Iterator> { } - ScannerIterator(ClientContext context, Text table, Authorizations authorizations, Range range, int size, int timeOut, ScannerOptions options, + ScannerIterator(ClientContext context, String tableId, Authorizations authorizations, Range range, int size, int timeOut, ScannerOptions options, boolean isolated, long readaheadThreshold) { - this.tableId = new Text(table); this.timeOut = timeOut; this.readaheadThreshold = readaheadThreshold; http://git-wip-us.apache.org/repos/asf/accumulo/blob/a14bc292/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java index d3d38bf..5a685d8 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java @@ -442,7 +442,7 @@ public class TableOperationsImpl extends TableOperationsHelper { private void addSplits(String tableName, SortedSet partitionKeys, String tableId) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, AccumuloServerException { - TabletLocator tabLocator = TabletLocator.getLocator(context, new Text(tableId)); + TabletLocator tabLocator = TabletLocator.getLocator(context, tableId); for (Text split : partitionKeys) { boolean successful = false; @@ -984,7 +984,7 @@ public class TableOperationsImpl extends TableOperationsHelper { Random random = new Random(); Map>> binnedRanges = new HashMap>>(); String tableId = Tables.getTableId(context.getInstance(), tableName); - TabletLocator tl = TabletLocator.getLocator(context, new Text(tableId)); + TabletLocator tl = TabletLocator.getLocator(context, tableId); // its possible that the cache could contain complete, but old information about a tables tablets... so clear it tl.invalidateCache(); while (!tl.binRanges(context, Collections.singletonList(range), binnedRanges).isEmpty()) { @@ -1106,9 +1106,9 @@ public class TableOperationsImpl extends TableOperationsHelper { } } - Range range = new KeyExtent(new Text(tableId), null, null).toMetadataRange(); + Range range = new KeyExtent(tableId, null, null).toMetadataRange(); if (startRow == null || lastRow == null) - range = new KeyExtent(new Text(tableId), null, null).toMetadataRange(); + range = new KeyExtent(tableId, null, null).toMetadataRange(); else range = new Range(startRow, lastRow); @@ -1163,7 +1163,7 @@ public class TableOperationsImpl extends TableOperationsHelper { serverCounts.increment(future, 1); } - if (!extent.getTableId().toString().equals(tableId)) { + if (!extent.getTableId().equals(tableId)) { throw new AccumuloException("Saw unexpected table Id " + tableId + " " + extent); } @@ -1264,7 +1264,7 @@ public class TableOperationsImpl extends TableOperationsHelper { @Override public void clearLocatorCache(String tableName) throws TableNotFoundException { checkArgument(tableName != null, "tableName is null"); - TabletLocator tabLocator = TabletLocator.getLocator(context, new Text(Tables.getTableId(context.getInstance(), tableName))); + TabletLocator tabLocator = TabletLocator.getLocator(context, Tables.getTableId(context.getInstance(), tableName)); tabLocator.invalidateCache(); } @@ -1590,7 +1590,7 @@ public class TableOperationsImpl extends TableOperationsHelper { requireNonNull(ranges, "ranges must be non null"); String tableId = Tables.getTableId(context.getInstance(), tableName); - TabletLocator locator = TabletLocator.getLocator(context, new Text(tableId)); + TabletLocator locator = TabletLocator.getLocator(context, tableId); List rangeList = null; if (ranges instanceof List) { http://git-wip-us.apache.org/repos/asf/accumulo/blob/a14bc292/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java index 1fbaee8..4a28bff 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java @@ -65,9 +65,9 @@ public abstract class TabletLocator { private static class LocatorKey { String instanceId; - Text tableName; + String tableName; - LocatorKey(String instanceId, Text table) { + LocatorKey(String instanceId, String table) { this.instanceId = instanceId; this.tableName = table; } @@ -96,19 +96,19 @@ public abstract class TabletLocator { locators.clear(); } - public static synchronized TabletLocator getLocator(ClientContext context, Text tableId) { + public static synchronized TabletLocator getLocator(ClientContext context, String tableId) { Instance instance = context.getInstance(); LocatorKey key = new LocatorKey(instance.getInstanceID(), tableId); TabletLocator tl = locators.get(key); if (tl == null) { MetadataLocationObtainer mlo = new MetadataLocationObtainer(); - if (tableId.toString().equals(RootTable.ID)) { + if (RootTable.ID.equals(tableId)) { tl = new RootTabletLocator(new ZookeeperLockChecker(instance)); - } else if (tableId.toString().equals(MetadataTable.ID)) { - tl = new TabletLocatorImpl(new Text(MetadataTable.ID), getLocator(context, new Text(RootTable.ID)), mlo, new ZookeeperLockChecker(instance)); + } else if (MetadataTable.ID.equals(tableId)) { + tl = new TabletLocatorImpl(MetadataTable.ID, getLocator(context, RootTable.ID), mlo, new ZookeeperLockChecker(instance)); } else { - tl = new TabletLocatorImpl(tableId, getLocator(context, new Text(MetadataTable.ID)), mlo, new ZookeeperLockChecker(instance)); + tl = new TabletLocatorImpl(tableId, getLocator(context, MetadataTable.ID), mlo, new ZookeeperLockChecker(instance)); } locators.put(key, tl); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/a14bc292/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocatorImpl.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocatorImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocatorImpl.java index 16ef8e8..1422b0c 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocatorImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocatorImpl.java @@ -88,7 +88,7 @@ public class TabletLocatorImpl extends TabletLocator { static final EndRowComparator endRowComparator = new EndRowComparator(); - protected Text tableId; + protected String tableId; protected TabletLocator parent; protected TreeMap metaCache = new TreeMap(endRowComparator); protected TabletLocationObtainer locationObtainer; @@ -152,8 +152,8 @@ public class TabletLocatorImpl extends TabletLocator { } } - public TabletLocatorImpl(Text table, TabletLocator parent, TabletLocationObtainer tlo, TabletServerLockChecker tslc) { - this.tableId = table; + public TabletLocatorImpl(String tableId, TabletLocator parent, TabletLocationObtainer tlo, TabletServerLockChecker tslc) { + this.tableId = tableId; this.parent = parent; this.locationObtainer = tlo; this.lockChecker = tslc; http://git-wip-us.apache.org/repos/asf/accumulo/blob/a14bc292/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReader.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReader.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReader.java index 6d09936..ce28f8b 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReader.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReader.java @@ -36,7 +36,7 @@ import org.slf4j.LoggerFactory; public class TabletServerBatchReader extends ScannerOptions implements BatchScanner { private static final Logger log = LoggerFactory.getLogger(TabletServerBatchReader.class); - private String table; + private String tableId; private int numThreads; private ExecutorService queryThreadPool; @@ -54,13 +54,13 @@ public class TabletServerBatchReader extends ScannerOptions implements BatchScan private final int batchReaderInstance = getNextBatchReaderInstance(); - public TabletServerBatchReader(ClientContext context, String table, Authorizations authorizations, int numQueryThreads) { + public TabletServerBatchReader(ClientContext context, String tableId, Authorizations authorizations, int numQueryThreads) { checkArgument(context != null, "context is null"); - checkArgument(table != null, "table is null"); + checkArgument(tableId != null, "tableId is null"); checkArgument(authorizations != null, "authorizations is null"); this.context = context; this.authorizations = authorizations; - this.table = table; + this.tableId = tableId; this.numThreads = numQueryThreads; queryThreadPool = new SimpleThreadPool(numQueryThreads, "batch scanner " + batchReaderInstance + "-"); @@ -112,6 +112,6 @@ public class TabletServerBatchReader extends ScannerOptions implements BatchScan throw new IllegalStateException("batch reader closed"); } - return new TabletServerBatchReaderIterator(context, table, authorizations, ranges, numThreads, queryThreadPool, this, timeOut); + return new TabletServerBatchReaderIterator(context, tableId, authorizations, ranges, numThreads, queryThreadPool, this, timeOut); } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/a14bc292/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java index 814e71b..13e52c0 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java @@ -65,7 +65,6 @@ import org.apache.accumulo.core.tabletserver.thrift.TabletClientService; import org.apache.accumulo.core.trace.Tracer; import org.apache.accumulo.core.util.ByteBufferUtil; import org.apache.accumulo.core.util.OpTimer; -import org.apache.hadoop.io.Text; import org.apache.htrace.wrappers.TraceRunnable; import org.apache.thrift.TApplicationException; import org.apache.thrift.TException; @@ -82,7 +81,7 @@ public class TabletServerBatchReaderIterator implements Iterator> entries); } - public TabletServerBatchReaderIterator(ClientContext context, String table, Authorizations authorizations, ArrayList ranges, int numThreads, + public TabletServerBatchReaderIterator(ClientContext context, String tableId, Authorizations authorizations, ArrayList ranges, int numThreads, ExecutorService queryThreadPool, ScannerOptions scannerOptions, long timeout) { this.context = context; this.instance = context.getInstance(); - this.table = table; + this.tableId = tableId; this.authorizations = authorizations; this.numThreads = numThreads; this.queryThreadPool = queryThreadPool; this.options = new ScannerOptions(scannerOptions); resultsQueue = new ArrayBlockingQueue>>(numThreads); - this.locator = new TimeoutTabletLocator(TabletLocator.getLocator(context, new Text(table)), timeout); + this.locator = new TimeoutTabletLocator(TabletLocator.getLocator(context, tableId), timeout); timeoutTrackers = Collections.synchronizedMap(new HashMap()); timedoutServers = Collections.synchronizedSet(new HashSet()); @@ -242,10 +241,10 @@ public class TabletServerBatchReaderIterator implements Iterator= lastFailureSize) - if (!Tables.exists(instance, table)) - throw new TableDeletedException(table); - else if (Tables.getTableState(instance, table) == TableState.OFFLINE) - throw new TableOfflineException(instance, table); + if (!Tables.exists(instance, tableId)) + throw new TableDeletedException(tableId); + else if (Tables.getTableState(instance, tableId) == TableState.OFFLINE) + throw new TableOfflineException(instance, tableId); lastFailureSize = failures.size(); @@ -313,7 +312,7 @@ public class TabletServerBatchReaderIterator implements Iterator tableIds = new HashSet(); for (KeyExtent ke : authorizationFailures.keySet()) - tableIds.add(ke.getTableId().toString()); + tableIds.add(ke.getTableId()); Tables.clearCache(context.getInstance()); for (String tableId : tableIds) @@ -593,7 +592,7 @@ public class TabletServerBatchWriter { synchronized void add(String location, TabletServerMutations tsm) { init(); for (Entry> entry : tsm.getMutations().entrySet()) { - recentFailures.addAll(entry.getKey().getTableId().toString(), entry.getValue()); + recentFailures.addAll(entry.getKey().getTableId(), entry.getValue()); } } @@ -644,7 +643,7 @@ public class TabletServerBatchWriter { private TabletLocator getLocator(String tableId) { TabletLocator ret = locators.get(tableId); if (ret == null) { - ret = TabletLocator.getLocator(context, new Text(tableId)); + ret = TabletLocator.getLocator(context, tableId); ret = new TimeoutTabletLocator(ret, timeout); locators.put(tableId, ret); } @@ -686,8 +685,7 @@ public class TabletServerBatchWriter { // assume an IOError communicating with metadata tablet failedMutations.add(mutationsToProcess); } catch (AccumuloSecurityException e) { - updateAuthorizationFailures(Collections.singletonMap(new KeyExtent(new Text(tableId), null, null), - SecurityErrorCode.valueOf(e.getSecurityErrorCode().name()))); + updateAuthorizationFailures(Collections.singletonMap(new KeyExtent(tableId, null, null), SecurityErrorCode.valueOf(e.getSecurityErrorCode().name()))); } catch (TableDeletedException e) { updateUnknownErrors(e.getMessage(), e); } catch (TableOfflineException e) { @@ -843,10 +841,10 @@ public class TabletServerBatchWriter { HashSet tables = new HashSet(); for (KeyExtent ke : mutationBatch.keySet()) - tables.add(ke.getTableId().toString()); + tables.add(ke.getTableId()); for (String table : tables) - TabletLocator.getLocator(context, new Text(table)).invalidateCache(context.getInstance(), location); + TabletLocator.getLocator(context, table).invalidateCache(context.getInstance(), location); failedMutations.add(location, tsm); } finally { @@ -882,8 +880,8 @@ public class TabletServerBatchWriter { try { client.update(tinfo, context.rpcCreds(), entry.getKey().toThrift(), entry.getValue().get(0).toThrift(), DurabilityImpl.toThrift(durability)); } catch (NotServingTabletException e) { - allFailures.addAll(entry.getKey().getTableId().toString(), entry.getValue()); - TabletLocator.getLocator(context, new Text(entry.getKey().getTableId())).invalidateCache(entry.getKey()); + allFailures.addAll(entry.getKey().getTableId(), entry.getValue()); + TabletLocator.getLocator(context, entry.getKey().getTableId()).invalidateCache(entry.getKey()); } catch (ConstraintViolationException e) { updatedConstraintViolations(Translator.translate(e.violationSummaries, Translators.TCVST)); } @@ -922,12 +920,12 @@ public class TabletServerBatchWriter { int numCommitted = (int) (long) entry.getValue(); totalCommitted += numCommitted; - String table = failedExtent.getTableId().toString(); + String tableId = failedExtent.getTableId(); - TabletLocator.getLocator(context, new Text(table)).invalidateCache(failedExtent); + TabletLocator.getLocator(context, tableId).invalidateCache(failedExtent); ArrayList mutations = (ArrayList) tabMuts.get(failedExtent); - allFailures.addAll(table, mutations.subList(numCommitted, mutations.size())); + allFailures.addAll(tableId, mutations.subList(numCommitted, mutations.size())); } if (failures.keySet().containsAll(tabMuts.keySet()) && totalCommitted == 0) { http://git-wip-us.apache.org/repos/asf/accumulo/blob/a14bc292/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java index 57f5102..ed8e95a 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java @@ -136,7 +136,7 @@ public class ThriftScanner { public static class ScanState { boolean isolated; - Text tableId; + String tableId; Text startRow; boolean skipStartRow; long readaheadThreshold; @@ -163,7 +163,7 @@ public class ThriftScanner { SamplerConfiguration samplerConfig; - public ScanState(ClientContext context, Text tableId, Authorizations authorizations, Range range, SortedSet fetchedColumns, int size, + public ScanState(ClientContext context, String tableId, Authorizations authorizations, Range range, SortedSet fetchedColumns, int size, List serverSideIteratorList, Map> serverSideIteratorOptions, boolean isolated, long readaheadThreshold, SamplerConfiguration samplerConfig, long batchTimeOut, String classLoaderContext) { this.context = context; @@ -245,10 +245,10 @@ public class ThriftScanner { loc = TabletLocator.getLocator(context, scanState.tableId).locateTablet(context, scanState.startRow, scanState.skipStartRow, false); if (loc == null) { - if (!Tables.exists(instance, scanState.tableId.toString())) - throw new TableDeletedException(scanState.tableId.toString()); - else if (Tables.getTableState(instance, scanState.tableId.toString()) == TableState.OFFLINE) - throw new TableOfflineException(instance, scanState.tableId.toString()); + if (!Tables.exists(instance, scanState.tableId)) + throw new TableDeletedException(scanState.tableId); + else if (Tables.getTableState(instance, scanState.tableId) == TableState.OFFLINE) + throw new TableOfflineException(instance, scanState.tableId); error = "Failed to locate tablet for table : " + scanState.tableId + " row : " + scanState.startRow; if (!error.equals(lastError)) @@ -296,15 +296,14 @@ public class ThriftScanner { results = scan(loc, scanState, context); } catch (AccumuloSecurityException e) { Tables.clearCache(instance); - if (!Tables.exists(instance, scanState.tableId.toString())) - throw new TableDeletedException(scanState.tableId.toString()); - e.setTableInfo(Tables.getPrintableTableInfoFromId(instance, scanState.tableId.toString())); + if (!Tables.exists(instance, scanState.tableId)) + throw new TableDeletedException(scanState.tableId); + e.setTableInfo(Tables.getPrintableTableInfoFromId(instance, scanState.tableId)); throw e; } catch (TApplicationException tae) { throw new AccumuloServerException(loc.tablet_location, tae); } catch (TSampleNotPresentException tsnpe) { - String message = "Table " + Tables.getPrintableTableInfoFromId(instance, scanState.tableId.toString()) - + " does not have sampling configured or built"; + String message = "Table " + Tables.getPrintableTableInfoFromId(instance, scanState.tableId) + " does not have sampling configured or built"; throw new SampleNotPresentException(message, tsnpe); } catch (NotServingTabletException e) { error = "Scan failed, not serving tablet " + loc; @@ -442,7 +441,7 @@ public class ThriftScanner { client.closeScan(tinfo, is.scanID); } else { - // log.debug("Calling continue scan : "+scanState.range+" loc = "+loc); + // log.debug("Calling continue scan : "+scanState.range+" loc = "+loc); String msg = "Continuing scan tserver=" + loc.tablet_location + " scanid=" + scanState.scanID; Thread.currentThread().setName(msg); http://git-wip-us.apache.org/repos/asf/accumulo/blob/a14bc292/core/src/main/java/org/apache/accumulo/core/client/impl/Writer.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/Writer.java b/core/src/main/java/org/apache/accumulo/core/client/impl/Writer.java index b8ce516..90691ef 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/Writer.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Writer.java @@ -17,6 +17,7 @@ package org.apache.accumulo.core.client.impl; import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly; import static java.nio.charset.StandardCharsets.UTF_8; import java.util.concurrent.TimeUnit; @@ -41,24 +42,19 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.net.HostAndPort; -import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly; public class Writer { private static final Logger log = LoggerFactory.getLogger(Writer.class); private ClientContext context; - private Text table; + private String tableId; - public Writer(ClientContext context, Text table) { + public Writer(ClientContext context, String tableId) { checkArgument(context != null, "context is null"); - checkArgument(table != null, "table is null"); + checkArgument(tableId != null, "tableId is null"); this.context = context; - this.table = table; - } - - public Writer(ClientContext context, String table) { - this(context, new Text(table)); + this.tableId = tableId; } private static void updateServer(ClientContext context, Mutation m, KeyExtent extent, HostAndPort server) throws TException, NotServingTabletException, @@ -87,7 +83,7 @@ public class Writer { throw new IllegalArgumentException("Can not add empty mutations"); while (true) { - TabletLocation tabLoc = TabletLocator.getLocator(context, table).locateTablet(context, new Text(m.getRow()), false, true); + TabletLocation tabLoc = TabletLocator.getLocator(context, tableId).locateTablet(context, new Text(m.getRow()), false, true); if (tabLoc == null) { log.trace("No tablet location found for row " + new String(m.getRow(), UTF_8)); @@ -101,15 +97,15 @@ public class Writer { return; } catch (NotServingTabletException e) { log.trace("Not serving tablet, server = " + parsedLocation); - TabletLocator.getLocator(context, table).invalidateCache(tabLoc.tablet_extent); + TabletLocator.getLocator(context, tableId).invalidateCache(tabLoc.tablet_extent); } catch (ConstraintViolationException cve) { log.error("error sending update to " + parsedLocation + ": " + cve); // probably do not need to invalidate cache, but it does not hurt - TabletLocator.getLocator(context, table).invalidateCache(tabLoc.tablet_extent); + TabletLocator.getLocator(context, tableId).invalidateCache(tabLoc.tablet_extent); throw cve; } catch (TException e) { log.error("error sending update to " + parsedLocation + ": " + e); - TabletLocator.getLocator(context, table).invalidateCache(tabLoc.tablet_extent); + TabletLocator.getLocator(context, tableId).invalidateCache(tabLoc.tablet_extent); } sleepUninterruptibly(500, TimeUnit.MILLISECONDS); http://git-wip-us.apache.org/repos/asf/accumulo/blob/a14bc292/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormat.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormat.java b/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormat.java index c24557a..461bdc0 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormat.java +++ b/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormat.java @@ -545,10 +545,11 @@ public class AccumuloOutputFormat implements OutputFormat { if (e.getSecurityErrorCodes().size() >= 0) { HashMap> tables = new HashMap>(); for (Entry> ke : e.getSecurityErrorCodes().entrySet()) { - Set secCodes = tables.get(ke.getKey().getTableId().toString()); + String tableId = ke.getKey().getTableId().toString(); + Set secCodes = tables.get(tableId); if (secCodes == null) { secCodes = new HashSet(); - tables.put(ke.getKey().getTableId().toString(), secCodes); + tables.put(tableId, secCodes); } secCodes.addAll(ke.getValue()); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/a14bc292/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java index 42bd243..fa926b6 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java +++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java @@ -544,10 +544,11 @@ public class AccumuloOutputFormat extends OutputFormat { if (e.getSecurityErrorCodes().size() >= 0) { HashMap> tables = new HashMap>(); for (Entry> ke : e.getSecurityErrorCodes().entrySet()) { - Set secCodes = tables.get(ke.getKey().getTableId().toString()); + String tableId = ke.getKey().getTableId().toString(); + Set secCodes = tables.get(tableId); if (secCodes == null) { secCodes = new HashSet(); - tables.put(ke.getKey().getTableId().toString(), secCodes); + tables.put(tableId, secCodes); } secCodes.addAll(ke.getValue()); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/a14bc292/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java index 175abbf..4cc3055 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java +++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java @@ -683,7 +683,7 @@ public class InputConfigurator extends ConfiguratorBase { ClientConfiguration clientConf = getClientConfiguration(implementingClass, conf); ClientContext context = new ClientContext(instance, new Credentials(getPrincipal(implementingClass, conf), getAuthenticationToken(implementingClass, conf)), clientConf); - return TabletLocator.getLocator(context, new Text(tableId)); + return TabletLocator.getLocator(context, tableId); } /** @@ -869,7 +869,7 @@ public class InputConfigurator extends ConfiguratorBase { else startRow = new Text(); - Range metadataRange = new Range(new KeyExtent(new Text(tableId), startRow, null).getMetadataEntry(), true, null, false); + Range metadataRange = new Range(new KeyExtent(tableId, startRow, null).getMetadataEntry(), true, null, false); Scanner scanner = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY); MetadataSchema.TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.fetch(scanner); scanner.fetchColumnFamily(MetadataSchema.TabletsSection.LastLocationColumnFamily.NAME); @@ -907,7 +907,7 @@ public class InputConfigurator extends ConfiguratorBase { if (location != null) return null; - if (!extent.getTableId().toString().equals(tableId)) { + if (!extent.getTableId().equals(tableId)) { throw new AccumuloException("Saw unexpected table Id " + tableId + " " + extent); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/a14bc292/core/src/main/java/org/apache/accumulo/core/client/mock/impl/MockTabletLocator.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/mock/impl/MockTabletLocator.java b/core/src/main/java/org/apache/accumulo/core/client/mock/impl/MockTabletLocator.java index 9936709..1046a8d 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/mock/impl/MockTabletLocator.java +++ b/core/src/main/java/org/apache/accumulo/core/client/mock/impl/MockTabletLocator.java @@ -57,7 +57,7 @@ public class MockTabletLocator extends TabletLocator { @Override public List binRanges(ClientContext context, List ranges, Map>> binnedRanges) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { - binnedRanges.put("", Collections.singletonMap(new KeyExtent(new Text(), null, null), ranges)); + binnedRanges.put("", Collections.singletonMap(new KeyExtent("", null, null), ranges)); return Collections.emptyList(); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/a14bc292/core/src/main/java/org/apache/accumulo/core/data/KeyExtent.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/data/KeyExtent.java b/core/src/main/java/org/apache/accumulo/core/data/KeyExtent.java index 7bbb0c2..4e3d058 100644 --- a/core/src/main/java/org/apache/accumulo/core/data/KeyExtent.java +++ b/core/src/main/java/org/apache/accumulo/core/data/KeyExtent.java @@ -51,11 +51,11 @@ public class KeyExtent implements WritableComparable { } public KeyExtent(Text table, Text endRow, Text prevEndRow) { - this.wrapped = new org.apache.accumulo.core.data.impl.KeyExtent(table, endRow, prevEndRow); + this.wrapped = new org.apache.accumulo.core.data.impl.KeyExtent(table.toString(), endRow, prevEndRow); } public KeyExtent(KeyExtent extent) { - this.wrapped = new org.apache.accumulo.core.data.impl.KeyExtent(extent.getTableId(), extent.getEndRow(), extent.getPrevEndRow()); + this.wrapped = new org.apache.accumulo.core.data.impl.KeyExtent(extent.getTableId().toString(), extent.getEndRow(), extent.getPrevEndRow()); } public KeyExtent(TKeyExtent tke) { @@ -78,11 +78,11 @@ public class KeyExtent implements WritableComparable { } public void setTableId(Text tId) { - wrapped.setTableId(tId); + wrapped.setTableId(tId.toString()); } public Text getTableId() { - return wrapped.getTableId(); + return new Text(wrapped.getTableId()); } public void setEndRow(Text endRow) { @@ -189,7 +189,7 @@ public class KeyExtent implements WritableComparable { } private static KeyExtent wrap(org.apache.accumulo.core.data.impl.KeyExtent ke) { - return new KeyExtent(ke.getTableId(), ke.getEndRow(), ke.getPrevEndRow()); + return new KeyExtent(new Text(ke.getTableId()), ke.getEndRow(), ke.getPrevEndRow()); } private static SortedSet wrap(Collection unwrapped) { @@ -202,7 +202,7 @@ public class KeyExtent implements WritableComparable { } public static Text getMetadataEntry(Text tableId, Text endRow) { - return MetadataSchema.TabletsSection.getRow(tableId, endRow); + return MetadataSchema.TabletsSection.getRow(tableId.toString(), endRow); } /** http://git-wip-us.apache.org/repos/asf/accumulo/blob/a14bc292/core/src/main/java/org/apache/accumulo/core/data/impl/KeyExtent.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/data/impl/KeyExtent.java b/core/src/main/java/org/apache/accumulo/core/data/impl/KeyExtent.java index d2ae00b..6cfacb3 100644 --- a/core/src/main/java/org/apache/accumulo/core/data/impl/KeyExtent.java +++ b/core/src/main/java/org/apache/accumulo/core/data/impl/KeyExtent.java @@ -16,12 +16,15 @@ */ package org.apache.accumulo.core.data.impl; +import static java.nio.charset.StandardCharsets.UTF_8; + import java.io.ByteArrayOutputStream; import java.io.DataInput; import java.io.DataOutput; import java.io.DataOutputStream; import java.io.IOException; import java.lang.ref.WeakReference; +import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -55,25 +58,24 @@ import org.apache.hadoop.io.WritableComparable; public class KeyExtent implements WritableComparable { - private static final WeakHashMap> tableIds = new WeakHashMap>(); + private static final WeakHashMap> tableIds = new WeakHashMap<>(); - private static Text dedupeTableId(Text tableId) { + private static String dedupeTableId(String tableId) { synchronized (tableIds) { - WeakReference etir = tableIds.get(tableId); + WeakReference etir = tableIds.get(tableId); if (etir != null) { - Text eti = etir.get(); + String eti = etir.get(); if (eti != null) { return eti; } } - tableId = new Text(tableId); - tableIds.put(tableId, new WeakReference(tableId)); + tableIds.put(tableId, new WeakReference<>(tableId)); return tableId; } } - private Text textTableId; + private String tableId; private Text textEndRow; private Text textPrevEndRow; @@ -95,12 +97,12 @@ public class KeyExtent implements WritableComparable { * */ public KeyExtent() { - this.setTableId(new Text()); + this.setTableId(""); this.setEndRow(new Text(), false, false); this.setPrevEndRow(new Text(), false, false); } - public KeyExtent(Text table, Text endRow, Text prevEndRow) { + public KeyExtent(String table, Text endRow, Text prevEndRow) { this.setTableId(table); this.setEndRow(endRow, false, true); this.setPrevEndRow(prevEndRow, false, true); @@ -110,7 +112,7 @@ public class KeyExtent implements WritableComparable { public KeyExtent(KeyExtent extent) { // extent has already deduped table id, so there is no need to do it again - this.textTableId = extent.textTableId; + this.tableId = extent.tableId; this.setEndRow(extent.getEndRow(), false, true); this.setPrevEndRow(extent.getPrevEndRow(), false, true); @@ -118,7 +120,7 @@ public class KeyExtent implements WritableComparable { } public KeyExtent(TKeyExtent tke) { - this.setTableId(new Text(ByteBufferUtil.toBytes(tke.table))); + this.setTableId(dedupeTableId(new String(ByteBufferUtil.toBytes(tke.table), UTF_8))); this.setEndRow(tke.endRow == null ? null : new Text(ByteBufferUtil.toBytes(tke.endRow)), false, false); this.setPrevEndRow(tke.prevEndRow == null ? null : new Text(ByteBufferUtil.toBytes(tke.prevEndRow)), false, false); @@ -133,7 +135,7 @@ public class KeyExtent implements WritableComparable { return getMetadataEntry(getTableId(), getEndRow()); } - public static Text getMetadataEntry(Text tableId, Text endRow) { + public static Text getMetadataEntry(String tableId, Text endRow) { return MetadataSchema.TabletsSection.getRow(tableId, endRow); } @@ -164,12 +166,12 @@ public class KeyExtent implements WritableComparable { * Sets the extents table id * */ - public void setTableId(Text tId) { + public void setTableId(String tId) { if (tId == null) throw new IllegalArgumentException("null table name not allowed"); - this.textTableId = dedupeTableId(tId); + this.tableId = dedupeTableId(tId); hashCode = 0; } @@ -178,8 +180,8 @@ public class KeyExtent implements WritableComparable { * Returns the extent's table id * */ - public Text getTableId() { - return textTableId; + public String getTableId() { + return tableId; } private void setEndRow(Text endRow, boolean check, boolean copy) { @@ -246,7 +248,7 @@ public class KeyExtent implements WritableComparable { public void readFields(DataInput in) throws IOException { Text tid = new Text(); tid.readFields(in); - setTableId(tid); + setTableId(tid.toString()); boolean hasRow = in.readBoolean(); if (hasRow) { Text er = new Text(); @@ -270,7 +272,7 @@ public class KeyExtent implements WritableComparable { @Override public void write(DataOutput out) throws IOException { - getTableId().write(out); + new Text(getTableId()).write(out); if (getEndRow() != null) { out.writeBoolean(true); getEndRow().write(out); @@ -453,14 +455,14 @@ public class KeyExtent implements WritableComparable { if (!(o instanceof KeyExtent)) return false; KeyExtent oke = (KeyExtent) o; - return textTableId.equals(oke.textTableId) && equals(textEndRow, oke.textEndRow) && equals(textPrevEndRow, oke.textPrevEndRow); + return tableId.equals(oke.tableId) && equals(textEndRow, oke.textEndRow) && equals(textPrevEndRow, oke.textPrevEndRow); } @Override public String toString() { String endRowString; String prevEndRowString; - String tableIdString = getTableId().toString().replaceAll(";", "\\\\;").replaceAll("\\\\", "\\\\\\\\"); + String tableIdString = getTableId().replaceAll(";", "\\\\;").replaceAll("\\\\", "\\\\\\\\"); if (getEndRow() == null) endRowString = "<"; @@ -526,14 +528,12 @@ public class KeyExtent implements WritableComparable { throw new IllegalArgumentException("< must come at end of Metadata row " + flattenedExtent); } - Text tableId = new Text(); - tableId.set(flattenedExtent.getBytes(), 0, flattenedExtent.getLength() - 1); + String tableId = new String(flattenedExtent.getBytes(), 0, flattenedExtent.getLength() - 1, UTF_8); this.setTableId(tableId); this.setEndRow(null, false, false); } else { - Text tableId = new Text(); - tableId.set(flattenedExtent.getBytes(), 0, semiPos); + String tableId = new String(flattenedExtent.getBytes(), 0, semiPos, UTF_8); Text endRow = new Text(); endRow.set(flattenedExtent.getBytes(), semiPos + 1, flattenedExtent.getLength() - (semiPos + 1)); @@ -547,7 +547,7 @@ public class KeyExtent implements WritableComparable { public static byte[] tableOfMetadataRow(Text row) { KeyExtent ke = new KeyExtent(); ke.decodeMetadataRow(row); - return TextUtil.getBytes(ke.getTableId()); + return ke.getTableId().getBytes(UTF_8); } public boolean contains(final ByteSequence bsrow) { @@ -738,8 +738,8 @@ public class KeyExtent implements WritableComparable { } public TKeyExtent toThrift() { - return new TKeyExtent(TextUtil.getByteBuffer(textTableId), textEndRow == null ? null : TextUtil.getByteBuffer(textEndRow), textPrevEndRow == null ? null - : TextUtil.getByteBuffer(textPrevEndRow)); + return new TKeyExtent(ByteBuffer.wrap(tableId.getBytes(UTF_8)), textEndRow == null ? null : TextUtil.getByteBuffer(textEndRow), + textPrevEndRow == null ? null : TextUtil.getByteBuffer(textPrevEndRow)); } public boolean isPreviousExtent(KeyExtent prevExtent) { @@ -759,10 +759,10 @@ public class KeyExtent implements WritableComparable { } public boolean isMeta() { - return getTableId().toString().equals(MetadataTable.ID) || isRootTablet(); + return getTableId().equals(MetadataTable.ID) || isRootTablet(); } public boolean isRootTablet() { - return getTableId().toString().equals(RootTable.ID); + return getTableId().equals(RootTable.ID); } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/a14bc292/core/src/main/java/org/apache/accumulo/core/data/impl/TabletIdImpl.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/data/impl/TabletIdImpl.java b/core/src/main/java/org/apache/accumulo/core/data/impl/TabletIdImpl.java index 41ff3f5..24a7141 100644 --- a/core/src/main/java/org/apache/accumulo/core/data/impl/TabletIdImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/data/impl/TabletIdImpl.java @@ -53,7 +53,7 @@ public class TabletIdImpl implements TabletId { @Deprecated public TabletIdImpl(org.apache.accumulo.core.data.KeyExtent ke) { - this.ke = new KeyExtent(ke.getTableId(), ke.getEndRow(), ke.getPrevEndRow()); + this.ke = new KeyExtent(ke.getTableId().toString(), ke.getEndRow(), ke.getPrevEndRow()); } public TabletIdImpl(KeyExtent ke) { @@ -67,7 +67,7 @@ public class TabletIdImpl implements TabletId { @Override public Text getTableId() { - return ke.getTableId(); + return new Text(ke.getTableId()); } @Override http://git-wip-us.apache.org/repos/asf/accumulo/blob/a14bc292/core/src/main/java/org/apache/accumulo/core/metadata/RootTable.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/metadata/RootTable.java b/core/src/main/java/org/apache/accumulo/core/metadata/RootTable.java index 97d73d1..2052563 100644 --- a/core/src/main/java/org/apache/accumulo/core/metadata/RootTable.java +++ b/core/src/main/java/org/apache/accumulo/core/metadata/RootTable.java @@ -18,7 +18,6 @@ package org.apache.accumulo.core.metadata; import org.apache.accumulo.core.client.impl.Namespaces; import org.apache.accumulo.core.data.impl.KeyExtent; -import org.apache.hadoop.io.Text; /** * @@ -44,7 +43,7 @@ public class RootTable { public static final String ZROOT_TABLET_CURRENT_LOGS = ZROOT_TABLET + "/current_logs"; public static final String ZROOT_TABLET_PATH = ZROOT_TABLET + "/dir"; - public static final KeyExtent EXTENT = new KeyExtent(new Text(ID), null, null); - public static final KeyExtent OLD_EXTENT = new KeyExtent(new Text(MetadataTable.ID), KeyExtent.getMetadataEntry(new Text(MetadataTable.ID), null), null); + public static final KeyExtent EXTENT = new KeyExtent(ID, null, null); + public static final KeyExtent OLD_EXTENT = new KeyExtent(MetadataTable.ID, KeyExtent.getMetadataEntry(MetadataTable.ID, null), null); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/a14bc292/core/src/main/java/org/apache/accumulo/core/metadata/schema/MetadataSchema.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/metadata/schema/MetadataSchema.java b/core/src/main/java/org/apache/accumulo/core/metadata/schema/MetadataSchema.java index 8c2bde5..7426fed 100644 --- a/core/src/main/java/org/apache/accumulo/core/metadata/schema/MetadataSchema.java +++ b/core/src/main/java/org/apache/accumulo/core/metadata/schema/MetadataSchema.java @@ -49,7 +49,7 @@ public class MetadataSchema { return new Range(new Key(tableId + ';'), true, new Key(tableId + '<').followingKey(PartialKey.ROW), false); } - public static Text getRow(Text tableId, Text endRow) { + public static Text getRow(String tableId, Text endRow) { Text entry = new Text(tableId); if (endRow == null) { @@ -247,18 +247,14 @@ public class MetadataSchema { } /** - * Extract the table ID from the colfam into the given {@link Text} + * Extract the table ID from the colfam * * @param k * Key to extract from - * @param buff - * Text to place table ID into */ - public static void getTableId(Key k, Text buff) { + public static String getTableId(Key k) { requireNonNull(k); - requireNonNull(buff); - - k.getColumnQualifier(buff); + return k.getColumnQualifier().toString(); } /** http://git-wip-us.apache.org/repos/asf/accumulo/blob/a14bc292/core/src/main/java/org/apache/accumulo/core/replication/ReplicationSchema.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/replication/ReplicationSchema.java b/core/src/main/java/org/apache/accumulo/core/replication/ReplicationSchema.java index 7e7ae38..94d19b5 100644 --- a/core/src/main/java/org/apache/accumulo/core/replication/ReplicationSchema.java +++ b/core/src/main/java/org/apache/accumulo/core/replication/ReplicationSchema.java @@ -95,27 +95,10 @@ public class ReplicationSchema { * @param k * Key to extract from * @return The table ID - * @see #getTableId(Key,Text) */ public static String getTableId(Key k) { - Text buff = new Text(); - getTableId(k, buff); - return buff.toString(); - } - - /** - * Extract the table ID from the key into the given {@link Text} - * - * @param k - * Key to extract from - * @param buff - * Text to place table ID into - */ - public static void getTableId(Key k, Text buff) { requireNonNull(k); - requireNonNull(buff); - - k.getColumnQualifier(buff); + return k.getColumnQualifier().toString(); } /** @@ -141,8 +124,8 @@ public class ReplicationSchema { scanner.fetchColumnFamily(NAME); } - public static Mutation add(Mutation m, Text tableId, Value v) { - m.put(NAME, tableId, v); + public static Mutation add(Mutation m, String tableId, Value v) { + m.put(NAME, new Text(tableId), v); return m; } } @@ -234,8 +217,8 @@ public class ReplicationSchema { * Serialized Status msg * @return The original Mutation */ - public static Mutation add(Mutation m, Text tableId, Value v) { - m.put(NAME, tableId, v); + public static Mutation add(Mutation m, String tableId, Value v) { + m.put(NAME, new Text(tableId), v); return m; } http://git-wip-us.apache.org/repos/asf/accumulo/blob/a14bc292/core/src/main/java/org/apache/accumulo/core/util/Merge.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/util/Merge.java b/core/src/main/java/org/apache/accumulo/core/util/Merge.java index 9f6f6ab..71f8325 100644 --- a/core/src/main/java/org/apache/accumulo/core/util/Merge.java +++ b/core/src/main/java/org/apache/accumulo/core/util/Merge.java @@ -212,7 +212,7 @@ public class Merge { } catch (Exception e) { throw new MergeException(e); } - scanner.setRange(new KeyExtent(new Text(tableId), end, start).toMetadataRange()); + scanner.setRange(new KeyExtent(tableId, end, start).toMetadataRange()); scanner.fetchColumnFamily(DataFileColumnFamily.NAME); TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.fetch(scanner); final Iterator> iterator = scanner.iterator(); http://git-wip-us.apache.org/repos/asf/accumulo/blob/a14bc292/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsImplTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsImplTest.java b/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsImplTest.java index 7351ede..825060b 100644 --- a/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsImplTest.java +++ b/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsImplTest.java @@ -27,7 +27,6 @@ import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.schema.MetadataSchema; import org.apache.accumulo.core.security.Authorizations; -import org.apache.hadoop.io.Text; import org.easymock.EasyMock; import org.junit.Test; @@ -45,7 +44,7 @@ public class TableOperationsImplTest { Connector connector = EasyMock.createMock(Connector.class); Scanner scanner = EasyMock.createMock(Scanner.class); - Range range = new KeyExtent(new Text("1"), null, null).toMetadataRange(); + Range range = new KeyExtent("1", null, null).toMetadataRange(); String user = "root"; PasswordToken token = new PasswordToken("password"); http://git-wip-us.apache.org/repos/asf/accumulo/blob/a14bc292/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java b/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java index 2e78bd8..a053cef 100644 --- a/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java +++ b/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java @@ -63,10 +63,10 @@ import org.junit.Test; public class TabletLocatorImplTest { private static final KeyExtent RTE = RootTable.EXTENT; - private static final KeyExtent MTE = new KeyExtent(new Text(MetadataTable.ID), null, RTE.getEndRow()); + private static final KeyExtent MTE = new KeyExtent(MetadataTable.ID, null, RTE.getEndRow()); static KeyExtent nke(String t, String er, String per) { - return new KeyExtent(new Text(t), er == null ? null : new Text(er), per == null ? null : new Text(per)); + return new KeyExtent(t, er == null ? null : new Text(er), per == null ? null : new Text(per)); } static Range nr(String k1, boolean si, String k2, boolean ei) { @@ -143,8 +143,8 @@ public class TabletLocatorImplTest { TestTabletLocationObtainer ttlo = new TestTabletLocationObtainer(tservers); RootTabletLocator rtl = new TestRootTabletLocator(); - TabletLocatorImpl rootTabletCache = new TabletLocatorImpl(new Text(MetadataTable.ID), rtl, ttlo, new YesLockChecker()); - TabletLocatorImpl tab1TabletCache = new TabletLocatorImpl(new Text(table), rootTabletCache, ttlo, tslc); + TabletLocatorImpl rootTabletCache = new TabletLocatorImpl(MetadataTable.ID, rtl, ttlo, new YesLockChecker()); + TabletLocatorImpl tab1TabletCache = new TabletLocatorImpl(table, rootTabletCache, ttlo, tslc); setLocation(tservers, rootTabLoc, RTE, MTE, metaTabLoc); @@ -692,8 +692,8 @@ public class TabletLocatorImplTest { TestTabletLocationObtainer ttlo = new TestTabletLocationObtainer(tservers); RootTabletLocator rtl = new TestRootTabletLocator(); - TabletLocatorImpl rootTabletCache = new TabletLocatorImpl(new Text(MetadataTable.ID), rtl, ttlo, new YesLockChecker()); - TabletLocatorImpl tab1TabletCache = new TabletLocatorImpl(new Text("tab1"), rootTabletCache, ttlo, new YesLockChecker()); + TabletLocatorImpl rootTabletCache = new TabletLocatorImpl(MetadataTable.ID, rtl, ttlo, new YesLockChecker()); + TabletLocatorImpl tab1TabletCache = new TabletLocatorImpl("tab1", rootTabletCache, ttlo, new YesLockChecker()); locateTabletTest(tab1TabletCache, "r1", null, null); @@ -770,8 +770,8 @@ public class TabletLocatorImplTest { locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver3"); // simulate the metadata table splitting - KeyExtent mte1 = new KeyExtent(new Text(MetadataTable.ID), tab1e21.getMetadataEntry(), RTE.getEndRow()); - KeyExtent mte2 = new KeyExtent(new Text(MetadataTable.ID), null, tab1e21.getMetadataEntry()); + KeyExtent mte1 = new KeyExtent(MetadataTable.ID, tab1e21.getMetadataEntry(), RTE.getEndRow()); + KeyExtent mte2 = new KeyExtent(MetadataTable.ID, null, tab1e21.getMetadataEntry()); setLocation(tservers, "tserver4", RTE, mte1, "tserver5"); setLocation(tservers, "tserver4", RTE, mte2, "tserver6"); @@ -809,8 +809,8 @@ public class TabletLocatorImplTest { locateTabletTest(tab1TabletCache, "r", tab1e22, "tserver9"); // simulate a hole in the metadata, caused by a partial split - KeyExtent mte11 = new KeyExtent(new Text(MetadataTable.ID), tab1e1.getMetadataEntry(), RTE.getEndRow()); - KeyExtent mte12 = new KeyExtent(new Text(MetadataTable.ID), tab1e21.getMetadataEntry(), tab1e1.getMetadataEntry()); + KeyExtent mte11 = new KeyExtent(MetadataTable.ID, tab1e1.getMetadataEntry(), RTE.getEndRow()); + KeyExtent mte12 = new KeyExtent(MetadataTable.ID, tab1e21.getMetadataEntry(), tab1e1.getMetadataEntry()); deleteServer(tservers, "tserver10"); setLocation(tservers, "tserver4", RTE, mte12, "tserver10"); setLocation(tservers, "tserver10", mte12, tab1e21, "tserver12"); @@ -1228,22 +1228,22 @@ public class TabletLocatorImplTest { @Test public void testBug1() throws Exception { // a bug that occurred while running continuous ingest - 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")); + KeyExtent mte1 = new KeyExtent(MetadataTable.ID, new Text("0;0bc"), RTE.getEndRow()); + KeyExtent mte2 = new KeyExtent(MetadataTable.ID, null, new Text("0;0bc")); TServers tservers = new TServers(); TestTabletLocationObtainer ttlo = new TestTabletLocationObtainer(tservers); RootTabletLocator rtl = new TestRootTabletLocator(); - TabletLocatorImpl rootTabletCache = new TabletLocatorImpl(new Text(MetadataTable.ID), rtl, ttlo, new YesLockChecker()); - TabletLocatorImpl tab0TabletCache = new TabletLocatorImpl(new Text("0"), rootTabletCache, ttlo, new YesLockChecker()); + TabletLocatorImpl rootTabletCache = new TabletLocatorImpl(MetadataTable.ID, rtl, ttlo, new YesLockChecker()); + TabletLocatorImpl tab0TabletCache = new TabletLocatorImpl("0", rootTabletCache, ttlo, new YesLockChecker()); setLocation(tservers, "tserver1", RTE, mte1, "tserver2"); setLocation(tservers, "tserver1", RTE, mte2, "tserver3"); // create two tablets that straddle a metadata split point - KeyExtent ke1 = new KeyExtent(new Text("0"), new Text("0bbf20e"), null); - KeyExtent ke2 = new KeyExtent(new Text("0"), new Text("0bc0756"), new Text("0bbf20e")); + KeyExtent ke1 = new KeyExtent("0", new Text("0bbf20e"), null); + KeyExtent ke2 = new KeyExtent("0", new Text("0bc0756"), new Text("0bbf20e")); setLocation(tservers, "tserver2", mte1, ke1, "tserver4"); setLocation(tservers, "tserver3", mte2, ke2, "tserver5"); @@ -1255,15 +1255,15 @@ public class TabletLocatorImplTest { @Test public void testBug2() throws Exception { // a bug that occurred while running a functional test - KeyExtent mte1 = new KeyExtent(new Text(MetadataTable.ID), new Text("~"), RTE.getEndRow()); - KeyExtent mte2 = new KeyExtent(new Text(MetadataTable.ID), null, new Text("~")); + KeyExtent mte1 = new KeyExtent(MetadataTable.ID, new Text("~"), RTE.getEndRow()); + KeyExtent mte2 = new KeyExtent(MetadataTable.ID, null, new Text("~")); TServers tservers = new TServers(); TestTabletLocationObtainer ttlo = new TestTabletLocationObtainer(tservers); RootTabletLocator rtl = new TestRootTabletLocator(); - TabletLocatorImpl rootTabletCache = new TabletLocatorImpl(new Text(MetadataTable.ID), rtl, ttlo, new YesLockChecker()); - TabletLocatorImpl tab0TabletCache = new TabletLocatorImpl(new Text("0"), rootTabletCache, ttlo, new YesLockChecker()); + TabletLocatorImpl rootTabletCache = new TabletLocatorImpl(MetadataTable.ID, rtl, ttlo, new YesLockChecker()); + TabletLocatorImpl tab0TabletCache = new TabletLocatorImpl("0", rootTabletCache, ttlo, new YesLockChecker()); setLocation(tservers, "tserver1", RTE, mte1, "tserver2"); setLocation(tservers, "tserver1", RTE, mte2, "tserver3"); @@ -1280,21 +1280,21 @@ public class TabletLocatorImplTest { // this test reproduces a problem where empty metadata tablets, that were created by user tablets being merged away, caused locating tablets to fail @Test public void testBug3() throws Exception { - 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 mte1 = new KeyExtent(MetadataTable.ID, new Text("1;c"), RTE.getEndRow()); + KeyExtent mte2 = new KeyExtent(MetadataTable.ID, new Text("1;f"), new Text("1;c")); + KeyExtent mte3 = new KeyExtent(MetadataTable.ID, new Text("1;j"), new Text("1;f")); + KeyExtent mte4 = new KeyExtent(MetadataTable.ID, new Text("1;r"), new Text("1;j")); + KeyExtent mte5 = new KeyExtent(MetadataTable.ID, null, new Text("1;r")); - KeyExtent ke1 = new KeyExtent(new Text("1"), null, null); + KeyExtent ke1 = new KeyExtent("1", null, null); TServers tservers = new TServers(); TestTabletLocationObtainer ttlo = new TestTabletLocationObtainer(tservers); RootTabletLocator rtl = new TestRootTabletLocator(); - TabletLocatorImpl rootTabletCache = new TabletLocatorImpl(new Text(MetadataTable.ID), rtl, ttlo, new YesLockChecker()); - TabletLocatorImpl tab0TabletCache = new TabletLocatorImpl(new Text("1"), rootTabletCache, ttlo, new YesLockChecker()); + TabletLocatorImpl rootTabletCache = new TabletLocatorImpl(MetadataTable.ID, rtl, ttlo, new YesLockChecker()); + TabletLocatorImpl tab0TabletCache = new TabletLocatorImpl("1", rootTabletCache, ttlo, new YesLockChecker()); setLocation(tservers, "tserver1", RTE, mte1, "tserver2"); setLocation(tservers, "tserver1", RTE, mte2, "tserver3");