mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-28 12:23:55 +00:00
Update etcd client to 3.3.9
This commit is contained in:
2
vendor/github.com/coreos/etcd/wal/BUILD
generated
vendored
2
vendor/github.com/coreos/etcd/wal/BUILD
generated
vendored
@@ -11,8 +11,6 @@ go_library(
|
||||
"repair.go",
|
||||
"util.go",
|
||||
"wal.go",
|
||||
"wal_unix.go",
|
||||
"wal_windows.go",
|
||||
],
|
||||
importmap = "k8s.io/kubernetes/vendor/github.com/coreos/etcd/wal",
|
||||
importpath = "github.com/coreos/etcd/wal",
|
||||
|
||||
9
vendor/github.com/coreos/etcd/wal/decoder.go
generated
vendored
9
vendor/github.com/coreos/etcd/wal/decoder.go
generated
vendored
@@ -29,6 +29,9 @@ import (
|
||||
|
||||
const minSectorSize = 512
|
||||
|
||||
// frameSizeBytes is frame size in bytes, including record size and padding size.
|
||||
const frameSizeBytes = 8
|
||||
|
||||
type decoder struct {
|
||||
mu sync.Mutex
|
||||
brs []*bufio.Reader
|
||||
@@ -104,7 +107,7 @@ func (d *decoder) decodeRecord(rec *walpb.Record) error {
|
||||
}
|
||||
}
|
||||
// record decoded as valid; point last valid offset to end of record
|
||||
d.lastValidOff += recBytes + padBytes + 8
|
||||
d.lastValidOff += frameSizeBytes + recBytes + padBytes
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -116,7 +119,7 @@ func decodeFrameSize(lenField int64) (recBytes int64, padBytes int64) {
|
||||
// padding is stored in lower 3 bits of length MSB
|
||||
padBytes = int64((uint64(lenField) >> 56) & 0x7)
|
||||
}
|
||||
return
|
||||
return recBytes, padBytes
|
||||
}
|
||||
|
||||
// isTornEntry determines whether the last entry of the WAL was partially written
|
||||
@@ -126,7 +129,7 @@ func (d *decoder) isTornEntry(data []byte) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
fileOff := d.lastValidOff + 8
|
||||
fileOff := d.lastValidOff + frameSizeBytes
|
||||
curOff := 0
|
||||
chunks := [][]byte{}
|
||||
// split data on sector boundaries
|
||||
|
||||
2
vendor/github.com/coreos/etcd/wal/encoder.go
generated
vendored
2
vendor/github.com/coreos/etcd/wal/encoder.go
generated
vendored
@@ -103,7 +103,7 @@ func encodeFrameSize(dataBytes int) (lenField uint64, padBytes int) {
|
||||
if padBytes != 0 {
|
||||
lenField |= uint64(0x80|padBytes) << 56
|
||||
}
|
||||
return
|
||||
return lenField, padBytes
|
||||
}
|
||||
|
||||
func (e *encoder) flush() error {
|
||||
|
||||
2
vendor/github.com/coreos/etcd/wal/file_pipeline.go
generated
vendored
2
vendor/github.com/coreos/etcd/wal/file_pipeline.go
generated
vendored
@@ -55,7 +55,7 @@ func (fp *filePipeline) Open() (f *fileutil.LockedFile, err error) {
|
||||
case f = <-fp.filec:
|
||||
case err = <-fp.errc:
|
||||
}
|
||||
return
|
||||
return f, err
|
||||
}
|
||||
|
||||
func (fp *filePipeline) Close() error {
|
||||
|
||||
49
vendor/github.com/coreos/etcd/wal/wal.go
generated
vendored
49
vendor/github.com/coreos/etcd/wal/wal.go
generated
vendored
@@ -157,6 +157,48 @@ func Create(dirpath string, metadata []byte) (*WAL, error) {
|
||||
return w, nil
|
||||
}
|
||||
|
||||
func (w *WAL) renameWal(tmpdirpath string) (*WAL, error) {
|
||||
if err := os.RemoveAll(w.dir); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// On non-Windows platforms, hold the lock while renaming. Releasing
|
||||
// the lock and trying to reacquire it quickly can be flaky because
|
||||
// it's possible the process will fork to spawn a process while this is
|
||||
// happening. The fds are set up as close-on-exec by the Go runtime,
|
||||
// but there is a window between the fork and the exec where another
|
||||
// process holds the lock.
|
||||
if err := os.Rename(tmpdirpath, w.dir); err != nil {
|
||||
if _, ok := err.(*os.LinkError); ok {
|
||||
return w.renameWalUnlock(tmpdirpath)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
w.fp = newFilePipeline(w.dir, SegmentSizeBytes)
|
||||
df, err := fileutil.OpenDir(w.dir)
|
||||
w.dirFile = df
|
||||
return w, err
|
||||
}
|
||||
|
||||
func (w *WAL) renameWalUnlock(tmpdirpath string) (*WAL, error) {
|
||||
// rename of directory with locked files doesn't work on windows/cifs;
|
||||
// close the WAL to release the locks so the directory can be renamed.
|
||||
plog.Infof("releasing file lock to rename %q to %q", tmpdirpath, w.dir)
|
||||
w.Close()
|
||||
if err := os.Rename(tmpdirpath, w.dir); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// reopen and relock
|
||||
newWAL, oerr := Open(w.dir, walpb.Snapshot{})
|
||||
if oerr != nil {
|
||||
return nil, oerr
|
||||
}
|
||||
if _, _, _, err := newWAL.ReadAll(); err != nil {
|
||||
newWAL.Close()
|
||||
return nil, err
|
||||
}
|
||||
return newWAL, nil
|
||||
}
|
||||
|
||||
// Open opens the WAL at the given snap.
|
||||
// The snap SHOULD have been previously saved to the WAL, or the following
|
||||
// ReadAll will fail.
|
||||
@@ -413,6 +455,7 @@ func (w *WAL) cut() error {
|
||||
return err
|
||||
}
|
||||
|
||||
// reopen newTail with its new path so calls to Name() match the wal filename format
|
||||
newTail.Close()
|
||||
|
||||
if newTail, err = fileutil.LockFile(fpath, os.O_WRONLY, fileutil.PrivateFileMode); err != nil {
|
||||
@@ -460,6 +503,10 @@ func (w *WAL) ReleaseLockTo(index uint64) error {
|
||||
w.mu.Lock()
|
||||
defer w.mu.Unlock()
|
||||
|
||||
if len(w.locks) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
var smaller int
|
||||
found := false
|
||||
|
||||
@@ -477,7 +524,7 @@ func (w *WAL) ReleaseLockTo(index uint64) error {
|
||||
|
||||
// if no lock index is greater than the release index, we can
|
||||
// release lock up to the last one(excluding).
|
||||
if !found && len(w.locks) != 0 {
|
||||
if !found {
|
||||
smaller = len(w.locks) - 1
|
||||
}
|
||||
|
||||
|
||||
44
vendor/github.com/coreos/etcd/wal/wal_unix.go
generated
vendored
44
vendor/github.com/coreos/etcd/wal/wal_unix.go
generated
vendored
@@ -1,44 +0,0 @@
|
||||
// Copyright 2016 The etcd Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// +build !windows
|
||||
|
||||
package wal
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/coreos/etcd/pkg/fileutil"
|
||||
)
|
||||
|
||||
func (w *WAL) renameWal(tmpdirpath string) (*WAL, error) {
|
||||
// On non-Windows platforms, hold the lock while renaming. Releasing
|
||||
// the lock and trying to reacquire it quickly can be flaky because
|
||||
// it's possible the process will fork to spawn a process while this is
|
||||
// happening. The fds are set up as close-on-exec by the Go runtime,
|
||||
// but there is a window between the fork and the exec where another
|
||||
// process holds the lock.
|
||||
|
||||
if err := os.RemoveAll(w.dir); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := os.Rename(tmpdirpath, w.dir); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
w.fp = newFilePipeline(w.dir, SegmentSizeBytes)
|
||||
df, err := fileutil.OpenDir(w.dir)
|
||||
w.dirFile = df
|
||||
return w, err
|
||||
}
|
||||
41
vendor/github.com/coreos/etcd/wal/wal_windows.go
generated
vendored
41
vendor/github.com/coreos/etcd/wal/wal_windows.go
generated
vendored
@@ -1,41 +0,0 @@
|
||||
// Copyright 2016 The etcd Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package wal
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/coreos/etcd/wal/walpb"
|
||||
)
|
||||
|
||||
func (w *WAL) renameWal(tmpdirpath string) (*WAL, error) {
|
||||
// rename of directory with locked files doesn't work on
|
||||
// windows; close the WAL to release the locks so the directory
|
||||
// can be renamed
|
||||
w.Close()
|
||||
if err := os.Rename(tmpdirpath, w.dir); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// reopen and relock
|
||||
newWAL, oerr := Open(w.dir, walpb.Snapshot{})
|
||||
if oerr != nil {
|
||||
return nil, oerr
|
||||
}
|
||||
if _, _, _, err := newWAL.ReadAll(); err != nil {
|
||||
newWAL.Close()
|
||||
return nil, err
|
||||
}
|
||||
return newWAL, nil
|
||||
}
|
||||
5
vendor/github.com/coreos/etcd/wal/walpb/BUILD
generated
vendored
5
vendor/github.com/coreos/etcd/wal/walpb/BUILD
generated
vendored
@@ -9,7 +9,10 @@ go_library(
|
||||
importmap = "k8s.io/kubernetes/vendor/github.com/coreos/etcd/wal/walpb",
|
||||
importpath = "github.com/coreos/etcd/wal/walpb",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["//vendor/github.com/golang/protobuf/proto:go_default_library"],
|
||||
deps = [
|
||||
"//vendor/github.com/gogo/protobuf/gogoproto:go_default_library",
|
||||
"//vendor/github.com/golang/protobuf/proto:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
|
||||
23
vendor/github.com/coreos/etcd/wal/walpb/record.pb.go
generated
vendored
23
vendor/github.com/coreos/etcd/wal/walpb/record.pb.go
generated
vendored
@@ -1,6 +1,5 @@
|
||||
// Code generated by protoc-gen-gogo.
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: record.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package walpb is a generated protocol buffer package.
|
||||
@@ -21,6 +20,8 @@ import (
|
||||
|
||||
math "math"
|
||||
|
||||
_ "github.com/gogo/protobuf/gogoproto"
|
||||
|
||||
io "io"
|
||||
)
|
||||
|
||||
@@ -122,24 +123,6 @@ func (m *Snapshot) MarshalTo(dAtA []byte) (int, error) {
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func encodeFixed64Record(dAtA []byte, offset int, v uint64) int {
|
||||
dAtA[offset] = uint8(v)
|
||||
dAtA[offset+1] = uint8(v >> 8)
|
||||
dAtA[offset+2] = uint8(v >> 16)
|
||||
dAtA[offset+3] = uint8(v >> 24)
|
||||
dAtA[offset+4] = uint8(v >> 32)
|
||||
dAtA[offset+5] = uint8(v >> 40)
|
||||
dAtA[offset+6] = uint8(v >> 48)
|
||||
dAtA[offset+7] = uint8(v >> 56)
|
||||
return offset + 8
|
||||
}
|
||||
func encodeFixed32Record(dAtA []byte, offset int, v uint32) int {
|
||||
dAtA[offset] = uint8(v)
|
||||
dAtA[offset+1] = uint8(v >> 8)
|
||||
dAtA[offset+2] = uint8(v >> 16)
|
||||
dAtA[offset+3] = uint8(v >> 24)
|
||||
return offset + 4
|
||||
}
|
||||
func encodeVarintRecord(dAtA []byte, offset int, v uint64) int {
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
|
||||
Reference in New Issue
Block a user