LuciferYang opened a new pull request, #10254: URL: https://github.com/apache/paimon/pull/10254
### Purpose `ChangelogManager` had two related weaknesses around changelog metadata files. `commitChangelog` wrote the changelog JSON with `fileIO.writeFile(path, json, true)`, a direct overwrite of the target path. A crash during that write leaves an empty or partial file at the canonical changelog path, while snapshots and hint files are already committed atomically. This changes `commitChangelog` to `fileIO.tryToWriteAtomic`, which writes a temp file and renames it into place. When the atomic write returns false because the target already exists, the same id must carry the same content, so the commit is treated as idempotent and only a genuinely different content raises an error. `safelyGetAllChangelogs` logged "Changelog file is empty" but then still called `Changelog.fromJson` on the empty string. That parse throws `UncheckedIOException`, which the consumer's `catch (IOException)` does not catch, so it propagates and aborts the whole enumeration. The only caller, `OrphanFilesClean`, then fails entirely because of one empty or torn file. This skips empty changelog files so the listing stays resilient, matching the intent already expressed by the method name and its existing `FileNotFoundException` handling. This closes #10252. ### Tests Added `ChangelogManagerTest` with two cases. `testCommitChangelogWritesAtomically` verifies the target path is never opened for a direct overwrite and that repeating a commit of the same id is idempotent while a different content for the same id fails. `testSafelyGetAllChangelogsSkipsEmptyFile` writes one valid and one empty changelog file and asserts the empty one is skipped. ### API and Format No. ### Documentation No. -- 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]
