KAFKA-8564: Fix NPE on deleted partition dirs#6968
Conversation
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) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
I don't think this comment adds much value.
|
Nice catch! |
hachikuji
left a comment
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
nit: I don't think we need to mention this in the code. We have the git history and JIRA already.
|
Thanks for the quick reviews! I've pushed an update |
|
@mimaison Thanks for the update. I will merge after the build completes. |
…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>
…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>
…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>
…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>
|
I'd like to understand why the |
|
looks like appending the |
|
the |
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)