This is an automated email from the ASF dual-hosted git repository.
mthakur pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push:
new 231e095802b HADOOP-18407. Improve readVectored() api spec (#4760)
231e095802b is described below
commit 231e095802bb2ccb0edb2ea3da30206f81d59bda
Author: Mukund Thakur <[email protected]>
AuthorDate: Mon Aug 22 23:19:29 2022 +0530
HADOOP-18407. Improve readVectored() api spec (#4760)
part of HADOOP-18103.
Contributed By: Mukund Thakur
---
.../src/main/java/org/apache/hadoop/fs/PositionedReadable.java | 10 ++++++++++
.../src/site/markdown/filesystem/fsdatainputstream.md | 7 +++++++
2 files changed, 17 insertions(+)
diff --git
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/PositionedReadable.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/PositionedReadable.java
index de760905127..7380402eb61 100644
---
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/PositionedReadable.java
+++
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/PositionedReadable.java
@@ -114,6 +114,16 @@ public interface PositionedReadable {
* As a result of the call, each range will have
FileRange.setData(CompletableFuture)
* called with a future that when complete will have a ByteBuffer with the
* data from the file's range.
+ * <p>
+ * The position returned by getPos() after readVectored() is undefined.
+ * </p>
+ * <p>
+ * If a file is changed while the readVectored() operation is in progress,
the output is
+ * undefined. Some ranges may have old data, some may have new and some
may have both.
+ * </p>
+ * <p>
+ * While a readVectored() operation is in progress, normal read api calls
may block.
+ * </p>
* @param ranges the byte ranges to read
* @param allocate the function to allocate ByteBuffer
* @throws IOException any IOE.
diff --git
a/hadoop-common-project/hadoop-common/src/site/markdown/filesystem/fsdatainputstream.md
b/hadoop-common-project/hadoop-common/src/site/markdown/filesystem/fsdatainputstream.md
index 197b999c81f..f64a2bd03b6 100644
---
a/hadoop-common-project/hadoop-common/src/site/markdown/filesystem/fsdatainputstream.md
+++
b/hadoop-common-project/hadoop-common/src/site/markdown/filesystem/fsdatainputstream.md
@@ -454,6 +454,13 @@ Also, clients are encouraged to use
`WeakReferencedElasticByteBufferPool` for
allocating buffers such that even direct buffers are garbage collected when
they are no longer referenced.
+The position returned by `getPos()` after `readVectored()` is undefined.
+
+If a file is changed while the `readVectored()` operation is in progress, the
output is
+undefined. Some ranges may have old data, some may have new, and some may have
both.
+
+While a `readVectored()` operation is in progress, normal read api calls may
block.
+
Note: Don't use direct buffers for reading from ChecksumFileSystem as that may
lead to memory fragmentation explained in HADOOP-18296.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]