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

Increase retry initial backoff to 1 minute #2418

Merged
merged 3 commits into from
Jan 8, 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
9 changes: 8 additions & 1 deletion flow/workflows/cdc_flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ func processTableRemovals(
logger.Info("altering publication for removed tables")
removeTablesCtx := workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
StartToCloseTimeout: 5 * time.Minute,
RetryPolicy: &temporal.RetryPolicy{
InitialInterval: 1 * time.Minute,
},
})
alterPublicationRemovedTablesFuture := workflow.ExecuteActivity(
removeTablesCtx,
Expand Down Expand Up @@ -457,6 +460,9 @@ func CDCFlowWorkflow(
renameTablesCtx := workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
StartToCloseTimeout: 12 * time.Hour,
HeartbeatTimeout: time.Minute,
RetryPolicy: &temporal.RetryPolicy{
InitialInterval: 1 * time.Minute,
},
})
renameTablesFuture := workflow.ExecuteActivity(renameTablesCtx, flowable.RenameTables, renameOpts)
if err := renameTablesFuture.Get(renameTablesCtx, nil); err != nil {
Expand Down Expand Up @@ -500,7 +506,8 @@ func CDCFlowWorkflow(
} else {
logger.Error("error in sync flow", slog.Any("error", err))
}
_ = workflow.Sleep(ctx, 30*time.Second)
logger.Info("sync flow errored, sleeping for 10 minutes before retrying")
_ = workflow.Sleep(ctx, 10*time.Minute)
} else {
logger.Info("sync finished")
}
Expand Down
10 changes: 10 additions & 0 deletions flow/workflows/drop_flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"time"

"go.temporal.io/sdk/converter"
"go.temporal.io/sdk/temporal"
"go.temporal.io/sdk/workflow"

"github.com/PeerDB-io/peerdb/flow/generated/protos"
Expand All @@ -15,6 +16,9 @@ import (
func executeCDCDropActivities(ctx workflow.Context, input *protos.DropFlowInput) error {
ctx = workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
StartToCloseTimeout: 5 * time.Minute,
RetryPolicy: &temporal.RetryPolicy{
InitialInterval: 1 * time.Minute,
},
})
ctx = workflow.WithDataConverter(ctx, converter.NewCompositeDataConverter(converter.NewJSONPayloadConverter()))

Expand Down Expand Up @@ -82,6 +86,9 @@ func DropFlowWorkflow(ctx workflow.Context, input *protos.DropFlowInput) error {
dropStatsCtx := workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
StartToCloseTimeout: 1 * time.Minute,
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should increase this and other places where StartToCloseTimeout is 1 minute and initial interval is also 1 minute

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

HeartbeatTimeout: 1 * time.Minute,
RetryPolicy: &temporal.RetryPolicy{
InitialInterval: 1 * time.Minute,
},
})
dropStatsFuture := workflow.ExecuteActivity(dropStatsCtx,
flowable.DeleteMirrorStats, input.FlowJobName)
Expand All @@ -103,6 +110,9 @@ func DropFlowWorkflow(ctx workflow.Context, input *protos.DropFlowInput) error {

removeFlowEntriesCtx := workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
StartToCloseTimeout: 1 * time.Minute,
RetryPolicy: &temporal.RetryPolicy{
InitialInterval: 1 * time.Minute,
},
})
removeFromCatalogFuture := workflow.ExecuteActivity(removeFlowEntriesCtx,
flowable.RemoveFlowEntryFromCatalog, input.FlowJobName)
Expand Down
13 changes: 13 additions & 0 deletions flow/workflows/setup_flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"time"

"go.temporal.io/sdk/log"
"go.temporal.io/sdk/temporal"
"go.temporal.io/sdk/workflow"

"github.com/PeerDB-io/peerdb/flow/activities"
Expand Down Expand Up @@ -89,6 +90,9 @@ func (s *SetupFlowExecution) checkConnectionsAndSetupMetadataTables(
if destConnStatus.NeedsSetupMetadataTables {
setupCtx := workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
StartToCloseTimeout: 2 * time.Minute,
RetryPolicy: &temporal.RetryPolicy{
InitialInterval: 1 * time.Minute,
},
})
fDst := workflow.ExecuteActivity(setupCtx, flowable.SetupMetadataTables, dstSetupInput)
if err := fDst.Get(setupCtx, nil); err != nil {
Expand All @@ -111,6 +115,9 @@ func (s *SetupFlowExecution) ensurePullability(

ctx = workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
StartToCloseTimeout: 4 * time.Hour,
RetryPolicy: &temporal.RetryPolicy{
InitialInterval: 1 * time.Minute,
},
})
srcTableIdNameMapping := make(map[uint32]string)

Expand Down Expand Up @@ -149,6 +156,9 @@ func (s *SetupFlowExecution) createRawTable(
s.Info("creating raw table on destination")
ctx = workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
StartToCloseTimeout: 5 * time.Minute,
RetryPolicy: &temporal.RetryPolicy{
InitialInterval: 1 * time.Minute,
},
})

// attempt to create the tables.
Expand Down Expand Up @@ -176,6 +186,9 @@ func (s *SetupFlowExecution) setupNormalizedTables(
ctx = workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
StartToCloseTimeout: 1 * time.Hour,
HeartbeatTimeout: time.Minute,
RetryPolicy: &temporal.RetryPolicy{
InitialInterval: 1 * time.Minute,
},
})

sourceTables := slices.Sorted(maps.Keys(s.tableNameMapping))
Expand Down
10 changes: 10 additions & 0 deletions flow/workflows/snapshot_flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func (s *SnapshotFlowExecution) setupReplication(
ctx = workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
StartToCloseTimeout: 4 * time.Hour,
RetryPolicy: &temporal.RetryPolicy{
InitialInterval: 1 * time.Minute,
MaximumAttempts: 20,
},
})
Expand Down Expand Up @@ -78,6 +79,9 @@ func (s *SnapshotFlowExecution) closeSlotKeepAlive(

ctx = workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
StartToCloseTimeout: 15 * time.Minute,
RetryPolicy: &temporal.RetryPolicy{
InitialInterval: 1 * time.Minute,
},
})

if err := workflow.ExecuteActivity(ctx, snapshot.CloseSlotKeepAlive, s.config.FlowJobName).Get(ctx, nil); err != nil {
Expand Down Expand Up @@ -126,6 +130,9 @@ func (s *SnapshotFlowExecution) cloneTable(
schemaCtx := workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
StartToCloseTimeout: time.Minute,
WaitForCancellation: true,
RetryPolicy: &temporal.RetryPolicy{
InitialInterval: 1 * time.Minute,
},
})
return workflow.ExecuteActivity(
schemaCtx,
Expand Down Expand Up @@ -343,6 +350,9 @@ func SnapshotFlowWorkflow(
StartToCloseTimeout: sessionOpts.ExecutionTimeout,
HeartbeatTimeout: 10 * time.Minute,
WaitForCancellation: true,
RetryPolicy: &temporal.RetryPolicy{
InitialInterval: 1 * time.Minute,
},
})

fMaintain := workflow.ExecuteActivity(
Expand Down
4 changes: 4 additions & 0 deletions flow/workflows/xmin_flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"time"

"github.com/google/uuid"
"go.temporal.io/sdk/temporal"
"go.temporal.io/sdk/workflow"

"github.com/PeerDB-io/peerdb/flow/generated/protos"
Expand Down Expand Up @@ -73,6 +74,9 @@ func XminFlowWorkflow(
replicateXminPartitionCtx := workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
StartToCloseTimeout: 24 * 5 * time.Hour,
HeartbeatTimeout: time.Minute,
RetryPolicy: &temporal.RetryPolicy{
InitialInterval: 1 * time.Minute,
},
})
if err := workflow.ExecuteActivity(
replicateXminPartitionCtx,
Expand Down
Loading