Merge pull request #967 from rqlite/bbolt

Move to etcd's fork of BoltDB
This commit is contained in:
Philip O'Toole
2022-01-20 22:46:02 -05:00
committed by GitHub
6 changed files with 25 additions and 12 deletions

View File

@@ -4,7 +4,9 @@ This release introduces new node-discovery integration with [Consul](https://www
See the [new documentation](https://github.com/rqlite/rqlite/blob/master/DOC/AUTO_CLUSTERING.md) for full details on using Consul and etcd.
### Upgrading
There are some breaking changes in release 7.0, but most users of rqlite can upgrade to 7.0 without doing anything special -- simply download and run the 7.0 release.
This release uses a new database for the Raft system. As a result **rqlite 7.0 is not compatible with earlier releases**. To upgrade from an earlier version to this release you should backup your existing Leader node, and restore the database dump into a new 7.0 cluster.
There are also some other breaking changes in release 7.0, related to command-line arguments:
- The disco-related command-line arguments have changed to support Consul and etcd. If you wish to continue to use legacy Discovery, you can't upgrade to 7.0 -- or consider using Consul or etcd for node-discovery.
- The command-line argument `-RaftWaitForLeader` has been removed. If you need to wait for a node to have a Leader, you should poll the `/readyz` endpoint.
@@ -15,6 +17,7 @@ There are some breaking changes in release 7.0, but most users of rqlite can upg
### Implementation changes and bug fixes
- [PR #957](https://github.com/rqlite/rqlite/pull/957): Refactor `rqlited` command-line argument code.
- [PR #965](https://github.com/rqlite/rqlite/pull/965): Stop using deprecated protobuf package.
- [PR #967](https://github.com/rqlite/rqlite/pull/967): Replace BoltDB with etcd's fork, [bbolt](https://pkg.go.dev/go.etcd.io/bbolt).
## 6.10.2 (January 13th 2022)
### Implementation changes and bug fixes

2
go.mod
View File

@@ -12,6 +12,7 @@ require (
github.com/hashicorp/go-msgpack v1.1.5 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/raft v1.3.3
github.com/hashicorp/raft-boltdb/v2 v2.2.0
github.com/hashicorp/serf v0.9.7 // indirect
github.com/labstack/gommon v0.3.1 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
@@ -21,6 +22,7 @@ require (
github.com/rqlite/go-sqlite3 v1.22.0
github.com/rqlite/raft-boltdb v0.0.0-20211018013422-771de01086ce
github.com/rqlite/rqlite-disco-clients v0.0.0-20220119185651-ab01e15666dd
go.etcd.io/bbolt v1.3.6
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.7.0 // indirect
go.uber.org/zap v1.20.0 // indirect

7
go.sum
View File

@@ -25,6 +25,7 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/boltdb/bolt v1.3.1 h1:JQmyP4ZBrce+ZQu0dY660FMfatumYDLun9hBCUVIkF4=
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
@@ -145,6 +146,10 @@ github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOn
github.com/hashicorp/raft v1.1.0/go.mod h1:4Ak7FSPnuvmb0GV6vgIAJ4vYT4bek9bb6Q+7HVbyzqM=
github.com/hashicorp/raft v1.3.3 h1:Xr6DSHC5cIM8kzxu+IgoT/+MeNeUNeWin3ie6nlSrMg=
github.com/hashicorp/raft v1.3.3/go.mod h1:4Ak7FSPnuvmb0GV6vgIAJ4vYT4bek9bb6Q+7HVbyzqM=
github.com/hashicorp/raft-boltdb v0.0.0-20210409134258-03c10cc3d4ea h1:RxcPJuutPRM8PUOyiweMmkuNO+RJyfy2jds2gfvgNmU=
github.com/hashicorp/raft-boltdb v0.0.0-20210409134258-03c10cc3d4ea/go.mod h1:qRd6nFJYYS6Iqnc/8HcUmko2/2Gw8qTFEmxDLii6W5I=
github.com/hashicorp/raft-boltdb/v2 v2.2.0 h1:/CVN9LSAcH50L3yp2TsPFIpeyHn1m3VF6kiutlDE3Nw=
github.com/hashicorp/raft-boltdb/v2 v2.2.0/go.mod h1:SgPUD5TP20z/bswEr210SnkUFvQP/YjKV95aaiTbeMQ=
github.com/hashicorp/serf v0.9.6/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4=
github.com/hashicorp/serf v0.9.7 h1:hkdgbqizGQHuU5IPqYM1JdSMV8nKfpuOnZYXssk9muY=
github.com/hashicorp/serf v0.9.7/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4=
@@ -271,6 +276,7 @@ github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU=
go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4=
go.etcd.io/etcd/api/v3 v3.5.1 h1:v28cktvBq+7vGyJXF8G+rWJmj+1XUmMtqcLnH8hDocM=
@@ -359,6 +365,7 @@ golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=

View File

@@ -4,7 +4,8 @@ import (
"fmt"
"github.com/hashicorp/raft"
"github.com/rqlite/raft-boltdb"
"github.com/hashicorp/raft-boltdb/v2"
"go.etcd.io/bbolt"
)
// Log is an object that can return information about the Raft log.
@@ -12,8 +13,8 @@ type Log struct {
*raftboltdb.BoltStore
}
// NewLog returns an instantiated Log object.
func NewLog(path string) (*Log, error) {
// New returns an instantiated Log object.
func New(path string) (*Log, error) {
bs, err := raftboltdb.NewBoltStore(path)
if err != nil {
return nil, fmt.Errorf("new bolt store: %s", err)
@@ -60,7 +61,7 @@ func (l *Log) LastCommandIndex() (uint64, error) {
return 0, nil
}
// Stats returns stats about the BoltDB database.
func (l *Log) Stats() raftboltdb.Stats {
// Stats returns stats about the BBoltDB database.
func (l *Log) Stats() bbolt.Stats {
return l.BoltStore.Stats()
}

View File

@@ -13,7 +13,7 @@ func Test_LogNewEmpty(t *testing.T) {
path := mustTempFile()
defer os.Remove(path)
l, err := NewLog(path)
l, err := New(path)
if err != nil {
t.Fatalf("failed to create log: %s", err)
}
@@ -62,7 +62,7 @@ func Test_LogNewExistNotEmpty(t *testing.T) {
t.Fatalf("failed to close bolt db: %s", err)
}
l, err := NewLog(path)
l, err := New(path)
if err != nil {
t.Fatalf("failed to create new log: %s", err)
}
@@ -107,7 +107,7 @@ func Test_LogNewExistNotEmpty(t *testing.T) {
t.Fatalf("failed to close bolt db: %s", err)
}
l, err = NewLog(path)
l, err = New(path)
if err != nil {
t.Fatalf("failed to create new log: %s", err)
}
@@ -165,7 +165,7 @@ func Test_LogLastCommandIndexNotExist(t *testing.T) {
t.Fatalf("failed to close bolt db: %s", err)
}
l, err := NewLog(path)
l, err := New(path)
if err != nil {
t.Fatalf("failed to create new log: %s", err)
}
@@ -210,7 +210,7 @@ func Test_LogLastCommandIndexNotExist(t *testing.T) {
t.Fatalf("failed to close bolt db: %s", err)
}
l, err = NewLog(path)
l, err = New(path)
if err != nil {
t.Fatalf("failed to create new log: %s", err)
}

View File

@@ -304,7 +304,7 @@ func (s *Store) Open() (retErr error) {
s.snapsExistOnOpen = len(snaps) > 0
// Create the log store and stable store.
s.boltStore, err = rlog.NewLog(filepath.Join(s.raftDir, raftDBPath))
s.boltStore, err = rlog.New(filepath.Join(s.raftDir, raftDBPath))
if err != nil {
return fmt.Errorf("new log store: %s", err)
}