Skip to content

Commit

Permalink
use opencdc constant
Browse files Browse the repository at this point in the history
  • Loading branch information
raulb committed Apr 17, 2024
1 parent ed31bc1 commit 2f57b53
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
7 changes: 1 addition & 6 deletions source/logrepl/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
}
}

Expand Down
4 changes: 2 additions & 2 deletions source/logrepl/snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
8 changes: 1 addition & 7 deletions source/longpoll/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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,
}
}

Expand Down

0 comments on commit 2f57b53

Please sign in to comment.