Skip to content
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

Merged
merged 1 commit into from
Sep 13, 2024

Conversation

FrankYang0529
Copy link
Member

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)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

Copy link
Contributor

@showuon showuon left a 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());
Copy link
Contributor

@showuon showuon Sep 11, 2024

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.

Copy link
Member Author

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.

Copy link
Contributor

@showuon showuon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@showuon
Copy link
Contributor

showuon commented Sep 12, 2024

@FrankYang0529 FrankYang0529 force-pushed the KAFKA-17508 branch 2 times, most recently from 91c166f to 7b481cd Compare September 12, 2024 12:05
@FrankYang0529
Copy link
Member Author

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.

@showuon
Copy link
Contributor

showuon commented Sep 13, 2024

@FrankYang0529
Copy link
Member Author

Retriggering CI: https://ci-builds.apache.org/job/Kafka/job/kafka-pr/job/PR-17154/6/

Hi @showuon, thanks for triggering CI. The latest failed cases can pass on my laptop.

@showuon showuon merged commit d95e384 into apache:trunk Sep 13, 2024
8 of 9 checks passed
@FrankYang0529 FrankYang0529 deleted the KAFKA-17508 branch September 13, 2024 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants