Add hashvalue warning (#10668)

Signed-off-by: godchen <qingxiang.chen@zilliz.com>
pull/11310/head
godchen 2021-11-05 14:20:55 +08:00 committed by GitHub
parent 140c5c8bcd
commit 88c9067873
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 11 deletions

View File

@ -1382,7 +1382,9 @@ func (node *Proxy) Delete(ctx context.Context, request *milvuspb.DeleteRequest)
Condition: NewTaskCondition(ctx),
req: deleteReq,
BaseDeleteTask: BaseDeleteTask{
BaseMsg: msgstream.BaseMsg{},
BaseMsg: msgstream.BaseMsg{
HashValues: request.HashKeys,
},
DeleteRequest: internalpb.DeleteRequest{
Base: &commonpb.MsgBase{
MsgType: commonpb.MsgType_Delete,

View File

@ -683,17 +683,9 @@ func (it *insertTask) checkFieldAutoIDAndHashPK() error {
},
}
it.HashValues = make([]uint32, 0, len(it.BaseInsertTask.RowIDs))
for _, rowID := range it.BaseInsertTask.RowIDs {
hash, _ := typeutil.Hash32Int64(rowID)
it.HashValues = append(it.HashValues, hash)
}
it.HashPK(it.BaseInsertTask.RowIDs)
} else {
it.HashValues = make([]uint32, 0, len(primaryData))
for _, pk := range primaryData {
hash, _ := typeutil.Hash32Int64(pk)
it.HashValues = append(it.HashValues, hash)
}
it.HashPK(it.BaseInsertTask.RowIDs)
}
sliceIndex := make([]uint32, rowNums)
@ -705,6 +697,17 @@ func (it *insertTask) checkFieldAutoIDAndHashPK() error {
return nil
}
func (it *insertTask) HashPK(pks []int64) {
if len(it.HashValues) != 0 {
log.Warn("the hashvalues passed through client is not supported now, and will be overwritten")
}
it.HashValues = make([]uint32, 0, len(pks))
for _, pk := range pks {
hash, _ := typeutil.Hash32Int64(pk)
it.HashValues = append(it.HashValues, hash)
}
}
func (it *insertTask) PreExecute(ctx context.Context) error {
sp, ctx := trace.StartSpanFromContextWithOperationName(it.ctx, "Proxy-Insert-PreExecute")
defer sp.Finish()
@ -4694,6 +4697,9 @@ func (dt *deleteTask) PostExecute(ctx context.Context) error {
}
func (dt *deleteTask) HashPK(pks []int64) {
if len(dt.HashValues) != 0 {
log.Warn("the hashvalues passed through client is not supported now, and will be overwritten")
}
dt.HashValues = make([]uint32, 0, len(pks))
for _, pk := range pks {
hash, _ := typeutil.Hash32Int64(pk)