K1taIkuyo0421 opened a new issue, #19619: URL: https://github.com/apache/hudi/issues/19619
### Bug Description **What happened:** The issue is in the `ClientIds#nextId` method in `hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/util/ClientIds.java`. See [ClientIds.java#L187-L208](https://github.com/apache/hudi/blob/master/hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/util/ClientIds.java#L187-L208). The method sorts ClientId heartbeat files lexicographically using `.sorted(Comparator.comparing(Path::getName))`. When the directory contains `_, _1, _2, ..., _9, _10`, the sorted result is `_, _1, _10, _2, ..., _9`. The last entry, `_9`, is therefore treated as the largest ClientId, and `10` is generated again, causing an existing ClientId to be allocated twice. **What you expected:** ClientIds should be sorted by their numeric values. When `_10` already exists, `nextId()` should return `11` instead of `10`. **Steps to reproduce:** 1. Create non-expired heartbeat files `_, _1, _2, ..., _9, _10` under `.hoodie/.aux/.ids`. 2. Call `ClientIds#nextId` without explicitly configuring `write.client.id`. 3. `nextId()` returns `10`, while the expected result is `11`. ### Environment **Hudi version:** 1.1.1 **Query engine:** Flink **Relevant configs:** - Flink multi-writer is enabled. - `write.client.id` is not explicitly configured. - Active ClientIds reach two digits, such as `_10`. ### Logs and Stack Trace N/A. This is a deterministic logic issue. -- 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]
