(task *proto.AdminTask)
| 729 | } |
| 730 | |
| 731 | func (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. |
| 763 | func (s *DataNode) handleMarkDeletePacket(p *repl.Packet, c net.Conn) { |
no test coverage detected