Skip to content

KAFKA-18026: KIP-1112, clean up graph node grace period resolution#18342

Merged
ableegoldman merged 2 commits intoapache:trunkfrom
ableegoldman:KIP-1112-cleanup-GracePeriodGraphNode
Jan 16, 2025
Merged

KAFKA-18026: KIP-1112, clean up graph node grace period resolution#18342
ableegoldman merged 2 commits intoapache:trunkfrom
ableegoldman:KIP-1112-cleanup-GracePeriodGraphNode

Conversation

@ableegoldman
Copy link
Copy Markdown
Member

Minor followup to #18195 that I split out into a separate PR since that one was getting a bit long. Should be rebased & reviewed after that one is merged.

Introduces a new class for windowed graph nodes with a grace period defined to improve (slightly) the type safety

@ableegoldman ableegoldman force-pushed the KIP-1112-cleanup-GracePeriodGraphNode branch from cf90a40 to 6a6f32c Compare January 15, 2025 01:54
}

@SuppressWarnings("rawtypes")
private static Long extractGracePeriod(final GraphNode node) {
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.

Main point of this PR is to get rid of this ugly thing

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Still a good progress that we replaced four nested instanceof with just one :) Just kidding.

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.

haha yeah it's a step in the right direction...but it's still only just one step 😛

Copy link
Copy Markdown
Contributor

@agavra agavra left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @ableegoldman - I always appreciate improving encapsulation and type safety 🫡

* Represents a stateful {@link ProcessorGraphNode} where a semantic grace period is defined for the processor
* and its state.
*/
public class GracePeriodGraphNode<K, V> extends ProcessorGraphNode<K, V> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wonder if it makes sense to add something directly to ProcessorGraphNode such as ProcessorGraphNode#getWindowInformation that returns an Optional<WindowInformation> that contains grace period.

That removes the instanceof GracePeriodGraphNode check, at the cost of adding something empty to all the other nodes. I'm ambivalent as either approach works for me.

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.

yeah I considered that too. In the end I opted for the smaller change, as there are some other things that work similarly which would be nice to clean up, so I was thinking it might make sense to wait until everything is done and then we can consider the full picture

Copy link
Copy Markdown
Contributor

@guozhangwang guozhangwang left a comment

Choose a reason for hiding this comment

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

LGTM. Only nit comments.

}

<KR, VR> KTable<KR, VR> build(final String aggFunctionName,
final String storeName,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: misaligned indentation?

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.

whoops 🙂

}

@SuppressWarnings("rawtypes")
private static Long extractGracePeriod(final GraphNode node) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Still a good progress that we replaced four nested instanceof with just one :) Just kidding.

@ableegoldman ableegoldman merged commit c7d3999 into apache:trunk Jan 16, 2025
pranavt84 pushed a commit to pranavt84/kafka that referenced this pull request Jan 27, 2025
…pache#18342)

Minor followup to apache#18195 that I split out into a separate PR since that one was getting a bit long. Should be rebased & reviewed after that one is merged.

Introduces a new class for windowed graph nodes with a grace period defined to improve (slightly) the type safety

Reviewers: Guozhang Wang <guozhang.wang.us@gmail.com>, Almog Gavra <almog@responsive.dev>
airlock-confluentinc bot pushed a commit to confluentinc/kafka that referenced this pull request Jan 27, 2025
…pache#18342)

Minor followup to apache#18195 that I split out into a separate PR since that one was getting a bit long. Should be rebased & reviewed after that one is merged.

Introduces a new class for windowed graph nodes with a grace period defined to improve (slightly) the type safety

Reviewers: Guozhang Wang <guozhang.wang.us@gmail.com>, Almog Gavra <almog@responsive.dev>
manoj-mathivanan pushed a commit to manoj-mathivanan/kafka that referenced this pull request Feb 19, 2025
…pache#18342)

Minor followup to apache#18195 that I split out into a separate PR since that one was getting a bit long. Should be rebased & reviewed after that one is merged.

Introduces a new class for windowed graph nodes with a grace period defined to improve (slightly) the type safety

Reviewers: Guozhang Wang <guozhang.wang.us@gmail.com>, Almog Gavra <almog@responsive.dev>
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.

3 participants