Skip to content

Commit 1c0ac5e

Browse files
committed
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>
1 parent 6b0f0c3 commit 1c0ac5e

File tree

1 file changed

+30
-0
lines changed
  • hadoop-common-project/hadoop-common/src/site/markdown/filesystem

1 file changed

+30
-0
lines changed

hadoop-common-project/hadoop-common/src/site/markdown/filesystem/filesystem.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,36 @@ for both files and directories, MUST always return `true` to the `isEncrypted()`
107107
predicate. This can be done by setting the `encrypted` flag to true when creating
108108
the `FileStatus` instance.
109109

110+
111+
### `msync()`
112+
113+
Synchronize metadata state of the client with the latest state of the metadata
114+
service of the FileSystem.
115+
116+
In highly available FileSystems standby service can be used as a read-only
117+
metadata replica. This call is essential to guarantee consistency of
118+
reads from the standby replica and to avoid stale reads.
119+
120+
It is currently only implemented for HDFS and others will just throw
121+
`UnsupportedOperationException`.
122+
123+
#### Preconditions
124+
125+
126+
#### Postconditions
127+
128+
This call internally records the state of the metadata service at the time of
129+
the call. This guarantees consistency of subsequent reads from any metadata
130+
replica. It assures the client will never access the state of the metadata that
131+
preceded the recorded state.
132+
133+
#### HDFS implementation notes
134+
135+
HDFS supports `msync()` in HA mode by calling the Active NameNode and requesting
136+
its latest journal transaction ID. For more details see HDFS documentation
137+
[Consistent Reads from HDFS Observer NameNode](https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/ObserverNameNode.html)
138+
139+
110140
### `Path getHomeDirectory()`
111141

112142
The function `getHomeDirectory` returns the home directory for the FileSystem

0 commit comments

Comments
 (0)