Implement MilvusClientV2 (2.6) - #141
Conversation
|
@yhmo Thanks for your contribution. Please submit with DCO, see the contributing guide https://github.com/milvus-io/milvus/blob/master/CONTRIBUTING.md#developer-certificate-of-origin-dco. |
|
Tick the box to add this pull request to the merge queue (same as
|
There was a problem hiding this comment.
🔵 Needs a closer look
It introduces a large new client surface area plus core caching/endpoint normalization and request-shaping logic where multiple concrete correctness issues were found that should be addressed and re-validated.
Pull request overview
This PR introduces a new Milvus.Client.V2 SDK implementation targeting the Milvus 2.6 API surface (DTO-based request/response pattern with a single MilvusClientV2 facade), while keeping the existing V1 client buildable after relocating/upgrading the shared milvus-proto submodule.
Changes:
- Adds the new
Milvus.Client.V2library (DTO requests/responses, types, utilities like timestamp/schema caches and retry infrastructure). - Adds a V2-focused test suite (unit/integration/system) and runnable examples showcasing V2 features.
- Relocates the
milvus-protosubmodule to the repo root and updates solution/package wiring to include V2 projects.
File summaries
| File | Description |
|---|---|
| Milvus.Client/Milvus.Client.csproj | Updates protobuf include paths to reference protos from the new repo-root Protos location. |
| .gitmodules | Relocates the milvus-proto submodule entry to the repo root (Protos). |
| Directory.Packages.props | Adds centralized package versions needed for the new V2 test infrastructure. |
| Milvus.Client.sln | Adds the V2 library and V2 test projects to the solution. |
| Milvus.Client.V2/Utils/Verify.cs | Adds V2 argument validation helpers used across DTOs. |
| Milvus.Client.V2/Utils/TypeMappings.cs | Adds enum-to-wire-string mapping for index/search request parameters. |
| Milvus.Client.V2/Utils/MilvusTimestampUtils.cs | Adds timestamp conversion helpers for guarantee/time-travel timestamps. |
| Milvus.Client.V2/Utils/Logging.cs | Adds source-generated logging extension methods for V2 client operations. |
| Milvus.Client.V2/Utils/CompilerAttributes.cs | Adds internal compatibility attributes for older target frameworks. |
| Milvus.Client.V2/Utils/CollectionCacheKey.cs | Adds cache key normalization for schema/TS caches keyed by endpoint/db/collection. |
| Milvus.Client.V2/Types/* | Introduces public V2 types/enums supporting the 2.6 API surface (metrics, load/index states, iterators, retry config, replication models, etc.). |
| Milvus.Client.V2/Requests/* | Adds DTO request objects for V2 operations (collection/index/DML/DQL/utility/RBAC/etc.). |
| Milvus.Client.V2/Responses/* | Adds DTO response objects for V2 operations. |
| Milvus.Client.V2/MilvusException.cs | Adds V2 exception type carrying MilvusErrorCode. |
| Milvus.Client.V2/MilvusErrorCode.cs | Adds V2 error code enum. |
| Milvus.Client.V2/MilvusClientV2.BulkImport.cs | Adds Bulk Import facade methods wired to DTOs and gRPC calls. |
| Milvus.Client.V2.Tests/Milvus.Client.V2.Tests.csproj | Adds the V2 test project and its dependencies. |
| Milvus.Client.V2.Tests/Unit/* | Adds unit tests for V2 utilities and request mapping logic. |
| Milvus.Client.V2.Tests/Integration/* | Adds integration tests using an in-process mock server to validate client behavior. |
| Milvus.Client.V2.Tests/System/* | Adds system tests against a real Milvus container. |
| examples/Milvus.Examples.csproj | Adds runnable examples project referencing Milvus.Client.V2. |
| examples/Program.cs | Adds an example runner/dispatcher for V2 examples. |
| examples/*Example.cs | Adds runnable V2 examples demonstrating specific features (RBAC, analyzer, aliases, nullable fields, etc.). |
| examples/ExampleHelpers.cs | Adds shared helper utilities for making examples idempotent and easy to run. |
Review details
- Files reviewed: 271/272 changed files
- Comments generated: 8
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
@yhmo Thanks for your contribution. Please submit with DCO, see the contributing guide https://github.com/milvus-io/milvus/blob/master/CONTRIBUTING.md#developer-certificate-of-origin-dco. |
a14a449 to
909287b
Compare
99e4dc8 to
8ace961
Compare
202430c to
97feaf7
Compare
## Summary Adds **MilvusClientV2**, a new DTO-based Milvus client targeting the **2.6 API surface**, alongside the existing V1 `Milvus.Client`. The client mirrors the V2 SDKs (Java / C++ / PyMilvus) with per-operation request/response DTOs, internal generated gRPC types, and the shared cache/retry infrastructure described in the design doc. The `milvus-proto` submodule is upgraded to the 2.6 branch (`a76db65`) and relocated to the repository root, since it is now a shared build-time dependency of both the V1 and V2 assemblies. Neither published package references the protos at runtime. ## What's included **Complete 2.6 API surface** (`Milvus.Client.V2`) - Collection & schema: create/drop/describe/alter, field & function operations, properties, replicas, truncate, refresh-load - Index: create/drop/describe/list, index properties - DML: insert / upsert / delete with Session-consistency timestamp tracking - DQL: get / query / search / **hybrid search** (RRF & weighted rerankers) / **query & search iterators** - Partition / database / alias - RBAC: users, roles, privileges, v2 privilege model, privilege groups - Resource group, utility (flush, compact, analyze, CDC / replicate info), bulk import **Mechanisms** Signed-off-by: yhmo <yihua.mo@zilliz.com>
issue: #139
Summary
Adds MilvusClientV2, a new DTO-based Milvus client targeting the 2.6 API surface, alongside the existing V1
Milvus.Client. The client mirrors the V2 SDKs (Java / C++ / PyMilvus) with per-operation request/response DTOs, internal generated gRPC types, and the shared cache/retry infrastructure described in the design doc.The
milvus-protosubmodule is upgraded to the 2.6 branch (a76db65) and relocated to the repository root, since it is now a shared build-time dependency of both the V1 and V2 assemblies. Neither published package references the protos at runtime.What's included
Complete 2.6 API surface (
Milvus.Client.V2)Mechanisms
CollectionTsCache(Session read-your-writes) and single-flightSchemaCache, keyed by endpoint/database/collectionRetryPolicywith the two-layer retryable-error decision (gRPC blacklist + server RateLimit), aligned with PyMilvus/Java/C++DumpMessagesand lazy paged iteratorsQuality & docs
FieldDatafixes,DropCollectioncache invalidationCompatibility
Milvus.Clientis unchanged in behavior and remains buildable after the proto upgradeTest plan