Skip to content

KAFKA-20665: re-use hot standby task for temporary active task grant - #23488

Open
mjsax wants to merge 2 commits into
apache:trunkfrom
mjsax:kafka-20665-assignment-refiner-3b
Open

mjsax wants to merge 2 commits into
apache:trunkfrom
mjsax:kafka-20665-assignment-refiner-3b

Conversation

@mjsax

@mjsax mjsax commented Sep 17, 2026

Copy link
Copy Markdown
Member

If a member leaves or drops out of a group, or a rebalance happens while
an active task is still restoring, it's possible that the task is moved
to a different member which might imply a cold start, because the old
member is gone or does not do any processing yet, so putting a warmup on
the new owner is useless.

However, if there is another member holding a hot standby, we can
temporarily promote it to an active task, and put a warmup task on the
new owner, for a proper staging and no offline time.

Part of KIP-1071.

@mjsax mjsax added streams KIP-1071 PRs related to KIP-1071 group-coordinator labels Sep 17, 2026

@lucasbru lucasbru left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the PR! I made a pass

* for how this is determined, and for why a member the coordinator has not heard from reads as processing.
* @param caughtUp
* Whether the member has restored the task to within {@code acceptable.recovery.lag}.
* Should only be checked if the task is not {@code restoring}.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this doc has it backwards - caughtUp is only meaningful while restoring is true (once a member stops restoring it stops reporting offsets for the task, so caughtUp would read as false). hot() relies on the short-circuit !restoring || caughtUp to be correct today, but as written this would mislead anyone who reads caughtUp on its own.

} else if (holder == null && onDisk(currentAssignment, targetProcessId, task)) {
// The target owner's process left this task's state on disk and can reopen it. How far behind that
// state is cannot be measured -- a member reports an end offset only for a task it is restoring --
// so this takes precedence over promoting a caught-up copy, because the common way a task ends up

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is that right? For a caught up copy, we know that we are not behind, for the on disk task, we don't.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, it's an optimistic approach here.

currentOwner = Optional.of(holder.memberId());
} else if (holder == null && onDisk(currentAssignment, targetProcessId, task)) {
// The target owner's process left this task's state on disk and can reopen it. How far behind that
// state is cannot be measured -- a member reports an end offset only for a task it is restoring --

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Another member could report the end offset (because it's actively restoring). This is actually likely to be the case. Could we measure the lag that way?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes we could

Matthias J. Sax added 2 commits September 18, 2026 10:50
If a member leaves or drops out of a group, or a rebalance happens while
an active task is still restoring, it's possible that the task is moved
to a different member which might imply a cold start, because the old
member is gone or does not do any processing yet, so putting a warmup on
the new owner is useless.

However, if there is another member holding a hot standby, we can
temporarily promote it to an active task, and put a warmup task on the
new owner, for a proper staging and no offline time.
@mjsax
mjsax force-pushed the kafka-20665-assignment-refiner-3b branch from 07c278d to 4d235e4 Compare September 18, 2026 19:16
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.

2 participants