From 3545306414639433fbba8754ddc3c54332445cb8 Mon Sep 17 00:00:00 2001 From: Peter Broadhurst Date: Tue, 11 Jul 2023 00:55:35 -0400 Subject: [PATCH] Non-nil timestamps on checkpoints Signed-off-by: Peter Broadhurst --- internal/persistence/dbmigration/migration.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/persistence/dbmigration/migration.go b/internal/persistence/dbmigration/migration.go index 205b8141..302d69c0 100644 --- a/internal/persistence/dbmigration/migration.go +++ b/internal/persistence/dbmigration/migration.go @@ -96,6 +96,13 @@ func (m *dbMigration) migrateEventStream(ctx context.Context, es *apitypes.Event return err } if cp != nil && existingCP == nil { + // LevelDB didn't have timestamps in checkpoints + if cp.FirstCheckpoint == nil { + cp.FirstCheckpoint = fftypes.Now() + } + if cp.Time == nil { + cp.Time = cp.FirstCheckpoint + } log.L(ctx).Infof("Writing checkpoint %s to target", cp.StreamID) if err := m.target.WriteCheckpoint(ctx, cp); err != nil { return err