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

[fix][admin][branch-2.10] getMessageIdByTimestamp cannot redirect #23658

Open
wants to merge 2 commits into
base: branch-2.10
Choose a base branch
from

Conversation

liudezhi2098
Copy link
Contributor

@liudezhi2098 liudezhi2098 commented Nov 29, 2024

Motivation

internalGetMessageIdByTimestamp(timestamp, authoritative)
.thenAccept(messageId -> {
if (messageId == null) {
asyncResponse.resume(new RestException(Response.Status.NOT_FOUND, "Message ID not found"));
} else {
asyncResponse.resume(messageId);
}
})
.exceptionally(ex -> {
if (isNot307And404Exception(ex)) {
log.error("[{}] Failed to get message ID by timestamp {} from {}",
clientAppId(), timestamp, topicName, ex);
resumeAsyncResponseExceptionally(asyncResponse, ex);
}
return null;
});
}

L1770 introduced by cherry-pick<#21995>, the forwarding will not be performed.

Modifications

adjust logic

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository:

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Nov 29, 2024
@liudezhi2098 liudezhi2098 self-assigned this Nov 29, 2024
@@ -122,4 +125,27 @@ public void testTopicLookup(TopicDomain topicDomain, boolean isPartition) throws
Assert.assertEquals(lookupResultSet.size(), 1);
}

@Test(timeOut = 30 * 1000)
public void testTopicGetMessageIdByTimestamp() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

this test don't verify this fix

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi,where is it not covered?

Copy link
Contributor

@congbobo184 congbobo184 Nov 29, 2024

Choose a reason for hiding this comment

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

you should check the 307And404Exception also can return the response exception right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, the requested admin address is not the Broker to which the Topic belong, will the result be successful.
however, there is no 404 verification.

Copy link
Contributor

@congbobo184 congbobo184 left a comment

Choose a reason for hiding this comment

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

LGTM! nice cherry pick

@lhotari lhotari changed the title [fix][admin] getMessageIdByTimestamp cannot redirect in branch-2.10 [fix][admin][branch-2.10] getMessageIdByTimestamp cannot redirect Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-not-needed Your PR changes do not impact docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants