diff --git a/source/logrepl/snapshot.go b/source/logrepl/snapshot.go index 4cbf70b..0e58701 100644 --- a/source/logrepl/snapshot.go +++ b/source/logrepl/snapshot.go @@ -31,11 +31,6 @@ var ErrSnapshotComplete = errors.New("snapshot complete") // ErrSnapshotInterrupt is returned by Teardown when a snapshot is interrupted var ErrSnapshotInterrupt = errors.New("snapshot interrupted") -const ( - // TODO Update this once snapshots are properly done for this mode. - MetadataPostgresTable = "postgres.table" -) - type SnapshotConfig struct { SnapshotName string Table string @@ -187,7 +182,7 @@ func (s *SnapshotIterator) buildRecordPosition() sdk.Position { func (s *SnapshotIterator) buildRecordMetadata() map[string]string { return map[string]string{ - MetadataPostgresTable: s.config.Table, + sdk.MetadataCollection: s.config.Table, } } diff --git a/source/logrepl/snapshot_test.go b/source/logrepl/snapshot_test.go index 7964d8b..4df7493 100644 --- a/source/logrepl/snapshot_test.go +++ b/source/logrepl/snapshot_test.go @@ -94,8 +94,8 @@ func TestSnapshotInterrupted(t *testing.T) { }, }, Metadata: map[string]string{ - MetadataPostgresTable: table, - sdk.MetadataReadAt: rec.Metadata[sdk.MetadataReadAt], + sdk.MetadataCollection: table, + sdk.MetadataReadAt: rec.Metadata[sdk.MetadataReadAt], }, }) is.True(errors.Is(s.Teardown(ctx), ErrSnapshotInterrupt)) diff --git a/source/longpoll/snapshot.go b/source/longpoll/snapshot.go index 57f9872..88282b9 100644 --- a/source/longpoll/snapshot.go +++ b/source/longpoll/snapshot.go @@ -24,12 +24,6 @@ import ( "github.com/jackc/pgx/v5" ) -const ( - // TODO same constant is defined in packages longpoll, logrepl and destination - // use same constant everywhere - MetadataPostgresTable = "postgres.table" -) - // Declare Postgres $ placeholder format var psql = sq.StatementBuilder.PlaceholderFormat(sq.Dollar) @@ -182,7 +176,7 @@ func (s *SnapshotIterator) buildRecordPosition() sdk.Position { func (s *SnapshotIterator) buildRecordMetadata() map[string]string { return map[string]string{ - MetadataPostgresTable: s.table, + sdk.MetadataCollection: s.table, } }