From cb06403d16f596c7eb814e7eb83763ad54a49a64 Mon Sep 17 00:00:00 2001 From: Alfonso Subiotto Marques Date: Wed, 29 Nov 2023 10:59:55 +0100 Subject: [PATCH 1/3] workflows: use go 1.21 This additionally bumps the golangci-lint version used. --- .github/workflows/go.yml | 2 +- .github/workflows/golangci-lint.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index c65eaabfc..cd315d585 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -16,7 +16,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v2 with: - go-version: '1.20' + go-version: '1.21' - name: Test run: go test -short -race -tags assert,debug -v ./... diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index cf31edb3e..8e47817d1 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -23,11 +23,11 @@ jobs: steps: - uses: actions/setup-go@v2 with: - go-version: ^1.20 + go-version: ^1.21 - uses: actions/checkout@v3 - name: golangci-lint uses: golangci/golangci-lint-action@v3.1.0 with: - version: v1.51.2 + version: v1.55.2 From e3936f67642f7520c33c5ea0e550d1de1b23586b Mon Sep 17 00:00:00 2001 From: Alfonso Subiotto Marques Date: Wed, 29 Nov 2023 11:41:29 +0100 Subject: [PATCH 2/3] golangci: update depguard config to new config depguard introduced a breaking change --- .golangci.yml | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index d061a65e1..2fe4c4dcb 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -23,15 +23,21 @@ issues: linters-settings: depguard: - list-type: blacklist - include-go-root: true - packages-with-error-message: - - go.uber.org/atomic: "Use sync/atomic instead of go.uber.org/atomic" - - debug/elf: "Use github.com/parca-dev/parca/internal/go/debug/elf instead of debug/elf" - - github.com/stretchr/testify/assert: "Use github.com/stretchr/testify/require instead of github.com/stretchr/testify/assert" - - github.com/go-kit/kit/log: "Use github.com/go-kit/log instead of github.com/go-kit/kit/log" - - github.com/pkg/errors: "Use fmt.Errorf instead" - - github.com/segmentio/parquet-go: "Use github.com/parquet-go/parquet-go instead" + rules: + main: + deny: + - pkg: go.uber.org/atomic + desc: "Use sync/atomic instead of go.uber.org/atomic" + - pkg: debug/elg + desc: "Use github.com/parca-dev/parca/internal/go/debug/elf instead of debug/elf" + - pkg: github.com/stretchr/testify/assert + desc: "Use github.com/stretchr/testify/require instead of github.com/stretchr/testify/assert" + - pkg: github.com/go-kit/kit/log + desc: "Use github.com/go-kit/log instead of github.com/go-kit/kit/log" + - pkg: github.com/pkg/errors + desc: "Use fmt.Errorf instead" + - pkg: github.com/segmentio/parquet-go + desc: "Use github.com/parquet-go/parquet-go instead" errcheck: exclude: ./.errcheck_excludes.txt goimports: From e35784109656f34bb06d896929aaaacb1861f14a Mon Sep 17 00:00:00 2001 From: Alfonso Subiotto Marques Date: Wed, 29 Nov 2023 12:05:28 +0100 Subject: [PATCH 3/3] *: fix unused linter errors --- dynparquet/nil_chunk.go | 2 +- dynparquet/schema.go | 10 +++++----- index/lsm.go | 6 +++++- index/lsm_test.go | 2 +- logictest/runner.go | 2 +- pqarrow/arrow.go | 7 +++---- pqarrow/arrowutils/merge.go | 2 +- pqarrow/arrowutils/nullarray.go | 2 +- pqarrow/builder/optbuilders.go | 2 +- pqarrow/writer/writer.go | 6 +++--- query/expr/filter.go | 6 +++--- query/logicalplan/expr.go | 14 +++++++------- query/logicalplan/logicalplan_test.go | 24 ++++++++++++------------ query/logicalplan/validate.go | 4 ++-- query/physicalplan/aggregate.go | 2 +- query/physicalplan/filter.go | 4 ++-- query/physicalplan/physicalplan_test.go | 24 ++++++++++++------------ query/physicalplan/project.go | 6 +++--- snapshot.go | 2 +- table.go | 14 +++++++------- tx_list.go | 2 ++ tx_list_test.go | 4 ++++ 22 files changed, 78 insertions(+), 69 deletions(-) diff --git a/dynparquet/nil_chunk.go b/dynparquet/nil_chunk.go index c71dec3e4..f86e2c69c 100644 --- a/dynparquet/nil_chunk.go +++ b/dynparquet/nil_chunk.go @@ -217,7 +217,7 @@ func (p *nilPage) Data() encoding.Values { panic("not implemented") } -func (p *nilPage) Slice(i, j int64) parquet.Page { +func (p *nilPage) Slice(_, _ int64) parquet.Page { return &nilPage{ numValues: p.numValues, columnIndex: p.columnIndex, diff --git a/dynparquet/schema.go b/dynparquet/schema.go index 12b31a5fb..0bdda9e7f 100644 --- a/dynparquet/schema.go +++ b/dynparquet/schema.go @@ -469,7 +469,7 @@ func (s *v2storageLayoutWrapper) GetCompressionInt32() int32 { return int32(s.StorageLayout.GetCompression()) } -func StorageLayoutWrapper(layout *schemav2pb.StorageLayout) StorageLayout { +func StorageLayoutWrapper(_ *schemav2pb.StorageLayout) StorageLayout { return nil } @@ -1290,13 +1290,13 @@ func (s *Schema) GetWriter(w io.Writer, dynamicColumns map[string][]string, sort pool, _ := s.writers.LoadOrStore(fmt.Sprintf("%s,sorting=%t", key, sorting), &sync.Pool{}) pooled := pool.(*sync.Pool).Get() if pooled == nil { - new, err := s.NewWriter(w, dynamicColumns, sorting) + pw, err := s.NewWriter(w, dynamicColumns, sorting) if err != nil { return nil, err } return &PooledWriter{ pool: pool.(*sync.Pool), - ParquetWriter: new, + ParquetWriter: pw, }, nil } pooled.(*PooledWriter).ParquetWriter.Reset(w) @@ -1372,13 +1372,13 @@ func (s *Schema) GetBuffer(dynamicColumns map[string][]string) (*PooledBuffer, e pool, _ := s.buffers.LoadOrStore(key, &sync.Pool{}) pooled := pool.(*sync.Pool).Get() if pooled == nil { - new, err := s.NewBuffer(dynamicColumns) + pw, err := s.NewBuffer(dynamicColumns) if err != nil { return nil, err } return &PooledBuffer{ pool: pool.(*sync.Pool), - Buffer: new, + Buffer: pw, }, nil } return pooled.(*PooledBuffer), nil diff --git a/index/lsm.go b/index/lsm.go index 926bdde74..8a8e69d4a 100644 --- a/index/lsm.go +++ b/index/lsm.go @@ -203,7 +203,7 @@ func (l *LSM) String() string { return s } -func (l *LSM) Prefixes(ctx context.Context, prefix string) ([]string, error) { +func (l *LSM) Prefixes(_ context.Context, _ string) ([]string, error) { return []string{l.prefix}, nil } @@ -298,12 +298,16 @@ func (l *LSM) findNode(node *Node) *Node { // levels are below the target size. func (l *LSM) EnsureCompaction() error { for !l.compacting.CompareAndSwap(false, true) { // TODO: should backoff retry this probably + // Satisfy linter with a statement. + continue } return l.compact(true /* ignoreSizes */) } func (l *LSM) Rotate(level SentinelType, externalWriter func([]*parts.Part) (*parts.Part, int64, int64, error)) error { for !l.compacting.CompareAndSwap(false, true) { // TODO: should backoff retry this probably + // Satisfy linter with a statement. + continue } defer l.compacting.Store(false) start := time.Now() diff --git a/index/lsm_test.go b/index/lsm_test.go index 262b9b737..b4afe9ee8 100644 --- a/index/lsm_test.go +++ b/index/lsm_test.go @@ -16,7 +16,7 @@ import ( "github.com/polarsignals/frostdb/parts" ) -func parquetCompaction(compact []*parts.Part, options ...parts.Option) ([]*parts.Part, int64, int64, error) { +func parquetCompaction(compact []*parts.Part, _ ...parts.Option) ([]*parts.Part, int64, int64, error) { b := &bytes.Buffer{} size, err := compactParts(b, compact) if err != nil { diff --git a/logictest/runner.go b/logictest/runner.go index b9475590b..6c29a22fa 100644 --- a/logictest/runner.go +++ b/logictest/runner.go @@ -105,7 +105,7 @@ func (r *Runner) handleCmd(ctx context.Context, c *datadriven.TestData) (string, return "", fmt.Errorf("unknown command %s", c.Cmd) } -func (r *Runner) handleCreateTable(ctx context.Context, c *datadriven.TestData) (string, error) { +func (r *Runner) handleCreateTable(_ context.Context, c *datadriven.TestData) (string, error) { var schema *schemapb.Schema for _, arg := range c.CmdArgs { if arg.Key == "schema" { diff --git a/pqarrow/arrow.go b/pqarrow/arrow.go index c60447633..d7ecb630b 100644 --- a/pqarrow/arrow.go +++ b/pqarrow/arrow.go @@ -270,7 +270,7 @@ func (c *ParquetConverter) Convert(ctx context.Context, rg parquet.RowGroup) err } if _, ok := rg.(*dynparquet.MergedRowGroup); ok { - return rowBasedParquetRowGroupToArrowRecord(ctx, c.pool, rg, c.outputSchema, c.builder) + return rowBasedParquetRowGroupToArrowRecord(ctx, rg, c.outputSchema, c.builder) } parquetSchema := rg.Schema() @@ -608,7 +608,6 @@ var rowBufPool = &sync.Pool{ // record row by row. The result is appended to b. func rowBasedParquetRowGroupToArrowRecord( ctx context.Context, - pool memory.Allocator, rg parquet.RowGroup, schema *arrow.Schema, builder *builder.RecordBuilder, @@ -852,11 +851,11 @@ func (f PreExprVisitorFunc) PreVisit(expr logicalplan.Expr) bool { return f(expr) } -func (f PreExprVisitorFunc) Visit(expr logicalplan.Expr) bool { +func (f PreExprVisitorFunc) Visit(_ logicalplan.Expr) bool { return false } -func (f PreExprVisitorFunc) PostVisit(expr logicalplan.Expr) bool { +func (f PreExprVisitorFunc) PostVisit(_ logicalplan.Expr) bool { return false } diff --git a/pqarrow/arrowutils/merge.go b/pqarrow/arrowutils/merge.go index 3d4024633..8c0bed5d3 100644 --- a/pqarrow/arrowutils/merge.go +++ b/pqarrow/arrowutils/merge.go @@ -120,7 +120,7 @@ func (h cursorHeap) Swap(i, j int) { h.cursors[i], h.cursors[j] = h.cursors[j], h.cursors[i] } -func (h cursorHeap) Push(x any) { +func (h cursorHeap) Push(_ any) { panic( "number of cursors are known at Init time, none should ever be pushed", ) diff --git a/pqarrow/arrowutils/nullarray.go b/pqarrow/arrowutils/nullarray.go index ff5a9c6e1..3f9daa4ef 100644 --- a/pqarrow/arrowutils/nullarray.go +++ b/pqarrow/arrowutils/nullarray.go @@ -76,6 +76,6 @@ func (n VirtualNullArray) Release() {} func (n VirtualNullArray) String() string { return "VirtualNullArray" } -func (n VirtualNullArray) ValueStr(i int) string { return "" } +func (n VirtualNullArray) ValueStr(_ int) string { return "" } func (n VirtualNullArray) GetOneForMarshal(_ int) any { return nil } diff --git a/pqarrow/builder/optbuilders.go b/pqarrow/builder/optbuilders.go index 4af44320f..63bf638b8 100644 --- a/pqarrow/builder/optbuilders.go +++ b/pqarrow/builder/optbuilders.go @@ -525,7 +525,7 @@ func (b *OptBooleanBuilder) Value(i int) bool { return bitutil.BitIsSet(b.data, i) } -func (b *OptBooleanBuilder) AppendData(data []byte) { +func (b *OptBooleanBuilder) AppendData(_ []byte) { panic("do not use AppendData for opt boolean builder, use Append instead") } diff --git a/pqarrow/writer/writer.go b/pqarrow/writer/writer.go index f03063938..cd1403e7a 100644 --- a/pqarrow/writer/writer.go +++ b/pqarrow/writer/writer.go @@ -24,7 +24,7 @@ type binaryValueWriter struct { type NewWriterFunc func(b builder.ColumnBuilder, numValues int) ValueWriter -func NewBinaryValueWriter(b builder.ColumnBuilder, numValues int) ValueWriter { +func NewBinaryValueWriter(b builder.ColumnBuilder, _ int) ValueWriter { return &binaryValueWriter{ b: b.(*builder.OptBinaryBuilder), } @@ -455,11 +455,11 @@ func NewMapWriter(b builder.ColumnBuilder, _ int) ValueWriter { } } -func (m *mapWriter) WritePage(p parquet.Page) error { +func (m *mapWriter) WritePage(_ parquet.Page) error { panic("not implemented") } -func (m *mapWriter) Write(values []parquet.Value) { +func (m *mapWriter) Write(_ []parquet.Value) { panic("not implemented") } diff --git a/query/expr/filter.go b/query/expr/filter.go index 8b8b54292..c8afd3b2a 100644 --- a/query/expr/filter.go +++ b/query/expr/filter.go @@ -16,11 +16,11 @@ func (f PreExprVisitorFunc) PreVisit(expr logicalplan.Expr) bool { return f(expr) } -func (f PreExprVisitorFunc) Visit(expr logicalplan.Expr) bool { +func (f PreExprVisitorFunc) Visit(_ logicalplan.Expr) bool { return false } -func (f PreExprVisitorFunc) PostVisit(expr logicalplan.Expr) bool { +func (f PreExprVisitorFunc) PostVisit(_ logicalplan.Expr) bool { return false } @@ -38,7 +38,7 @@ type TrueNegativeFilter interface { type AlwaysTrueFilter struct{} -func (f *AlwaysTrueFilter) Eval(p Particulate) (bool, error) { +func (f *AlwaysTrueFilter) Eval(_ Particulate) (bool, error) { return true, nil } diff --git a/query/logicalplan/expr.go b/query/logicalplan/expr.go index d8c24fdc4..18cd486e1 100644 --- a/query/logicalplan/expr.go +++ b/query/logicalplan/expr.go @@ -611,11 +611,11 @@ func (d *DurationExpr) Clone() Expr { } } -func (d *DurationExpr) DataType(schema *parquet.Schema) (arrow.DataType, error) { +func (d *DurationExpr) DataType(_ *parquet.Schema) (arrow.DataType, error) { return &arrow.DurationType{}, nil } -func (d *DurationExpr) MatchPath(path string) bool { +func (d *DurationExpr) MatchPath(_ string) bool { return false } @@ -716,7 +716,7 @@ func (a *RegexpColumnMatch) Clone() Expr { } } -func (a *RegexpColumnMatch) DataType(s *parquet.Schema) (arrow.DataType, error) { +func (a *RegexpColumnMatch) DataType(_ *parquet.Schema) (arrow.DataType, error) { return nil, nil } @@ -768,10 +768,10 @@ func (a *AllExpr) Name() string { return "all" } func (a *AllExpr) ColumnsUsedExprs() []Expr { return []Expr{&AllExpr{}} } -func (a *AllExpr) MatchColumn(columnName string) bool { return true } -func (a *AllExpr) MatchPath(path string) bool { return true } -func (a *AllExpr) Computed() bool { return false } -func (a *AllExpr) Clone() Expr { return &AllExpr{} } +func (a *AllExpr) MatchColumn(_ string) bool { return true } +func (a *AllExpr) MatchPath(_ string) bool { return true } +func (a *AllExpr) Computed() bool { return false } +func (a *AllExpr) Clone() Expr { return &AllExpr{} } type NotExpr struct { Expr Expr diff --git a/query/logicalplan/logicalplan_test.go b/query/logicalplan/logicalplan_test.go index ef44ef611..bf862125c 100644 --- a/query/logicalplan/logicalplan_test.go +++ b/query/logicalplan/logicalplan_test.go @@ -18,26 +18,26 @@ func (m *mockTableReader) Schema() *dynparquet.Schema { return m.schema } -func (m *mockTableReader) View(ctx context.Context, fn func(ctx context.Context, tx uint64) error) error { +func (m *mockTableReader) View(_ context.Context, _ func(ctx context.Context, tx uint64) error) error { return nil } func (m *mockTableReader) Iterator( - ctx context.Context, - tx uint64, - pool memory.Allocator, - callbacks []Callback, - iterOpts ...Option, + _ context.Context, + _ uint64, + _ memory.Allocator, + _ []Callback, + _ ...Option, ) error { return nil } func (m *mockTableReader) SchemaIterator( - ctx context.Context, - tx uint64, - pool memory.Allocator, - callbacks []Callback, - iterOpts ...Option, + _ context.Context, + _ uint64, + _ memory.Allocator, + _ []Callback, + _ ...Option, ) error { return nil } @@ -46,7 +46,7 @@ type mockTableProvider struct { schema *dynparquet.Schema } -func (m *mockTableProvider) GetTable(name string) (TableReader, error) { +func (m *mockTableProvider) GetTable(_ string) (TableReader, error) { return &mockTableReader{ schema: m.schema, }, nil diff --git a/query/logicalplan/validate.go b/query/logicalplan/validate.go index fc3513230..a647f529e 100644 --- a/query/logicalplan/validate.go +++ b/query/logicalplan/validate.go @@ -409,11 +409,11 @@ type findExpressionForTypeVisitor struct { result Expr } -func (v *findExpressionForTypeVisitor) PreVisit(expr Expr) bool { +func (v *findExpressionForTypeVisitor) PreVisit(_ Expr) bool { return true } -func (v *findExpressionForTypeVisitor) Visit(expr Expr) bool { +func (v *findExpressionForTypeVisitor) Visit(_ Expr) bool { return true } diff --git a/query/physicalplan/aggregate.go b/query/physicalplan/aggregate.go index bd4b248b4..19cb7ade2 100644 --- a/query/physicalplan/aggregate.go +++ b/query/physicalplan/aggregate.go @@ -305,7 +305,7 @@ func (d *durationHashCombine) hashCombine(rhs uint64) uint64 { return rhs / d.milliseconds // floors by default } -func (a *HashAggregate) Callback(ctx context.Context, r arrow.Record) error { +func (a *HashAggregate) Callback(_ context.Context, r arrow.Record) error { // Generates high volume of spans. Comment out if needed during development. // ctx, span := a.tracer.Start(ctx, "HashAggregate/Callback") // defer span.End() diff --git a/query/physicalplan/filter.go b/query/physicalplan/filter.go index 2a9a8fbf7..0107c6177 100644 --- a/query/physicalplan/filter.go +++ b/query/physicalplan/filter.go @@ -53,11 +53,11 @@ func (f PreExprVisitorFunc) PreVisit(expr logicalplan.Expr) bool { return f(expr) } -func (f PreExprVisitorFunc) Visit(expr logicalplan.Expr) bool { +func (f PreExprVisitorFunc) Visit(_ logicalplan.Expr) bool { return false } -func (f PreExprVisitorFunc) PostVisit(expr logicalplan.Expr) bool { +func (f PreExprVisitorFunc) PostVisit(_ logicalplan.Expr) bool { return false } diff --git a/query/physicalplan/physicalplan_test.go b/query/physicalplan/physicalplan_test.go index 23f3b18ed..307c5b9f0 100644 --- a/query/physicalplan/physicalplan_test.go +++ b/query/physicalplan/physicalplan_test.go @@ -21,26 +21,26 @@ func (m *mockTableReader) Schema() *dynparquet.Schema { return m.schema } -func (m *mockTableReader) View(ctx context.Context, fn func(ctx context.Context, tx uint64) error) error { +func (m *mockTableReader) View(_ context.Context, _ func(ctx context.Context, tx uint64) error) error { return nil } func (m *mockTableReader) Iterator( - ctx context.Context, - tx uint64, - pool memory.Allocator, - callbacks []logicalplan.Callback, - iterOpts ...logicalplan.Option, + _ context.Context, + _ uint64, + _ memory.Allocator, + _ []logicalplan.Callback, + _ ...logicalplan.Option, ) error { return nil } func (m *mockTableReader) SchemaIterator( - ctx context.Context, - tx uint64, - pool memory.Allocator, - callbacks []logicalplan.Callback, - iterOpts ...logicalplan.Option, + _ context.Context, + _ uint64, + _ memory.Allocator, + _ []logicalplan.Callback, + _ ...logicalplan.Option, ) error { return nil } @@ -49,7 +49,7 @@ type mockTableProvider struct { schema *dynparquet.Schema } -func (m *mockTableProvider) GetTable(name string) (logicalplan.TableReader, error) { +func (m *mockTableProvider) GetTable(_ string) (logicalplan.TableReader, error) { return &mockTableReader{ schema: m.schema, }, nil diff --git a/query/physicalplan/project.go b/query/physicalplan/project.go index f86570217..cfa24d4fb 100644 --- a/query/physicalplan/project.go +++ b/query/physicalplan/project.go @@ -134,7 +134,7 @@ func (p plainProjection) Name() string { return p.expr.ColumnName } -func (p plainProjection) Project(mem memory.Allocator, ar arrow.Record) ([]arrow.Field, []arrow.Array, error) { +func (p plainProjection) Project(_ memory.Allocator, ar arrow.Record) ([]arrow.Field, []arrow.Array, error) { for i := 0; i < ar.Schema().NumFields(); i++ { field := ar.Schema().Field(i) if p.expr.MatchColumn(field.Name) { @@ -154,7 +154,7 @@ func (p dynamicProjection) Name() string { return p.expr.ColumnName } -func (p dynamicProjection) Project(mem memory.Allocator, ar arrow.Record) ([]arrow.Field, []arrow.Array, error) { +func (p dynamicProjection) Project(_ memory.Allocator, ar arrow.Record) ([]arrow.Field, []arrow.Array, error) { fields := []arrow.Field{} arrays := []arrow.Array{} for i := 0; i < ar.Schema().NumFields(); i++ { @@ -367,6 +367,6 @@ type allProjection struct{} func (a allProjection) Name() string { return "all" } -func (a allProjection) Project(mem memory.Allocator, ar arrow.Record) ([]arrow.Field, []arrow.Array, error) { +func (a allProjection) Project(_ memory.Allocator, ar arrow.Record) ([]arrow.Field, []arrow.Array, error) { return ar.Schema().Fields(), ar.Columns(), nil } diff --git a/snapshot.go b/snapshot.go index da9211111..3a4cbe3b0 100644 --- a/snapshot.go +++ b/snapshot.go @@ -382,7 +382,7 @@ func (db *DB) offlineSnapshotWriter(tx uint64, txnMetadata []byte) func(context. } } -func WriteSnapshot(ctx context.Context, tx uint64, txnMetadata []byte, db *DB, w io.Writer, offline bool) error { +func WriteSnapshot(ctx context.Context, _ uint64, txnMetadata []byte, db *DB, w io.Writer, offline bool) error { offW := newOffsetWriter(w) w = offW var tables []*Table diff --git a/table.go b/table.go index 75d5446e3..bfa5245c7 100644 --- a/table.go +++ b/table.go @@ -478,7 +478,7 @@ func (t *Table) writeBlock(block *TableBlock, skipPersist, snapshotDB bool) { } } -func (t *Table) RotateBlock(ctx context.Context, block *TableBlock, skipPersist bool) error { +func (t *Table) RotateBlock(_ context.Context, block *TableBlock, skipPersist bool) error { t.mtx.Lock() defer t.mtx.Unlock() @@ -566,11 +566,11 @@ func (t *Table) Write(ctx context.Context, vals ...any) (uint64, error) { } func (t *Table) InsertRecord(ctx context.Context, record arrow.Record) (uint64, error) { - block, close, err := t.appender(ctx) + block, finish, err := t.appender(ctx) if err != nil { return 0, fmt.Errorf("get appender: %w", err) } - defer close() + defer finish() tx, _, metadata, commit := t.db.begin() defer commit() @@ -590,7 +590,7 @@ func (t *Table) appender(ctx context.Context) (*TableBlock, func(), error) { for { // Using active write block is important because it ensures that we don't // miss pending writers when synchronizing the block. - block, close, err := t.ActiveWriteBlock() + block, finish, err := t.ActiveWriteBlock() if err != nil { return nil, nil, err } @@ -624,11 +624,11 @@ func (t *Table) appender(ctx context.Context) (*TableBlock, func(), error) { } blockSize := block.Size() if blockSize < t.db.columnStore.activeMemorySize || t.db.columnStore.manualBlockRotation { - return block, close, nil + return block, finish, nil } // We need to rotate the block and the writer won't actually be used. - close() + finish() err = t.RotateBlock(ctx, block, false) if err != nil { @@ -880,7 +880,7 @@ func (t *TableBlock) EnsureCompaction() error { return t.index.EnsureCompaction() } -func (t *TableBlock) InsertRecord(ctx context.Context, tx uint64, record arrow.Record) error { +func (t *TableBlock) InsertRecord(_ context.Context, tx uint64, record arrow.Record) error { recordSize := util.TotalRecordSize(record) defer func() { t.table.metrics.rowsInserted.Add(float64(record.NumRows())) diff --git a/tx_list.go b/tx_list.go index e8f8ca218..19474745b 100644 --- a/tx_list.go +++ b/tx_list.go @@ -107,6 +107,8 @@ func (l *TxPool) Insert(tx Txn) { return false } for !tryInsert() { + // Satisfy linter with statement. + continue } } diff --git a/tx_list_test.go b/tx_list_test.go index 72b6d1635..0a31961a4 100644 --- a/tx_list_test.go +++ b/tx_list_test.go @@ -87,6 +87,8 @@ func Test_TXList_Async(t *testing.T) { p.Insert(Txn{TxnID: 1}) // insert the missing tx to drain the pool for v := wm.Load().TxnID; v < tx.Load(); v = wm.Load().TxnID { + // Satisfy linter with statement. + continue } require.Equal(t, tx.Load(), wm.Load().TxnID) @@ -145,6 +147,8 @@ func Benchmark_TXList_InsertAndDrain(b *testing.B) { // Wait for the sweeper to drain for v := wm.Load().TxnID; v < tx.Load(); v = wm.Load().TxnID { + // Satisfy linter with statement. + continue } require.Equal(b, tx.Load(), wm.Load().TxnID) }