milvus-logo
LFAI
< Docs
  • Java

getCompactionState()

A MilvusClient interface. This method returns the state of a compaction operation and shows if the specified compaction operation has completed.

R<GetCompactionStateResponse> getCompactionState(GetCompactionStateParam requestParam);

GetCompactionStateParam

Use the GetCompactionStateParam.Builder to construct a GetCompactionStateParam object.

import io.milvus.param.GetCompactionStateParam;
GetCompactionStateParam.Builder builder = GetCompactionStateParam.newBuilder();

Methods of GetCompactionStateParam.Builder:

MethodDescriptionParameters
withCompactionID(Long compactionID)Sets the ID of the compaction.compactionID: The ID of the compaction operation to be checked.
build()Constructs a GetCompactionStateParam object.N/A

The GetCompactionStateParam.Builder.build() can throw the following exceptions:

  • ParamException: error if the parameter is invalid.

Returns

This method catches all the exceptions and returns an R<GetCompactionStateResponse> object.

  • If the API fails on the server side, it returns the error code and message from the server.

  • If the API fails by RPC exception, it returns R.Status.Unknow and the error message of the exception.

  • If the API succeeds, it returns a valid GetCompactionStateResponse held by the R template.

CompactionState

Use the getState() of GetCompactionStateResponse to get the compaction state:

package io.milvus.grpc;
public enum CompactionState
TypeCodeDescription
UndefiedState0For internal usage.
Executing1Compaction is in execution.
Completed2Compaction is completed.

Example

import io.milvus.param.*;
import io.milvus.grpc.GetCompactionStateResponse;

GetCompactionStateParam param = GetCompactionStateParam.newBuilder()
        .withCompactionID(compactionID)
        .build();
R<GetCompactionStateResponse> response = client.getCompactionState(param);
if (response.getStatus() != R.Status.Success.getCode()) {
    System.out.println(response.getMessage());
}

System.out.println("Compaction state: " + response.getData().getState());
Feedback

Was this page helpful?