Skip to content

KAFKA-8564: Fix NPE on deleted partition dirs#6968

Merged
hachikuji merged 2 commits intoapache:trunkfrom
mimaison:KAFKA-8564
Jun 19, 2019
Merged

KAFKA-8564: Fix NPE on deleted partition dirs#6968
hachikuji merged 2 commits intoapache:trunkfrom
mimaison:KAFKA-8564

Conversation

@mimaison
Copy link
Copy Markdown
Member

Kafka should not NPE while loading a deleted partition dir with no log segments

Co-authored-by: Edoardo Comar ecomar@uk.ibm.com
Co-authored-by: Mickael Maison mickael.maison@gmail.com

Committer Checklist (excluded from commit message)

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

Kafka should not NPE while loading a deleted partition dir with no log segments

Co-authored-by: Edoardo Comar <ecomar@uk.ibm.com>
Co-authored-by: Mickael Maison <mickael.maison@gmail.com>
logDir.mkdirs()
val logConfig = LogTest.createLogConfig()
// There was a regression in 2.2.1 which threw an NPE
val log = createLog(logDir, logConfig)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we assert something about the log? If not, then we should remove the val.

val logDir = new File(tmpDir, dirName)
logDir.mkdirs()
val logConfig = LogTest.createLogConfig()
// There was a regression in 2.2.1 which threw an NPE
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think this comment adds much value.

@ijuma
Copy link
Copy Markdown
Member

ijuma commented Jun 19, 2019

Nice catch!

Copy link
Copy Markdown
Contributor

@hachikuji hachikuji left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM. Left two small comments in the test case.

logDir.mkdirs()
val logConfig = LogTest.createLogConfig()
// There was a regression in 2.2.1 which threw an NPE
val log = createLog(logDir, logConfig)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe add an assertion that there is exactly one log segment?

val logDir = new File(tmpDir, dirName)
logDir.mkdirs()
val logConfig = LogTest.createLogConfig()
// There was a regression in 2.2.1 which threw an NPE
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: I don't think we need to mention this in the code. We have the git history and JIRA already.

@mimaison
Copy link
Copy Markdown
Member Author

Thanks for the quick reviews!

I've pushed an update

@hachikuji
Copy link
Copy Markdown
Contributor

@mimaison Thanks for the update. I will merge after the build completes.

@hachikuji hachikuji merged commit 635c213 into apache:trunk Jun 19, 2019
hachikuji pushed a commit that referenced this pull request Jun 19, 2019
…6968)

Kafka should not NPE while loading a deleted partition dir with no log segments. This patch ensures that there will always be at least one segment after initialization.

Co-authored-by: Edoardo Comar <ecomar@uk.ibm.com>
Co-authored-by: Mickael Maison <mickael.maison@gmail.com>

Reviewers: Ismael Juma <ismael@juma.me.uk>, Jason Gustafson <jason@confluent.io>
hachikuji pushed a commit that referenced this pull request Jun 19, 2019
…6968)

Kafka should not NPE while loading a deleted partition dir with no log segments. This patch ensures that there will always be at least one segment after initialization.

Co-authored-by: Edoardo Comar <ecomar@uk.ibm.com>
Co-authored-by: Mickael Maison <mickael.maison@gmail.com>

Reviewers: Ismael Juma <ismael@juma.me.uk>, Jason Gustafson <jason@confluent.io>
hachikuji pushed a commit that referenced this pull request Jun 19, 2019
…6968)

Kafka should not NPE while loading a deleted partition dir with no log segments. This patch ensures that there will always be at least one segment after initialization.

Co-authored-by: Edoardo Comar <ecomar@uk.ibm.com>
Co-authored-by: Mickael Maison <mickael.maison@gmail.com>

Reviewers: Ismael Juma <ismael@juma.me.uk>, Jason Gustafson <jason@confluent.io>
hachikuji pushed a commit that referenced this pull request Jun 19, 2019
…6968)

Kafka should not NPE while loading a deleted partition dir with no log segments. This patch ensures that there will always be at least one segment after initialization.

Co-authored-by: Edoardo Comar <ecomar@uk.ibm.com>
Co-authored-by: Mickael Maison <mickael.maison@gmail.com>

Reviewers: Ismael Juma <ismael@juma.me.uk>, Jason Gustafson <jason@confluent.io>
@edoardocomar
Copy link
Copy Markdown
Contributor

I'd like to understand why the Co-authored-by commit did not pick me up - again!

@edoardocomar
Copy link
Copy Markdown
Contributor

looks like appending the Reviewers line with a whitespace after Co-authored-by makes the coauthor to be forgotten

Co-authored-by: Edoardo Comar <ecomar@uk.ibm.com>
Co-authored-by: Mickael Maison <mickael.maison@gmail.com>

Reviewers: Ismael Juma <ismael@juma.me.uk>, Jason Gustafson <jason@confluent.io>

@edoardocomar
Copy link
Copy Markdown
Contributor

the Co-authored-by lines have to be a TRAILER
https://help.github.com/en/articles/creating-a-commit-with-multiple-authors

@mimaison mimaison deleted the KAFKA-8564 branch June 25, 2019 16:04
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.

4 participants