Skip to content

Support optimize() interface#1788

Merged
sre-ci-robot merged 1 commit intomilvus-io:masterfrom
yhmo:mm
Apr 2, 2026
Merged

Support optimize() interface#1788
sre-ci-robot merged 1 commit intomilvus-io:masterfrom
yhmo:mm

Conversation

@yhmo
Copy link
Copy Markdown
Contributor

@yhmo yhmo commented Mar 27, 2026

No description provided.

Copilot AI review requested due to automatic review settings March 27, 2026 08:31
@sre-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: yhmo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new optimize() interface to the Java SDK v2 utility layer, providing an end-to-end “optimize collection” workflow (wait for indexes → compact with optional target size → wait for compaction/index rebuild → refresh load) plus supporting request/response models, task/progress tracking, and examples/tests.

Changes:

  • Introduces OptimizeReq, OptimizeResp, and an asynchronous OptimizeTask with progress/cancellation support.
  • Extends compact() to pass an optional targetSize (MB) down to the server compaction request.
  • Adds an OptimizeExample and unit tests for targetSize parsing.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
sdk-core/src/test/java/io/milvus/v2/service/utility/OptimizeTaskTest.java Adds unit tests for OptimizeTask.parseTargetSize() parsing/validation.
sdk-core/src/main/java/io/milvus/v2/service/utility/response/OptimizeResp.java New response DTO for optimize results and progress history.
sdk-core/src/main/java/io/milvus/v2/service/utility/request/OptimizeReq.java New request DTO to configure optimize (target size, async, timeout).
sdk-core/src/main/java/io/milvus/v2/service/utility/request/CompactReq.java Adds targetSize (MB) to compaction request model.
sdk-core/src/main/java/io/milvus/v2/service/utility/UtilityService.java Wires targetSize into ManualCompactionRequest.
sdk-core/src/main/java/io/milvus/v2/service/utility/OptimizeTask.java Implements background task execution, cancellation, waiting, and size parsing.
sdk-core/src/main/java/io/milvus/v2/client/MilvusClientV2.java Adds optimize() API and implements the optimize workflow.
examples/src/main/java/io/milvus/v2/OptimizeExample.java New runnable example demonstrating optimize usage.
examples/src/main/java/io/milvus/v2/HybridSearchExample.java Comments out functionScore usage (currently introduces a compile issue).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sdk-core/src/main/java/io/milvus/v2/service/utility/OptimizeTask.java Outdated
Comment thread examples/src/main/java/io/milvus/v2/HybridSearchExample.java
@mergify mergify Bot added the ci-passed label Mar 27, 2026
@yhmo yhmo force-pushed the mm branch 4 times, most recently from b97434d to 0034e93 Compare April 2, 2026 02:49
Signed-off-by: yhmo <yihua.mo@zilliz.com>
@yhmo yhmo added the lgtm label Apr 2, 2026
@sre-ci-robot sre-ci-robot merged commit b347a77 into milvus-io:master Apr 2, 2026
6 checks passed
@yhmo yhmo deleted the mm branch April 2, 2026 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants