http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/SampleIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/SampleIT.java b/test/src/main/java/org/apache/accumulo/test/SampleIT.java index 15ca4a6..dc0b9ce 100644 --- a/test/src/main/java/org/apache/accumulo/test/SampleIT.java +++ b/test/src/main/java/org/apache/accumulo/test/SampleIT.java @@ -47,6 +47,7 @@ import org.apache.accumulo.core.client.admin.CompactionConfig; import org.apache.accumulo.core.client.admin.NewTableConfiguration; import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.OfflineScanner; +import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.client.sample.RowSampler; import org.apache.accumulo.core.client.sample.SamplerConfiguration; import org.apache.accumulo.core.data.ByteSequence; @@ -204,7 +205,7 @@ public class SampleIT extends AccumuloClusterHarness { Set<String> es = Collections.emptySet(); conn.tableOperations().clone(tableName, clone, false, em, es); conn.tableOperations().offline(clone, true); - String cloneID = conn.tableOperations().tableIdMap().get(clone); + Table.ID cloneID = new Table.ID(conn.tableOperations().tableIdMap().get(clone)); OfflineScanner oScanner = new OfflineScanner(conn.getInstance(), new Credentials(getAdminPrincipal(), getAdminToken()), cloneID, Authorizations.EMPTY); if (sc != null) { oScanner.setSamplerConfiguration(sc);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/SplitRecoveryIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/SplitRecoveryIT.java b/test/src/main/java/org/apache/accumulo/test/SplitRecoveryIT.java index 4f5d8e9..e82a733 100644 --- a/test/src/main/java/org/apache/accumulo/test/SplitRecoveryIT.java +++ b/test/src/main/java/org/apache/accumulo/test/SplitRecoveryIT.java @@ -26,6 +26,7 @@ import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.TableNotFoundException; +import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Range; @@ -86,7 +87,7 @@ public class SplitRecoveryIT extends AccumuloClusterHarness { // poke a partial split into the metadata table connector.securityOperations().grantTablePermission(getAdminPrincipal(), MetadataTable.NAME, TablePermission.WRITE); - String tableId = connector.tableOperations().tableIdMap().get(tableName); + Table.ID tableId = new Table.ID(connector.tableOperations().tableIdMap().get(tableName)); KeyExtent extent = new KeyExtent(tableId, null, new Text("b")); Mutation m = extent.getPrevRowUpdateMutation(); http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java b/test/src/main/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java index 79036cc..dba0c5b 100644 --- a/test/src/main/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java +++ b/test/src/main/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java @@ -63,7 +63,7 @@ public class TableConfigurationUpdateIT extends AccumuloClusterHarness { int numThreads = 2; // Number of iterations per thread int iterations = 100000; - AccumuloConfiguration tableConf = new TableConfiguration(inst, table, defaultConf); + AccumuloConfiguration tableConf = new TableConfiguration(inst, new org.apache.accumulo.core.client.impl.Table.ID(table), defaultConf); long start = System.currentTimeMillis(); ExecutorService svc = Executors.newFixedThreadPool(numThreads); http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/VolumeChooserIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/VolumeChooserIT.java b/test/src/main/java/org/apache/accumulo/test/VolumeChooserIT.java index 6f575c7..ef08cec 100644 --- a/test/src/main/java/org/apache/accumulo/test/VolumeChooserIT.java +++ b/test/src/main/java/org/apache/accumulo/test/VolumeChooserIT.java @@ -34,6 +34,7 @@ import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.TableNotFoundException; +import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Mutation; @@ -176,7 +177,7 @@ public class VolumeChooserIT extends ConfigurableMacBase { // Create table1 on namespace1 String tableName = namespace1 + ".1"; connector.tableOperations().create(tableName); - String tableID = connector.tableOperations().tableIdMap().get(tableName); + Table.ID tableID = new Table.ID(connector.tableOperations().tableIdMap().get(tableName)); // Add 10 splits to the table addSplits(connector, tableName); @@ -200,7 +201,7 @@ public class VolumeChooserIT extends ConfigurableMacBase { String tableName2 = namespace2 + ".1"; connector.tableOperations().create(tableName2); - String tableID2 = connector.tableOperations().tableIdMap().get(tableName2); + Table.ID tableID2 = new Table.ID(connector.tableOperations().tableIdMap().get(tableName2)); // Add 10 splits to the table addSplits(connector, tableName2); @@ -227,7 +228,7 @@ public class VolumeChooserIT extends ConfigurableMacBase { // Create table1 on namespace1 String tableName = namespace1 + ".1"; connector.tableOperations().create(tableName); - String tableID = connector.tableOperations().tableIdMap().get(tableName); + Table.ID tableID = new Table.ID(connector.tableOperations().tableIdMap().get(tableName)); // Add 10 splits to the table addSplits(connector, tableName); @@ -247,7 +248,7 @@ public class VolumeChooserIT extends ConfigurableMacBase { // Create table2 on namespace2 String tableName2 = namespace2 + ".1"; connector.tableOperations().create(tableName2); - String tableID2 = connector.tableOperations().tableIdMap().get(tableName); + Table.ID tableID2 = new Table.ID(connector.tableOperations().tableIdMap().get(tableName2)); // / Add 10 splits to the table addSplits(connector, tableName2); @@ -275,7 +276,7 @@ public class VolumeChooserIT extends ConfigurableMacBase { // Create table1 on namespace1 String tableName = namespace1 + ".1"; connector.tableOperations().create(tableName); - String tableID = connector.tableOperations().tableIdMap().get(tableName); + Table.ID tableID = new Table.ID(connector.tableOperations().tableIdMap().get(tableName)); // Add 10 splits to the table addSplits(connector, tableName); @@ -299,7 +300,7 @@ public class VolumeChooserIT extends ConfigurableMacBase { // Create table2 on namespace2 String tableName2 = namespace2 + ".1"; connector.tableOperations().create(tableName2); - String tableID2 = connector.tableOperations().tableIdMap().get(tableName2); + Table.ID tableID2 = new Table.ID(connector.tableOperations().tableIdMap().get(tableName2)); // Add 10 splits to the table addSplits(connector, tableName2); @@ -327,7 +328,7 @@ public class VolumeChooserIT extends ConfigurableMacBase { // Create table1 on namespace1 String tableName = namespace1 + ".1"; connector.tableOperations().create(tableName); - String tableID = connector.tableOperations().tableIdMap().get(tableName); + Table.ID tableID = new Table.ID(connector.tableOperations().tableIdMap().get(tableName)); // Add 10 splits to the table addSplits(connector, tableName); @@ -359,7 +360,7 @@ public class VolumeChooserIT extends ConfigurableMacBase { // Create table1 on namespace1 String tableName = namespace1 + ".1"; connector.tableOperations().create(tableName); - String tableID = connector.tableOperations().tableIdMap().get(tableName); + Table.ID tableID = new Table.ID(connector.tableOperations().tableIdMap().get(tableName)); // Add 10 splits to the table addSplits(connector, tableName); @@ -378,7 +379,7 @@ public class VolumeChooserIT extends ConfigurableMacBase { Connector connector = getConnector(); String tableName = getUniqueNames(2)[0]; connector.tableOperations().create(tableName); - String tableID = connector.tableOperations().tableIdMap().get(tableName); + Table.ID tableID = new Table.ID(connector.tableOperations().tableIdMap().get(tableName)); // Add 10 splits to the table addSplits(connector, tableName); http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/VolumeIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/VolumeIT.java b/test/src/main/java/org/apache/accumulo/test/VolumeIT.java index 2b02541..cce3686 100644 --- a/test/src/main/java/org/apache/accumulo/test/VolumeIT.java +++ b/test/src/main/java/org/apache/accumulo/test/VolumeIT.java @@ -47,6 +47,7 @@ import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.ZooKeeperInstance; import org.apache.accumulo.core.client.admin.DiskUsage; import org.apache.accumulo.core.client.admin.NewTableConfiguration; +import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.Key; @@ -188,7 +189,7 @@ public class VolumeIT extends ConfigurableMacBase { String tableName = getUniqueNames(1)[0]; connector.tableOperations().create(tableName, new NewTableConfiguration().withoutDefaultIterators()); - String tableId = connector.tableOperations().tableIdMap().get(tableName); + Table.ID tableId = new Table.ID(connector.tableOperations().tableIdMap().get(tableName)); SortedSet<Text> partitions = new TreeSet<>(); // with some splits @@ -403,7 +404,7 @@ public class VolumeIT extends ConfigurableMacBase { verifyData(expected, conn.createScanner(tableName, Authorizations.EMPTY)); - String tableId = conn.tableOperations().tableIdMap().get(tableName); + Table.ID tableId = new Table.ID(conn.tableOperations().tableIdMap().get(tableName)); Scanner metaScanner = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY); MetadataSchema.TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.fetch(metaScanner); metaScanner.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME); http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/WrongTabletTest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/WrongTabletTest.java b/test/src/main/java/org/apache/accumulo/test/WrongTabletTest.java index 80f015a..2886d68 100644 --- a/test/src/main/java/org/apache/accumulo/test/WrongTabletTest.java +++ b/test/src/main/java/org/apache/accumulo/test/WrongTabletTest.java @@ -20,6 +20,7 @@ import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.impl.ClientContext; import org.apache.accumulo.core.client.impl.Credentials; +import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.rpc.ThriftUtil; @@ -63,8 +64,8 @@ public class WrongTabletTest { Mutation mutation = new Mutation(new Text("row_0003750001")); mutation.putDelete(new Text("colf"), new Text("colq")); - client.update(Tracer.traceInfo(), context.rpcCreds(), new KeyExtent("!!", null, new Text("row_0003750000")).toThrift(), mutation.toThrift(), - TDurability.DEFAULT); + client.update(Tracer.traceInfo(), context.rpcCreds(), new KeyExtent(new Table.ID("!!"), null, new Text("row_0003750000")).toThrift(), + mutation.toThrift(), TDurability.DEFAULT); } catch (Exception e) { throw new RuntimeException(e); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java b/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java index 8659922..ccec0f9 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java @@ -38,6 +38,7 @@ import org.apache.accumulo.core.cli.BatchWriterOpts; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.Scanner; +import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Mutation; @@ -67,7 +68,7 @@ public class FunctionalTestUtils { public static int countRFiles(Connector c, String tableName) throws Exception { Scanner scanner = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY); - String tableId = c.tableOperations().tableIdMap().get(tableName); + Table.ID tableId = new Table.ID(c.tableOperations().tableIdMap().get(tableName)); scanner.setRange(MetadataSchema.TabletsSection.getRange(tableId)); scanner.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME); http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/functional/MasterAssignmentIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/MasterAssignmentIT.java b/test/src/main/java/org/apache/accumulo/test/functional/MasterAssignmentIT.java index 7745a0f..3595ca2 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/MasterAssignmentIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/MasterAssignmentIT.java @@ -27,6 +27,7 @@ import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.impl.ClientContext; import org.apache.accumulo.core.client.impl.Credentials; +import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.impl.KeyExtent; @@ -91,7 +92,7 @@ public class MasterAssignmentIT extends AccumuloClusterHarness { private TabletLocationState getTabletLocationState(Connector c, String tableId) throws FileNotFoundException, ConfigurationException { Credentials creds = new Credentials(getAdminPrincipal(), getAdminToken()); ClientContext context = new ClientContext(c.getInstance(), creds, getCluster().getClientConfig()); - MetaDataTableScanner s = new MetaDataTableScanner(context, new Range(KeyExtent.getMetadataEntry(tableId, null))); + MetaDataTableScanner s = new MetaDataTableScanner(context, new Range(KeyExtent.getMetadataEntry(new Table.ID(tableId), null))); TabletLocationState tlState = s.next(); s.close(); return tlState; http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/functional/MergeIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/MergeIT.java b/test/src/main/java/org/apache/accumulo/test/functional/MergeIT.java index 8c20673..1a62e02 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/MergeIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/MergeIT.java @@ -32,6 +32,7 @@ import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.admin.NewTableConfiguration; import org.apache.accumulo.core.client.admin.TimeType; +import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Range; @@ -218,7 +219,7 @@ public class MergeIT extends AccumuloClusterHarness { protected void resetScanner() { try { Scanner ds = conn.createScanner(metadataTableName, Authorizations.EMPTY); - Text tablet = new KeyExtent("0", new Text("m"), null).getMetadataEntry(); + Text tablet = new KeyExtent(new Table.ID("0"), new Text("m"), null).getMetadataEntry(); ds.setRange(new Range(tablet, true, tablet, true)); Mutation m = new Mutation(tablet); @@ -249,11 +250,11 @@ public class MergeIT extends AccumuloClusterHarness { String metadataTableName = getUniqueNames(1)[0]; getConnector().tableOperations().create(metadataTableName); - KeyExtent ke1 = new KeyExtent("0", new Text("m"), null); + KeyExtent ke1 = new KeyExtent(new Table.ID("0"), new Text("m"), null); Mutation mut1 = ke1.getPrevRowUpdateMutation(); TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(mut1, new Value("/d1".getBytes())); - KeyExtent ke2 = new KeyExtent("0", null, null); + KeyExtent ke2 = new KeyExtent(new Table.ID("0"), null, null); Mutation mut2 = ke2.getPrevRowUpdateMutation(); TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(mut2, new Value("/d2".getBytes())); http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/functional/RegexGroupBalanceIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/RegexGroupBalanceIT.java b/test/src/main/java/org/apache/accumulo/test/functional/RegexGroupBalanceIT.java index a8c5bca..dd8238a 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/RegexGroupBalanceIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/RegexGroupBalanceIT.java @@ -165,7 +165,8 @@ public class RegexGroupBalanceIT extends ConfigurableMacBase { private Table<String,String,MutableInt> getCounts(Connector conn, String tablename) throws TableNotFoundException { Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY); s.fetchColumnFamily(MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME); - String tableId = conn.tableOperations().tableIdMap().get(tablename); + org.apache.accumulo.core.client.impl.Table.ID tableId = new org.apache.accumulo.core.client.impl.Table.ID(conn.tableOperations().tableIdMap() + .get(tablename)); s.setRange(MetadataSchema.TabletsSection.getRange(tableId)); Table<String,String,MutableInt> groupLocationCounts = HashBasedTable.create(); @@ -175,7 +176,7 @@ public class RegexGroupBalanceIT extends ConfigurableMacBase { if (group.endsWith("<")) { group = "03"; } else { - group = group.substring(tableId.length() + 1).substring(0, 2); + group = group.substring(tableId.canonicalID().length() + 1).substring(0, 2); } String loc = new TServerInstance(entry.getValue(), entry.getKey().getColumnQualifier()).toString(); http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/functional/SplitIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/SplitIT.java b/test/src/main/java/org/apache/accumulo/test/functional/SplitIT.java index 6009636..263787c 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/SplitIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/SplitIT.java @@ -33,6 +33,7 @@ import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.admin.InstanceOperations; +import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.ConfigurationTypeHelper; import org.apache.accumulo.core.conf.Property; @@ -147,7 +148,7 @@ public class SplitIT extends AccumuloClusterHarness { while (c.tableOperations().listSplits(table).size() < 10) { sleepUninterruptibly(15, TimeUnit.SECONDS); } - String id = c.tableOperations().tableIdMap().get(table); + Table.ID id = new Table.ID(c.tableOperations().tableIdMap().get(table)); Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY); KeyExtent extent = new KeyExtent(id, null, null); s.setRange(extent.toMetadataRange()); http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryIT.java b/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryIT.java index 70e8901..10fcb61 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryIT.java @@ -34,6 +34,7 @@ import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.impl.ScannerImpl; +import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.client.impl.Writer; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Mutation; @@ -77,7 +78,7 @@ public class SplitRecoveryIT extends ConfigurableMacBase { } private KeyExtent nke(String table, String endRow, String prevEndRow) { - return new KeyExtent(table, endRow == null ? null : new Text(endRow), prevEndRow == null ? null : new Text(prevEndRow)); + return new KeyExtent(new Table.ID(table), endRow == null ? null : new Text(endRow), prevEndRow == null ? null : new Text(prevEndRow)); } private void run() throws Exception { @@ -166,8 +167,8 @@ public class SplitRecoveryIT extends ConfigurableMacBase { SortedMap<FileRef,DataFileValue> highDatafileSizes = new TreeMap<>(); List<FileRef> highDatafilesToRemove = new ArrayList<>(); - MetadataTableUtil.splitDatafiles(extent.getTableId(), midRow, splitRatio, new HashMap<FileRef,FileUtil.FileInfo>(), mapFiles, lowDatafileSizes, - highDatafileSizes, highDatafilesToRemove); + MetadataTableUtil.splitDatafiles(midRow, splitRatio, new HashMap<FileRef,FileUtil.FileInfo>(), mapFiles, lowDatafileSizes, highDatafileSizes, + highDatafilesToRemove); MetadataTableUtil.splitTablet(high, extent.getPrevEndRow(), splitRatio, context, zl); TServerInstance instance = new TServerInstance(location, zl.getSessionId()); http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/functional/TableChangeStateIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/TableChangeStateIT.java b/test/src/main/java/org/apache/accumulo/test/functional/TableChangeStateIT.java index 7ab9f3f..0fc33eb 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/TableChangeStateIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/TableChangeStateIT.java @@ -27,6 +27,7 @@ import org.apache.accumulo.core.client.IteratorSetting; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.TableExistsException; import org.apache.accumulo.core.client.TableNotFoundException; +import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.client.impl.Tables; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.Key; @@ -213,7 +214,7 @@ public class TableChangeStateIT extends AccumuloClusterHarness { try { - String tableId = Tables.getTableId(instance, tableName); + Table.ID tableId = Tables.getTableId(instance, tableName); log.trace("tid: {}", tableId); @@ -248,7 +249,7 @@ public class TableChangeStateIT extends AccumuloClusterHarness { */ private TableState getTableState(String tableName) throws TableNotFoundException { - String tableId = Tables.getTableId(connector.getInstance(), tableName); + Table.ID tableId = Tables.getTableId(connector.getInstance(), tableName); TableState tstate = Tables.getTableState(connector.getInstance(), tableId); http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/functional/TableIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/TableIT.java b/test/src/main/java/org/apache/accumulo/test/functional/TableIT.java index d3036f7..517ae37 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/TableIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/TableIT.java @@ -30,6 +30,7 @@ import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.admin.TableOperations; +import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema; @@ -85,7 +86,7 @@ public class TableIT extends AccumuloClusterHarness { to.flush(tableName, null, null, true); vopts.setTableName(tableName); VerifyIngest.verifyIngest(c, vopts, new ScannerOpts()); - String id = to.tableIdMap().get(tableName); + Table.ID id = new Table.ID(to.tableIdMap().get(tableName)); Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY); s.setRange(new KeyExtent(id, null, null).toMetadataRange()); s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME); http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/functional/TabletStateChangeIteratorIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/TabletStateChangeIteratorIT.java b/test/src/main/java/org/apache/accumulo/test/functional/TabletStateChangeIteratorIT.java index 62374d2..a5149dc 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/TabletStateChangeIteratorIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/TabletStateChangeIteratorIT.java @@ -38,6 +38,7 @@ import org.apache.accumulo.core.client.MutationsRejectedException; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.TableExistsException; import org.apache.accumulo.core.client.TableNotFoundException; +import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.client.impl.Tables; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Mutation; @@ -110,7 +111,7 @@ public class TabletStateChangeIteratorIT extends AccumuloClusterHarness { state = new State() { @Override public Collection<MergeInfo> merges() { - String tableIdToModify = getConnector().tableOperations().tableIdMap().get(t3); + Table.ID tableIdToModify = new Table.ID(getConnector().tableOperations().tableIdMap().get(t3)); return Collections.singletonList(new MergeInfo(new KeyExtent(tableIdToModify, null, null), MergeInfo.Operation.MERGE)); } }; @@ -127,7 +128,7 @@ public class TabletStateChangeIteratorIT extends AccumuloClusterHarness { } private void addDuplicateLocation(String table, String tableNameToModify) throws TableNotFoundException, MutationsRejectedException { - String tableIdToModify = getConnector().tableOperations().tableIdMap().get(tableNameToModify); + Table.ID tableIdToModify = new Table.ID(getConnector().tableOperations().tableIdMap().get(tableNameToModify)); Mutation m = new Mutation(new KeyExtent(tableIdToModify, null, null).getMetadataEntry()); m.put(MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME, new Text("1234567"), new Value("fake:9005".getBytes(UTF_8))); BatchWriter bw = getConnector().createBatchWriter(table, null); @@ -136,7 +137,7 @@ public class TabletStateChangeIteratorIT extends AccumuloClusterHarness { } private void reassignLocation(String table, String tableNameToModify) throws TableNotFoundException, MutationsRejectedException { - String tableIdToModify = getConnector().tableOperations().tableIdMap().get(tableNameToModify); + Table.ID tableIdToModify = new Table.ID(getConnector().tableOperations().tableIdMap().get(tableNameToModify)); Scanner scanner = getConnector().createScanner(table, Authorizations.EMPTY); scanner.setRange(new KeyExtent(tableIdToModify, null, null).toMetadataRange()); scanner.fetchColumnFamily(MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME); @@ -151,7 +152,7 @@ public class TabletStateChangeIteratorIT extends AccumuloClusterHarness { } private void removeLocation(String table, String tableNameToModify) throws TableNotFoundException, MutationsRejectedException { - String tableIdToModify = getConnector().tableOperations().tableIdMap().get(tableNameToModify); + Table.ID tableIdToModify = new Table.ID(getConnector().tableOperations().tableIdMap().get(tableNameToModify)); BatchDeleter deleter = getConnector().createBatchDeleter(table, Authorizations.EMPTY, 1, new BatchWriterConfig()); deleter.setRanges(Collections.singleton(new KeyExtent(tableIdToModify, null, null).toMetadataRange())); deleter.fetchColumnFamily(MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME); @@ -216,8 +217,8 @@ public class TabletStateChangeIteratorIT extends AccumuloClusterHarness { } @Override - public Set<String> onlineTables() { - HashSet<String> onlineTables = new HashSet<>(getConnector().tableOperations().tableIdMap().values()); + public Set<Table.ID> onlineTables() { + Set<Table.ID> onlineTables = Tables.getIdToNameMap(getConnector().getInstance()).keySet(); return Sets.filter(onlineTables, tableId -> Tables.getTableState(getConnector().getInstance(), tableId) == TableState.ONLINE); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/functional/WALSunnyDayIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/WALSunnyDayIT.java b/test/src/main/java/org/apache/accumulo/test/functional/WALSunnyDayIT.java index 2f5ee81..a74318e 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/WALSunnyDayIT.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/WALSunnyDayIT.java @@ -141,7 +141,7 @@ public class WALSunnyDayIT extends ConfigurableMacBase { Map<KeyExtent,List<String>> markers = getRecoveryMarkers(c); // log.debug("markers " + markers); assertEquals("one tablet should have markers", 1, markers.keySet().size()); - assertEquals("tableId of the keyExtent should be 1", "1", markers.keySet().iterator().next().getTableId()); + assertEquals("tableId of the keyExtent should be 1", "1", markers.keySet().iterator().next().getTableId().canonicalID()); // put some data in the WAL assertEquals(0, cluster.exec(SetGoalState.class, "NORMAL").waitFor()); http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/gc/replication/CloseWriteAheadLogReferencesIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/gc/replication/CloseWriteAheadLogReferencesIT.java b/test/src/main/java/org/apache/accumulo/test/gc/replication/CloseWriteAheadLogReferencesIT.java index 32a7e6f..f7aaead 100644 --- a/test/src/main/java/org/apache/accumulo/test/gc/replication/CloseWriteAheadLogReferencesIT.java +++ b/test/src/main/java/org/apache/accumulo/test/gc/replication/CloseWriteAheadLogReferencesIT.java @@ -32,6 +32,7 @@ import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.Scanner; +import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.ConfigurationCopy; import org.apache.accumulo.core.conf.Property; @@ -168,7 +169,7 @@ public class CloseWriteAheadLogReferencesIT extends ConfigurableMacBase { Set<String> wals = Collections.singleton(file); BatchWriter bw = ReplicationTable.getBatchWriter(conn); Mutation m = new Mutation(file); - StatusSection.add(m, "1", ProtobufUtil.toValue(StatusUtil.ingestedUntil(1000))); + StatusSection.add(m, new Table.ID("1"), ProtobufUtil.toValue(StatusUtil.ingestedUntil(1000))); bw.addMutation(m); bw.close(); http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/master/MergeStateIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/master/MergeStateIT.java b/test/src/main/java/org/apache/accumulo/test/master/MergeStateIT.java index 2d233c4..7730e38 100644 --- a/test/src/main/java/org/apache/accumulo/test/master/MergeStateIT.java +++ b/test/src/main/java/org/apache/accumulo/test/master/MergeStateIT.java @@ -26,6 +26,7 @@ import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.MutationsRejectedException; import org.apache.accumulo.core.client.TableNotFoundException; +import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; @@ -65,8 +66,8 @@ public class MergeStateIT extends ConfigurableMacBase { } @Override - public Set<String> onlineTables() { - return Collections.singleton("t"); + public Set<Table.ID> onlineTables() { + return Collections.singleton(new Table.ID("t")); } @Override @@ -113,7 +114,7 @@ public class MergeStateIT extends ConfigurableMacBase { // Create a fake METADATA table with these splits String splits[] = {"a", "e", "j", "o", "t", "z"}; // create metadata for a table "t" with the splits above - String tableId = "t"; + Table.ID tableId = new Table.ID("t"); Text pr = null; for (String s : splits) { Text split = new Text(s); http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/master/SuspendedTabletsIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/master/SuspendedTabletsIT.java b/test/src/main/java/org/apache/accumulo/test/master/SuspendedTabletsIT.java index bed0b62..993c816 100644 --- a/test/src/main/java/org/apache/accumulo/test/master/SuspendedTabletsIT.java +++ b/test/src/main/java/org/apache/accumulo/test/master/SuspendedTabletsIT.java @@ -317,7 +317,7 @@ public class SuspendedTabletsIT extends ConfigurableMacBase { while (scanner.hasNext()) { TabletLocationState tls = scanner.next(); - if (!tls.extent.getTableId().equals(tableId)) { + if (!tls.extent.getTableId().canonicalID().equals(tableId)) { continue; } locationStates.put(tls.extent, tls); http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java b/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java index 157d4a0..259edbd 100644 --- a/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java +++ b/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java @@ -34,6 +34,7 @@ import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.ZooKeeperInstance; +import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; @@ -77,7 +78,7 @@ public class MetadataBatchScanTest { splits.add((r.nextLong() & 0x7fffffffffffffffl) % 1000000000000l); } - String tid = "8"; + Table.ID tid = new Table.ID("8"); Text per = null; ArrayList<KeyExtent> extents = new ArrayList<>(); http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java b/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java index ceb1252..8fcf258 100644 --- a/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java +++ b/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java @@ -39,6 +39,7 @@ import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.impl.ClientContext; import org.apache.accumulo.core.client.impl.Credentials; +import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.client.impl.Tables; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.data.ArrayByteSequence; @@ -113,7 +114,7 @@ public class CollectTabletStats { Credentials creds = new Credentials(opts.getPrincipal(), opts.getToken()); ClientContext context = new ClientContext(instance, creds, sconf.getSystemConfiguration()); - String tableId = Tables.getNameToIdMap(instance).get(opts.getTableName()); + Table.ID tableId = Tables.getTableId(instance, opts.getTableName()); if (tableId == null) { log.error("Unable to find table named " + opts.getTableName()); System.exit(-1); @@ -132,7 +133,7 @@ public class CollectTabletStats { Map<KeyExtent,List<FileRef>> tabletFiles = new HashMap<>(); for (KeyExtent ke : tabletsToTest) { - List<FileRef> files = getTabletFiles(context, tableId, ke); + List<FileRef> files = getTabletFiles(context, ke); tabletFiles.put(ke, files); } @@ -349,7 +350,7 @@ public class CollectTabletStats { private static List<KeyExtent> findTablets(ClientContext context, boolean selectLocalTablets, String tableName, SortedMap<KeyExtent,String> tabletLocations) throws Exception { - String tableId = Tables.getNameToIdMap(context.getInstance()).get(tableName); + Table.ID tableId = Tables.getTableId(context.getInstance(), tableName); MetadataServicer.forTableId(context, tableId).getTabletLocations(tabletLocations); InetAddress localaddress = InetAddress.getLocalHost(); @@ -384,7 +385,7 @@ public class CollectTabletStats { return tabletsToTest; } - private static List<FileRef> getTabletFiles(ClientContext context, String tableId, KeyExtent ke) throws IOException { + private static List<FileRef> getTabletFiles(ClientContext context, KeyExtent ke) throws IOException { return new ArrayList<>(MetadataTableUtil.getDataFileSizes(ke, context).keySet()); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java b/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java index 08658cd..7598af7 100644 --- a/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java +++ b/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java @@ -30,6 +30,7 @@ import org.apache.accumulo.core.cli.Help; import org.apache.accumulo.core.client.ClientConfiguration; import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.ZooKeeperInstance; +import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.client.impl.Tables; import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode; import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException; @@ -294,7 +295,7 @@ public class NullTserver { HostAndPort addr = HostAndPort.fromParts(InetAddress.getLocalHost().getHostName(), opts.port); - String tableId = Tables.getTableId(zki, opts.tableName); + Table.ID tableId = Tables.getTableId(zki, opts.tableName); // read the locations for the table Range tableRange = new KeyExtent(tableId, null, null).toMetadataRange(); http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/replication/FinishedWorkUpdaterIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/replication/FinishedWorkUpdaterIT.java b/test/src/main/java/org/apache/accumulo/test/replication/FinishedWorkUpdaterIT.java index 5519013..e4dac96 100644 --- a/test/src/main/java/org/apache/accumulo/test/replication/FinishedWorkUpdaterIT.java +++ b/test/src/main/java/org/apache/accumulo/test/replication/FinishedWorkUpdaterIT.java @@ -23,6 +23,7 @@ import java.util.UUID; import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Scanner; +import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Range; @@ -66,7 +67,7 @@ public class FinishedWorkUpdaterIT extends ConfigurableMacBase { String file = "/accumulo/wals/tserver+port/" + UUID.randomUUID(); Status stat = Status.newBuilder().setBegin(100).setEnd(200).setClosed(true).setInfiniteEnd(false).build(); - ReplicationTarget target = new ReplicationTarget("peer", "table1", "1"); + ReplicationTarget target = new ReplicationTarget("peer", "table1", new Table.ID("1")); // Create a single work record for a file to some peer BatchWriter bw = ReplicationTable.getBatchWriter(conn); @@ -83,7 +84,7 @@ public class FinishedWorkUpdaterIT extends ConfigurableMacBase { Entry<Key,Value> entry = Iterables.getOnlyElement(s); Assert.assertEquals(entry.getKey().getColumnFamily(), StatusSection.NAME); - Assert.assertEquals(entry.getKey().getColumnQualifier().toString(), target.getSourceTableId()); + Assert.assertEquals(entry.getKey().getColumnQualifier().toString(), target.getSourceTableId().canonicalID()); // We should only rely on the correct begin attribute being returned Status actual = Status.parseFrom(entry.getValue().get()); @@ -101,9 +102,9 @@ public class FinishedWorkUpdaterIT extends ConfigurableMacBase { Status stat1 = Status.newBuilder().setBegin(100).setEnd(1000).setClosed(true).setInfiniteEnd(false).build(), stat2 = Status.newBuilder().setBegin(500).setEnd(1000).setClosed(true).setInfiniteEnd(false).build(), stat3 = Status.newBuilder().setBegin(1).setEnd(1000).setClosed(true).setInfiniteEnd(false).build(); - ReplicationTarget target1 = new ReplicationTarget("peer1", "table1", "1"), - target2 = new ReplicationTarget("peer2", "table2", "1"), - target3 = new ReplicationTarget("peer3", "table3", "1"); + ReplicationTarget target1 = new ReplicationTarget("peer1", "table1", new Table.ID("1")), + target2 = new ReplicationTarget("peer2", "table2", new Table.ID("1")), + target3 = new ReplicationTarget("peer3", "table3", new Table.ID("1")); // @formatter:on // Create a single work record for a file to some peer @@ -123,7 +124,7 @@ public class FinishedWorkUpdaterIT extends ConfigurableMacBase { Entry<Key,Value> entry = Iterables.getOnlyElement(s); Assert.assertEquals(entry.getKey().getColumnFamily(), StatusSection.NAME); - Assert.assertEquals(entry.getKey().getColumnQualifier().toString(), target1.getSourceTableId()); + Assert.assertEquals(entry.getKey().getColumnQualifier().toString(), target1.getSourceTableId().canonicalID()); // We should only rely on the correct begin attribute being returned Status actual = Status.parseFrom(entry.getValue().get()); @@ -141,9 +142,9 @@ public class FinishedWorkUpdaterIT extends ConfigurableMacBase { Status stat1 = Status.newBuilder().setBegin(100).setEnd(1000).setClosed(true).setInfiniteEnd(true).build(), stat2 = Status.newBuilder().setBegin(1).setEnd(1000).setClosed(true).setInfiniteEnd(true).build(), stat3 = Status.newBuilder().setBegin(500).setEnd(1000).setClosed(true).setInfiniteEnd(true).build(); - ReplicationTarget target1 = new ReplicationTarget("peer1", "table1", "1"), - target2 = new ReplicationTarget("peer2", "table2", "1"), - target3 = new ReplicationTarget("peer3", "table3", "1"); + ReplicationTarget target1 = new ReplicationTarget("peer1", "table1", new Table.ID("1")), + target2 = new ReplicationTarget("peer2", "table2", new Table.ID("1")), + target3 = new ReplicationTarget("peer3", "table3", new Table.ID("1")); // @formatter:on // Create a single work record for a file to some peer @@ -163,7 +164,7 @@ public class FinishedWorkUpdaterIT extends ConfigurableMacBase { Entry<Key,Value> entry = Iterables.getOnlyElement(s); Assert.assertEquals(entry.getKey().getColumnFamily(), StatusSection.NAME); - Assert.assertEquals(entry.getKey().getColumnQualifier().toString(), target1.getSourceTableId()); + Assert.assertEquals(entry.getKey().getColumnQualifier().toString(), target1.getSourceTableId().canonicalID()); // We should only rely on the correct begin attribute being returned Status actual = Status.parseFrom(entry.getValue().get()); http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/replication/GarbageCollectorCommunicatesWithTServersIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/replication/GarbageCollectorCommunicatesWithTServersIT.java b/test/src/main/java/org/apache/accumulo/test/replication/GarbageCollectorCommunicatesWithTServersIT.java index fccb238..6141a02 100644 --- a/test/src/main/java/org/apache/accumulo/test/replication/GarbageCollectorCommunicatesWithTServersIT.java +++ b/test/src/main/java/org/apache/accumulo/test/replication/GarbageCollectorCommunicatesWithTServersIT.java @@ -32,6 +32,7 @@ import org.apache.accumulo.core.client.impl.ClientContext; import org.apache.accumulo.core.client.impl.ClientExecReturn; import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.MasterClient; +import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.Key; @@ -123,7 +124,7 @@ public class GarbageCollectorCommunicatesWithTServersIT extends ConfigurableMacB */ private Set<String> getFilesForTable(String tableName) throws Exception { final Connector conn = getConnector(); - final String tableId = conn.tableOperations().tableIdMap().get(tableName); + final Table.ID tableId = new Table.ID(conn.tableOperations().tableIdMap().get(tableName)); Assert.assertNotNull("Could not determine table ID for " + tableName, tableId); http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/replication/RemoveCompleteReplicationRecordsIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/replication/RemoveCompleteReplicationRecordsIT.java b/test/src/main/java/org/apache/accumulo/test/replication/RemoveCompleteReplicationRecordsIT.java index 237a8a0..3fe2d2e 100644 --- a/test/src/main/java/org/apache/accumulo/test/replication/RemoveCompleteReplicationRecordsIT.java +++ b/test/src/main/java/org/apache/accumulo/test/replication/RemoveCompleteReplicationRecordsIT.java @@ -26,6 +26,7 @@ import org.apache.accumulo.core.client.BatchScanner; import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.IteratorSetting; +import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Range; @@ -76,6 +77,10 @@ public class RemoveCompleteReplicationRecordsIT extends ConfigurableMacBase { ReplicationTable.setOnline(conn); } + private Table.ID createTableId(int i) { + return new Table.ID(Integer.toString(i)); + } + @Test public void notYetReplicationRecordsIgnored() throws Exception { BatchWriter bw = ReplicationTable.getBatchWriter(conn); @@ -83,7 +88,7 @@ public class RemoveCompleteReplicationRecordsIT extends ConfigurableMacBase { for (int i = 0; i < numRecords; i++) { String file = "/accumulo/wal/tserver+port/" + UUID.randomUUID(); Mutation m = new Mutation(file); - StatusSection.add(m, Integer.toString(i), StatusUtil.openWithUnknownLengthValue()); + StatusSection.add(m, createTableId(i), StatusUtil.openWithUnknownLengthValue()); bw.addMutation(m); } @@ -116,7 +121,7 @@ public class RemoveCompleteReplicationRecordsIT extends ConfigurableMacBase { for (int i = 0; i < numRecords; i++) { String file = "/accumulo/wal/tserver+port/" + UUID.randomUUID(); Mutation m = new Mutation(file); - StatusSection.add(m, Integer.toString(i), ProtobufUtil.toValue(builder.setBegin(1000 * (i + 1)).build())); + StatusSection.add(m, createTableId(i), ProtobufUtil.toValue(builder.setBegin(1000 * (i + 1)).build())); bw.addMutation(m); } @@ -153,21 +158,21 @@ public class RemoveCompleteReplicationRecordsIT extends ConfigurableMacBase { for (int i = 0; i < numRecords; i++) { String file = "/accumulo/wal/tserver+port/" + UUID.randomUUID(); Mutation m = new Mutation(file); - StatusSection.add(m, Integer.toString(i), ProtobufUtil.toValue(builder.setBegin(1000 * (i + 1)).build())); + StatusSection.add(m, createTableId(i), ProtobufUtil.toValue(builder.setBegin(1000 * (i + 1)).build())); replBw.addMutation(m); } // Add two records that we can delete String fileToRemove = "/accumulo/wal/tserver+port/" + UUID.randomUUID(); Mutation m = new Mutation(fileToRemove); - StatusSection.add(m, "5", ProtobufUtil.toValue(builder.setBegin(10000).setEnd(10000).setClosed(false).build())); + StatusSection.add(m, new Table.ID("5"), ProtobufUtil.toValue(builder.setBegin(10000).setEnd(10000).setClosed(false).build())); replBw.addMutation(m); numRecords++; fileToRemove = "/accumulo/wal/tserver+port/" + UUID.randomUUID(); m = new Mutation(fileToRemove); - StatusSection.add(m, "6", ProtobufUtil.toValue(builder.setBegin(10000).setEnd(10000).setClosed(false).build())); + StatusSection.add(m, new Table.ID("6"), ProtobufUtil.toValue(builder.setBegin(10000).setEnd(10000).setClosed(false).build())); replBw.addMutation(m); numRecords++; @@ -208,10 +213,10 @@ public class RemoveCompleteReplicationRecordsIT extends ConfigurableMacBase { String file = "/accumulo/wal/tserver+port/" + UUID.randomUUID(); Mutation m = new Mutation(file); Value v = ProtobufUtil.toValue(builder.setBegin(1000 * (i + 1)).build()); - StatusSection.add(m, Integer.toString(i), v); + StatusSection.add(m, createTableId(i), v); replBw.addMutation(m); m = OrderSection.createMutation(file, time); - OrderSection.add(m, Integer.toString(i), v); + OrderSection.add(m, createTableId(i), v); replBw.addMutation(m); } @@ -224,14 +229,14 @@ public class RemoveCompleteReplicationRecordsIT extends ConfigurableMacBase { String fileToRemove = "/accumulo/wal/tserver+port/" + UUID.randomUUID(); filesToRemove.add(fileToRemove); Mutation m = new Mutation(fileToRemove); - ReplicationTarget target = new ReplicationTarget("peer1", "5", "5"); + ReplicationTarget target = new ReplicationTarget("peer1", "5", new Table.ID("5")); Value value = ProtobufUtil.toValue(builder.setBegin(10000).setEnd(10000).setClosed(true).setCreatedTime(time).build()); - StatusSection.add(m, "5", value); + StatusSection.add(m, new Table.ID("5"), value); WorkSection.add(m, target.toText(), value); replBw.addMutation(m); m = OrderSection.createMutation(fileToRemove, time); - OrderSection.add(m, "5", value); + OrderSection.add(m, new Table.ID("5"), value); replBw.addMutation(m); time++; @@ -241,13 +246,13 @@ public class RemoveCompleteReplicationRecordsIT extends ConfigurableMacBase { filesToRemove.add(fileToRemove); m = new Mutation(fileToRemove); value = ProtobufUtil.toValue(builder.setBegin(10000).setEnd(10000).setClosed(true).setCreatedTime(time).build()); - target = new ReplicationTarget("peer1", "6", "6"); - StatusSection.add(m, "6", value); + target = new ReplicationTarget("peer1", "6", new Table.ID("6")); + StatusSection.add(m, new Table.ID("6"), value); WorkSection.add(m, target.toText(), value); replBw.addMutation(m); m = OrderSection.createMutation(fileToRemove, time); - OrderSection.add(m, "6", value); + OrderSection.add(m, new Table.ID("6"), value); replBw.addMutation(m); time++; @@ -296,20 +301,20 @@ public class RemoveCompleteReplicationRecordsIT extends ConfigurableMacBase { for (int i = 0; i < numRecords; i++) { String file = "/accumulo/wal/tserver+port/" + UUID.randomUUID(); Mutation m = new Mutation(file); - StatusSection.add(m, Integer.toString(i), ProtobufUtil.toValue(builder.setBegin(1000 * (i + 1)).build())); + StatusSection.add(m, createTableId(i), ProtobufUtil.toValue(builder.setBegin(1000 * (i + 1)).build())); replBw.addMutation(m); } // Add two records that we can delete String fileToRemove = "/accumulo/wal/tserver+port/" + UUID.randomUUID(); Mutation m = new Mutation(fileToRemove); - ReplicationTarget target = new ReplicationTarget("peer1", "5", "5"); + ReplicationTarget target = new ReplicationTarget("peer1", "5", new Table.ID("5")); Value value = ProtobufUtil.toValue(builder.setBegin(10000).setEnd(10000).setClosed(true).build()); - StatusSection.add(m, "5", value); + StatusSection.add(m, new Table.ID("5"), value); WorkSection.add(m, target.toText(), value); - target = new ReplicationTarget("peer2", "5", "5"); + target = new ReplicationTarget("peer2", "5", new Table.ID("5")); WorkSection.add(m, target.toText(), value); - target = new ReplicationTarget("peer3", "5", "5"); + target = new ReplicationTarget("peer3", "5", new Table.ID("5")); WorkSection.add(m, target.toText(), ProtobufUtil.toValue(builder.setClosed(false).build())); replBw.addMutation(m); http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/replication/ReplicationIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/replication/ReplicationIT.java b/test/src/main/java/org/apache/accumulo/test/replication/ReplicationIT.java index 1b2cc19..ee8cebf 100644 --- a/test/src/main/java/org/apache/accumulo/test/replication/ReplicationIT.java +++ b/test/src/main/java/org/apache/accumulo/test/replication/ReplicationIT.java @@ -49,6 +49,7 @@ import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.TableOfflineException; import org.apache.accumulo.core.client.ZooKeeperInstance; import org.apache.accumulo.core.client.admin.TableOperations; +import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Mutation; @@ -138,7 +139,7 @@ public class ReplicationIT extends ConfigurableMacBase { hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName()); } - private Multimap<String,String> getLogs(Connector conn) throws Exception { + private Multimap<String,Table.ID> getLogs(Connector conn) throws Exception { // Map of server to tableId Multimap<TServerInstance,String> serverToTableID = HashMultimap.create(); Scanner scanner = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY); @@ -150,7 +151,7 @@ public class ReplicationIT extends ConfigurableMacBase { serverToTableID.put(key, new String(tableId, UTF_8)); } // Map of logs to tableId - Multimap<String,String> logs = HashMultimap.create(); + Multimap<String,Table.ID> logs = HashMultimap.create(); Instance i = conn.getInstance(); ZooReaderWriter zk = new ZooReaderWriter(i.getZooKeepers(), i.getZooKeepersSessionTimeOut(), ""); WalStateManager wals = new WalStateManager(conn.getInstance(), zk); @@ -158,15 +159,15 @@ public class ReplicationIT extends ConfigurableMacBase { for (UUID id : entry.getValue()) { Pair<WalState,Path> state = wals.state(entry.getKey(), id); for (String tableId : serverToTableID.get(entry.getKey())) { - logs.put(state.getSecond().toString(), tableId); + logs.put(state.getSecond().toString(), new Table.ID(tableId)); } } } return logs; } - private Multimap<String,String> getAllLogs(Connector conn) throws Exception { - Multimap<String,String> logs = getLogs(conn); + private Multimap<String,Table.ID> getAllLogs(Connector conn) throws Exception { + Multimap<String,Table.ID> logs = getLogs(conn); try { Scanner scanner = conn.createScanner(ReplicationTable.NAME, Authorizations.EMPTY); StatusSection.limit(scanner); @@ -179,7 +180,7 @@ public class ReplicationIT extends ConfigurableMacBase { StatusSection.getFile(entry.getKey(), buff); String file = buff.toString(); - String tableId = StatusSection.getTableId(entry.getKey()); + Table.ID tableId = StatusSection.getTableId(entry.getKey()); logs.put(file, tableId); } @@ -207,7 +208,7 @@ public class ReplicationIT extends ConfigurableMacBase { @Test public void replicationTableCreated() throws AccumuloException, AccumuloSecurityException { Assert.assertTrue(getConnector().tableOperations().exists(ReplicationTable.NAME)); - Assert.assertEquals(ReplicationTable.ID, getConnector().tableOperations().tableIdMap().get(ReplicationTable.NAME)); + Assert.assertEquals(ReplicationTable.ID.canonicalID(), getConnector().tableOperations().tableIdMap().get(ReplicationTable.NAME)); } @Test @@ -492,7 +493,7 @@ public class ReplicationIT extends ConfigurableMacBase { public void replicationEntriesPrecludeWalDeletion() throws Exception { final Connector conn = getConnector(); String table1 = "table1", table2 = "table2", table3 = "table3"; - final Multimap<String,String> logs = HashMultimap.create(); + final Multimap<String,Table.ID> logs = HashMultimap.create(); final AtomicBoolean keepRunning = new AtomicBoolean(true); Thread t = new Thread(new Runnable() { @@ -552,10 +553,10 @@ public class ReplicationIT extends ConfigurableMacBase { // We might have a WAL that was use solely for the replication table // We want to remove that from our list as it should not appear in the replication table String replicationTableId = conn.tableOperations().tableIdMap().get(ReplicationTable.NAME); - Iterator<Entry<String,String>> observedLogs = logs.entries().iterator(); + Iterator<Entry<String,Table.ID>> observedLogs = logs.entries().iterator(); while (observedLogs.hasNext()) { - Entry<String,String> observedLog = observedLogs.next(); - if (replicationTableId.equals(observedLog.getValue())) { + Entry<String,Table.ID> observedLog = observedLogs.next(); + if (replicationTableId.equals(observedLog.getValue().canonicalID())) { log.info("Removing {} because its tableId is for the replication table", observedLog); observedLogs.remove(); } @@ -675,7 +676,7 @@ public class ReplicationIT extends ConfigurableMacBase { String table = "table"; conn.tableOperations().create(table); - String tableId = conn.tableOperations().tableIdMap().get(table); + Table.ID tableId = new Table.ID(conn.tableOperations().tableIdMap().get(table)); Assert.assertNotNull(tableId); @@ -973,7 +974,7 @@ public class ReplicationIT extends ConfigurableMacBase { writeSomeData(conn, table1, 2000, 50); conn.tableOperations().flush(table1, null, null, true); - String tableId = conn.tableOperations().tableIdMap().get(table1); + Table.ID tableId = new Table.ID(conn.tableOperations().tableIdMap().get(table1)); Assert.assertNotNull("Table ID was null", tableId); // Make sure the replication table exists at this point @@ -1219,7 +1220,7 @@ public class ReplicationIT extends ConfigurableMacBase { } } - String tableId = conn.tableOperations().tableIdMap().get(table1); + Table.ID tableId = new Table.ID(conn.tableOperations().tableIdMap().get(table1)); Assert.assertNotNull("Could not determine table id for " + table1, tableId); // Write some data to table1 http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/replication/ReplicationOperationsImplIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/replication/ReplicationOperationsImplIT.java b/test/src/main/java/org/apache/accumulo/test/replication/ReplicationOperationsImplIT.java index 00945a1..8604e48 100644 --- a/test/src/main/java/org/apache/accumulo/test/replication/ReplicationOperationsImplIT.java +++ b/test/src/main/java/org/apache/accumulo/test/replication/ReplicationOperationsImplIT.java @@ -31,6 +31,7 @@ import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.impl.ClientContext; import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.ReplicationOperationsImpl; +import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.data.Key; @@ -87,9 +88,9 @@ public class ReplicationOperationsImplIT extends ConfigurableMacBase { final MasterClientServiceHandler mcsh = new MasterClientServiceHandler(master) { @Override - protected String getTableId(Instance inst, String tableName) throws ThriftTableOperationException { + protected Table.ID getTableId(Instance inst, String tableName) throws ThriftTableOperationException { try { - return conn.tableOperations().tableIdMap().get(tableName); + return new Table.ID(conn.tableOperations().tableIdMap().get(tableName)); } catch (Exception e) { throw new RuntimeException(e); } @@ -113,7 +114,7 @@ public class ReplicationOperationsImplIT extends ConfigurableMacBase { @Test public void waitsUntilEntriesAreReplicated() throws Exception { conn.tableOperations().create("foo"); - String tableId = conn.tableOperations().tableIdMap().get("foo"); + Table.ID tableId = new Table.ID(conn.tableOperations().tableIdMap().get("foo")); String file1 = "/accumulo/wals/tserver+port/" + UUID.randomUUID(), file2 = "/accumulo/wals/tserver+port/" + UUID.randomUUID(); Status stat = Status.newBuilder().setBegin(0).setEnd(10000).setInfiniteEnd(false).setClosed(false).build(); @@ -132,12 +133,12 @@ public class ReplicationOperationsImplIT extends ConfigurableMacBase { bw = conn.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig()); m = new Mutation(ReplicationSection.getRowPrefix() + file1); - m.put(ReplicationSection.COLF, new Text(tableId), ProtobufUtil.toValue(stat)); + m.put(ReplicationSection.COLF, new Text(tableId.getUtf8()), ProtobufUtil.toValue(stat)); bw.addMutation(m); m = new Mutation(ReplicationSection.getRowPrefix() + file2); - m.put(ReplicationSection.COLF, new Text(tableId), ProtobufUtil.toValue(stat)); + m.put(ReplicationSection.COLF, new Text(tableId.getUtf8()), ProtobufUtil.toValue(stat)); bw.close(); @@ -164,14 +165,14 @@ public class ReplicationOperationsImplIT extends ConfigurableMacBase { bw = conn.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig()); m = new Mutation(ReplicationSection.getRowPrefix() + file1); - m.putDelete(ReplicationSection.COLF, new Text(tableId)); + m.putDelete(ReplicationSection.COLF, new Text(tableId.getUtf8())); bw.addMutation(m); bw.flush(); Assert.assertFalse(done.get()); m = new Mutation(ReplicationSection.getRowPrefix() + file2); - m.putDelete(ReplicationSection.COLF, new Text(tableId)); + m.putDelete(ReplicationSection.COLF, new Text(tableId.getUtf8())); bw.addMutation(m); bw.flush(); bw.close(); @@ -182,14 +183,14 @@ public class ReplicationOperationsImplIT extends ConfigurableMacBase { // Remove the replication entries too bw = ReplicationTable.getBatchWriter(conn); m = new Mutation(file1); - m.putDelete(StatusSection.NAME, new Text(tableId)); + m.putDelete(StatusSection.NAME, new Text(tableId.getUtf8())); bw.addMutation(m); bw.flush(); Assert.assertFalse(done.get()); m = new Mutation(file2); - m.putDelete(StatusSection.NAME, new Text(tableId)); + m.putDelete(StatusSection.NAME, new Text(tableId.getUtf8())); bw.addMutation(m); bw.flush(); @@ -209,8 +210,8 @@ public class ReplicationOperationsImplIT extends ConfigurableMacBase { conn.tableOperations().create("foo"); conn.tableOperations().create("bar"); - String tableId1 = conn.tableOperations().tableIdMap().get("foo"); - String tableId2 = conn.tableOperations().tableIdMap().get("bar"); + Table.ID tableId1 = new Table.ID(conn.tableOperations().tableIdMap().get("foo")); + Table.ID tableId2 = new Table.ID(conn.tableOperations().tableIdMap().get("bar")); String file1 = "/accumulo/wals/tserver+port/" + UUID.randomUUID(), file2 = "/accumulo/wals/tserver+port/" + UUID.randomUUID(); Status stat = Status.newBuilder().setBegin(0).setEnd(10000).setInfiniteEnd(false).setClosed(false).build(); @@ -229,12 +230,12 @@ public class ReplicationOperationsImplIT extends ConfigurableMacBase { bw = conn.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig()); m = new Mutation(ReplicationSection.getRowPrefix() + file1); - m.put(ReplicationSection.COLF, new Text(tableId1), ProtobufUtil.toValue(stat)); + m.put(ReplicationSection.COLF, new Text(tableId1.getUtf8()), ProtobufUtil.toValue(stat)); bw.addMutation(m); m = new Mutation(ReplicationSection.getRowPrefix() + file2); - m.put(ReplicationSection.COLF, new Text(tableId2), ProtobufUtil.toValue(stat)); + m.put(ReplicationSection.COLF, new Text(tableId2.getUtf8()), ProtobufUtil.toValue(stat)); bw.close(); @@ -263,7 +264,7 @@ public class ReplicationOperationsImplIT extends ConfigurableMacBase { bw = conn.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig()); m = new Mutation(ReplicationSection.getRowPrefix() + file1); - m.putDelete(ReplicationSection.COLF, new Text(tableId1)); + m.putDelete(ReplicationSection.COLF, new Text(tableId1.getUtf8())); bw.addMutation(m); bw.flush(); @@ -273,7 +274,7 @@ public class ReplicationOperationsImplIT extends ConfigurableMacBase { // Remove the replication entries too bw = ReplicationTable.getBatchWriter(conn); m = new Mutation(file1); - m.putDelete(StatusSection.NAME, new Text(tableId1)); + m.putDelete(StatusSection.NAME, new Text(tableId1.getUtf8())); bw.addMutation(m); bw.flush(); @@ -292,7 +293,7 @@ public class ReplicationOperationsImplIT extends ConfigurableMacBase { public void inprogressReplicationRecordsBlockExecution() throws Exception { conn.tableOperations().create("foo"); - String tableId1 = conn.tableOperations().tableIdMap().get("foo"); + Table.ID tableId1 = new Table.ID(conn.tableOperations().tableIdMap().get("foo")); String file1 = "/accumulo/wals/tserver+port/" + UUID.randomUUID(); Status stat = Status.newBuilder().setBegin(0).setEnd(10000).setInfiniteEnd(false).setClosed(false).build(); @@ -308,7 +309,7 @@ public class ReplicationOperationsImplIT extends ConfigurableMacBase { bw = conn.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig()); m = new Mutation(ReplicationSection.getRowPrefix() + file1); - m.put(ReplicationSection.COLF, new Text(tableId1), ProtobufUtil.toValue(stat)); + m.put(ReplicationSection.COLF, new Text(tableId1.getUtf8()), ProtobufUtil.toValue(stat)); bw.addMutation(m); m = new Mutation(logEntry.getRow()); @@ -341,7 +342,7 @@ public class ReplicationOperationsImplIT extends ConfigurableMacBase { Status newStatus = Status.newBuilder().setBegin(1000).setEnd(2000).setInfiniteEnd(false).setClosed(true).build(); bw = conn.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig()); m = new Mutation(ReplicationSection.getRowPrefix() + file1); - m.put(ReplicationSection.COLF, new Text(tableId1), ProtobufUtil.toValue(newStatus)); + m.put(ReplicationSection.COLF, new Text(tableId1.getUtf8()), ProtobufUtil.toValue(newStatus)); bw.addMutation(m); bw.flush(); @@ -351,7 +352,7 @@ public class ReplicationOperationsImplIT extends ConfigurableMacBase { // Remove the replication entries too bw = ReplicationTable.getBatchWriter(conn); m = new Mutation(file1); - m.put(StatusSection.NAME, new Text(tableId1), ProtobufUtil.toValue(newStatus)); + m.put(StatusSection.NAME, new Text(tableId1.getUtf8()), ProtobufUtil.toValue(newStatus)); bw.addMutation(m); bw.flush(); @@ -370,7 +371,7 @@ public class ReplicationOperationsImplIT extends ConfigurableMacBase { public void laterCreatedLogsDontBlockExecution() throws Exception { conn.tableOperations().create("foo"); - String tableId1 = conn.tableOperations().tableIdMap().get("foo"); + Table.ID tableId1 = new Table.ID(conn.tableOperations().tableIdMap().get("foo")); String file1 = "/accumulo/wals/tserver+port/" + UUID.randomUUID(); Status stat = Status.newBuilder().setBegin(0).setEnd(10000).setInfiniteEnd(false).setClosed(false).build(); @@ -383,7 +384,7 @@ public class ReplicationOperationsImplIT extends ConfigurableMacBase { bw = conn.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig()); m = new Mutation(ReplicationSection.getRowPrefix() + file1); - m.put(ReplicationSection.COLF, new Text(tableId1), ProtobufUtil.toValue(stat)); + m.put(ReplicationSection.COLF, new Text(tableId1.getUtf8()), ProtobufUtil.toValue(stat)); bw.addMutation(m); bw.close(); @@ -417,10 +418,10 @@ public class ReplicationOperationsImplIT extends ConfigurableMacBase { // Write another file, but also delete the old files bw = conn.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig()); m = new Mutation(ReplicationSection.getRowPrefix() + "/accumulo/wals/tserver+port/" + UUID.randomUUID()); - m.put(ReplicationSection.COLF, new Text(tableId1), ProtobufUtil.toValue(stat)); + m.put(ReplicationSection.COLF, new Text(tableId1.getUtf8()), ProtobufUtil.toValue(stat)); bw.addMutation(m); m = new Mutation(ReplicationSection.getRowPrefix() + file1); - m.putDelete(ReplicationSection.COLF, new Text(tableId1)); + m.putDelete(ReplicationSection.COLF, new Text(tableId1.getUtf8())); bw.addMutation(m); bw.close(); @@ -431,7 +432,7 @@ public class ReplicationOperationsImplIT extends ConfigurableMacBase { bw = ReplicationTable.getBatchWriter(conn); m = new Mutation(file1); - m.putDelete(StatusSection.NAME, new Text(tableId1)); + m.putDelete(StatusSection.NAME, new Text(tableId1.getUtf8())); bw.addMutation(m); bw.close(); http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/replication/SequentialWorkAssignerIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/replication/SequentialWorkAssignerIT.java b/test/src/main/java/org/apache/accumulo/test/replication/SequentialWorkAssignerIT.java index ae277c9..cf0c5a7 100644 --- a/test/src/main/java/org/apache/accumulo/test/replication/SequentialWorkAssignerIT.java +++ b/test/src/main/java/org/apache/accumulo/test/replication/SequentialWorkAssignerIT.java @@ -26,6 +26,7 @@ import java.util.Map; import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.client.Connector; +import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.protobuf.ProtobufUtil; import org.apache.accumulo.core.replication.ReplicationSchema.OrderSection; @@ -104,7 +105,7 @@ public class SequentialWorkAssignerIT extends ConfigurableMacBase { @Test public void createWorkForFilesInCorrectOrder() throws Exception { - ReplicationTarget target = new ReplicationTarget("cluster1", "table1", "1"); + ReplicationTarget target = new ReplicationTarget("cluster1", "table1", new Table.ID("1")); Text serializedTarget = target.toText(); // Create two mutations, both of which need replication work done @@ -157,16 +158,16 @@ public class SequentialWorkAssignerIT extends ConfigurableMacBase { Assert.assertTrue(queuedWork.containsKey("cluster1")); Map<String,String> cluster1Work = queuedWork.get("cluster1"); Assert.assertEquals(1, cluster1Work.size()); - Assert.assertTrue(cluster1Work.containsKey(target.getSourceTableId())); - Assert.assertEquals(DistributedWorkQueueWorkAssignerHelper.getQueueKey(filename1, target), cluster1Work.get(target.getSourceTableId())); + Assert.assertTrue(cluster1Work.containsKey(target.getSourceTableId().canonicalID())); + Assert.assertEquals(DistributedWorkQueueWorkAssignerHelper.getQueueKey(filename1, target), cluster1Work.get(target.getSourceTableId().canonicalID())); } @Test public void workAcrossTablesHappensConcurrently() throws Exception { - ReplicationTarget target1 = new ReplicationTarget("cluster1", "table1", "1"); + ReplicationTarget target1 = new ReplicationTarget("cluster1", "table1", new Table.ID("1")); Text serializedTarget1 = target1.toText(); - ReplicationTarget target2 = new ReplicationTarget("cluster1", "table2", "2"); + ReplicationTarget target2 = new ReplicationTarget("cluster1", "table2", new Table.ID("2")); Text serializedTarget2 = target2.toText(); // Create two mutations, both of which need replication work done @@ -223,19 +224,19 @@ public class SequentialWorkAssignerIT extends ConfigurableMacBase { Map<String,String> cluster1Work = queuedWork.get("cluster1"); Assert.assertEquals(2, cluster1Work.size()); - Assert.assertTrue(cluster1Work.containsKey(target1.getSourceTableId())); - Assert.assertEquals(DistributedWorkQueueWorkAssignerHelper.getQueueKey(filename1, target1), cluster1Work.get(target1.getSourceTableId())); + Assert.assertTrue(cluster1Work.containsKey(target1.getSourceTableId().canonicalID())); + Assert.assertEquals(DistributedWorkQueueWorkAssignerHelper.getQueueKey(filename1, target1), cluster1Work.get(target1.getSourceTableId().canonicalID())); - Assert.assertTrue(cluster1Work.containsKey(target2.getSourceTableId())); - Assert.assertEquals(DistributedWorkQueueWorkAssignerHelper.getQueueKey(filename2, target2), cluster1Work.get(target2.getSourceTableId())); + Assert.assertTrue(cluster1Work.containsKey(target2.getSourceTableId().canonicalID())); + Assert.assertEquals(DistributedWorkQueueWorkAssignerHelper.getQueueKey(filename2, target2), cluster1Work.get(target2.getSourceTableId().canonicalID())); } @Test public void workAcrossPeersHappensConcurrently() throws Exception { - ReplicationTarget target1 = new ReplicationTarget("cluster1", "table1", "1"); + ReplicationTarget target1 = new ReplicationTarget("cluster1", "table1", new Table.ID("1")); Text serializedTarget1 = target1.toText(); - ReplicationTarget target2 = new ReplicationTarget("cluster2", "table1", "1"); + ReplicationTarget target2 = new ReplicationTarget("cluster2", "table1", new Table.ID("1")); Text serializedTarget2 = target2.toText(); // Create two mutations, both of which need replication work done @@ -292,18 +293,18 @@ public class SequentialWorkAssignerIT extends ConfigurableMacBase { Map<String,String> cluster1Work = queuedWork.get("cluster1"); Assert.assertEquals(1, cluster1Work.size()); - Assert.assertTrue(cluster1Work.containsKey(target1.getSourceTableId())); - Assert.assertEquals(DistributedWorkQueueWorkAssignerHelper.getQueueKey(filename1, target1), cluster1Work.get(target1.getSourceTableId())); + Assert.assertTrue(cluster1Work.containsKey(target1.getSourceTableId().canonicalID())); + Assert.assertEquals(DistributedWorkQueueWorkAssignerHelper.getQueueKey(filename1, target1), cluster1Work.get(target1.getSourceTableId().canonicalID())); Map<String,String> cluster2Work = queuedWork.get("cluster2"); Assert.assertEquals(1, cluster2Work.size()); - Assert.assertTrue(cluster2Work.containsKey(target2.getSourceTableId())); - Assert.assertEquals(DistributedWorkQueueWorkAssignerHelper.getQueueKey(filename2, target2), cluster2Work.get(target2.getSourceTableId())); + Assert.assertTrue(cluster2Work.containsKey(target2.getSourceTableId().canonicalID())); + Assert.assertEquals(DistributedWorkQueueWorkAssignerHelper.getQueueKey(filename2, target2), cluster2Work.get(target2.getSourceTableId().canonicalID())); } @Test public void reprocessingOfCompletedWorkRemovesWork() throws Exception { - ReplicationTarget target = new ReplicationTarget("cluster1", "table1", "1"); + ReplicationTarget target = new ReplicationTarget("cluster1", "table1", new Table.ID("1")); Text serializedTarget = target.toText(); // Create two mutations, both of which need replication work done @@ -339,7 +340,7 @@ public class SequentialWorkAssignerIT extends ConfigurableMacBase { // Treat filename1 as we have already submitted it for replication Map<String,Map<String,String>> queuedWork = new HashMap<>(); Map<String,String> queuedWorkForCluster = new HashMap<>(); - queuedWorkForCluster.put(target.getSourceTableId(), DistributedWorkQueueWorkAssignerHelper.getQueueKey(filename1, target)); + queuedWorkForCluster.put(target.getSourceTableId().canonicalID(), DistributedWorkQueueWorkAssignerHelper.getQueueKey(filename1, target)); queuedWork.put("cluster1", queuedWorkForCluster); assigner.setQueuedWork(queuedWork); @@ -362,7 +363,7 @@ public class SequentialWorkAssignerIT extends ConfigurableMacBase { Assert.assertTrue(queuedWork.containsKey("cluster1")); Map<String,String> cluster1Work = queuedWork.get("cluster1"); Assert.assertEquals(1, cluster1Work.size()); - Assert.assertTrue(cluster1Work.containsKey(target.getSourceTableId())); - Assert.assertEquals(DistributedWorkQueueWorkAssignerHelper.getQueueKey(filename2, target), cluster1Work.get(target.getSourceTableId())); + Assert.assertTrue(cluster1Work.containsKey(target.getSourceTableId().canonicalID())); + Assert.assertEquals(DistributedWorkQueueWorkAssignerHelper.getQueueKey(filename2, target), cluster1Work.get(target.getSourceTableId().canonicalID())); } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/replication/StatusCombinerMacIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/replication/StatusCombinerMacIT.java b/test/src/main/java/org/apache/accumulo/test/replication/StatusCombinerMacIT.java index 03663a2..0bf1645 100644 --- a/test/src/main/java/org/apache/accumulo/test/replication/StatusCombinerMacIT.java +++ b/test/src/main/java/org/apache/accumulo/test/replication/StatusCombinerMacIT.java @@ -26,6 +26,7 @@ import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.admin.TableOperations; +import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Mutation; @@ -101,7 +102,7 @@ public class StatusCombinerMacIT extends SharedMiniClusterBase { long createTime = System.currentTimeMillis(); try { Mutation m = new Mutation("file:/accumulo/wal/HW10447.local+56808/93cdc17e-7521-44fa-87b5-37f45bcb92d3"); - StatusSection.add(m, "1", StatusUtil.fileCreatedValue(createTime)); + StatusSection.add(m, new Table.ID("1"), StatusUtil.fileCreatedValue(createTime)); bw.addMutation(m); } finally { bw.close(); @@ -114,7 +115,7 @@ public class StatusCombinerMacIT extends SharedMiniClusterBase { bw = ReplicationTable.getBatchWriter(conn); try { Mutation m = new Mutation("file:/accumulo/wal/HW10447.local+56808/93cdc17e-7521-44fa-87b5-37f45bcb92d3"); - StatusSection.add(m, "1", ProtobufUtil.toValue(StatusUtil.replicated(Long.MAX_VALUE))); + StatusSection.add(m, new Table.ID("1"), ProtobufUtil.toValue(StatusUtil.replicated(Long.MAX_VALUE))); bw.addMutation(m); } finally { bw.close(); http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/replication/StatusMakerIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/replication/StatusMakerIT.java b/test/src/main/java/org/apache/accumulo/test/replication/StatusMakerIT.java index cd57ae1..ad8d3a9 100644 --- a/test/src/main/java/org/apache/accumulo/test/replication/StatusMakerIT.java +++ b/test/src/main/java/org/apache/accumulo/test/replication/StatusMakerIT.java @@ -29,6 +29,7 @@ import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Scanner; +import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; @@ -101,10 +102,10 @@ public class StatusMakerIT extends ConfigurableMacBase { Text file = new Text(); for (Entry<Key,Value> entry : s) { StatusSection.getFile(entry.getKey(), file); - String tableId = StatusSection.getTableId(entry.getKey()); + Table.ID tableId = StatusSection.getTableId(entry.getKey()); Assert.assertTrue("Found unexpected file: " + file, files.contains(file.toString())); - Assert.assertEquals(fileToTableId.get(file.toString()), new Integer(tableId)); + Assert.assertEquals(fileToTableId.get(file.toString()), new Integer(tableId.canonicalID())); timeCreated = fileToTimeCreated.get(file.toString()); Assert.assertNotNull(timeCreated); Assert.assertEquals(StatusUtil.fileCreated(timeCreated), Status.parseFrom(entry.getValue().get())); http://git-wip-us.apache.org/repos/asf/accumulo/blob/d6ea49e0/test/src/main/java/org/apache/accumulo/test/replication/UnorderedWorkAssignerIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/replication/UnorderedWorkAssignerIT.java b/test/src/main/java/org/apache/accumulo/test/replication/UnorderedWorkAssignerIT.java index f24129e..34d9ef6 100644 --- a/test/src/main/java/org/apache/accumulo/test/replication/UnorderedWorkAssignerIT.java +++ b/test/src/main/java/org/apache/accumulo/test/replication/UnorderedWorkAssignerIT.java @@ -27,6 +27,7 @@ import java.util.UUID; import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.client.Connector; +import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.protobuf.ProtobufUtil; import org.apache.accumulo.core.replication.ReplicationSchema.OrderSection; @@ -118,7 +119,8 @@ public class UnorderedWorkAssignerIT extends ConfigurableMacBase { @Test public void createWorkForFilesNeedingIt() throws Exception { - ReplicationTarget target1 = new ReplicationTarget("cluster1", "table1", "1"), target2 = new ReplicationTarget("cluster1", "table2", "2"); + ReplicationTarget target1 = new ReplicationTarget("cluster1", "table1", new Table.ID("1")), target2 = new ReplicationTarget("cluster1", "table2", + new Table.ID("2")); Text serializedTarget1 = target1.toText(), serializedTarget2 = target2.toText(); String keyTarget1 = target1.getPeerName() + DistributedWorkQueueWorkAssignerHelper.KEY_SEPARATOR + target1.getRemoteIdentifier() + DistributedWorkQueueWorkAssignerHelper.KEY_SEPARATOR + target1.getSourceTableId(), keyTarget2 = target2.getPeerName() @@ -174,7 +176,8 @@ public class UnorderedWorkAssignerIT extends ConfigurableMacBase { @Test public void doNotCreateWorkForFilesNotNeedingIt() throws Exception { - ReplicationTarget target1 = new ReplicationTarget("cluster1", "table1", "1"), target2 = new ReplicationTarget("cluster1", "table2", "2"); + ReplicationTarget target1 = new ReplicationTarget("cluster1", "table1", new Table.ID("1")), target2 = new ReplicationTarget("cluster1", "table2", + new Table.ID("2")); Text serializedTarget1 = target1.toText(), serializedTarget2 = target2.toText(); // Create two mutations, both of which need replication work done @@ -210,7 +213,7 @@ public class UnorderedWorkAssignerIT extends ConfigurableMacBase { assigner.setQueuedWork(queuedWork); - ReplicationTarget target = new ReplicationTarget("cluster1", "table1", "1"); + ReplicationTarget target = new ReplicationTarget("cluster1", "table1", new Table.ID("1")); String serializedTarget = target.getPeerName() + DistributedWorkQueueWorkAssignerHelper.KEY_SEPARATOR + target.getRemoteIdentifier() + DistributedWorkQueueWorkAssignerHelper.KEY_SEPARATOR + target.getSourceTableId();