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:
| Method | Description | Parameters |
|---|---|---|
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.Unknowand the error message of the exception.If the API succeeds, it returns a valid
GetCompactionStateResponseheld by the R template.
CompactionState
Use the getState() of GetCompactionStateResponse to get the compaction state:
package io.milvus.grpc;
public enum CompactionState
| Type | Code | Description |
|---|---|---|
| UndefiedState | 0 | For internal usage. |
| Executing | 1 | Compaction is in execution. |
| Completed | 2 | Compaction 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());