Skip to content
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

KAFKA-18913: Removing _state.updater.enabled_ flag through the Stream… #19275

Open
wants to merge 5 commits into
base: trunk
Choose a base branch
from

Conversation

janchilling
Copy link
Contributor

…Thread#runOnceWithoutProcessingThreads flow.

Removed code of the method StreamThread#initializeAndRestorePhase, since it was only used in the negation flow. Also removed the flag entirely from the StreamThread#runOnceWithoutProcessingThreads method.

Will remove the flag and the related code entirely from the future commits!

…Thread#runOnceWithoutProcessingThreads flow.

Removed code of the method StreamThread#initializeAndRestorePhase, since it was only used in the negation flow. Also removed the flag entirely from the StreamThread#runOnceWithoutProcessingThreads method.
@github-actions github-actions bot added triage PRs from the community streams small Small PRs labels Mar 24, 2025
@janchilling
Copy link
Contributor Author

janchilling commented Mar 24, 2025

Hi @cadonna ,

Would you be able to verify if the changes I have done are correct, like is this what is required?

Also TaskManager#needsInitializationOrRestoration had only one usage through StreamThread#initializeAndRestorePhase method (which was removed). And TaskManager#tryToCompleteRestoration also had only one usage but lot of test cases around 53 I guess. So wanted to know if I should go levels below and remove the code or just top level code.

I will do the changes to remove the flag from the other places and commit them, in the meantime would be great if you can verify if my approach is correct. Also could you also start the workflow as well?

…Thread#create flow.

Removed the stateUpdaterEnabled dependency completely from the StreamThread#create methods and all the inner methods that use it
@github-actions github-actions bot removed the small Small PRs label Mar 24, 2025
…Thread#maybeGetClientInstanceIds, StreamThread#pollPhase and StreamThread#clientInstanceIds flow.

Removed the stateUpdaterEnabled dependency completely from the StreamThread#maybeGetClientInstanceIds,  StreamThread#pollPhase and StreamThread#clientInstanceIds flow.

Also with this commit, have removed the flag dependency completely from the StreamThread and StreamThreadTest classes
@mjsax mjsax requested a review from cadonna March 27, 2025 23:59
Copy link
Member

@cadonna cadonna 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, @janchilling !

I started the review, but was not able to finish it. Nevertheless, I would like to share the comments up until now with you. Most comments are about additional indentation. We use 4 spaces and not 8. There are also some other comments about the code.

I will proceed with the review next week. Feel free to update the PR in the meanwhile.

@@ -372,15 +371,13 @@ public static StreamThread create(final TopologyMetadata topologyMetadata,
final Runnable shutdownErrorHook,
final BiConsumer<Throwable, Boolean> streamsUncaughtExceptionHandler) {

final boolean stateUpdaterEnabled = InternalConfig.stateUpdaterEnabled(config.originals());
Copy link
Member

Choose a reason for hiding this comment

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

Could you please also remove the internal config _state.updater.enabled_ and all corresponding code from StreamsConfig?

"only DEAD state is a valid next state", newState);
"only DEAD state is a valid next state", newState);
Copy link
Member

Choose a reason for hiding this comment

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

Could you revert this change, please?

"no valid next state after DEAD", newState);
"no valid next state after DEAD", newState);
Copy link
Member

Choose a reason for hiding this comment

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

Could you revert this change, please?

Comment on lines -397 to +400
time,
config,
restorationLogContext,
adminClient,
restoreConsumer,
userStateRestoreListener,
userStandbyUpdateListener
time,
config,
restorationLogContext,
adminClient,
restoreConsumer,
userStateRestoreListener,
userStandbyUpdateListener
Copy link
Member

Choose a reason for hiding this comment

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

Could you please revert this change?

Comment on lines +407 to +419
topologyMetadata,
config,
streamsMetrics,
stateDirectory,
changelogReader,
cache,
time,
clientSupplier,
threadId,
threadIdx,
processId,
log,
proceessingThreadsEnabled
Copy link
Member

Choose a reason for hiding this comment

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

Could you please revert the additional indentation?

@@ -831,7 +816,7 @@ void maybeGetClientInstanceIds() {
if (fetchDeadlineClientInstanceId >= time.milliseconds()) {
try {
producerInstanceIdFuture.complete(
taskManager.streamsProducer().kafkaProducer().clientInstanceId(Duration.ZERO)
taskManager.streamsProducer().kafkaProducer().clientInstanceId(Duration.ZERO)
Copy link
Member

Choose a reason for hiding this comment

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

Could you please revert the additional indentation?

@@ -844,14 +829,14 @@ void maybeGetClientInstanceIds() {
}
} else {
producerInstanceIdFuture.completeExceptionally(
new TimeoutException("Could not retrieve thread producer client instance id.")
new TimeoutException("Could not retrieve thread producer client instance id.")
Copy link
Member

Choose a reason for hiding this comment

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

Could you please revert the additional indentation?

Comment on lines +838 to +839
&& restoreConsumerInstanceIdFuture.isDone()
&& producerInstanceIdFuture.isDone()) {
Copy link
Member

Choose a reason for hiding this comment

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

Could you please revert the additional indentation?

);
}
}

if (mainConsumerInstanceIdFuture.isDone()
&& (!stateUpdaterEnabled && restoreConsumerInstanceIdFuture.isDone())
&& producerInstanceIdFuture.isDone()) {
&& restoreConsumerInstanceIdFuture.isDone()
Copy link
Member

Choose a reason for hiding this comment

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

I believe you can also remove this line. With the state updater fetching this instance ID is done within the state updater.

Comment on lines -921 to +907
"This implies that this thread missed a rebalance and dropped out of the consumer group. " +
"Will close out all assigned tasks and rejoin the consumer group.", e);
"This implies that this thread missed a rebalance and dropped out of the consumer group. " +
"Will close out all assigned tasks and rejoin the consumer group.", e);
Copy link
Member

Choose a reason for hiding this comment

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

Could you please revert the additional indentation?

@github-actions github-actions bot removed the triage PRs from the community label Mar 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants