-
Notifications
You must be signed in to change notification settings - Fork 13.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KAFKA-17508: Adding some guard for fallback deletion logic #17154
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. For the test, I think we can use mock(TransactionIndex.class)
when creating segment in LogSegmentTest
to mock the transactionIndex has no parent.
@@ -805,6 +805,10 @@ private Void deleteTypeIfExists(StorageAction<Boolean, IOException> delete, Stri | |||
if (logIfMissing) { | |||
LOGGER.info("Failed to delete {} {} because it does not exist.", fileType, file.getAbsolutePath()); | |||
} | |||
if (file.getParent() == null) { | |||
LOGGER.warn("Failed to delete {} {} because parent directory is null.", fileType, file.getAbsolutePath()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we have to log anything here. It is already logged above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @showuon, thanks for the suggestion. I removed the log and add a test with mock for it.
2613290
to
1a2c7b8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@FrankYang0529 , we have build fail in jdk8 scala 2.12: https://ci-builds.apache.org/job/Kafka/job/kafka-pr/job/PR-17154/2/cloudbees-pipeline-explorer/?filter=9 Please help fix it. Thanks. |
91c166f
to
7b481cd
Compare
Signed-off-by: PoAn Yang <[email protected]>
7b481cd
to
94dc2ed
Compare
Hi @showuon, build fail in jdk 8 and scala 2.12 is fixed. Also, all failed cases in latest CI can pass on my laptop. Could you take a look? Thank you. |
Hi @showuon, thanks for triggering CI. The latest failed cases can pass on my laptop. |
In KAFKA-16424, we added a fallback logic to delete the logs, but the file has no parent. It'd be better we have some guard from it.
Committer Checklist (excluded from commit message)