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: reduce Metadata log volume when last seen epoch is not updated #12541

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

fabien-chebel
Copy link

Context

Since updating to kafka client 3.0.1, we noticed quite a lot of new info-level logs generated by org.apache.kafka.clients.Metadata.

The logs look like this:

[Producer clientId=producer-1] Resetting the last seen epoch of partition user-3 to 2044 since the associated topicId changed from null to O5w7zNcCTpKdylvkOUMesQ

They appear at seemingly random times, while keeping the same last seen epoch value.

Proposed fix

As suggested in #12378, I am updating the code condition to avoid generating a log when the last seen epoch reset operation is a no-op.

Committer Checklist (excluded from commit message)

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

Context
-------

Since updating to kafka client 3.0.1, we noticed quite a lot of new info-level logs generated by `org.apache.kafka.clients.Metadata`.

The logs look like this:
```
[Producer clientId=producer-1] Resetting the last seen epoch of partition user-3 to 2044 since the associated topicId changed from null to O5w7zNcCTpKdylvkOUMesQ
```

They appear at seemingly random times, while keeping the same last seen epoch value.

Proposed fix
------------

As suggested in apache#12378, I am updating the code condition to avoid generating a log when the last seen epoch reset operation is a no-op.
@fabien-chebel
Copy link
Author

The original logging verbosity change was performed in #11552.

Pinging @jolshan, who previously reviewed #12378.

@jolshan
Copy link
Contributor

jolshan commented Aug 19, 2022

Thanks @fabien-chebel -- this was a solution I was thinking of when reviewing https://github.com/apache/kafka/pull/12378/files

@jolshan
Copy link
Contributor

jolshan commented Aug 19, 2022

Another option I was thinking of was removing the log line from the case where the previous topic ID was null.

log.info("Resetting the last seen epoch of partition {} to {} since the associated topicId changed from {} to {}",
tp, newEpoch, oldTopicId, topicId);
lastSeenLeaderEpochs.put(tp, newEpoch);
if (!Objects.equals(currentEpoch, newEpoch)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering though if using a primitive and an Integer is ok here. Maybe we can just compare the value of currentEpoch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants