MCPcopy
hub / github.com/cubefs/cubefs / asyncLoadDataPartition

Method asyncLoadDataPartition

datanode/wrap_operator.go:731–760  ·  view source on GitHub ↗
(task *proto.AdminTask)

Source from the content-addressed store, hash-verified

729}
730
731func (s *DataNode) asyncLoadDataPartition(task *proto.AdminTask) {
732 var err error
733 request := &proto.LoadDataPartitionRequest{}
734 response := &proto.LoadDataPartitionResponse{}
735 if task.OpCode == proto.OpLoadDataPartition {
736 bytes, _ := json.Marshal(task.Request)
737 json.Unmarshal(bytes, request)
738 dp := s.space.Partition(request.PartitionId)
739 if dp == nil {
740 response.Status = proto.TaskFailed
741 response.PartitionId = uint64(request.PartitionId)
742 err = fmt.Errorf(fmt.Sprintf("DataPartition(%v) not found", request.PartitionId))
743 response.Result = err.Error()
744 } else {
745 response = dp.Load()
746 response.PartitionId = uint64(request.PartitionId)
747 response.Status = proto.TaskSucceeds
748 }
749 } else {
750 response.PartitionId = uint64(request.PartitionId)
751 response.Status = proto.TaskFailed
752 err = fmt.Errorf("illegal opcode")
753 response.Result = err.Error()
754 }
755 task.Response = response
756 if err = MasterClient.NodeAPI().ResponseDataNodeTask(task); err != nil {
757 err = errors.Trace(err, "load DataPartition failed,PartitionID(%v)", request.PartitionId)
758 log.LogError(errors.Stack(err))
759 }
760}
761
762// Handle OpMarkDelete packet.
763func (s *DataNode) handleMarkDeletePacket(p *repl.Packet, c net.Conn) {

Callers 1

Calls 11

TraceFunction · 0.92
LogErrorFunction · 0.92
StackFunction · 0.92
PartitionMethod · 0.80
ResponseDataNodeTaskMethod · 0.80
NodeAPIMethod · 0.80
MarshalMethod · 0.65
UnmarshalMethod · 0.65
ErrorfMethod · 0.65
ErrorMethod · 0.65
LoadMethod · 0.65

Tested by

no test coverage detected