-
Notifications
You must be signed in to change notification settings - Fork 11.7k
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
[ISSUE #7074] Allow a BoundaryType to be specified when retrieving offset based on the timestamp #7082
[ISSUE #7074] Allow a BoundaryType to be specified when retrieving offset based on the timestamp #7082
Conversation
tools/src/test/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtTest.java
Outdated
Show resolved
Hide resolved
Please fix failed tests. |
Codecov Report
@@ Coverage Diff @@
## develop #7082 +/- ##
=============================================
+ Coverage 42.72% 42.75% +0.02%
- Complexity 9282 9296 +14
=============================================
Files 1138 1137 -1
Lines 81146 81267 +121
Branches 10619 10640 +21
=============================================
+ Hits 34672 34746 +74
- Misses 42137 42179 +42
- Partials 4337 4342 +5
... and 26 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
if (messageStore instanceof DefaultMessageStore) { | ||
// get offset with specific boundary type | ||
offset = ((DefaultMessageStore) messageStore).getOffsetInQueueByTime(requestHeader.getTopic(), | ||
requestHeader.getQueueId(), requestHeader.getTimestamp(), requestHeader.getBoundaryType()); | ||
} else { | ||
offset = messageStore.getOffsetInQueueByTime(requestHeader.getTopic(), requestHeader.getQueueId(), | ||
requestHeader.getTimestamp()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found that getOffsetInQueueByTime also exists in TieredMessageStore. Would it be better to abstract an interface instead of checking the type every time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I also wanted to add an interface directly at the beginning. But later I found that the BoundaryType used in TieredMessageStore belongs to package org.apache.rocketmq.tieredstore.common and the BoundaryType used in DefaultMessageStore belongs to package org.apache.rocketmq.common. So if I wanna to abstract an interface, the argument of the interface might be boundaryTypeName(String), which means that the enum class is converted to a string, or the string is converted to the enum class, each time the argument is passed and the argument is fetched.
Or maybe I should unify the two enum classes?What do you think I should do in this situation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to unify the two enumeration classes.
Which Issue(s) This PR Fixes
[Feature] Allow a BoundaryType to be specified when retrieving offset based on the timestamp #7074
Brief Description
Add two interfaces to the DefaultMQAdminExt class for the reason that messages will miss if there are multiple messages with the same storeTime(endTime) when retrieving messages over a period of time.
How Did You Test This Change?
I wrote a test case to determine whether the maximum offset of the queue is equal to searchUpperBoundaryOffset(queue's maxTimestamp), and the minimum offset of the queue is equal to searchLowerBoundaryOffset(queue's minTimestamp). The codes are below: