Skip to content

Commit

Permalink
better error logging around LoadSnapshotNameFromCatalog
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Oct 22, 2024
1 parent 0242dc2 commit 986928a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion flow/activities/flowable.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,8 @@ func (a *FlowableActivity) GetQRepPartitions(ctx context.Context,
if config.ParentMirrorName != "" {
_, snapshotName, _, err = shared.LoadSnapshotNameFromCatalog(ctx, a.CatalogPool, config.ParentMirrorName)
if err != nil {
return nil, err
a.Alerter.LogFlowError(ctx, "[GetQRepPartitions] "+config.FlowJobName, err)
return nil, fmt.Errorf("[GetQRepPartitions] failed to LoadSnapshotNameFromCatalog: %w", err)
}
}

Expand Down
6 changes: 4 additions & 2 deletions flow/activities/flowable_core.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,8 @@ func replicateQRepPartition[TRead any, TWrite any, TSync connectors.QRepSyncConn
if config.ParentMirrorName != "" {
_, snapshotName, _, err = shared.LoadSnapshotNameFromCatalog(ctx, a.CatalogPool, config.ParentMirrorName)
if err != nil {
return err
a.Alerter.LogFlowError(ctx, "[replicateQRepPartition] "+config.FlowJobName, err)
return fmt.Errorf("[replicateQRepPartition] failed to LoadSnapshotNameFromCatalog: %w", err)
}
}

Expand Down Expand Up @@ -518,7 +519,8 @@ func replicateXminPartition[TRead any, TWrite any, TSync connectors.QRepSyncConn
var err error
_, snapshotName, _, err = shared.LoadSnapshotNameFromCatalog(ctx, a.CatalogPool, config.ParentMirrorName)
if err != nil {
return err
a.Alerter.LogFlowError(ctx, "[replicateXminPartition] "+config.FlowJobName, err)
return fmt.Errorf("[replicateXminPartition] failed to LoadSnapshotNameFromCatalog: %w", err)
}
}

Expand Down
5 changes: 4 additions & 1 deletion flow/activities/snapshot_activity.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (a *SnapshotActivity) SetupReplication(
"select pg_drop_replication_slot($1)",
slotName,
); err != nil && !shared.IsSQLStateError(err, pgerrcode.UndefinedObject) {
return fmt.Errorf("Failed to drop slot from previous run: %w", err)
return fmt.Errorf("failed to drop slot from previous run: %w", err)
}
}
if _, err := a.CatalogPool.Exec(ctx,
Expand Down Expand Up @@ -144,6 +144,9 @@ func (a *SnapshotActivity) LoadSupportsTidScan(
flowJobName string,
) (bool, error) {
_, _, supportsTidScan, err := shared.LoadSnapshotNameFromCatalog(ctx, a.CatalogPool, flowJobName)
if err != nil {
a.Alerter.LogFlowError(ctx, "[LoadSupportsTidScan] "+flowJobName, err)
}
return supportsTidScan, err
}

Expand Down

0 comments on commit 986928a

Please sign in to comment.