diff --git a/datanode/data_partition_repair.go b/datanode/data_partition_repair.go index 80857e0a2..c41ec2124 100644 --- a/datanode/data_partition_repair.go +++ b/datanode/data_partition_repair.go @@ -534,7 +534,7 @@ func (dp *DataPartition) streamRepairExtent(remoteExtentInfo *storage.ExtentInfo if reply.ResultCode != proto.OpOk { err = errors.Trace(fmt.Errorf("unknow result code"), - "streamRepairExtent receive opcode error(%v) ,localExtentSize(%v) remoteExtentSize(%v)", string(reply.Data[:reply.Size]), currFixOffset, remoteExtentInfo.Size) + "streamRepairExtent receive opcode error(%v) ,localExtentSize(%v) remoteExtentSize(%v)", string(reply.Data[:intMin(len(reply.Data), int(reply.Size))]), currFixOffset, remoteExtentInfo.Size) return } @@ -602,3 +602,11 @@ func (dp *DataPartition) streamRepairExtent(remoteExtentInfo *storage.ExtentInfo return } + +func intMin(a, b int) int { + if a < b { + return a + } else { + return b + } +}