Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-18625

SessionState Not Checking For Directory Creation Result

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.3.2, 2.4.0, 3.0.0
    • 3.0.0
    • HiveServer2
    • None

    Description

      https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java#L773

        private static void createPath(HiveConf conf, Path path, String permission, boolean isLocal,
            boolean isCleanUp) throws IOException {
          FsPermission fsPermission = new FsPermission(permission);
          FileSystem fs;
          if (isLocal) {
            fs = FileSystem.getLocal(conf);
          } else {
            fs = path.getFileSystem(conf);
          }
          if (!fs.exists(path)) {
            fs.mkdirs(path, fsPermission);
            String dirType = isLocal ? "local" : "HDFS";
            LOG.info("Created " + dirType + " directory: " + path.toString());
          }
          if (isCleanUp) {
            fs.deleteOnExit(path);
          }
        }
      

      The method fs.mkdirs(path, fsPermission) returns a boolean value indicating if the directory creation was successful or not. Hive ignores this return value and therefore could be acting on a directory that doesn't exist.

      Please capture the result, check it, and throw an Exception if it failed

      Attachments

        1. HIVE-18625.2.patch
          5 kB
          Andrew Sherman
        2. HIVE-18625.1.patch
          5 kB
          Andrew Sherman

        Activity

          People

            asherman Andrew Sherman
            belugabehr David Mollitor
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: