hudi-agent commented on code in PR #19940:
URL: https://github.com/apache/hudi/pull/19940#discussion_r4011827502
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/streamer/StreamSync.java:
##########
@@ -912,12 +912,25 @@ private Pair<Option<String>, JavaRDD<WriteStatus>>
writeToSinkAndDoMetaSync(Hood
HoodiePreCommitValidatorConfig.VALIDATOR_CLASS_NAMES.key(),
HoodiePreCommitValidatorConfig.VALIDATOR_CLASS_NAMES.defaultValue()));
- // Step 1: Commit the error table BEFORE running validators or the
write-error gate.
+ // Step 1: Count records. Must stay ahead of the error-table commit:
the error-table write
+ // statuses are held only by the cache that commit releases, so
reading them afterwards
+ // re-runs the write and lands every error record twice.
+ SuccessfulRecordCounter.Counts counts =
SuccessfulRecordCounter.compute(
+ writeStatuses, errorTableWriteStatusRDDOpt,
isErrorTableWriteUnificationEnabled);
Review Comment:
🤖 This now relies on the writer's `upsert` handing back an RDD that is
already persisted (the bulk insert's instant cache), but
`BaseErrorTableWriter#upsert` is a pluggable EVOLVING API with no such
contract. If a custom writer returns an unpersisted or derived RDD (e.g. a
`map` over the bulk-insert result), `aggregate` evaluates the write once here
and `writeClient.commit` evaluates it again — the same double-write this PR
fixes. The previous revision's `cacheHere` fallback covered that; was dropping
it intentional, or would a `StorageLevel.NONE()` check + persist around the
count (like the data-table block just above) be worth keeping?
<sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag
quality.</i></sub>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]