diff --git a/bolt_store.go b/bolt_store.go index 66b75bc..a5822da 100644 --- a/bolt_store.go +++ b/bolt_store.go @@ -3,7 +3,7 @@ package raftboltdb import ( "errors" - "github.com/boltdb/bolt" + "go.etcd.io/bbolt" "github.com/hashicorp/raft" ) @@ -27,7 +27,7 @@ var ( // a LogStore and StableStore. type BoltStore struct { // conn is the underlying handle to the db. - conn *bolt.DB + conn *bbolt.DB // The path to the Bolt database file path string @@ -40,7 +40,7 @@ type Options struct { // BoltOptions contains any specific BoltDB options you might // want to specify [e.g. open timeout] - BoltOptions *bolt.Options + BoltOptions *bbolt.Options // NoSync causes the database to skip fsync calls after each // write to the log. This is unsafe, so it should be used @@ -63,7 +63,7 @@ func NewBoltStore(path string) (*BoltStore, error) { // New uses the supplied options to open the BoltDB and prepare it for use as a raft backend. func New(options Options) (*BoltStore, error) { // Try to connect - handle, err := bolt.Open(options.Path, dbFileMode, options.BoltOptions) + handle, err := bbolt.Open(options.Path, dbFileMode, options.BoltOptions) if err != nil { return nil, err } diff --git a/bolt_store_test.go b/bolt_store_test.go index 12b09b2..737efc2 100644 --- a/bolt_store_test.go +++ b/bolt_store_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "github.com/boltdb/bolt" + "go.etcd.io/bbolt" "github.com/hashicorp/raft" ) @@ -54,7 +54,7 @@ func TestBoltOptionsTimeout(t *testing.T) { defer os.Remove(fh.Name()) options := Options{ Path: fh.Name(), - BoltOptions: &bolt.Options{ + BoltOptions: &bbolt.Options{ Timeout: time.Second / 10, }, } @@ -102,7 +102,7 @@ func TestBoltOptionsReadOnly(t *testing.T) { store.Close() options := Options{ Path: fh.Name(), - BoltOptions: &bolt.Options{ + BoltOptions: &bbolt.Options{ Timeout: time.Second / 10, ReadOnly: true, }, @@ -123,8 +123,8 @@ func TestBoltOptionsReadOnly(t *testing.T) { } // Attempt to store the log, should fail on a read-only store err = roStore.StoreLog(log) - if err != bolt.ErrDatabaseReadOnly { - t.Errorf("expecting error %v, but got %v", bolt.ErrDatabaseReadOnly, err) + if err != bbolt.ErrDatabaseReadOnly { + t.Errorf("expecting error %v, but got %v", bbolt.ErrDatabaseReadOnly, err) } } @@ -156,7 +156,7 @@ func TestNewBoltStore(t *testing.T) { } // Ensure our tables were created - db, err := bolt.Open(fh.Name(), dbFileMode, nil) + db, err := bbolt.Open(fh.Name(), dbFileMode, nil) if err != nil { t.Fatalf("err: %s", err) } @@ -164,10 +164,10 @@ func TestNewBoltStore(t *testing.T) { if err != nil { t.Fatalf("err: %s", err) } - if _, err := tx.CreateBucket([]byte(dbLogs)); err != bolt.ErrBucketExists { + if _, err := tx.CreateBucket([]byte(dbLogs)); err != bbolt.ErrBucketExists { t.Fatalf("bad: %v", err) } - if _, err := tx.CreateBucket([]byte(dbConf)); err != bolt.ErrBucketExists { + if _, err := tx.CreateBucket([]byte(dbConf)); err != bbolt.ErrBucketExists { t.Fatalf("bad: %v", err) } } diff --git a/go.mod b/go.mod index 5b92dc7..3b29579 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/hashicorp/raft-boltdb go 1.12 require ( - github.com/boltdb/bolt v1.3.1 + // github.com/boltdb/bolt v1.3.1 github.com/hashicorp/go-msgpack v0.5.5 github.com/hashicorp/raft v1.1.0 - golang.org/x/sys v0.0.0-20190602015325-4c4f7f33c9ed // indirect + go.etcd.io/bbolt v1.3.5 ) diff --git a/go.sum b/go.sum index 6433ce8..b746757 100644 --- a/go.sum +++ b/go.sum @@ -39,7 +39,11 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= +go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= +go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190602015325-4c4f7f33c9ed h1:uPxWBzB3+mlnjy9W58qY1j/cjyFjutgw/Vhan2zLy/A= golang.org/x/sys v0.0.0-20190602015325-4c4f7f33c9ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 h1:LfCXLvNmTYH9kEmVgqbnsWfruoXZIrh4YBgqVHtDvw0= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=