Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downgrade poc #6

Open
wants to merge 72 commits into
base: master
Choose a base branch
from
Open

Downgrade poc #6

wants to merge 72 commits into from

Conversation

YoyinZyc
Copy link
Owner

@jingyih Please have a look.

Copy link

@jingyih jingyih left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a quick pass on API changes and proto changes:)

// DowngradeValidate requests validation of the downgrade request
DowngradeValidate(ctx context.Context, version string) (*DowngradeResponse, error)

// DowngradeEnable requests to downgrade the current cluster version to target version.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's elaborate the behavior of these user facing APIs. As an example: https://github.com/etcd-io/etcd/blob/d05459ed5b30f231246be5378ef05d45a79894ea/clientv3/watch.go#L72:2

@@ -59,6 +59,16 @@ type RaftCluster struct {
// removed contains the ids of removed members in the cluster.
// removed id cannot be reused.
removed map[types.ID]bool

downgrade *Downgrade
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

downgradeInfo?

@@ -118,6 +118,7 @@ enum ConfChangeType {
ConfChangeRemoveNode = 1;
ConfChangeUpdateNode = 2;
ConfChangeAddLearnerNode = 3;
ConfChangeDowngrade = 4;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think Downgrade is config change from Raft's perspective, because it is not changing Raft's cluster configuration. Can we add a new type in https://github.com/etcd-io/etcd/blob/master/etcdserver/etcdserverpb/raft_internal.proto

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am thinking something generic, so later if we have similar needs to add more cluster info, we can reuse the same type.

@@ -25,6 +25,8 @@ import (
type Cluster interface {
// ID returns the cluster ID
ID() types.ID
// LocalID returns the local server ID
LocalID() types.ID
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My impression is that this is also a v2 interface. If we need to add more APIs, we might want to create a new interface. See my later comments in etcdhttp/peer.go

)

// NewPeerHandler generates an http.Handler to handle etcd peer requests.
func NewPeerHandler(lg *zap.Logger, s etcdserver.ServerPeer) http.Handler {
return newPeerHandler(lg, s, s.RaftHandler(), s.LeaseHandler())
}

func newPeerHandler(lg *zap.Logger, s etcdserver.Server, raftHandler http.Handler, leaseHandler http.Handler) http.Handler {
func newPeerHandler(lg *zap.Logger, s etcdserver.ServerPeer, raftHandler http.Handler, leaseHandler http.Handler) http.Handler {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe create a new interface ServerDowngradable instead of modifying the existing Cluster interface?

jingyih and others added 29 commits December 11, 2019 11:45
CHANGELOG: Add etcd-io#11418 to changelog-3.4, changelog-3.5
…ng server and modify compatibility check when new member joins in an existing cluster; add http handler to get downgrade enabled status
…luster. It is used when adding a new member to an downgrading cluster. The new member should match the downgrade target version.
…interface ServerPeerHTTP to wrap up ServerPeer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.