diff --git a/iterator/cdc.go b/iterator/cdc.go index cf8f46c..5ed2bce 100644 --- a/iterator/cdc.go +++ b/iterator/cdc.go @@ -74,6 +74,11 @@ func NewCDCIterator(ctx context.Context, tableName string, pKey string, sKey str recordsPollingPeriod: recordsPollingPeriod, } + // initialize SequenceNumberMap if it is nil + if c.lastPosition.SequenceNumberMap == nil { + c.lastPosition.SequenceNumberMap = make(map[string]string) + } + // start listening to changes c.tomb, ctx = tomb.WithContext(ctx) c.tomb.Go(func() error { diff --git a/iterator/combined_iterator.go b/iterator/combined_iterator.go index 25671a0..a22c6f4 100644 --- a/iterator/combined_iterator.go +++ b/iterator/combined_iterator.go @@ -79,7 +79,7 @@ func NewCombinedIterator( IteratorType: position.TypeCDC, Time: now, AfterSnapshot: true, - SequenceNumberMap: map[string]string{}, + SequenceNumberMap: make(map[string]string), }) if err != nil { return nil, fmt.Errorf("could not create the CDC iterator: %w", err)