mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-06 17:18:35 +08:00
enhance: [GoSDK] Return SchemaMismatch error to retry (#42950)
Related to #39718 After adding field, composing write request may failure and shall trigger retry with new schema. This PR make composing error returns SchemaMismatch error to trigger retry policy --------- Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
parent
be05b653c1
commit
1139ebb964
@ -41,7 +41,8 @@ func (c *Client) Insert(ctx context.Context, option InsertOption, callOptions ..
|
|||||||
}
|
}
|
||||||
req, err := option.InsertRequest(collection)
|
req, err := option.InsertRequest(collection)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return collection.UpdateTimestamp, err
|
// return schema mismatch err to retry with newer schema
|
||||||
|
return collection.UpdateTimestamp, merr.WrapErrCollectionSchemaMisMatch(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return collection.UpdateTimestamp, c.callService(func(milvusService milvuspb.MilvusServiceClient) error {
|
return collection.UpdateTimestamp, c.callService(func(milvusService milvuspb.MilvusServiceClient) error {
|
||||||
@ -99,7 +100,8 @@ func (c *Client) Upsert(ctx context.Context, option UpsertOption, callOptions ..
|
|||||||
}
|
}
|
||||||
req, err := option.UpsertRequest(collection)
|
req, err := option.UpsertRequest(collection)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return collection.UpdateTimestamp, err
|
// return schema mismatch err to retry with newer schema
|
||||||
|
return collection.UpdateTimestamp, merr.WrapErrCollectionSchemaMisMatch(err)
|
||||||
}
|
}
|
||||||
return collection.UpdateTimestamp, c.callService(func(milvusService milvuspb.MilvusServiceClient) error {
|
return collection.UpdateTimestamp, c.callService(func(milvusService milvuspb.MilvusServiceClient) error {
|
||||||
resp, err := milvusService.Upsert(ctx, req, callOptions...)
|
resp, err := milvusService.Upsert(ctx, req, callOptions...)
|
||||||
|
|||||||
@ -147,6 +147,12 @@ func (s *WriteSuite) TestInsert() {
|
|||||||
s.Run("bad_input", func() {
|
s.Run("bad_input", func() {
|
||||||
collName := fmt.Sprintf("coll_%s", s.randString(6))
|
collName := fmt.Sprintf("coll_%s", s.randString(6))
|
||||||
s.setupCache(collName, s.schema)
|
s.setupCache(collName, s.schema)
|
||||||
|
// bs, err := proto.Marshal(s.schema.ProtoMessage())
|
||||||
|
// s.Require().NoError(err)
|
||||||
|
s.mock.EXPECT().DescribeCollection(mock.Anything, mock.Anything).Return(&milvuspb.DescribeCollectionResponse{
|
||||||
|
CollectionName: collName,
|
||||||
|
Schema: s.schema.ProtoMessage(),
|
||||||
|
}, nil)
|
||||||
|
|
||||||
type badCase struct {
|
type badCase struct {
|
||||||
tag string
|
tag string
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user