enhance: clear exclude if no dp is selected

Signed-off-by: Shuoran Liu <shuoranliu@gmail.com>
This commit is contained in:
Shuoran Liu 2021-12-29 23:08:52 +08:00
parent 03e4ec61a4
commit 9b41a7cefd
3 changed files with 4 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package datanode
import (
"context"
"fmt"
"golang.org/x/time/rate"
)

View File

@ -506,7 +506,8 @@ func (eh *ExtentHandler) allocateExtent() (err error) {
for i := 0; i < MaxSelectDataPartitionForWrite; i++ {
if eh.key == nil {
if dp, err = eh.stream.client.dataWrapper.GetDataPartitionForWrite(exclude); err != nil {
log.LogWarnf("allocateExtent: failed to get write data partition, eh(%v) exclude(%v)", eh, exclude)
log.LogWarnf("allocateExtent: failed to get write data partition, eh(%v) exclude(%v), clear exclude and try again!", eh, exclude)
exclude = make(map[string]struct{})
continue
}

View File

@ -133,7 +133,7 @@ func (dp *DataPartition) CheckAllHostsIsAvail(exclude map[string]struct{}) {
for i := 0; i < len(dp.Hosts); i++ {
host := dp.Hosts[i]
if conn, err = util.DailTimeOut(host, proto.ReadDeadlineTime*time.Second); err != nil {
log.LogWarnf("Dail to Host (%v) err(%v)", host, err.Error())
log.LogWarnf("CheckAllHostsIsAvail: dial host (%v) err(%v)", host, err)
if strings.Contains(err.Error(), syscall.ECONNREFUSED.Error()) {
exclude[host] = struct{}{}
}