mirror of https://github.com/status-im/consul.git
config: add NoFreelistSync option
# Conflicts: # agent/config/testdata/TestRuntimeConfig_Sanitize-enterprise.golden # agent/consul/server.go
This commit is contained in:
parent
42a5635bc3
commit
e47cecc653
|
@ -1263,6 +1263,7 @@ func newConsulConfig(runtimeCfg *config.RuntimeConfig, logger hclog.Logger) (*co
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg.ConfigEntryBootstrap = runtimeCfg.ConfigEntryBootstrap
|
cfg.ConfigEntryBootstrap = runtimeCfg.ConfigEntryBootstrap
|
||||||
|
cfg.RaftBoltDBConfig = runtimeCfg.RaftBoltDBConfig
|
||||||
|
|
||||||
// Duplicate our own serf config once to make sure that the duplication
|
// Duplicate our own serf config once to make sure that the duplication
|
||||||
// function does not drift.
|
// function does not drift.
|
||||||
|
|
|
@ -1094,6 +1094,10 @@ func (b *builder) build() (rt RuntimeConfig, err error) {
|
||||||
|
|
||||||
rt.UseStreamingBackend = boolValWithDefault(c.UseStreamingBackend, true)
|
rt.UseStreamingBackend = boolValWithDefault(c.UseStreamingBackend, true)
|
||||||
|
|
||||||
|
if c.RaftBoltDBConfig != nil {
|
||||||
|
rt.RaftBoltDBConfig = *c.RaftBoltDBConfig
|
||||||
|
}
|
||||||
|
|
||||||
if rt.Cache.EntryFetchMaxBurst <= 0 {
|
if rt.Cache.EntryFetchMaxBurst <= 0 {
|
||||||
return RuntimeConfig{}, fmt.Errorf("cache.entry_fetch_max_burst must be strictly positive, was: %v", rt.Cache.EntryFetchMaxBurst)
|
return RuntimeConfig{}, fmt.Errorf("cache.entry_fetch_max_burst must be strictly positive, was: %v", rt.Cache.EntryFetchMaxBurst)
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,8 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/hashicorp/consul/agent/consul"
|
||||||
|
|
||||||
"github.com/hashicorp/hcl"
|
"github.com/hashicorp/hcl"
|
||||||
"github.com/mitchellh/mapstructure"
|
"github.com/mitchellh/mapstructure"
|
||||||
|
|
||||||
|
@ -256,6 +258,8 @@ type Config struct {
|
||||||
|
|
||||||
RPC RPC `mapstructure:"rpc"`
|
RPC RPC `mapstructure:"rpc"`
|
||||||
|
|
||||||
|
RaftBoltDBConfig *consul.RaftBoltDBConfig `mapstructure:"raft_boltdb"`
|
||||||
|
|
||||||
// UseStreamingBackend instead of blocking queries for service health and
|
// UseStreamingBackend instead of blocking queries for service health and
|
||||||
// any other endpoints which support streaming.
|
// any other endpoints which support streaming.
|
||||||
UseStreamingBackend *bool `mapstructure:"use_streaming_backend"`
|
UseStreamingBackend *bool `mapstructure:"use_streaming_backend"`
|
||||||
|
|
|
@ -943,6 +943,8 @@ type RuntimeConfig struct {
|
||||||
// hcl: raft_trailing_logs = int
|
// hcl: raft_trailing_logs = int
|
||||||
RaftTrailingLogs int
|
RaftTrailingLogs int
|
||||||
|
|
||||||
|
RaftBoltDBConfig consul.RaftBoltDBConfig
|
||||||
|
|
||||||
// ReconnectTimeoutLAN specifies the amount of time to wait to reconnect with
|
// ReconnectTimeoutLAN specifies the amount of time to wait to reconnect with
|
||||||
// another agent before deciding it's permanently gone. This can be used to
|
// another agent before deciding it's permanently gone. This can be used to
|
||||||
// control the time it takes to reap failed nodes from the cluster.
|
// control the time it takes to reap failed nodes from the cluster.
|
||||||
|
|
|
@ -6015,6 +6015,7 @@ func TestLoad_FullConfig(t *testing.T) {
|
||||||
"args": []interface{}{"dltjDJ2a", "flEa7C2d"},
|
"args": []interface{}{"dltjDJ2a", "flEa7C2d"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
RaftBoltDBConfig: consul.RaftBoltDBConfig{NoFreelistSync: true},
|
||||||
}
|
}
|
||||||
entFullRuntimeConfig(expected)
|
entFullRuntimeConfig(expected)
|
||||||
|
|
||||||
|
|
|
@ -252,6 +252,9 @@
|
||||||
"RPCMaxConnsPerClient": 0,
|
"RPCMaxConnsPerClient": 0,
|
||||||
"RPCProtocol": 0,
|
"RPCProtocol": 0,
|
||||||
"RPCRateLimit": 0,
|
"RPCRateLimit": 0,
|
||||||
|
"RaftBoltDBConfig": {
|
||||||
|
"NoFreelistSync": false
|
||||||
|
},
|
||||||
"RaftProtocol": 3,
|
"RaftProtocol": 3,
|
||||||
"RaftSnapshotInterval": "0s",
|
"RaftSnapshotInterval": "0s",
|
||||||
"RaftSnapshotThreshold": 0,
|
"RaftSnapshotThreshold": 0,
|
||||||
|
|
|
@ -328,6 +328,9 @@ raft_protocol = 3
|
||||||
raft_snapshot_threshold = 16384
|
raft_snapshot_threshold = 16384
|
||||||
raft_snapshot_interval = "30s"
|
raft_snapshot_interval = "30s"
|
||||||
raft_trailing_logs = 83749
|
raft_trailing_logs = 83749
|
||||||
|
raft_boltdb {
|
||||||
|
NoFreelistSync = true
|
||||||
|
}
|
||||||
read_replica = true
|
read_replica = true
|
||||||
reconnect_timeout = "23739s"
|
reconnect_timeout = "23739s"
|
||||||
reconnect_timeout_wan = "26694s"
|
reconnect_timeout_wan = "26694s"
|
||||||
|
|
|
@ -326,6 +326,9 @@
|
||||||
"raft_snapshot_threshold": 16384,
|
"raft_snapshot_threshold": 16384,
|
||||||
"raft_snapshot_interval": "30s",
|
"raft_snapshot_interval": "30s",
|
||||||
"raft_trailing_logs": 83749,
|
"raft_trailing_logs": 83749,
|
||||||
|
"raft_boltdb": {
|
||||||
|
"NoFreelistSync": true
|
||||||
|
},
|
||||||
"read_replica": true,
|
"read_replica": true,
|
||||||
"reconnect_timeout": "23739s",
|
"reconnect_timeout": "23739s",
|
||||||
"reconnect_timeout_wan": "26694s",
|
"reconnect_timeout_wan": "26694s",
|
||||||
|
|
|
@ -391,6 +391,8 @@ type Config struct {
|
||||||
|
|
||||||
RPCConfig RPCConfig
|
RPCConfig RPCConfig
|
||||||
|
|
||||||
|
RaftBoltDBConfig RaftBoltDBConfig
|
||||||
|
|
||||||
// Embedded Consul Enterprise specific configuration
|
// Embedded Consul Enterprise specific configuration
|
||||||
*EnterpriseConfig
|
*EnterpriseConfig
|
||||||
}
|
}
|
||||||
|
@ -603,3 +605,7 @@ type ReloadableConfig struct {
|
||||||
RaftSnapshotInterval time.Duration
|
RaftSnapshotInterval time.Duration
|
||||||
RaftTrailingLogs int
|
RaftTrailingLogs int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type RaftBoltDBConfig struct {
|
||||||
|
NoFreelistSync bool
|
||||||
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/hashicorp/go-version"
|
"github.com/hashicorp/go-version"
|
||||||
|
"go.etcd.io/bbolt"
|
||||||
|
|
||||||
"github.com/armon/go-metrics"
|
"github.com/armon/go-metrics"
|
||||||
connlimit "github.com/hashicorp/go-connlimit"
|
connlimit "github.com/hashicorp/go-connlimit"
|
||||||
|
@ -729,7 +730,12 @@ func (s *Server) setupRaft() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the backend raft store for logs and stable storage.
|
// Create the backend raft store for logs and stable storage.
|
||||||
store, err := raftboltdb.NewBoltStore(filepath.Join(path, "raft.db"))
|
store, err := raftboltdb.New(raftboltdb.Options{
|
||||||
|
BoltOptions: &bbolt.Options{
|
||||||
|
NoFreelistSync: s.config.RaftBoltDBConfig.NoFreelistSync,
|
||||||
|
},
|
||||||
|
Path: filepath.Join(path, "raft.db"),
|
||||||
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue