loadPartitions()
MilvusClient interface. This method loads partitions' data into query nodes' memory before the search or query.
R<RpcStatus> loadPartitions(LoadPartitionsParam requestParam);
LoadPartitionsParam
Use the LoadPartitionsParam.Builder
to construct a LoadPartitionsParam
object.
import io.milvus.param.LoadPartitionsParam;
LoadPartitionsParam.Builder builder = LoadPartitionsParam.newBuilder();
Methods of LoadPartitionsParam.Builder
:
Method | Description | Parameters |
---|---|---|
withCollectionName(String collectionName) | Set the collection name. Collection name cannot be empty or null. | collectionName: The target collection name. |
withDatabaseName(String databaseName) | Sets the database name. database name can be null for default database. | databaseName: The database name. |
withPartitionNames(List<String> partitionNames) | Set the partition names list. Partition names list cannot be null or empty. | partitionNames: |
addPartitionName(String partitionName) | Add a partition by name. Partition name cannot be empty or null. | partitionName: A target partition name. |
withSyncLoad(Boolean syncLoad) | Enable sync mode for load action. With sync mode enabled, the client keeps waiting until all segments of the partition are successfully loaded.If sync mode is disabled, client returns instantly after the loadPartitions() is called. | syncLoad: set to True is sync mode |
withSyncLoadWaitingInterval(Long milliseconds) | Set the waiting interval for sync mode. In sync mode, the client constantly checks partition load state by interval. | milliseconds: interval value(units: millisecond) |
withSyncLoadWaitingTimeout(Long seconds) | Set the timeout value for sync mode. | seconds: timeout value(units: second) |
withReplicaNumber(Integer replicaNumber) | Specify replica number to load. | replicaNumber: replica number |
withRefresh(Boolean refresh) | Whether to renew the segment list of this partition before loading. This flag must be set to FALSE when first time call the loadPartitions(). After loading a partition, call loadPartitions() again with refresh=TRUE, the server will look for new segments that are not loaded yet and tries to load them up. | refresh: The flag whether to renew segment list. |
build() | Construct a LoadPartitionsParam object. | N/A |
The LoadPartitionsParam.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<RpcStatus>
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.Unknown
and error message of the exception. -
If the API succeeds, it returns
R.Status.Success
.
Example
import io.milvus.param.*;
LoadPartitionsParam param = LoadPartitionsParam.newBuilder()
.withCollectionName(COLLECTION_NAME)
.addPartitionName(PARTITION_NAME)
.build();
R<RpcStatus> response = client.loadPartitions(param);
if (response.getStatus() != R.Status.Success.getCode()) {
System.out.println(response.getMessage());
}