Compare commits

...

10 Commits

Author SHA1 Message Date
Sam Batschelet 333b9f2656
Merge pull request #12802 from hexfusion/test-bump-release-3.2
test: bump golang to 1.12.17 for travis
2021-03-28 19:01:21 -04:00
Sam Batschelet 7436c63a48 Dockerfile-test: use ubuntu LTS and build workaround for old go-tools
Signed-off-by: Sam Batschelet <sbatsche@redhat.com>
2021-03-28 17:11:39 -04:00
Sam Batschelet 5caf504f40 test: bump golang to 1.12.17 for travis
Signed-off-by: Sam Batschelet <sbatsche@redhat.com>
2021-03-28 17:11:39 -04:00
Sam Batschelet 7dc07f2a9b
Merge pull request #12811 from hexfusion/cp-8469-release-3.2
Manual cherry pick of #8469
2021-03-28 17:07:40 -04:00
Manjunath A Kumatagi 7ec9c48a45 pkg/pbutil: Fix go vet errors 2021-03-28 16:47:09 -04:00
Piotr Tabor 8ce82ff877
Merge pull request #12809 from hexfusion/fix-logger
raft: correctly pass arguments to Logger.Panic
2021-03-28 21:33:47 +02:00
Sam Batschelet 6064a0e39c raft: correctly pass arguments to Logger.Panic
Signed-off-by: Sam Batschelet <sbatsche@redhat.com>
2021-03-28 15:20:34 -04:00
Sam Batschelet 78f1a05493 version: 3.2.32
Signed-off-by: Sam Batschelet <sbatsche@redhat.com>
2021-03-26 13:04:17 -04:00
Sam Batschelet 7a07e9f3b3
Merge pull request #12639 from retroflexer/check-nil-decoder
wal: fix panic when decoder not set
2021-01-21 13:13:55 -05:00
Sahdev P. Zala 8d4ab97008 wal: fix panic when decoder not set
Handle the related panic and clarify doc.
2021-01-21 13:00:34 -05:00
7 changed files with 48 additions and 11 deletions

View File

@ -6,12 +6,15 @@ sudo: required
services: docker
go:
- 1.8.7
- 1.12.17
notifications:
on_success: never
on_failure: never
env:
- GO111MODULE=off
env:
matrix:
- TARGET=linux-amd64-integration
@ -23,7 +26,7 @@ env:
matrix:
fast_finish: true
allow_failures:
- go: 1.8.7
- go: 1.12.17
env: TARGET=linux-386-unit
exclude:
- go: tip

View File

@ -1,4 +1,4 @@
FROM ubuntu:16.10
FROM ubuntu:16.04
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
@ -29,6 +29,7 @@ RUN apt-get -y update \
&& apt-get -y autoremove \
&& apt-get -y autoclean
ENV GO111MODULE=off
ENV GOROOT /usr/local/go
ENV GOPATH /go
ENV PATH ${GOPATH}/bin:${GOROOT}/bin:${PATH}
@ -46,11 +47,18 @@ ADD ./scripts/install-marker.sh /tmp/install-marker.sh
RUN go get -v -u -tags spell github.com/chzchzchz/goword \
&& go get -v -u github.com/coreos/license-bill-of-materials \
&& go get -v -u honnef.co/go/tools/cmd/gosimple \
&& go get -v -u honnef.co/go/tools/cmd/unused \
&& go get -v -u honnef.co/go/tools/cmd/staticcheck \
&& go get -v -u github.com/wadey/gocovmerge \
&& go get -v -u github.com/gordonklaus/ineffassign \
&& mkdir -p $GOPATH/src/honnef.co/go/tools \
&& git clone https://github.com/dominikh/go-tools.git $GOPATH/src/honnef.co/go/tools \
&& cd $GOPATH/src/honnef.co/go/tools/cmd/staticcheck \
&& git checkout 2017.2.2 \
&& go get \
&& go install \
&& cd $GOPATH/src/honnef.co/go/tools/cmd/gosimple \
&& go install \
&& cd $GOPATH/src/honnef.co/go/tools/cmd/unused \
&& go install \
&& /tmp/install-marker.sh amd64 \
&& rm -f /tmp/install-marker.sh \
&& curl -s https://codecov.io/bash >/codecov \

View File

@ -24,7 +24,7 @@ func TestMarshaler(t *testing.T) {
data := []byte("test data")
m := &fakeMarshaler{data: data}
if g := MustMarshal(m); !reflect.DeepEqual(g, data) {
t.Errorf("data = %s, want %s", g, m)
t.Errorf("data = %s, want %s", g, m.data)
}
}
@ -43,7 +43,7 @@ func TestUnmarshaler(t *testing.T) {
m := &fakeUnmarshaler{}
MustUnmarshal(m, data)
if !reflect.DeepEqual(m.data, data) {
t.Errorf("data = %s, want %s", m.data, m)
t.Errorf("data = %s, want %s", m.data, data)
}
}

View File

@ -114,7 +114,7 @@ func (l *DefaultLogger) Fatalf(format string, v ...interface{}) {
}
func (l *DefaultLogger) Panic(v ...interface{}) {
l.Logger.Panic(v)
l.Logger.Panic(v...)
}
func (l *DefaultLogger) Panicf(format string, v ...interface{}) {

View File

@ -26,7 +26,7 @@ import (
var (
// MinClusterVersion is the min cluster version this etcd binary is compatible with.
MinClusterVersion = "3.0.0"
Version = "3.2.31"
Version = "3.2.32"
APIVersion = "unknown"
// Git SHA Value will be set during build

View File

@ -61,6 +61,7 @@ var (
ErrSnapshotNotFound = errors.New("wal: snapshot not found")
ErrSliceOutOfRange = errors.New("wal: slice bounds out of range")
ErrMaxWALEntrySizeLimitExceeded = errors.New("wal: max entry size limit exceeded")
ErrDecoderNotFound = errors.New("wal: decoder not found")
crcTable = crc32.MakeTable(crc32.Castagnoli)
)
@ -91,7 +92,8 @@ type WAL struct {
}
// Create creates a WAL ready for appending records. The given metadata is
// recorded at the head of each WAL file, and can be retrieved with ReadAll.
// recorded at the head of each WAL file, and can be retrieved with ReadAll
// after the file is Open.
func Create(dirpath string, metadata []byte) (*WAL, error) {
if Exist(dirpath) {
return nil, os.ErrExist
@ -262,6 +264,10 @@ func (w *WAL) ReadAll() (metadata []byte, state raftpb.HardState, ents []raftpb.
defer w.mu.Unlock()
rec := &walpb.Record{}
if w.decoder == nil {
return nil, state, nil, ErrDecoderNotFound
}
decoder := w.decoder
var match bool

View File

@ -823,3 +823,23 @@ func TestOpenOnTornWrite(t *testing.T) {
t.Fatalf("expected len(ents) = %d, got %d", wEntries, len(ents))
}
}
func TestReadAllFail(t *testing.T) {
dir, err := ioutil.TempDir(os.TempDir(), "waltest")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(dir)
// create initial WAL
f, err := Create(dir, []byte("metadata"))
if err != nil {
t.Fatal(err)
}
f.Close()
// try to read without opening the WAL
_, _, _, err = f.ReadAll()
if err == nil || err != ErrDecoderNotFound {
t.Fatalf("err = %v, want ErrDecoderNotFound", err)
}
}