Skip to content

Commit

Permalink
More fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom McCormick committed Nov 9, 2022
1 parent bdfe88c commit 14c244d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4889,7 +4889,6 @@ public CompletableFuture<FSDataInputStream> build() throws IOException {
*/
@InterfaceAudience.Public
@InterfaceStability.Unstable
// Should this throw RuntimeException (instead of IO), so we can throw NotInMountpointException from viewfs/rbf?
public Path getEnclosingRoot(Path path) throws IOException {
this.makeQualified(path);
return this.makeQualified(new Path("/"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -602,25 +602,31 @@ on the filesystem.
1. The outcome of this operation MUST be identical to the value of
`getFileStatus(P).getBlockSize()`.
2. By inference, it MUST be > 0 for any file of length > 0.

### `Path getEnclosingRoot(Path p)`

This method is used to find a root directory for a path given. This is useful for creating
staging and temp directories in the same root directory. There are constraints around how
staging and temp directories in the same enclosing root directory. There are constraints around how
renames are allowed to atomically occur (ex. across hdfs volumes or across encryption zones).

For any two paths p1 and p2 that do not have the same enclosing root, `rename(p1, p2)` is expected to fail or will not
be atomic.

The following statement is always true:
`getEnclosingRoot(p) == getEnclosingRoot(getEnclosingRoot(p))`

#### Preconditions

if no root path is found: raise IOException
No root path would be found only if there is no mount point for the given path
The path does not have to exist, but the path does need to be valid and reconcilable by the filesystem
* if a linkfallback is used all paths are reconcilable
* if a linkfallback is not used there must be a mount point covering the path


#### Postconditions

The path return will not be null
* The path returned will not be null, if there is no deeper enclosing root, the root path ("/") will be returned.
* The path returned is a directory

1. The outcome of this operation MUST be identical to the value of
`getFileStatus(P).getBlockSize()`.
1. By inference, it MUST be > 0 for any file of length > 0.

## <a name="state_changing_operations"></a> State Changing Operations

Expand Down

0 comments on commit 14c244d

Please sign in to comment.