Skip to content

fix(proxy): keep sub-second bounds on admin message queries - #11235

Open
3219378872 wants to merge 1 commit into
apache:developfrom
3219378872:fix/proxy-admin-query-time-window
Open

3219378872 wants to merge 1 commit into
apache:developfrom
3219378872:fix/proxy-admin-query-time-window

Conversation

@3219378872

Copy link
Copy Markdown

Which Issue(s) This PR Fixes

Fixes #11234.

Brief Description

ProxyAdminGrpcService.queryMessage converted ListMessageRequest begin/end timestamps with getSeconds() only. Timestamps.fromMillis stores the fractional second in nanos, so a window such as [1700000000500, 1700000001250] was sent to the broker as [1700000000000, 1700000001000]. The broker index compares those bounds with millisecond store timestamps, inclusive, so the window can shift by up to 999ms.

The query bounds now use the same seconds-plus-nanos conversion ResetGroupOffset already uses. Unset bounds stay 0 and Long.MAX_VALUE. GrpcConverter is unchanged, including the receive-path TIMER_DELAY_SEC delivery timestamp covered by #10686.

How Did You Test This Change?

ProxyAdminGrpcServiceTest#queryMessagePreservesSubSecondTimeRangeTest failed on the unmodified proxy: the mocked AdminService.queryMessage was invoked with 1700000000000 and 1700000001000. After the fix, the same test expects and observes 1700000000500 and 1700000001250.

The whole ProxyAdminGrpcServiceTest class then passed: 61 tests, 0 failures, checkstyle 0 violations. JDK 8 (Temurin 8u504-b01) and Maven 3.8.7. JDK 21 cannot load the pinned Mockito agent for this module. No live broker was required: the defect is the bounds passed into AdminService.queryMessage.

mvn -B -ntp -pl proxy -am test \
  -Dtest=ProxyAdminGrpcServiceTest \
  -DfailIfNoTests=false -Dspotbugs.skip=true

Prepared with AI assistance.

QueryMessage converted protobuf Timestamps with getSeconds() only, so
the inclusive millisecond window passed to the broker shifted by up to
999ms. ResetGroupOffset already kept nanos.

Share that seconds-plus-nanos conversion for the query begin and end.

Fixes apache#11234
@3219378872

Copy link
Copy Markdown
Author

The seven GitHub Actions workflows for head 1dbd294 currently show action_required, and none has started any jobs (for example, Build and Run Tests by Maven).

Could a maintainer approve the pending workflow runs when convenient? The 61 local ProxyAdminGrpcServiceTest tests documented in the PR description do not replace upstream CI validation. Thank you.

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.

[Bug] Proxy Admin QueryMessage drops the fractional second of the time window

1 participant