mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdserver: go back to marshal request in 2.1 way
It fixes the problem that 2.1 cannot roll upgrade to 2.2 smoothly because 2.1 cannot understand the bytes marshalled at 2.2.
This commit is contained in:
@@ -529,9 +529,7 @@ func (s *EtcdServer) Do(ctx context.Context, r pb.Request) (Response, error) {
|
||||
}
|
||||
switch r.Method {
|
||||
case "POST", "PUT", "DELETE", "QGET":
|
||||
var raftReq pb.InternalRaftRequest
|
||||
raftReq.V2 = &r
|
||||
data, err := raftReq.Marshal()
|
||||
data, err := r.Marshal()
|
||||
if err != nil {
|
||||
return Response{}, err
|
||||
}
|
||||
|
||||
@@ -989,11 +989,10 @@ func TestPublish(t *testing.T) {
|
||||
t.Fatalf("action = %s, want Propose", action[0].Name)
|
||||
}
|
||||
data := action[0].Params[0].([]byte)
|
||||
var rr pb.InternalRaftRequest
|
||||
if err := rr.Unmarshal(data); err != nil {
|
||||
var r pb.Request
|
||||
if err := r.Unmarshal(data); err != nil {
|
||||
t.Fatalf("unmarshal request error: %v", err)
|
||||
}
|
||||
r := rr.V2
|
||||
if r.Method != "PUT" {
|
||||
t.Errorf("method = %s, want PUT", r.Method)
|
||||
}
|
||||
@@ -1073,11 +1072,10 @@ func TestUpdateVersion(t *testing.T) {
|
||||
t.Fatalf("action = %s, want Propose", action[0].Name)
|
||||
}
|
||||
data := action[0].Params[0].([]byte)
|
||||
var rr pb.InternalRaftRequest
|
||||
if err := rr.Unmarshal(data); err != nil {
|
||||
var r pb.Request
|
||||
if err := r.Unmarshal(data); err != nil {
|
||||
t.Fatalf("unmarshal request error: %v", err)
|
||||
}
|
||||
r := rr.V2
|
||||
if r.Method != "PUT" {
|
||||
t.Errorf("method = %s, want PUT", r.Method)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user