frankvicky opened a new pull request, #17589:
URL: https://github.com/apache/kafka/pull/17589
The current implementation of `TestUtils#verifyTopicDeletion` contained an
incorrect logic when verifying the hard-deletion of topic directories.
Specifically, the logic was erroneously applying startsWith and endsWith
checks on an array of partition directory names rather than on each individual
directory name. This caused the validation to pass even when the target
directories were still present, which could lead to data consistency issues
during topic deletion operations.
If `Array[String].startsWith()` receives a `String` as a parameter, it
implicitly converts the `String` into an `Array[Char]` and then compares it
against the array of strings.
As a result, the actual comparison was mistakenly happening between:
- **`partitionDirectoryNames` values (example):**
`Array(".lock", "bootstrap.checkpoint",
"recovery-point-offset-checkpoint", "recovery-point-offset-checkpoint.tmp",
"__cluster_metadata-0", "topic-0.9e1caebe9f5d499c9694032104eebe95-delete",
"log-start-offset-checkpoint", "cleaner-offset-checkpoint",
"replication-offset-checkpoint", "meta.properties")`
- **`tp` converted to an `Array[Char]`:**
`Array('t', 'o', 'p', 'i', 'c', '-', '0')`
This implicit conversion led to incorrect behavior where the logic was not
checking the directory names as intended.
### Committer Checklist (excluded from commit message)
- [ ] Verify design and implementation
- [ ] Verify test coverage and CI build status
- [ ] Verify documentation (including upgrade notes)
--
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]