This is an automated email from the ASF dual-hosted git repository. drew pushed a commit to branch 1.9 in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/1.9 by this push: new e92ef4e Fixes #1041 Provides proper volumes to chooser from import table command e92ef4e is described below commit e92ef4ecf17e8b24d145a746c019848e3ec85d9f Author: Drew Farris <drew.far...@gmail.com> AuthorDate: Wed Mar 20 07:53:42 2019 -0700 Fixes #1041 Provides proper volumes to chooser from import table command --- .../accumulo/master/tableOps/PopulateMetadataTable.java | 12 ++++++------ .../org/apache/accumulo/master/tableOps/ImportTableTest.java | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/PopulateMetadataTable.java b/server/master/src/main/java/org/apache/accumulo/master/tableOps/PopulateMetadataTable.java index 160480b..75c080a 100644 --- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/PopulateMetadataTable.java +++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/PopulateMetadataTable.java @@ -109,7 +109,7 @@ class PopulateMetadataTable extends MasterRepo { // hdfs://localhost:8020/path/to/accumulo/tables/... final String bulkDir = tableInfo.importDir; - final String[] tableDirs = ServerConstants.getTablesDirs(); + final String[] volumes = ServerConstants.getBaseUris(); ZipEntry zipEntry; while ((zipEntry = zis.getNextEntry()) != null) { @@ -155,7 +155,7 @@ class PopulateMetadataTable extends MasterRepo { UTF_8); // Build up a full hdfs://localhost:8020/accumulo/tables/$id/c-XXXXXXX - String absolutePath = getClonedTabletDir(master, tableDirs, tabletDir); + String absolutePath = getClonedTabletDir(master, volumes, tabletDir); m = new Mutation(metadataRow); TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(m, @@ -173,7 +173,7 @@ class PopulateMetadataTable extends MasterRepo { UTF_8); // Build up a full hdfs://localhost:8020/accumulo/tables/$id/c-XXXXXXX - String absolutePath = getClonedTabletDir(master, tableDirs, tabletDir); + String absolutePath = getClonedTabletDir(master, volumes, tabletDir); m = new Mutation(metadataRow); TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(m, @@ -220,12 +220,12 @@ class PopulateMetadataTable extends MasterRepo { * * @return An absolute, unique path for the imported table */ - protected String getClonedTabletDir(Master master, String[] tableDirs, String tabletDir) { + protected String getClonedTabletDir(Master master, String[] volumes, String tabletDir) { // We can try to spread out the tablet dirs across all volumes - String tableDir = master.getFileSystem().choose(Optional.of(tableInfo.tableId), tableDirs); + String volume = master.getFileSystem().choose(Optional.of(tableInfo.tableId), volumes); // Build up a full hdfs://localhost:8020/accumulo/tables/$id/c-XXXXXXX - return tableDir + "/" + tableInfo.tableId + "/" + tabletDir; + return volume + "/" + ServerConstants.TABLE_DIR + "/" + tableInfo.tableId + "/" + tabletDir; } @Override diff --git a/server/master/src/test/java/org/apache/accumulo/master/tableOps/ImportTableTest.java b/server/master/src/test/java/org/apache/accumulo/master/tableOps/ImportTableTest.java index 5e0a32b..e22d710 100644 --- a/server/master/src/test/java/org/apache/accumulo/master/tableOps/ImportTableTest.java +++ b/server/master/src/test/java/org/apache/accumulo/master/tableOps/ImportTableTest.java @@ -19,6 +19,7 @@ package org.apache.accumulo.master.tableOps; import static org.junit.Assert.assertEquals; import org.apache.accumulo.master.Master; +import org.apache.accumulo.server.ServerConstants; import org.apache.accumulo.server.fs.VolumeManager; import org.easymock.EasyMock; import org.junit.Test; @@ -38,21 +39,20 @@ public class ImportTableTest { iti.tableId = "5"; // Different volumes with different paths - String[] tableDirs = new String[] {"hdfs://nn1:8020/apps/accumulo1/tables", - "hdfs://nn2:8020/applications/accumulo/tables"}; + String[] volumes = new String[] {"hdfs://nn1:8020/apps/accumulo1", + "hdfs://nn2:8020/applications/accumulo"}; // This needs to be unique WRT the importtable command String tabletDir = "/c-00000001"; EasyMock.expect(master.getFileSystem()).andReturn(volumeManager); // Choose the 2nd element - EasyMock.expect(volumeManager.choose(Optional.of(iti.tableId), tableDirs)) - .andReturn(tableDirs[1]); + EasyMock.expect(volumeManager.choose(Optional.of(iti.tableId), volumes)).andReturn(volumes[1]); EasyMock.replay(master, volumeManager); PopulateMetadataTable pmt = new PopulateMetadataTable(iti); - assertEquals(tableDirs[1] + "/" + iti.tableId + "/" + tabletDir, - pmt.getClonedTabletDir(master, tableDirs, tabletDir)); + assertEquals(volumes[1] + "/" + ServerConstants.TABLE_DIR + "/" + iti.tableId + "/" + tabletDir, + pmt.getClonedTabletDir(master, volumes, tabletDir)); EasyMock.verify(master, volumeManager); }