Skip to content

Conversation

@dajac
Copy link
Member

@dajac dajac commented Jan 7, 2026

This patch removes the onPartitionsDeleted method from the
GroupCoordinator interface by moving its functionality into
onMetadataUpdate. The MetadataDelta already contains the deleted
topic information via delta.topicsDelta().deletedTopicIds(), making
the separate method redundant.

Reviewers: Dongnuo Lyu [email protected], Sean Quah
[email protected], Lianet Magrans [email protected]

This patch removes the `onPartitionsDeleted` method from the `GroupCoordinator`
interface by moving its functionality into `onMetadataUpdate`. The `MetadataDelta`
already contains the deleted topic information via `delta.topicsDelta().deletedTopicIds()`,
making the separate method redundant.
Comment on lines -2273 to -2274
// Wait on the results.
CompletableFuture.allOf(futures.toArray(new CompletableFuture<?>[0]));
Copy link
Member Author

Choose a reason for hiding this comment

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

There is a but here as the code does not actually waits on the future to complete.

Copy link
Contributor

@squah-confluent squah-confluent left a comment

Choose a reason for hiding this comment

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

Thanks for the patch!

Not introduced in this PR but I'm not too happy about the onMetadataUpdate being the only method that throws ExecutionException and InteruptedException in the interface. Based on https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Future.html#get--, ExecutionException should never happen since we catch exceptions coming from the futures and maybe we could swallow InterruptedException and convert it to Thread.currentThread().interrupt()?

}

@Test
public void testOnPartitionsDeletedWhenServiceIsNotStarted() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have an equivalent test for onMetadataUpdate? I couldn't find one.

Copy link
Member Author

Choose a reason for hiding this comment

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

added it. good catch.

@dajac
Copy link
Member Author

dajac commented Jan 7, 2026

Not introduced in this PR but I'm not too happy about the onMetadataUpdate being the only method that throws ExecutionException and InteruptedException in the interface. Based on https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Future.html#get--, ExecutionException should never happen since we catch exceptions coming from the futures and maybe we could swallow InterruptedException and convert it to Thread.currentThread().interrupt()?

Interesting... An alternative would be to use join(). What do you think?

@squah-confluent
Copy link
Contributor

Interesting... An alternative would be to use join(). What do you think?

That would work nicely, we could use that instead.

Comment on lines -202 to -203
case t: Throwable => metadataPublishingFaultHandler.handleFault("Error updating group " +
s"coordinator with deleted partitions in $deltaName", t)
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems to be replaced by the general with local changes but I guess it's fine as we also log error message in futures exception

Copy link
Contributor

@dongnuo123 dongnuo123 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Lgtm.


@Test
public void testCompleteTransactionWhenNotCoordinatorServiceStarted() {
public void testCompleteTransactionWhenNotCoordinatorServiceStarted() throws ExecutionException, InterruptedException {
Copy link
Contributor

@squah-confluent squah-confluent Jan 7, 2026

Choose a reason for hiding this comment

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

Thanks for updating the PR. Did we miss removing these?


@Test
public void testPersisterInitializeSuccess() {
public void testPersisterInitializeSuccess() throws ExecutionException, InterruptedException {
Copy link
Contributor

Choose a reason for hiding this comment

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

We missed removing these down here too

@dajac dajac requested a review from lianetm January 7, 2026 19:30
Copy link
Member

@lianetm lianetm left a comment

Choose a reason for hiding this comment

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

Thanks! Just a comment on test

Comment on lines 3224 to 3225
// Verify method is blocked.
assertFalse(resultFuture.isDone());
Copy link
Member

Choose a reason for hiding this comment

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

Is this enough to be sure that we're blocking? I guess the future here could be incomplete only because the async execution of onMetadataUpdate hasn't made it til the end where it's supposed to block/join on the write operations (not because it is blocked waiting on the operations completion). If so, this wouldn't catch a bug like the one you pointed out above with the missing join().

What about we verify that we did schedule the operations before this assert?
~ verify(runtime, timeout(xxx).times(2)).scheduleWriteAllOperation) + assertFalse(resultFuture.isDone())

Copy link
Member Author

Choose a reason for hiding this comment

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

Good callout. Addressed it.

Copy link
Member

@lianetm lianetm left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM

@dajac dajac merged commit 2f90af7 into apache:trunk Jan 8, 2026
24 checks passed
@dajac dajac deleted the minor-remove-on-partition-deleted branch January 8, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants