diff --git a/source/logrepl/cdc.go b/source/logrepl/cdc.go index 1b95a70..1c99f20 100644 --- a/source/logrepl/cdc.go +++ b/source/logrepl/cdc.go @@ -124,7 +124,7 @@ func (i *CDCIterator) NextN(ctx context.Context, n int) ([]opencdc.Record, error return nil, fmt.Errorf("n must be greater than 0, got %d", n) } - recs := make([]opencdc.Record, 0, n) + var recs []opencdc.Record // Block until at least one record is received or context is canceled select { diff --git a/source/logrepl/cdc_test.go b/source/logrepl/cdc_test.go index d827447..f7f9b41 100644 --- a/source/logrepl/cdc_test.go +++ b/source/logrepl/cdc_test.go @@ -510,7 +510,7 @@ func TestCDCIterator_NextN(t *testing.T) { } // Will keep calling NextN until all records are received - var records []opencdc.Record + records := make([]opencdc.Record, 0, 2) for len(records) < 2 { recordsTmp, err := i.NextN(ctx, 5) is.NoErr(err) diff --git a/source/logrepl/combined.go b/source/logrepl/combined.go index a85be94..7ed853d 100644 --- a/source/logrepl/combined.go +++ b/source/logrepl/combined.go @@ -131,7 +131,7 @@ func (c *CombinedIterator) NextN(ctx context.Context, n int) ([]opencdc.Record, } sdk.Logger(ctx).Debug().Msg("Snapshot completed, switching to CDC mode") - return c.activeIterator.NextN(ctx, n) + return c.NextN(ctx, n) } return records, nil } diff --git a/source/logrepl/combined_test.go b/source/logrepl/combined_test.go index 90980cb..3d2a3bd 100644 --- a/source/logrepl/combined_test.go +++ b/source/logrepl/combined_test.go @@ -289,7 +289,7 @@ func TestCombinedIterator_NextN(t *testing.T) { is.NoErr(err) // Request 2 records in CDC mode - var records []opencdc.Record + records := make([]opencdc.Record, 0, 2) var retries int maxRetries := 10 for retries < maxRetries {