You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2019/10/17 21:29:38 UTC

[GitHub] [accumulo] keith-turner commented on a change in pull request #1389: Always choose volume for new tablet files.

keith-turner commented on a change in pull request #1389: Always choose volume for new tablet files.
URL: https://github.com/apache/accumulo/pull/1389#discussion_r336235930
 
 

 ##########
 File path: server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
 ##########
 @@ -2806,49 +2806,12 @@ public AtomicLong getScannedCounter() {
     return scannedCount;
   }
 
-  private static String createTabletDirectory(ServerContext context, VolumeManager fs,
-      TableId tableId, Text endRow) {
-    String lowDirectory;
-
-    UniqueNameAllocator namer = context.getUniqueNameAllocator();
-    VolumeChooserEnvironment chooserEnv =
-        new VolumeChooserEnvironmentImpl(tableId, endRow, context);
-    String volume = fs.choose(chooserEnv, ServerConstants.getBaseUris(context))
-        + Constants.HDFS_TABLES_DIR + Path.SEPARATOR;
-
-    while (true) {
-      try {
-        if (endRow == null) {
-          lowDirectory = Constants.DEFAULT_TABLET_LOCATION;
-          Path lowDirectoryPath = new Path(volume + "/" + tableId + "/" + lowDirectory);
-          if (fs.exists(lowDirectoryPath) || fs.mkdirs(lowDirectoryPath)) {
-            FileSystem pathFs = fs.getVolumeByPath(lowDirectoryPath).getFileSystem();
-            return lowDirectoryPath.makeQualified(pathFs.getUri(), pathFs.getWorkingDirectory())
-                .toString();
-          }
-          log.warn("Failed to create {} for unknown reason", lowDirectoryPath);
-        } else {
-          lowDirectory = "/" + Constants.GENERATED_TABLET_DIRECTORY_PREFIX + namer.getNextName();
-          Path lowDirectoryPath = new Path(volume + "/" + tableId + "/" + lowDirectory);
-          if (fs.exists(lowDirectoryPath)) {
-            throw new IllegalStateException("Attempting to create tablet dir for tableID " + tableId
-                + " and dir exists when it should not: " + lowDirectoryPath);
-          }
-          if (fs.mkdirs(lowDirectoryPath)) {
-            FileSystem lowDirectoryFs = fs.getVolumeByPath(lowDirectoryPath).getFileSystem();
-            return lowDirectoryPath
-                .makeQualified(lowDirectoryFs.getUri(), lowDirectoryFs.getWorkingDirectory())
-                .toString();
-          }
-        }
-      } catch (IOException e) {
-        log.warn("{}", e.getMessage(), e);
-      }
-
-      log.warn("Failed to create dir for tablet in table {} in volume {} will retry ...", tableId,
-          volume);
-      sleepUninterruptibly(3, TimeUnit.SECONDS);
-
+  private static String createTabletDirectoryName(ServerContext context, Text endRow) {
+    if (endRow == null) {
+      return Constants.DEFAULT_TABLET_DIR_NAME;
+    } else {
+      UniqueNameAllocator namer = context.getUniqueNameAllocator();
+      return Constants.GENERATED_TABLET_DIRECTORY_PREFIX + namer.getNextName();
 
 Review comment:
    Its done in the function `Tablet.checkTabletDir()`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services