Browse Source

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

Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
Gyuho Lee 7 years ago
parent
commit
fa57f7fbc7

+ 2 - 2
Gopkg.lock

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

+ 0 - 0
vendor/github.com/coreos/bbolt/LICENSE → vendor/go.etcd.io/bbolt/LICENSE


+ 1 - 1
vendor/github.com/coreos/bbolt/bolt_386.go → vendor/go.etcd.io/bbolt/bolt_386.go

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

+ 1 - 1
vendor/github.com/coreos/bbolt/bolt_amd64.go → vendor/go.etcd.io/bbolt/bolt_amd64.go

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

+ 1 - 1
vendor/github.com/coreos/bbolt/bolt_arm.go → vendor/go.etcd.io/bbolt/bolt_arm.go

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

+ 1 - 1
vendor/github.com/coreos/bbolt/bolt_arm64.go → vendor/go.etcd.io/bbolt/bolt_arm64.go

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

+ 1 - 1
vendor/github.com/coreos/bbolt/bolt_linux.go → vendor/go.etcd.io/bbolt/bolt_linux.go

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

+ 1 - 1
vendor/github.com/coreos/bbolt/bolt_mips64x.go → vendor/go.etcd.io/bbolt/bolt_mips64x.go

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

+ 1 - 1
vendor/github.com/coreos/bbolt/bolt_mipsx.go → vendor/go.etcd.io/bbolt/bolt_mipsx.go

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

+ 1 - 1
vendor/github.com/coreos/bbolt/bolt_openbsd.go → vendor/go.etcd.io/bbolt/bolt_openbsd.go

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

+ 4 - 1
vendor/github.com/coreos/bbolt/bolt_ppc.go → vendor/go.etcd.io/bbolt/bolt_ppc.go

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

+ 1 - 1
vendor/github.com/coreos/bbolt/bolt_ppc64.go → vendor/go.etcd.io/bbolt/bolt_ppc64.go

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

+ 1 - 1
vendor/github.com/coreos/bbolt/bolt_ppc64le.go → vendor/go.etcd.io/bbolt/bolt_ppc64le.go

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

+ 1 - 1
vendor/github.com/coreos/bbolt/bolt_s390x.go → vendor/go.etcd.io/bbolt/bolt_s390x.go

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

+ 4 - 2
vendor/github.com/coreos/bbolt/bolt_unix.go → vendor/go.etcd.io/bbolt/bolt_unix.go

@@ -1,6 +1,6 @@
 // +build !windows,!plan9,!solaris
 
-package bolt
+package bbolt
 
 import (
 	"fmt"
@@ -56,7 +56,9 @@ func mmap(db *DB, sz int) error {
 	}
 
 	// 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)
 	}
 

+ 1 - 1
vendor/github.com/coreos/bbolt/bolt_unix_solaris.go → vendor/go.etcd.io/bbolt/bolt_unix_solaris.go

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

+ 1 - 1
vendor/github.com/coreos/bbolt/bolt_windows.go → vendor/go.etcd.io/bbolt/bolt_windows.go

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

+ 1 - 1
vendor/github.com/coreos/bbolt/boltsync_unix.go → vendor/go.etcd.io/bbolt/boltsync_unix.go

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

+ 1 - 1
vendor/github.com/coreos/bbolt/bucket.go → vendor/go.etcd.io/bbolt/bucket.go

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

+ 3 - 7
vendor/github.com/coreos/bbolt/cursor.go → vendor/go.etcd.io/bbolt/cursor.go

@@ -1,4 +1,4 @@
-package bolt
+package bbolt
 
 import (
 	"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.
 	c.stack = c.stack[:0]
 	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.
 	return c.keyValue()
@@ -339,6 +333,8 @@ func (c *Cursor) nsearch(key []byte) {
 // keyValue returns the key and value of the current leaf element.
 func (c *Cursor) keyValue() ([]byte, []byte, uint32) {
 	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() {
 		return nil, nil, 0
 	}

+ 9 - 4
vendor/github.com/coreos/bbolt/db.go → vendor/go.etcd.io/bbolt/db.go

@@ -1,4 +1,4 @@
-package bolt
+package bbolt
 
 import (
 	"errors"
@@ -213,10 +213,13 @@ func Open(path string, mode os.FileMode, options *Options) (*DB, error) {
 
 	// Initialize the database if it doesn't exist.
 	if info, err := db.file.Stat(); err != nil {
+		_ = db.close()
 		return nil, err
 	} else if info.Size() == 0 {
 		// Initialize new files with meta pages.
 		if err := db.init(); err != nil {
+			// clean up file descriptor on initialization fail
+			_ = db.close()
 			return nil, err
 		}
 	} else {
@@ -236,6 +239,7 @@ func Open(path string, mode os.FileMode, options *Options) (*DB, error) {
 				db.pageSize = int(m.pageSize)
 			}
 		} else {
+			_ = db.close()
 			return nil, ErrInvalid
 		}
 	}
@@ -441,7 +445,8 @@ func (db *DB) init() error {
 }
 
 // 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 {
 	db.rwlock.Lock()
 	defer db.rwlock.Unlock()
@@ -449,8 +454,8 @@ func (db *DB) Close() error {
 	db.metalock.Lock()
 	defer db.metalock.Unlock()
 
-	db.mmaplock.RLock()
-	defer db.mmaplock.RUnlock()
+	db.mmaplock.Lock()
+	defer db.mmaplock.Unlock()
 
 	return db.close()
 }

+ 2 - 2
vendor/github.com/coreos/bbolt/doc.go → vendor/go.etcd.io/bbolt/doc.go

@@ -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
 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
@@ -41,4 +41,4 @@ point to different data or can point to invalid memory which will cause a panic.
 
 
 */
-package bolt
+package bbolt

+ 1 - 1
vendor/github.com/coreos/bbolt/errors.go → vendor/go.etcd.io/bbolt/errors.go

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

+ 1 - 1
vendor/github.com/coreos/bbolt/freelist.go → vendor/go.etcd.io/bbolt/freelist.go

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

+ 1 - 1
vendor/github.com/coreos/bbolt/node.go → vendor/go.etcd.io/bbolt/node.go

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

+ 1 - 1
vendor/github.com/coreos/bbolt/page.go → vendor/go.etcd.io/bbolt/page.go

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

+ 4 - 2
vendor/github.com/coreos/bbolt/tx.go → vendor/go.etcd.io/bbolt/tx.go

@@ -1,4 +1,4 @@
-package bolt
+package bbolt
 
 import (
 	"fmt"
@@ -303,7 +303,9 @@ func (tx *Tx) close() {
 }
 
 // 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 {
 	_, err := tx.WriteTo(w)
 	return err