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

feat: Session Window and Reduce Streaming #1384

Merged
merged 58 commits into from
Dec 19, 2023
Merged

feat: Session Window and Reduce Streaming #1384

merged 58 commits into from
Dec 19, 2023

Conversation

yhl25
Copy link
Contributor

@yhl25 yhl25 commented Nov 23, 2023

  • Controller changes to support session reduce, introduced a new object under groupBy called "session", which takes a "timeout" field.

  • Supporting streaming reduce, by making the ReduceApplier asynchronous and the ApplyReduce function now returns a channel of responses and errors, enabling immediate forwarding results to ISB upon receiving SDK responses.

  • Windower interfaces have been updated to support session reduce and streaming reduce, Introduced TimedWindower, TimedWindow, TimedWindowRequest and TimedWindowResponse for easier window operations such as create, delete, expand, merge and close, along with a SortedWindowByEndTime data structure for better window tracking in windower.

  • PBQ signatures have been updated to accept TimedWindowRequests, in line with ReduceApplier now taking TimedWindowRequests and returning TimedWindowResponses.

  • PnF has been updated to support async and session reduce, and it takes care of publishing monotonically increasing watermarks.

  • Tracking of closed windows previously in the PBQManager has been moved to the windower, suiting multiple windows in a session sharing a common PBQ. Now, DataForward and PnF will use the windower for all window-related operations.

yhl25 and others added 27 commits October 25, 2023 10:14
Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Vigith Maurice <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Vigith Maurice <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
@yhl25 yhl25 changed the title feat: session window feat: Session Window and Reduce Streaming Nov 27, 2023
Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
@vigith vigith dismissed their stale review December 8, 2023 03:08

the previous commit has issues

yhl25 added 2 commits December 8, 2023 15:22
Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
@yhl25 yhl25 marked this pull request as ready for review December 8, 2023 11:11
@yhl25 yhl25 requested a review from whynowy as a code owner December 8, 2023 11:11
@vigith vigith requested a review from a team December 8, 2023 15:33
}

// FixedWindow describes a fixed window
type FixedWindow struct {
Length *metav1.Duration `json:"length,omitempty" protobuf:"bytes,1,opt,name=length"`
// +optional
Streaming bool `json:"streaming,omitempty" protobuf:"bytes,3,opt,name=streaming"`
Copy link
Member

Choose a reason for hiding this comment

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

Wrong index.

Doc please.

}

// SlidingWindow describes a sliding window
type SlidingWindow struct {
Length *metav1.Duration `json:"length,omitempty" protobuf:"bytes,1,opt,name=length"`
Slide *metav1.Duration `json:"slide,omitempty" protobuf:"bytes,2,opt,name=slide"`
// +optional
Copy link
Member

Choose a reason for hiding this comment

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

Doc.

pkg/window/strategy/sliding/sliding.go Outdated Show resolved Hide resolved
pkg/window/strategy/sliding/sliding.go Outdated Show resolved Hide resolved
pkg/window/strategy/sliding/sliding.go Show resolved Hide resolved
pkg/window/strategy/fixed/fixed.go Show resolved Hide resolved
pkg/window/strategy/session/session.go Show resolved Hide resolved
pkg/window/strategy/session/session.go Outdated Show resolved Hide resolved
return w.keys
}

func (w *sessionWindow) Partition() *partition.ID {
Copy link
Member

Choose a reason for hiding this comment

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

// Partition returns the partition id of the window
	// which will be used to map to the pbq instance.
	Partition() *partition.ID

Should we use SharedSessionPartition here for the session window? Since it's used for identifying the PBQ.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

both are a little different, I will update and fix the comments to avoid confusion.

pkg/window/strategy/session/session.go Show resolved Hide resolved
pkg/window/strategy/session/session.go Show resolved Hide resolved
pkg/window/strategy/session/session.go Outdated Show resolved Hide resolved
Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
@vigith vigith merged commit 45c8594 into main Dec 19, 2023
18 checks passed
@vigith vigith deleted the session-win branch December 19, 2023 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants