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

MINOR: make sure all dir jobs are completed #9728

Merged
merged 4 commits into from
Jan 6, 2021

Conversation

chia7712
Copy link
Member

revert the change introduced by #9680 and add a unit test to verify

Committer Checklist (excluded from commit message)

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

* @param jobs jobs
* @return true if all pass. Otherwise, false
*/
private[log] def allPass(jobs: Seq[Future[_]]): Boolean = {
Copy link
Contributor

Choose a reason for hiding this comment

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

The name makes this look generic, but it's not. The logging is very specific. I would change the name to be specific.

Copy link
Member Author

Choose a reason for hiding this comment

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

How about "waitForAllToComplete"

Copy link
Contributor

Choose a reason for hiding this comment

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

The log message talks explicitly about LogManager shutdown. Seems like you'd want it to say something about log manager shutdown. I would even set the type parameter to the type we expect from the shutdown method.

Copy link
Member Author

Choose a reason for hiding this comment

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

I would even set the type parameter to the type we expect from the shutdown method.

There is no explicit type so I didn't define the type parameter.

Copy link
Contributor

@kowshik kowshik left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the fix @chia7712 ! I've added a few comments. It will be useful to get this PR into master.

core/src/main/scala/kafka/log/LogManager.scala Outdated Show resolved Hide resolved
Copy link
Contributor

@kowshik kowshik left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the updated PR!

@chia7712
Copy link
Member Author

chia7712 commented Jan 5, 2021

@ijuma Could you take a look?

Copy link
Contributor

@ijuma ijuma left a comment

Choose a reason for hiding this comment

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

Looks good overall, just a few nits.

core/src/main/scala/kafka/log/LogManager.scala Outdated Show resolved Hide resolved
core/src/main/scala/kafka/log/LogManager.scala Outdated Show resolved Hide resolved
def testWaitForAllToComplete(): Unit = {
var invokedCount = 0
val success: Future[Boolean] = Mockito.mock(classOf[Future[Boolean]])
Mockito.when(success.get()).thenAnswer(_ => invokedCount += 1)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we not return true in this answer?

Copy link
Member Author

Choose a reason for hiding this comment

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

waitForAllToComplete does not use the return value so it does not cause casting error even though we don't return true. However, it does look like a bug so I will add the return value.

Copy link
Contributor

@ijuma ijuma left a comment

Choose a reason for hiding this comment

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

LGTM, thanks.

@chia7712 chia7712 merged commit b80cf9c into apache:trunk Jan 6, 2021
@chia7712 chia7712 deleted the MINOR-9728 branch March 25, 2024 15:22
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.

3 participants