Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mattisonchao committed Nov 4, 2024
1 parent 0d683a6 commit 5be0df6
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 20 deletions.
4 changes: 2 additions & 2 deletions coordinator/impl/coordinator_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -805,10 +805,10 @@ func TestCoordinator_RefreshServerInfo(t *testing.T) {
}, 10*time.Second, 10*time.Millisecond)

// change the localhost to 127.0.0.1
var clusterServer []model.ServerAddress
clusterServer := make([]model.ServerAddress, 0)
for _, sv := range clusterConfig.Servers {
clusterServer = append(clusterServer, model.ServerAddress{
Public: strings.Replace(sv.Public, "localhost", "127.0.0.1", -1),
Public: strings.ReplaceAll(sv.Public, "localhost", "127.0.0.1"),
Internal: sv.Internal,
})
}
Expand Down
2 changes: 1 addition & 1 deletion oxia/options_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (u *useIndex) applyRangeScan(opts *rangeScanOptions) {
}

// UseIndex let the users specify a different index to follow for the
// Note: The returned list will contain they primary keys of the records
// Note: The returned list will contain they primary keys of the records.
func UseIndex(indexName string) ListOption {
return &useIndex{indexName}
}
3 changes: 2 additions & 1 deletion oxia/sync_client_impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ package oxia
import (
"context"
"fmt"
"github.com/streamnative/oxia/server"
"log/slog"
"strings"
"testing"

"github.com/streamnative/oxia/server"

"github.com/stretchr/testify/assert"
)

Expand Down
3 changes: 2 additions & 1 deletion server/kv/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ package kv

import (
"fmt"
"github.com/google/uuid"
"os"
"path"
"testing"

"github.com/google/uuid"

"github.com/stretchr/testify/assert"
pb "google.golang.org/protobuf/proto"

Expand Down
3 changes: 2 additions & 1 deletion server/kv/kv_pebble.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ package kv

import (
"fmt"
"golang.org/x/net/context"
"io"
"log/slog"
"os"
"path/filepath"
"sync/atomic"
"time"

"golang.org/x/net/context"

"github.com/cockroachdb/pebble/bloom"

"github.com/streamnative/oxia/common/compare"
Expand Down
4 changes: 2 additions & 2 deletions server/wal/codec/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ type Codec interface {
// - buf: the byte slice containing the raw data.
// - startFileOffset: the starting file offset from which recovery begins.
// - baseEntryOffset: the base offset for the index entries, used to adjust entry offsets.
// - commitOffset: a pointer to the commit offset, which is using for auto-discard uncommited corruption data
// - commitOffset: a pointer to the commit offset, which is using for auto-discard uncommitted corruption data
//
// Returns:
// - index: the recovered index data as a byte slice.
Expand Down Expand Up @@ -165,7 +165,7 @@ func ReadInt(b []byte, offset uint32) uint32 {
return binary.BigEndian.Uint32(b[offset : offset+4])
}

// Index buf
// Index buf.
var bufferPool = sync.Pool{}

const initialIndexBufferCapacity = 16 * 1024
Expand Down
7 changes: 4 additions & 3 deletions server/wal/codec/v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ package codec

import (
"encoding/binary"
"github.com/pkg/errors"
"go.uber.org/multierr"
"io"
"os"

"github.com/pkg/errors"
"go.uber.org/multierr"
)

// Txn File:
Expand All @@ -33,7 +34,7 @@ import (
// +----------------+----------------+----------------+
// | Index(4 Bytes) | Index(4 Bytes) | ... |
// +----------------+----------------+----------------+
// Index: The file offset index
// Index: The file offset index.
var _ Codec = &V1{}

const v1PayloadSizeLen uint32 = 4
Expand Down
3 changes: 2 additions & 1 deletion server/wal/codec/v1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ package codec

import (
"encoding/binary"
"github.com/google/uuid"
"os"
"path"
"testing"

"github.com/google/uuid"

"github.com/stretchr/testify/assert"
)

Expand Down
9 changes: 5 additions & 4 deletions server/wal/codec/v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ package codec

import (
"encoding/binary"
"go.uber.org/multierr"
"io"
"log/slog"
"os"

"go.uber.org/multierr"

"github.com/pkg/errors"

"github.com/streamnative/oxia/server/util/crc"
Expand All @@ -40,7 +41,7 @@ import (
// | CRC(4Bytes) | Index(4B) | Index(4B) | ... |
// +--------------+-----------+-----------+-----+
// CRC: 32bit hash computed over the payload using CRC.
// Index: The file offset index
// Index: The file offset index.
var _ Codec = &V2{}

const v2PayloadSizeLen uint32 = 4
Expand Down Expand Up @@ -217,8 +218,8 @@ func (v *V2) RecoverIndex(buf []byte, startFileOffset uint32, baseEntryOffset in
// data corruption
if errors.Is(err, ErrOffsetOutOfBounds) || errors.Is(err, ErrDataCorrupted) {
if commitOffset != nil && currentEntryOffset > *commitOffset {
// uncommited data corruption, simply discard it
slog.Warn("discard the corrupted uncommited data.",
// uncommitted data corruption, simply discard it
slog.Warn("discard the corrupted uncommitted data.",
slog.Int64("entryId", currentEntryOffset), slog.Any("error", err))
break
}
Expand Down
3 changes: 2 additions & 1 deletion server/wal/codec/v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ package codec

import (
"encoding/binary"
"github.com/google/uuid"
"os"
"path"
"testing"

"github.com/google/uuid"

"github.com/stretchr/testify/assert"

"github.com/streamnative/oxia/server/util/crc"
Expand Down
2 changes: 1 addition & 1 deletion server/wal/wal_ro_segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ func (r *readOnlySegmentsGroup) PollHighestSegment() (common.RefCount[ReadOnlySe
defer r.Unlock()

if r.allSegments.Empty() {
return nil, nil // nolint: nilnil
return nil, nil //nolint: nilnil
}

offset, _ := r.allSegments.Max()
Expand Down
3 changes: 2 additions & 1 deletion server/wal/wal_ro_segment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ package wal

import (
"fmt"
"github.com/google/uuid"
"os"
"testing"

"github.com/google/uuid"

"github.com/streamnative/oxia/server/wal/codec"

"github.com/stretchr/testify/assert"
Expand Down
3 changes: 2 additions & 1 deletion server/wal/wal_rw_segment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ package wal

import (
"encoding/binary"
"github.com/streamnative/oxia/server/wal/codec"
"testing"

"github.com/streamnative/oxia/server/wal/codec"

"github.com/stretchr/testify/assert"
)

Expand Down

0 comments on commit 5be0df6

Please sign in to comment.