GetCompactionPlansAsync()
Gets the compaction plans for a compaction.
public async Task<GetCompactionPlansResp> GetCompactionPlansAsync(
GetCompactionPlansReq request, CancellationToken cancellationToken = default)
Request Syntax
var request = new GetCompactionPlansReq
{
CompactionId = 450357031542
};
GetCompactionPlansResp result = await client.GetCompactionPlansAsync(request);
REQUEST PARAMETERS:
CompactionId(long) -The ID of the compaction whose plans to retrieve.
RETURN TYPE:
Task
RETURNS:
A GetCompactionPlansResp object that contains the state of the compaction and its merge plans.
GetCompactionPlansResp
CompactionId // -> long?
CollectionName // -> string?
State // -> CompactionState
MergeInfos // -> IReadOnlyList<CompactionMergeInfo>
PARAMETERS:
CompactionId (long?) -
The ID of the compaction whose plans are reported, or
nullwhen the tasks were selected by collection name.CollectionName (string?) -
The name of the collection the reported compaction tasks belong to, or
nullwhen the plans were selected by compaction ID.State (CompactionState) -
The aggregate state of the compaction. See CompactionState.
MergeInfos (IReadOnlyList
) - The merge plans for the compaction: each entry maps the source segments onto a target segment. Each CompactionMergeInfo exposes:
Sources(IReadOnlyList) - The segment IDs that are merged as part of this plan.
Target(long) -The target segment ID produced by this merge.
Targets(IReadOnlyList) - The complete set of target segments produced by this compaction, which may be larger than the single legacy
Target.PlanId(long) -The server-side compaction task identifier.
TriggerId(long) -The ID of the compaction that triggered this plan.
CollectionId(long) -The ID of the collection being compacted.
PartitionId(long) -The ID of the partition being compacted.
Channel(string) -The channel on which the compaction was scheduled.
CompactionType(CompactionType) -The type of the compaction task. See CompactionType.
State(CompactionTaskState) -The state of the compaction task. See CompactionTaskState.
FailureReason(string) -The failure reason of the compaction task, empty when it did not fail.
EXCEPTIONS:
-
Thrown when the RPC fails or the server returns an error. Inspect the exception message for details.
Example
using Milvus.Client.V2;
using Milvus.Client.V2.Requests.Utility;
using Milvus.Client.V2.Responses.Utility;
using var client = new MilvusClientV2(new ConnectConfig
{
Uri = "localhost:19530",
Username = "root",
Password = "Milvus"
});
await client.ConnectAsync();
GetCompactionPlansResp result = await client.GetCompactionPlansAsync(new GetCompactionPlansReq
{
CompactionId = 450357031542
});
foreach (CompactionMergeInfo plan in result.MergeInfos)
{
Console.WriteLine($"Merging {plan.Sources.Count} segments into {plan.Target}");
}