Repository: milvus-io/milvus-sdk-go
Pull request #420 (2023-03-10 02:01:06)

Set default consistency level to Bounded
Sync sdk behavior

/kind improvement

sre-ci-robot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/milvus-io/milvus-sdk-go/pull/420#" title="Author self-approved">congqixia</a>*

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=milvus-io%2Fmilvus-sdk-go).

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

<details >
Needs approval from an approver in each of these files:

- ~~[OWNERS](https://github.com/milvus-io/milvus-sdk-go/blob/master/OWNERS)~~ [congqixia]

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":[]} -->
codecov[bot]: ## [Codecov](https://codecov.io/gh/milvus-io/milvus-sdk-go/pull/420?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=milvus-io) Report
> Merging [#420](https://codecov.io/gh/milvus-io/milvus-sdk-go/pull/420?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=milvus-io) (4b9258a) into [master](https://codecov.io/gh/milvus-io/milvus-sdk-go/commit/01b5dd8ee38df7c5e59722d4853235b04d38f4be?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=milvus-io) (01b5dd8) will **not change** coverage.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/milvus-io/milvus-sdk-go/pull/420/graphs/tree.svg?width=650&height=150&src=pr&token=WJK43PV390&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=milvus-io)](https://codecov.io/gh/milvus-io/milvus-sdk-go/pull/420?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=milvus-io)

```diff
@@           Coverage Diff           @@
##           master     #420   +/-   ##
=======================================
  Coverage   87.44%   87.44%           
=======================================
  Files          30       30           
  Lines        2804     2804           
=======================================
  Hits         2452     2452           
  Misses        267      267           
  Partials       85       85           
```


| [Impacted Files](https://codecov.io/gh/milvus-io/milvus-sdk-go/pull/420?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=milvus-io) | Coverage Δ | |
|---|---|---|
| [client/client\_grpc\_collection.go](https://codecov.io/gh/milvus-io/milvus-sdk-go/pull/420?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=milvus-io#diff-Y2xpZW50L2NsaWVudF9ncnBjX2NvbGxlY3Rpb24uZ28=) | `87.54% <100.00%> (ø)` | |

weiliu1031: /lgtm

Patch:
diff --git a/client/client_grpc_collection.go b/client/client_grpc_collection.go
index 975be48..1e6e484 100644
--- a/client/client_grpc_collection.go
+++ b/client/client_grpc_collection.go
@@ -135,7 +135,7 @@ func (c *GrpcClient) CreateCollection(ctx context.Context, collSchema *entity.Sc
 		ShardsNum:      shardNum,
 		// default consistency level is strong
 		// to be consistent with previous version
-		ConsistencyLevel: common.ConsistencyLevel_Strong,
+		ConsistencyLevel: common.ConsistencyLevel_Bounded,
 	}
 	// apply options on request
 	for _, opt := range opts {


Test patch:
diff --git a/client/client_grpc_collection_test.go b/client/client_grpc_collection_test.go
index 6cc452b..bb1c05b 100644
--- a/client/client_grpc_collection_test.go
+++ b/client/client_grpc_collection_test.go
@@ -122,7 +122,7 @@ func (s *CollectionSuite) TestCreateCollection() {
 					s.EqualValues(fieldSchema.DataType, sschema.GetFields()[idx].GetDataType())
 				}
 				s.Equal(shardsNum, req.GetShardsNum())
-				s.Equal(common.ConsistencyLevel_Strong, req.GetConsistencyLevel())
+				s.Equal(common.ConsistencyLevel_Bounded, req.GetConsistencyLevel())
 			}).
 			Return(&common.Status{ErrorCode: common.ErrorCode_Success}, nil)
 		s.mock.EXPECT().HasCollection(mock.Anything, &server.HasCollectionRequest{CollectionName: testCollectionName}).Return(&server.BoolResponse{Status: &common.Status{}, Value: false}, nil)
diff --git a/test/common/utils.go b/test/common/utils.go
index 1042cf3..4f52d45 100644
--- a/test/common/utils.go
+++ b/test/common/utils.go
@@ -25,7 +25,7 @@ const (
 	MaxDim                    = 32768
 	DefaultMaxLength          = "65535"
 	DefaultShards             = int32(2)
-	DefaultConsistencyLevel   = entity.ConsistencyLevel(0)
+	DefaultConsistencyLevel   = entity.ClBounded
 	DefaultNb                 = 3000
 	DefaultNq                 = 5
 	DefaultTopK               = 10