accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmar...@apache.org
Subject [accumulo] 02/02: Merged in changes for 573 into code correcting compiler errors due to changes in master since PR was initially opened.
Date Fri, 07 Sep 2018 20:37:27 GMT
This is an automated email from the ASF dual-hosted git repository.

jmark99 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git

commit ffffc9f11a21d21458d4a8c4414201c5447098bc
Author: Mark Owens <jmark99@apache.org>
AuthorDate: Fri Sep 7 16:03:47 2018 -0400

    Merged in changes for 573 into code correcting compiler errors due to
    changes in master since PR was initially opened.
---
 .../org/apache/accumulo/master/tableOps/ChooseDir.java  | 17 +++++++----------
 .../accumulo/master/tableOps/FinishCreateTable.java     |  6 +++---
 .../accumulo/master/tableOps/PopulateMetadata.java      | 14 +++++++-------
 .../java/org/apache/accumulo/master/tableOps/Utils.java |  1 -
 .../java/org/apache/accumulo/test/ShellServerIT.java    |  2 ++
 5 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/ChooseDir.java
b/server/master/src/main/java/org/apache/accumulo/master/tableOps/ChooseDir.java
index 5d0985d..81593f9 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/ChooseDir.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/ChooseDir.java
@@ -53,18 +53,14 @@ class ChooseDir extends MasterRepo {
 
     VolumeChooserEnvironment chooserEnv = new VolumeChooserEnvironment(tableInfo.tableId);
 
-    String baseDir = master.getFileSystem().choose(chooserEnv, ServerConstants.getBaseUris())
-        + Constants.HDFS_TABLES_DIR + Path.SEPARATOR + tableInfo.tableId;
+    String baseDir = master.getFileSystem().choose(chooserEnv,
+        ServerConstants.getBaseUris(master.getConfiguration())) + Constants.HDFS_TABLES_DIR
+        + Path.SEPARATOR + tableInfo.tableId;
     tableInfo.defaultTabletDir = baseDir + Constants.DEFAULT_TABLET_LOCATION;
 
     if (tableInfo.initialSplitSize > 0) {
       createTableDirectoriesInfo(master, baseDir);
     }
-    VolumeChooserEnvironment chooserEnv = new VolumeChooserEnvironment(tableInfo.tableId,
-        master.getContext());
-    tableInfo.dir = master.getFileSystem().choose(chooserEnv,
-        ServerConstants.getBaseUris(master.getConfiguration())) + Constants.HDFS_TABLES_DIR
-        + Path.SEPARATOR + tableInfo.tableId + Constants.DEFAULT_TABLET_LOCATION;
     return new CreateDir(tableInfo);
   }
 
@@ -81,7 +77,8 @@ class ChooseDir extends MasterRepo {
   private void createTableDirectoriesInfo(Master master, String baseDir) throws IOException
{
     SortedSet<Text> splits = Utils.getSortedSetFromFile(master.getInputStream(tableInfo.splitFile),
         true);
-    SortedSet<Text> tabletDirectoryInfo = createTabletDirectoriesSet(splits.size(),
baseDir);
+    SortedSet<Text> tabletDirectoryInfo = createTabletDirectoriesSet(master, splits.size(),
+        baseDir);
     writeTabletDirectoriesToFileSystem(master, tabletDirectoryInfo);
   }
 
@@ -89,9 +86,9 @@ class ChooseDir extends MasterRepo {
    * Create a set of unique table directories. These will be associated with splits in a
follow-on
    * FATE step.
    */
-  private SortedSet<Text> createTabletDirectoriesSet(int num, String baseDir) {
+  private SortedSet<Text> createTabletDirectoriesSet(Master master, int num, String
baseDir) {
     String tabletDir;
-    UniqueNameAllocator namer = UniqueNameAllocator.getInstance();
+    UniqueNameAllocator namer = master.getContext().getUniqueNameAllocator();
     SortedSet<Text> splitDirs = new TreeSet<>();
     for (int i = 0; i < num; i++) {
       tabletDir = "/" + Constants.GENERATED_TABLET_DIRECTORY_PREFIX + namer.getNextName();
diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/FinishCreateTable.java
b/server/master/src/main/java/org/apache/accumulo/master/tableOps/FinishCreateTable.java
index 6512521..616001e 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/FinishCreateTable.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/FinishCreateTable.java
@@ -23,7 +23,6 @@ import org.apache.accumulo.core.master.state.tables.TableState;
 import org.apache.accumulo.core.volume.Volume;
 import org.apache.accumulo.fate.Repo;
 import org.apache.accumulo.master.Master;
-import org.apache.accumulo.server.tables.TableManager;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 
@@ -46,9 +45,10 @@ class FinishCreateTable extends MasterRepo {
   public Repo<Master> call(long tid, Master env) throws Exception {
 
     if (tableInfo.initialTableState == InitialTableState.OFFLINE) {
-      TableManager.getInstance().transitionTableState(tableInfo.tableId, TableState.OFFLINE);
+      env.getContext().getTableManager().transitionTableState(tableInfo.tableId,
+          TableState.OFFLINE);
     } else {
-      TableManager.getInstance().transitionTableState(tableInfo.tableId, TableState.ONLINE);
+      env.getContext().getTableManager().transitionTableState(tableInfo.tableId, TableState.ONLINE);
     }
 
     Utils.unreserveNamespace(env, tableInfo.namespaceId, tid, false);
diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/PopulateMetadata.java
b/server/master/src/main/java/org/apache/accumulo/master/tableOps/PopulateMetadata.java
index cb51e9d..eb1c7eb 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/PopulateMetadata.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/PopulateMetadata.java
@@ -31,6 +31,7 @@ import org.apache.accumulo.core.data.impl.KeyExtent;
 import org.apache.accumulo.core.metadata.schema.MetadataSchema;
 import org.apache.accumulo.fate.Repo;
 import org.apache.accumulo.master.Master;
+import org.apache.accumulo.server.ServerContext;
 import org.apache.accumulo.server.util.MetadataTableUtil;
 import org.apache.accumulo.server.zookeeper.ZooLock;
 import org.apache.hadoop.io.Text;
@@ -57,8 +58,7 @@ class PopulateMetadata extends MasterRepo {
   public Repo<Master> call(long tid, Master environment) throws Exception {
     KeyExtent extent = new KeyExtent(tableInfo.tableId, null, null);
     MetadataTableUtil.addTablet(extent, tableInfo.defaultTabletDir, environment.getContext(),
-        tableInfo.timeType,
-        environment.getMasterLock());
+        tableInfo.timeType, environment.getMasterLock());
 
     if (tableInfo.initialSplitSize > 0) {
       SortedSet<Text> splits = Utils
@@ -67,15 +67,15 @@ class PopulateMetadata extends MasterRepo {
           .getSortedSetFromFile(environment.getInputStream(tableInfo.splitDirsFile), false);
       Map<Text,Text> splitDirMap = createSplitDirectoryMap(splits, dirs);
       try (BatchWriter bw = environment.getConnector().createBatchWriter("accumulo.metadata"))
{
-        writeSplitsToMetadataTable(tableInfo.tableId, splits, splitDirMap, tableInfo.timeType,
-            environment.getMasterLock(), bw);
+        writeSplitsToMetadataTable(environment.getContext(), tableInfo.tableId, splits, splitDirMap,
+            tableInfo.timeType, environment.getMasterLock(), bw);
       }
     }
     return new FinishCreateTable(tableInfo);
   }
 
-  private void writeSplitsToMetadataTable(Table.ID tableId, SortedSet<Text> splits,
-      Map<Text,Text> data, char timeType, ZooLock lock, BatchWriter bw)
+  private void writeSplitsToMetadataTable(ServerContext ctx, Table.ID tableId,
+      SortedSet<Text> splits, Map<Text,Text> data, char timeType, ZooLock lock,
BatchWriter bw)
       throws MutationsRejectedException {
     Text prevSplit = null;
     Value dirValue;
@@ -86,7 +86,7 @@ class PopulateMetadata extends MasterRepo {
       MetadataSchema.TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(mut, dirValue);
       MetadataSchema.TabletsSection.ServerColumnFamily.TIME_COLUMN.put(mut,
           new Value(timeType + "0"));
-      MetadataTableUtil.putLockID(lock, mut);
+      MetadataTableUtil.putLockID(ctx, lock, mut);
       prevSplit = split;
       bw.addMutation(mut);
     }
diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/Utils.java b/server/master/src/main/java/org/apache/accumulo/master/tableOps/Utils.java
index bbf801a..0f656ee 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/Utils.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/Utils.java
@@ -45,7 +45,6 @@ import org.apache.accumulo.fate.zookeeper.ZooReservation;
 import org.apache.accumulo.master.Master;
 import org.apache.accumulo.server.ServerContext;
 import org.apache.accumulo.server.zookeeper.ZooQueueLock;
-import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.hadoop.fs.FSDataInputStream;
 import org.apache.hadoop.io.Text;
 import org.apache.zookeeper.KeeperException;
diff --git a/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java b/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java
index 917edd7..92aa47d 100644
--- a/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java
@@ -36,6 +36,7 @@ import java.lang.reflect.Constructor;
 import java.nio.charset.Charset;
 import java.nio.file.Files;
 import java.nio.file.Paths;
+import java.security.SecureRandom;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Base64;
@@ -98,6 +99,7 @@ import org.apache.hadoop.io.Text;
 import org.apache.hadoop.tools.DistCp;
 import org.junit.After;
 import org.junit.AfterClass;
+import org.junit.Assert;
 import org.junit.Assume;
 import org.junit.Before;
 import org.junit.BeforeClass;


Mime
View raw message