fix(mirror): use correct statements on push (#8414)

# Which Problems Are Solved

The mirror command used the wrong position to filter for events if
different database technologies for source and destination were used.

# How the Problems Are Solved

The statements which diverge are stored on the client so that different
technologies can use different statements.

# Additional Context

- https://discord.com/channels/927474939156643850/1256396896243552347
This commit is contained in:
Silvan
2024-08-12 12:33:45 +02:00
committed by GitHub
parent 3f25e36fbd
commit cd3ffbd3eb
4 changed files with 18 additions and 14 deletions

View File

@@ -71,7 +71,7 @@ func (s *Storage) Push(ctx context.Context, intent *eventstore.PushIntent) (err
return err
}
return push(ctx, tx, intent, commands)
return s.push(ctx, tx, intent, commands)
})
}
@@ -144,7 +144,7 @@ func lockAggregates(ctx context.Context, tx *sql.Tx, intent *eventstore.PushInte
return res, nil
}
func push(ctx context.Context, tx *sql.Tx, reducer eventstore.Reducer, commands []*command) (err error) {
func (s *Storage) push(ctx context.Context, tx *sql.Tx, reducer eventstore.Reducer, commands []*command) (err error) {
ctx, span := tracing.NewSpan(ctx)
defer func() { span.EndWithError(err) }()
@@ -171,7 +171,7 @@ func push(ctx context.Context, tx *sql.Tx, reducer eventstore.Reducer, commands
cmd.position.InPositionOrder,
)
stmt.WriteString(pushPositionStmt)
stmt.WriteString(s.pushPositionStmt)
stmt.WriteString(`)`)
}
stmt.WriteString(` RETURNING created_at, "position"`)