Skip to content

MINOR: reduce Metadata log volume when last seen epoch is not updated#12541

Closed
fabien-chebel wants to merge 1 commit intoapache:trunkfrom
fabien-chebel:reduce-metadata-log-verbosity
Closed

MINOR: reduce Metadata log volume when last seen epoch is not updated#12541
fabien-chebel wants to merge 1 commit intoapache:trunkfrom
fabien-chebel:reduce-metadata-log-verbosity

Conversation

@fabien-chebel
Copy link
Copy Markdown

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
Copy Markdown
Author

The original logging verbosity change was performed in #11552.

Pinging @jolshan, who previously reviewed #12378.

@jolshan
Copy link
Copy Markdown
Member

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
Copy Markdown
Member

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
Copy Markdown
Member

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?

@github-actions
Copy link
Copy Markdown

This PR is being marked as stale since it has not had any activity in 90 days. If you
would like to keep this PR alive, please leave a comment asking for a review. If the PR has
merge conflicts, update it with the latest from the base branch.

If you are having difficulty finding a reviewer, please reach out on the [mailing list](https://kafka.apache.org/contact).

If this PR is no longer valid or desired, please feel free to close it. If no activity occurs in the next 30 days, it will be automatically closed.

@github-actions github-actions Bot added the stale Stale PRs label Dec 27, 2024
@github-actions
Copy link
Copy Markdown

This PR has been closed since it has not had any activity in 120 days. If you feel like this
was a mistake, or you would like to continue working on it, please feel free to re-open the
PR and ask for a review.

@github-actions github-actions Bot added the closed-stale PRs that were closed due to inactivity label Jan 27, 2025
@github-actions github-actions Bot closed this Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

closed-stale PRs that were closed due to inactivity stale Stale PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants