vendor: use "go.etcd.io/bbolt" v1.3.1-etcd.7

Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
release-3.4
Gyuho Lee 2018-08-29 12:39:59 -07:00
parent 790cc3cdd6
commit fa57f7fbc7
27 changed files with 47 additions and 39 deletions

4
Gopkg.lock generated
View File

@ -317,8 +317,8 @@
name = "go.etcd.io/bbolt" name = "go.etcd.io/bbolt"
packages = ["."] packages = ["."]
pruneopts = "UT" pruneopts = "UT"
revision = "583e8937c61f1af6513608ccc75c97b6abdf4ff9" revision = "acbc2c426a444a65e0cbfdcbb3573857bf18b465"
version = "v1.3.0" version = "v1.3.1-etcd.7"
[[projects]] [[projects]]
digest = "1:3c1a69cdae3501bf75e76d0d86dc6f2b0a7421bc205c0cb7b96b19eed464a34d" digest = "1:3c1a69cdae3501bf75e76d0d86dc6f2b0a7421bc205c0cb7b96b19eed464a34d"

View File

@ -1,4 +1,4 @@
package bolt package bbolt
// maxMapSize represents the largest mmap size supported by Bolt. // maxMapSize represents the largest mmap size supported by Bolt.
const maxMapSize = 0x7FFFFFFF // 2GB const maxMapSize = 0x7FFFFFFF // 2GB

View File

@ -1,4 +1,4 @@
package bolt package bbolt
// maxMapSize represents the largest mmap size supported by Bolt. // maxMapSize represents the largest mmap size supported by Bolt.
const maxMapSize = 0xFFFFFFFFFFFF // 256TB const maxMapSize = 0xFFFFFFFFFFFF // 256TB

View File

@ -1,4 +1,4 @@
package bolt package bbolt
import "unsafe" import "unsafe"

View File

@ -1,6 +1,6 @@
// +build arm64 // +build arm64
package bolt package bbolt
// maxMapSize represents the largest mmap size supported by Bolt. // maxMapSize represents the largest mmap size supported by Bolt.
const maxMapSize = 0xFFFFFFFFFFFF // 256TB const maxMapSize = 0xFFFFFFFFFFFF // 256TB

View File

@ -1,4 +1,4 @@
package bolt package bbolt
import ( import (
"syscall" "syscall"

View File

@ -1,6 +1,6 @@
// +build mips64 mips64le // +build mips64 mips64le
package bolt package bbolt
// maxMapSize represents the largest mmap size supported by Bolt. // maxMapSize represents the largest mmap size supported by Bolt.
const maxMapSize = 0x8000000000 // 512GB const maxMapSize = 0x8000000000 // 512GB

View File

@ -1,6 +1,6 @@
// +build mips mipsle // +build mips mipsle
package bolt package bbolt
// maxMapSize represents the largest mmap size supported by Bolt. // maxMapSize represents the largest mmap size supported by Bolt.
const maxMapSize = 0x40000000 // 1GB const maxMapSize = 0x40000000 // 1GB

View File

@ -1,4 +1,4 @@
package bolt package bbolt
import ( import (
"syscall" "syscall"

View File

@ -1,9 +1,12 @@
// +build ppc // +build ppc
package bolt package bbolt
// maxMapSize represents the largest mmap size supported by Bolt. // maxMapSize represents the largest mmap size supported by Bolt.
const maxMapSize = 0x7FFFFFFF // 2GB const maxMapSize = 0x7FFFFFFF // 2GB
// maxAllocSize is the size used when creating array pointers. // maxAllocSize is the size used when creating array pointers.
const maxAllocSize = 0xFFFFFFF const maxAllocSize = 0xFFFFFFF
// Are unaligned load/stores broken on this arch?
var brokenUnaligned = false

View File

@ -1,6 +1,6 @@
// +build ppc64 // +build ppc64
package bolt package bbolt
// maxMapSize represents the largest mmap size supported by Bolt. // maxMapSize represents the largest mmap size supported by Bolt.
const maxMapSize = 0xFFFFFFFFFFFF // 256TB const maxMapSize = 0xFFFFFFFFFFFF // 256TB

View File

@ -1,6 +1,6 @@
// +build ppc64le // +build ppc64le
package bolt package bbolt
// maxMapSize represents the largest mmap size supported by Bolt. // maxMapSize represents the largest mmap size supported by Bolt.
const maxMapSize = 0xFFFFFFFFFFFF // 256TB const maxMapSize = 0xFFFFFFFFFFFF // 256TB

View File

@ -1,6 +1,6 @@
// +build s390x // +build s390x
package bolt package bbolt
// maxMapSize represents the largest mmap size supported by Bolt. // maxMapSize represents the largest mmap size supported by Bolt.
const maxMapSize = 0xFFFFFFFFFFFF // 256TB const maxMapSize = 0xFFFFFFFFFFFF // 256TB

View File

@ -1,6 +1,6 @@
// +build !windows,!plan9,!solaris // +build !windows,!plan9,!solaris
package bolt package bbolt
import ( import (
"fmt" "fmt"
@ -56,7 +56,9 @@ func mmap(db *DB, sz int) error {
} }
// Advise the kernel that the mmap is accessed randomly. // Advise the kernel that the mmap is accessed randomly.
if err := madvise(b, syscall.MADV_RANDOM); err != nil { err = madvise(b, syscall.MADV_RANDOM)
if err != nil && err != syscall.ENOSYS {
// Ignore not implemented error in kernel because it still works.
return fmt.Errorf("madvise: %s", err) return fmt.Errorf("madvise: %s", err)
} }

View File

@ -1,4 +1,4 @@
package bolt package bbolt
import ( import (
"fmt" "fmt"

View File

@ -1,4 +1,4 @@
package bolt package bbolt
import ( import (
"fmt" "fmt"

View File

@ -1,6 +1,6 @@
// +build !windows,!plan9,!linux,!openbsd // +build !windows,!plan9,!linux,!openbsd
package bolt package bbolt
// fdatasync flushes written data to a file descriptor. // fdatasync flushes written data to a file descriptor.
func fdatasync(db *DB) error { func fdatasync(db *DB) error {

View File

@ -1,4 +1,4 @@
package bolt package bbolt
import ( import (
"bytes" "bytes"

View File

@ -1,4 +1,4 @@
package bolt package bbolt
import ( import (
"bytes" "bytes"
@ -157,12 +157,6 @@ func (c *Cursor) seek(seek []byte) (key []byte, value []byte, flags uint32) {
// Start from root page/node and traverse to correct page. // Start from root page/node and traverse to correct page.
c.stack = c.stack[:0] c.stack = c.stack[:0]
c.search(seek, c.bucket.root) c.search(seek, c.bucket.root)
ref := &c.stack[len(c.stack)-1]
// If the cursor is pointing to the end of page/node then return nil.
if ref.index >= ref.count() {
return nil, nil, 0
}
// If this is a bucket then return a nil value. // If this is a bucket then return a nil value.
return c.keyValue() return c.keyValue()
@ -339,6 +333,8 @@ func (c *Cursor) nsearch(key []byte) {
// keyValue returns the key and value of the current leaf element. // keyValue returns the key and value of the current leaf element.
func (c *Cursor) keyValue() ([]byte, []byte, uint32) { func (c *Cursor) keyValue() ([]byte, []byte, uint32) {
ref := &c.stack[len(c.stack)-1] ref := &c.stack[len(c.stack)-1]
// If the cursor is pointing to the end of page/node then return nil.
if ref.count() == 0 || ref.index >= ref.count() { if ref.count() == 0 || ref.index >= ref.count() {
return nil, nil, 0 return nil, nil, 0
} }

View File

@ -1,4 +1,4 @@
package bolt package bbolt
import ( import (
"errors" "errors"
@ -213,10 +213,13 @@ func Open(path string, mode os.FileMode, options *Options) (*DB, error) {
// Initialize the database if it doesn't exist. // Initialize the database if it doesn't exist.
if info, err := db.file.Stat(); err != nil { if info, err := db.file.Stat(); err != nil {
_ = db.close()
return nil, err return nil, err
} else if info.Size() == 0 { } else if info.Size() == 0 {
// Initialize new files with meta pages. // Initialize new files with meta pages.
if err := db.init(); err != nil { if err := db.init(); err != nil {
// clean up file descriptor on initialization fail
_ = db.close()
return nil, err return nil, err
} }
} else { } else {
@ -236,6 +239,7 @@ func Open(path string, mode os.FileMode, options *Options) (*DB, error) {
db.pageSize = int(m.pageSize) db.pageSize = int(m.pageSize)
} }
} else { } else {
_ = db.close()
return nil, ErrInvalid return nil, ErrInvalid
} }
} }
@ -441,7 +445,8 @@ func (db *DB) init() error {
} }
// Close releases all database resources. // Close releases all database resources.
// All transactions must be closed before closing the database. // It will block waiting for any open transactions to finish
// before closing the database and returning.
func (db *DB) Close() error { func (db *DB) Close() error {
db.rwlock.Lock() db.rwlock.Lock()
defer db.rwlock.Unlock() defer db.rwlock.Unlock()
@ -449,8 +454,8 @@ func (db *DB) Close() error {
db.metalock.Lock() db.metalock.Lock()
defer db.metalock.Unlock() defer db.metalock.Unlock()
db.mmaplock.RLock() db.mmaplock.Lock()
defer db.mmaplock.RUnlock() defer db.mmaplock.Unlock()
return db.close() return db.close()
} }

View File

@ -1,5 +1,5 @@
/* /*
Package bolt implements a low-level key/value store in pure Go. It supports package bbolt implements a low-level key/value store in pure Go. It supports
fully serializable transactions, ACID semantics, and lock-free MVCC with fully serializable transactions, ACID semantics, and lock-free MVCC with
multiple readers and a single writer. Bolt can be used for projects that multiple readers and a single writer. Bolt can be used for projects that
want a simple data store without the need to add large dependencies such as want a simple data store without the need to add large dependencies such as
@ -41,4 +41,4 @@ point to different data or can point to invalid memory which will cause a panic.
*/ */
package bolt package bbolt

View File

@ -1,4 +1,4 @@
package bolt package bbolt
import "errors" import "errors"

View File

@ -1,4 +1,4 @@
package bolt package bbolt
import ( import (
"fmt" "fmt"

View File

@ -1,4 +1,4 @@
package bolt package bbolt
import ( import (
"bytes" "bytes"

View File

@ -1,4 +1,4 @@
package bolt package bbolt
import ( import (
"fmt" "fmt"

View File

@ -1,4 +1,4 @@
package bolt package bbolt
import ( import (
"fmt" "fmt"
@ -303,7 +303,9 @@ func (tx *Tx) close() {
} }
// Copy writes the entire database to a writer. // Copy writes the entire database to a writer.
// This function exists for backwards compatibility. Use WriteTo() instead. // This function exists for backwards compatibility.
//
// Deprecated; Use WriteTo() instead.
func (tx *Tx) Copy(w io.Writer) error { func (tx *Tx) Copy(w io.Writer) error {
_, err := tx.WriteTo(w) _, err := tx.WriteTo(w)
return err return err