fix bug when packet opCode=OpExtentRepairRead and network is unstable

Signed-off-by: mingwei <gongwilliam@163.com>
This commit is contained in:
xrefft 2021-04-01 19:49:01 +08:00 committed by mingwei
parent 0450464705
commit 764d1e496d

View File

@ -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
}
}