liuliuOD commented on PR #23564: URL: https://github.com/apache/kafka/pull/23564#issuecomment-5835269562
> LGTM — sensible test-only change that should reduce flakiness and speed up restarts. > > The change replaces plain `streams.close()` / `streams.close(Duration)` with `close(CloseOptions.groupMembershipOperation(LEAVE_GROUP).withTimeout(...))` across several Streams integration tests. The intent (per the comments) is to make the close path deterministic and faster: explicitly leaving the group avoids waiting for the group coordinator's session timeout / rebalance on close, which is the common source of slow or flaky restarts in these tests. > > The change is consistent and mechanical: > > * A shared `closeStreamsWithLeaveGroup` helper is introduced where the pattern repeats (LagFetchIntegrationTest, SelfManagedOffsetLifecycleIntegrationTest). > > * `tearDown` in SelfManagedOffsetLifecycleIntegrationTest still uses the plain `close(STREAMS_CLOSE_TIMEOUT)` — that's fine, since teardown doesn't need the leave-group optimization. > > > One thing to confirm (non-blocking): `LEAVE_GROUP` changes the semantics of close — the member explicitly leaves the group rather than just closing. For tests that assert on group state or rely on the member staying in the group until session timeout, this could alter behavior. Given these are all restart/restore tests that immediately restart the instance, LEAVE_GROUP is appropriate, but it's worth a quick sanity check that none of them assert on group membership _after_ close. > > Also note this is test-only, so no production risk. The `CloseOptions` API usage looks correct (builder pattern with `withTimeout`). I also checked the affected restart paths and none of them rely on the member remaining in the group after close. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
