Skip to content

Commit

Permalink
Fix: data partition decommission timeout
Browse files Browse the repository at this point in the history
Fix ths issue that Master report timeout error when executing data
partition decommision operation.

Signed-off-by: Mofei Zhang <[email protected]>
  • Loading branch information
mervinkid committed Oct 10, 2020
1 parent d259d3f commit fffad00
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions datanode/partition_raftfsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ package datanode
import (
"encoding/json"
"fmt"
"github.com/chubaofs/chubaofs/storage"
"net"
"sync"
"sync/atomic"
"time"

"github.com/chubaofs/chubaofs/proto"
"github.com/chubaofs/chubaofs/storage"
"github.com/chubaofs/chubaofs/util/log"
"github.com/tiglabs/raft"
raftproto "github.com/tiglabs/raft/proto"
Expand Down Expand Up @@ -55,10 +56,21 @@ func (dp *DataPartition) ApplyMemberChange(confChange *raftproto.ConfChange, ind
}
isUpdated, err = dp.addRaftNode(req, index)
if isUpdated && err == nil {
dp.updateReplicas(true)
if dp.isLeader {
dp.ExtentStore().MoveAllToBrokenTinyExtentC(storage.TinyExtentCount)
}
// Perform the update replicas operation asynchronously after the execution of the member change applying
// related process.
updateWG := sync.WaitGroup{}
updateWG.Add(1)
defer updateWG.Done()
go func() {
updateWG.Wait()
if err = dp.updateReplicas(true); err != nil {
log.LogErrorf("ApplyMemberChange: update partition %v replicas failed: %v", dp.partitionID, err)
return
}
if dp.isLeader {
dp.ExtentStore().MoveAllToBrokenTinyExtentC(storage.TinyExtentCount)
}
}()
}
case raftproto.ConfRemoveNode:
req := &proto.RemoveDataPartitionRaftMemberRequest{}
Expand Down

0 comments on commit fffad00

Please sign in to comment.