Skip to content

Commit

Permalink
qrep: if the last sync is nil, check the table if there are new rows.
Browse files Browse the repository at this point in the history
this bug can prevent tables which are empty to be synced once they get data.
  • Loading branch information
yasinzaehringer-paradime committed May 3, 2024
1 parent 794e8ea commit e5c51da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion flow/activities/flowable.go
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ func (a *FlowableActivity) QRepHasNewRows(ctx context.Context,
ctx = context.WithValue(ctx, shared.FlowNameKey, config.FlowJobName)
logger := log.With(activity.GetLogger(ctx), slog.String(string(shared.FlowNameKey), config.FlowJobName))

if config.SourcePeer.Type != protos.DBType_POSTGRES || last.Range == nil {
if config.SourcePeer.Type != protos.DBType_POSTGRES {
return QRepWaitUntilNewRowsResult{Found: true}, nil
}

Expand Down
4 changes: 4 additions & 0 deletions flow/connectors/postgres/qrep.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ func (c *PostgresConnector) CheckForUpdatedMaxValue(
return false, fmt.Errorf("error while getting min and max values: %w", err)
}

if last == nil || last.Range == nil {
return maxValue != nil, nil
}

switch x := last.Range.Range.(type) {
case *protos.PartitionRange_IntRange:
if maxValue.(int64) > x.IntRange.End {
Expand Down

0 comments on commit e5c51da

Please sign in to comment.