Increase timeout interval of task in Proxy

Signed-off-by: dragondriver <jiquan.long@zilliz.com>
pull/4973/head^2
dragondriver 2020-11-18 15:44:17 +08:00 committed by yefu.chen
parent 9cbec8c41c
commit a18ac17a98
4 changed files with 22 additions and 19 deletions

View File

@ -54,7 +54,7 @@ func (ttBarrier *softTimeTickBarrier) GetTimeTick() (Timestamp, error) {
}
func (ttBarrier *softTimeTickBarrier) Start() error {
ttBarrier.closeCh = make(chan struct{})
ttBarrier.closeCh = make(chan struct{}, 1)
go func() {
for {
select {
@ -165,7 +165,7 @@ func (ttBarrier *hardTimeTickBarrier) GetTimeTick() (Timestamp, error) {
}
func (ttBarrier *hardTimeTickBarrier) Start() error {
ttBarrier.closeCh = make(chan struct{})
ttBarrier.closeCh = make(chan struct{}, 1)
go func() {
// Last timestamp synchronized

View File

@ -16,7 +16,7 @@ import (
)
const (
reqTimeoutInterval = time.Second * 2
reqTimeoutInterval = time.Second * 10
)
func (p *Proxy) Insert(ctx context.Context, in *servicepb.RowBatch) (*servicepb.IntegerRangeResponse, error) {
@ -103,7 +103,7 @@ func (p *Proxy) CreateCollection(ctx context.Context, req *schemapb.CollectionSc
return &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UNEXPECTED_ERROR,
Reason: err.Error(),
}, err
}, nil
}
err = cct.WaitToFinish()
@ -111,7 +111,7 @@ func (p *Proxy) CreateCollection(ctx context.Context, req *schemapb.CollectionSc
return &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UNEXPECTED_ERROR,
Reason: err.Error(),
}, err
}, nil
}
return cct.result, nil
@ -196,7 +196,7 @@ func (p *Proxy) DropCollection(ctx context.Context, req *servicepb.CollectionNam
return &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UNEXPECTED_ERROR,
Reason: err.Error(),
}, err
}, nil
}
err = dct.WaitToFinish()
@ -204,7 +204,7 @@ func (p *Proxy) DropCollection(ctx context.Context, req *servicepb.CollectionNam
return &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UNEXPECTED_ERROR,
Reason: err.Error(),
}, err
}, nil
}
return dct.result, nil
@ -239,7 +239,7 @@ func (p *Proxy) HasCollection(ctx context.Context, req *servicepb.CollectionName
ErrorCode: commonpb.ErrorCode_UNEXPECTED_ERROR,
Reason: err.Error(),
},
}, err
}, nil
}
err = hct.WaitToFinish()
@ -249,7 +249,7 @@ func (p *Proxy) HasCollection(ctx context.Context, req *servicepb.CollectionName
ErrorCode: commonpb.ErrorCode_UNEXPECTED_ERROR,
Reason: err.Error(),
},
}, err
}, nil
}
return hct.result, nil
@ -284,7 +284,7 @@ func (p *Proxy) DescribeCollection(ctx context.Context, req *servicepb.Collectio
ErrorCode: commonpb.ErrorCode_UNEXPECTED_ERROR,
Reason: err.Error(),
},
}, err
}, nil
}
err = dct.WaitToFinish()
@ -294,7 +294,7 @@ func (p *Proxy) DescribeCollection(ctx context.Context, req *servicepb.Collectio
ErrorCode: commonpb.ErrorCode_UNEXPECTED_ERROR,
Reason: err.Error(),
},
}, err
}, nil
}
return dct.result, nil
@ -328,7 +328,7 @@ func (p *Proxy) ShowCollections(ctx context.Context, req *commonpb.Empty) (*serv
ErrorCode: commonpb.ErrorCode_UNEXPECTED_ERROR,
Reason: err.Error(),
},
}, err
}, nil
}
err = sct.WaitToFinish()
@ -338,7 +338,7 @@ func (p *Proxy) ShowCollections(ctx context.Context, req *commonpb.Empty) (*serv
ErrorCode: commonpb.ErrorCode_UNEXPECTED_ERROR,
Reason: err.Error(),
},
}, err
}, nil
}
return sct.result, nil

View File

@ -157,7 +157,7 @@ func (p *Proxy) connectMaster() error {
panic(err)
}
log.Printf("Proxy connected to master, master_addr=%s", masterAddr)
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
conn, err := grpc.DialContext(ctx, masterAddr, grpc.WithInsecure(), grpc.WithBlock())
if err != nil {
@ -198,10 +198,12 @@ func (p *Proxy) queryResultLoop() {
// TODO: use the number of query node instead
t := p.taskSch.getTaskByReqID(reqID)
if t != nil {
qt := t.(*QueryTask)
log.Printf("address of query task: %p", qt)
qt.resultBuf <- queryResultBuf[reqID]
delete(queryResultBuf, reqID)
qt, ok := t.(*QueryTask)
if ok {
log.Printf("address of query task: %p", qt)
qt.resultBuf <- queryResultBuf[reqID]
delete(queryResultBuf, reqID)
}
} else {
log.Printf("task with reqID %v is nil", reqID)
}

View File

@ -13,4 +13,5 @@ SCRIPTS_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
# ignore Minio,S3 unittes
MILVUS_DIR="${SCRIPTS_DIR}/../internal/"
echo $MILVUS_DIR
go test -cover "${MILVUS_DIR}/kv/..." "${MILVUS_DIR}/msgstream/..." "${MILVUS_DIR}/master/..." "${MILVUS_DIR}/reader/..." "${MILVUS_DIR}/proxy/..." -failfast
#go test -cover "${MILVUS_DIR}/kv/..." "${MILVUS_DIR}/msgstream/..." "${MILVUS_DIR}/master/..." "${MILVUS_DIR}/reader/..." "${MILVUS_DIR}/proxy/..." -failfast
go test -cover "${MILVUS_DIR}/kv/..." "${MILVUS_DIR}/msgstream/..." "${MILVUS_DIR}/master/..." "${MILVUS_DIR}/reader/..." -failfast