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

[snapshot] close stream when fail to get srcConn in errgroup #2409

Merged
merged 3 commits into from
Jan 5, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion flow/activities/flowable_core.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ func (a *FlowableActivity) getPostgresPeerConfigs(ctx context.Context) ([]*proto
}

// replicateQRepPartition replicates a QRepPartition from the source to the destination.
func replicateQRepPartition[TRead any, TWrite any, TSync connectors.QRepSyncConnectorCore, TPull connectors.QRepPullConnectorCore](
func replicateQRepPartition[TRead any, TWrite model.StreamCloser, TSync connectors.QRepSyncConnectorCore, TPull connectors.QRepPullConnectorCore](
ctx context.Context,
a *FlowableActivity,
config *protos.QRepConfig,
Expand Down Expand Up @@ -440,6 +440,7 @@ func replicateQRepPartition[TRead any, TWrite any, TSync connectors.QRepSyncConn
srcConn, err := connectors.GetByNameAs[TPull](ctx, config.Env, a.CatalogPool, config.SourceName)
if err != nil {
a.Alerter.LogFlowError(ctx, config.FlowJobName, err)
stream.Close(err)
return fmt.Errorf("failed to get qrep source connector: %w", err)
}
defer connectors.CloseConnector(ctx, srcConn)
Expand Down
4 changes: 4 additions & 0 deletions flow/model/qrecord_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
"github.com/PeerDB-io/peer-flow/model/qvalue"
)

type StreamCloser interface {

Check failure on line 7 in flow/model/qrecord_stream.go

View workflow job for this annotation

GitHub Actions / lint

unused: interface StreamCloser is declared but not used within the package (iface)
heavycrystal marked this conversation as resolved.
Show resolved Hide resolved
Close(error)
}

type QRecordStream struct {
schemaLatch chan struct{}
Records chan []qvalue.QValue
Expand Down
Loading