HDFS-15751. Add documentation for msync() API to filesystem.md. Contributed by Konstantin V Shvachko.

Reviewed-by: He Xiaoqiao <hexiaoqiao@apache.org>
Reviewed-by: Chao Sun <sunchao@apache.org>
This commit is contained in:
He Xiaoqiao 2021-01-03 16:25:17 +08:00
parent 060594259c
commit cfcd17ffe7
No known key found for this signature in database
GPG Key ID: A80CC124E9A0FA63
1 changed files with 30 additions and 0 deletions

View File

@ -116,6 +116,36 @@ for both files and directories, MUST always return `true` to the `isEncrypted()`
predicate. This can be done by setting the `encrypted` flag to true when creating
the `FileStatus` instance.
### `msync()`
Synchronize metadata state of the client with the latest state of the metadata
service of the FileSystem.
In highly available FileSystems standby service can be used as a read-only
metadata replica. This call is essential to guarantee consistency of
reads from the standby replica and to avoid stale reads.
It is currently only implemented for HDFS and others will just throw
`UnsupportedOperationException`.
#### Preconditions
#### Postconditions
This call internally records the state of the metadata service at the time of
the call. This guarantees consistency of subsequent reads from any metadata
replica. It assures the client will never access the state of the metadata that
preceded the recorded state.
#### HDFS implementation notes
HDFS supports `msync()` in HA mode by calling the Active NameNode and requesting
its latest journal transaction ID. For more details see HDFS documentation
[Consistent Reads from HDFS Observer NameNode](https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/ObserverNameNode.html)
### `Path getHomeDirectory()`
The function `getHomeDirectory` returns the home directory for the FileSystem