lilei1128 opened a new issue, #16542:
URL: https://github.com/apache/iceberg/issues/16542
`TestSnapshotSummary#testFileSizeSummaryWithDVs` is a flaky test that fails
intermittently in CI.
`FileGenerationUtil.generateContentLength()` uses
`random().nextInt(10_000)`, which can return **0** with a probability of
1/10,000.
When a DV's `contentSizeInBytes` is 0:
1. `addedSize` accumulates to 0 in `UpdateMetrics.addedFile()`
2. `SnapshotSummary.addTo()` skips writing the `"added-files-size"` field
due to the guard `setIf(addedSize > 0, builder, ADDED_FILE_SIZE_PROP,
addedSize)`
3. The snapshot summary ends up with 18 fields instead of the expected 19
4. `assertThat(summary2).hasSize(19)` fails
## Failure Output
<img width="2182" height="392" alt="Image"
src="https://github.com/user-attachments/assets/35067352-720d-481a-a1de-e096495df334"
/>
## Fix
Change `generateContentLength()` in `FileGenerationUtil` to guarantee a
positive value:
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]