This is an automated email from the ASF dual-hosted git repository.
yihua pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git
The following commit(s) were added to refs/heads/master by this push:
new c65434b20cd [HUDI-7207] Sequentially delete complete instant files in
archival to prevent inconsistency during data reads (#10325)
c65434b20cd is described below
commit c65434b20cd68f9a6963cc0ce96acc9eada83f85
Author: majian <[email protected]>
AuthorDate: Fri Dec 15 06:45:59 2023 +0800
[HUDI-7207] Sequentially delete complete instant files in archival to
prevent inconsistency during data reads (#10325)
---
.../apache/hudi/client/timeline/HoodieTimelineArchiver.java | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git
a/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/timeline/HoodieTimelineArchiver.java
b/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/timeline/HoodieTimelineArchiver.java
index c6bb7b300f4..26bd964e4e9 100644
---
a/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/timeline/HoodieTimelineArchiver.java
+++
b/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/timeline/HoodieTimelineArchiver.java
@@ -342,11 +342,13 @@ public class HoodieTimelineArchiver<T extends
HoodieAvroPayload, I, K, O> {
);
}
if (!completedInstants.isEmpty()) {
- context.foreach(
- completedInstants,
- instant -> activeTimeline.deleteInstantFileIfExists(instant),
- Math.min(completedInstants.size(),
config.getArchiveDeleteParallelism())
- );
+ // Due to the concurrency between deleting completed instants and
reading data,
+ // there may be hole in the timeline, which can lead to errors when
reading data.
+ // Therefore, the concurrency of deleting completed instants is
temporarily disabled,
+ // and instants are deleted in ascending order to prevent the occurrence
of such holes.
+ // See HUDI-7207 and #10325.
+ completedInstants.stream()
+ .forEach(instant ->
activeTimeline.deleteInstantFileIfExists(instant));
}
return true;