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: Fallback Sink #1669

Merged
merged 13 commits into from
Apr 17, 2024
Merged

feat: Fallback Sink #1669

merged 13 commits into from
Apr 17, 2024

Conversation

yhl25
Copy link
Contributor

@yhl25 yhl25 commented Apr 15, 2024

fixes #1668

Signed-off-by: Yashash H L <yashashhl25@gmail.com>
Signed-off-by: Yashash H L <yashashhl25@gmail.com>
Signed-off-by: Yashash H L <yashashhl25@gmail.com>
Signed-off-by: Yashash H L <yashashhl25@gmail.com>
Signed-off-by: Yashash H L <yashashhl25@gmail.com>
// forward the message to the edge buffer (could be multiple edges)
writeOffsets, err := df.writeToBuffer(ctx, df.toBuffer, messageToStep)
// write the messages to the sink
writeOffsets, fallbackMessages, err := df.writeToSink(ctx, df.sinkWriter, writeMessages)
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

comment that this error will only happen if there is ctx.Done()

@@ -28,6 +28,8 @@ import (
"github.com/numaproj/numaflow/pkg/shared/logging"
)

var WriteToFallbackErr = "write to fallback sink"
Copy link
Contributor

Choose a reason for hiding this comment

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

inline it?

pkg/sinks/forward/forward.go Outdated Show resolved Hide resolved
}

// create the fallback sink writer if fallback sink is present
if u.VertexInstance.Vertex.Spec.Sink.Fallback != nil {
Copy link
Member

Choose a reason for hiding this comment

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

This requires a sink must be defined in the field fallback. We could argue this is a requirement, but usually this should not be enforced - if nothing is defined under fallback, we should consider there's no fallback specified.

Signed-off-by: Yashash H L <yashashhl25@gmail.com>
// create the fallback sink writer if fallback sink is present
fbSink := u.VertexInstance.Vertex.Spec.Sink.Fallback
if fbSink != nil && fbSink.IsAnySinkSpecified() {
fbSinkWriter, err := u.createSinkWriter(ctx, u.VertexInstance.Vertex.Spec.Sink.Fallback, fbSinkHandler)
Copy link
Member

Choose a reason for hiding this comment

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

Who handles the close of gbSinkWriter?

Copy link
Member

Choose a reason for hiding this comment

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

Instead of using an option to pass in the fallback writer, is it better to explicitly add it as a property to the forwarder?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good find... The forwarder should close it, I missed that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fb sink writer is not a mandatory field for the forwarder to start, so kept it optional. Since it is optional for users as well

yhl25 and others added 6 commits April 16, 2024 21:30
Signed-off-by: Yashash H L <yashashhl25@gmail.com>
Signed-off-by: Yashash H L <yashashhl25@gmail.com>

Co-authored-by: Vigith Maurice <vigith@gmail.com>
Signed-off-by: Yashash H L <yashashhl25@gmail.com>
Signed-off-by: Yashash H L <yashashhl25@gmail.com>
@yhl25 yhl25 marked this pull request as ready for review April 17, 2024 05:28
@yhl25 yhl25 requested a review from whynowy April 17, 2024 05:31
pkg/sinks/forward/forward.go Outdated Show resolved Hide resolved
Signed-off-by: Yashash H L <yashashhl25@gmail.com>

Co-authored-by: Derek Wang <whynowy@gmail.com>
@yhl25 yhl25 enabled auto-merge (squash) April 17, 2024 05:49
@yhl25 yhl25 merged commit db0d2ed into main Apr 17, 2024
23 checks passed
@yhl25 yhl25 deleted the fb-sink branch April 17, 2024 06:44
yhl25 added a commit that referenced this pull request Apr 18, 2024
Signed-off-by: Yashash H L <yashashhl25@gmail.com>
Co-authored-by: Vigith Maurice <vigith@gmail.com>
Co-authored-by: Derek Wang <whynowy@gmail.com>
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.

add fallback-sink to sinker
3 participants