mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
typo: bootstrapedCluster -> bootstrappedCluster
Signed-off-by: James Williams <james.williams@griffin.com>
This commit is contained in:
parent
3d4d4a0053
commit
ccb4ef76e3
@ -118,7 +118,7 @@ func bootstrap(cfg config.ServerConfig) (b *bootstrappedServer, err error) {
|
|||||||
|
|
||||||
type bootstrappedServer struct {
|
type bootstrappedServer struct {
|
||||||
storage *bootstrappedStorage
|
storage *bootstrappedStorage
|
||||||
cluster *bootstrapedCluster
|
cluster *bootstrappedCluster
|
||||||
raft *bootstrappedRaft
|
raft *bootstrappedRaft
|
||||||
prt http.RoundTripper
|
prt http.RoundTripper
|
||||||
ss *snap.Snapshotter
|
ss *snap.Snapshotter
|
||||||
@ -150,7 +150,7 @@ func (s *bootstrappedBackend) Close() {
|
|||||||
s.be.Close()
|
s.be.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
type bootstrapedCluster struct {
|
type bootstrappedCluster struct {
|
||||||
remotes []*membership.Member
|
remotes []*membership.Member
|
||||||
cl *membership.RaftCluster
|
cl *membership.RaftCluster
|
||||||
nodeID types.ID
|
nodeID types.ID
|
||||||
@ -165,7 +165,7 @@ type bootstrappedRaft struct {
|
|||||||
storage *raft.MemoryStorage
|
storage *raft.MemoryStorage
|
||||||
}
|
}
|
||||||
|
|
||||||
func bootstrapStorage(cfg config.ServerConfig, st v2store.Store, be *bootstrappedBackend, wal *bootstrappedWAL, cl *bootstrapedCluster) *bootstrappedStorage {
|
func bootstrapStorage(cfg config.ServerConfig, st v2store.Store, be *bootstrappedBackend, wal *bootstrappedWAL, cl *bootstrappedCluster) *bootstrappedStorage {
|
||||||
if wal == nil {
|
if wal == nil {
|
||||||
wal = bootstrapNewWAL(cfg, cl)
|
wal = bootstrapNewWAL(cfg, cl)
|
||||||
}
|
}
|
||||||
@ -269,7 +269,7 @@ func maybeDefragBackend(cfg config.ServerConfig, be backend.Backend) error {
|
|||||||
return be.Defrag()
|
return be.Defrag()
|
||||||
}
|
}
|
||||||
|
|
||||||
func bootstrapCluster(cfg config.ServerConfig, bwal *bootstrappedWAL, prt http.RoundTripper) (c *bootstrapedCluster, err error) {
|
func bootstrapCluster(cfg config.ServerConfig, bwal *bootstrappedWAL, prt http.RoundTripper) (c *bootstrappedCluster, err error) {
|
||||||
switch {
|
switch {
|
||||||
case bwal == nil && !cfg.NewCluster:
|
case bwal == nil && !cfg.NewCluster:
|
||||||
c, err = bootstrapExistingClusterNoWAL(cfg, prt)
|
c, err = bootstrapExistingClusterNoWAL(cfg, prt)
|
||||||
@ -286,7 +286,7 @@ func bootstrapCluster(cfg config.ServerConfig, bwal *bootstrappedWAL, prt http.R
|
|||||||
return c, nil
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func bootstrapExistingClusterNoWAL(cfg config.ServerConfig, prt http.RoundTripper) (*bootstrapedCluster, error) {
|
func bootstrapExistingClusterNoWAL(cfg config.ServerConfig, prt http.RoundTripper) (*bootstrappedCluster, error) {
|
||||||
if err := cfg.VerifyJoinExisting(); err != nil {
|
if err := cfg.VerifyJoinExisting(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -311,14 +311,14 @@ func bootstrapExistingClusterNoWAL(cfg config.ServerConfig, prt http.RoundTrippe
|
|||||||
remotes := existingCluster.Members()
|
remotes := existingCluster.Members()
|
||||||
cl.SetID(types.ID(0), existingCluster.ID())
|
cl.SetID(types.ID(0), existingCluster.ID())
|
||||||
member := cl.MemberByName(cfg.Name)
|
member := cl.MemberByName(cfg.Name)
|
||||||
return &bootstrapedCluster{
|
return &bootstrappedCluster{
|
||||||
remotes: remotes,
|
remotes: remotes,
|
||||||
cl: cl,
|
cl: cl,
|
||||||
nodeID: member.ID,
|
nodeID: member.ID,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func bootstrapNewClusterNoWAL(cfg config.ServerConfig, prt http.RoundTripper) (*bootstrapedCluster, error) {
|
func bootstrapNewClusterNoWAL(cfg config.ServerConfig, prt http.RoundTripper) (*bootstrappedCluster, error) {
|
||||||
if err := cfg.VerifyBootstrap(); err != nil {
|
if err := cfg.VerifyBootstrap(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -354,14 +354,14 @@ func bootstrapNewClusterNoWAL(cfg config.ServerConfig, prt http.RoundTripper) (*
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return &bootstrapedCluster{
|
return &bootstrappedCluster{
|
||||||
remotes: nil,
|
remotes: nil,
|
||||||
cl: cl,
|
cl: cl,
|
||||||
nodeID: m.ID,
|
nodeID: m.ID,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func bootstrapClusterWithWAL(cfg config.ServerConfig, meta *snapshotMetadata) (*bootstrapedCluster, error) {
|
func bootstrapClusterWithWAL(cfg config.ServerConfig, meta *snapshotMetadata) (*bootstrappedCluster, error) {
|
||||||
if err := fileutil.IsDirWriteable(cfg.MemberDir()); err != nil {
|
if err := fileutil.IsDirWriteable(cfg.MemberDir()); err != nil {
|
||||||
return nil, fmt.Errorf("cannot write to member directory: %v", err)
|
return nil, fmt.Errorf("cannot write to member directory: %v", err)
|
||||||
}
|
}
|
||||||
@ -380,7 +380,7 @@ func bootstrapClusterWithWAL(cfg config.ServerConfig, meta *snapshotMetadata) (*
|
|||||||
}
|
}
|
||||||
|
|
||||||
cl.SetID(meta.nodeID, meta.clusterID)
|
cl.SetID(meta.nodeID, meta.clusterID)
|
||||||
return &bootstrapedCluster{
|
return &bootstrappedCluster{
|
||||||
cl: cl,
|
cl: cl,
|
||||||
nodeID: meta.nodeID,
|
nodeID: meta.nodeID,
|
||||||
}, nil
|
}, nil
|
||||||
@ -442,7 +442,7 @@ func recoverSnapshot(cfg config.ServerConfig, st v2store.Store, be backend.Backe
|
|||||||
return snapshot, be, nil
|
return snapshot, be, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *bootstrapedCluster) Finalize(cfg config.ServerConfig, s *bootstrappedStorage) error {
|
func (c *bootstrappedCluster) Finalize(cfg config.ServerConfig, s *bootstrappedStorage) error {
|
||||||
if !s.wal.haveWAL {
|
if !s.wal.haveWAL {
|
||||||
c.cl.SetID(c.nodeID, c.cl.ID())
|
c.cl.SetID(c.nodeID, c.cl.ID())
|
||||||
}
|
}
|
||||||
@ -460,12 +460,12 @@ func (c *bootstrapedCluster) Finalize(cfg config.ServerConfig, s *bootstrappedSt
|
|||||||
return membership.ValidateMaxLearnerConfig(cfg.ExperimentalMaxLearners, c.cl.Members(), scaleUpLearners)
|
return membership.ValidateMaxLearnerConfig(cfg.ExperimentalMaxLearners, c.cl.Members(), scaleUpLearners)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *bootstrapedCluster) databaseFileMissing(s *bootstrappedStorage) bool {
|
func (c *bootstrappedCluster) databaseFileMissing(s *bootstrappedStorage) bool {
|
||||||
v3Cluster := c.cl.Version() != nil && !c.cl.Version().LessThan(semver.Version{Major: 3})
|
v3Cluster := c.cl.Version() != nil && !c.cl.Version().LessThan(semver.Version{Major: 3})
|
||||||
return v3Cluster && !s.backend.beExist
|
return v3Cluster && !s.backend.beExist
|
||||||
}
|
}
|
||||||
|
|
||||||
func bootstrapRaft(cfg config.ServerConfig, cluster *bootstrapedCluster, bwal *bootstrappedWAL) *bootstrappedRaft {
|
func bootstrapRaft(cfg config.ServerConfig, cluster *bootstrappedCluster, bwal *bootstrappedWAL) *bootstrappedRaft {
|
||||||
switch {
|
switch {
|
||||||
case !bwal.haveWAL && !cfg.NewCluster:
|
case !bwal.haveWAL && !cfg.NewCluster:
|
||||||
return bootstrapRaftFromCluster(cfg, cluster.cl, nil, bwal)
|
return bootstrapRaftFromCluster(cfg, cluster.cl, nil, bwal)
|
||||||
@ -631,7 +631,7 @@ type snapshotMetadata struct {
|
|||||||
nodeID, clusterID types.ID
|
nodeID, clusterID types.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
func bootstrapNewWAL(cfg config.ServerConfig, cl *bootstrapedCluster) *bootstrappedWAL {
|
func bootstrapNewWAL(cfg config.ServerConfig, cl *bootstrappedCluster) *bootstrappedWAL {
|
||||||
metadata := pbutil.MustMarshal(
|
metadata := pbutil.MustMarshal(
|
||||||
&etcdserverpb.Metadata{
|
&etcdserverpb.Metadata{
|
||||||
NodeID: uint64(cl.nodeID),
|
NodeID: uint64(cl.nodeID),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user