Skip to content

Commit

Permalink
Merge pull request #17930 from jamesreprise/bootstraped
Browse files Browse the repository at this point in the history
Fix typo bootstrapedCluster
  • Loading branch information
ahrtr authored May 3, 2024
2 parents 7c19823 + ccb4ef7 commit 36414cb
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions server/etcdserver/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func bootstrap(cfg config.ServerConfig) (b *bootstrappedServer, err error) {

type bootstrappedServer struct {
storage *bootstrappedStorage
cluster *bootstrapedCluster
cluster *bootstrappedCluster
raft *bootstrappedRaft
prt http.RoundTripper
ss *snap.Snapshotter
Expand Down Expand Up @@ -150,7 +150,7 @@ func (s *bootstrappedBackend) Close() {
s.be.Close()
}

type bootstrapedCluster struct {
type bootstrappedCluster struct {
remotes []*membership.Member
cl *membership.RaftCluster
nodeID types.ID
Expand All @@ -165,7 +165,7 @@ type bootstrappedRaft struct {
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 {
wal = bootstrapNewWAL(cfg, cl)
}
Expand Down Expand Up @@ -269,7 +269,7 @@ func maybeDefragBackend(cfg config.ServerConfig, be backend.Backend) error {
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 {
case bwal == nil && !cfg.NewCluster:
c, err = bootstrapExistingClusterNoWAL(cfg, prt)
Expand All @@ -286,7 +286,7 @@ func bootstrapCluster(cfg config.ServerConfig, bwal *bootstrappedWAL, prt http.R
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 {
return nil, err
}
Expand All @@ -311,14 +311,14 @@ func bootstrapExistingClusterNoWAL(cfg config.ServerConfig, prt http.RoundTrippe
remotes := existingCluster.Members()
cl.SetID(types.ID(0), existingCluster.ID())
member := cl.MemberByName(cfg.Name)
return &bootstrapedCluster{
return &bootstrappedCluster{
remotes: remotes,
cl: cl,
nodeID: member.ID,
}, 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 {
return nil, err
}
Expand Down Expand Up @@ -354,14 +354,14 @@ func bootstrapNewClusterNoWAL(cfg config.ServerConfig, prt http.RoundTripper) (*
return nil, err
}
}
return &bootstrapedCluster{
return &bootstrappedCluster{
remotes: nil,
cl: cl,
nodeID: m.ID,
}, 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 {
return nil, fmt.Errorf("cannot write to member directory: %v", err)
}
Expand All @@ -380,7 +380,7 @@ func bootstrapClusterWithWAL(cfg config.ServerConfig, meta *snapshotMetadata) (*
}

cl.SetID(meta.nodeID, meta.clusterID)
return &bootstrapedCluster{
return &bootstrappedCluster{
cl: cl,
nodeID: meta.nodeID,
}, nil
Expand Down Expand Up @@ -442,7 +442,7 @@ func recoverSnapshot(cfg config.ServerConfig, st v2store.Store, be backend.Backe
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 {
c.cl.SetID(c.nodeID, c.cl.ID())
}
Expand All @@ -460,12 +460,12 @@ func (c *bootstrapedCluster) Finalize(cfg config.ServerConfig, s *bootstrappedSt
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})
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 {
case !bwal.haveWAL && !cfg.NewCluster:
return bootstrapRaftFromCluster(cfg, cluster.cl, nil, bwal)
Expand Down Expand Up @@ -631,7 +631,7 @@ type snapshotMetadata struct {
nodeID, clusterID types.ID
}

func bootstrapNewWAL(cfg config.ServerConfig, cl *bootstrapedCluster) *bootstrappedWAL {
func bootstrapNewWAL(cfg config.ServerConfig, cl *bootstrappedCluster) *bootstrappedWAL {
metadata := pbutil.MustMarshal(
&etcdserverpb.Metadata{
NodeID: uint64(cl.nodeID),
Expand Down

0 comments on commit 36414cb

Please sign in to comment.