GetPersistentSegmentInfoAsync()

Gets the persistent segment info of a collection.

public async Task<GetPersistentSegmentInfoResp> GetPersistentSegmentInfoAsync(
    GetPersistentSegmentInfoReq request, CancellationToken cancellationToken = default)

Request Syntax

var request = new GetPersistentSegmentInfoReq
{
    CollectionName = "my_collection"
};

GetPersistentSegmentInfoResp result = await client.GetPersistentSegmentInfoAsync(request);

REQUEST PARAMETERS:

  • DatabaseName (string?) -

    An optional database name to operate on. When empty, the client’s currently selected database is used.

  • CollectionName (string) -

    The name of the collection whose persistent segment info to retrieve.

RETURN TYPE:

Task

RETURNS:

A GetPersistentSegmentInfoResp object that contains the persistent segment info of the collection.

GetPersistentSegmentInfoResp
    Infos  // -> IReadOnlyList<PersistentSegmentInfo>

PARAMETERS:

  • Infos (IReadOnlyList) -

    The persistent segments of the collection. Each PersistentSegmentInfo has the following members:

    • CollectionName (string) -

      The name of the collection that owns the segment (from the request; the server reports only the id).

    • SegmentId (long) -

      The segment id.

    • CollectionId (long) -

      The id of the collection that owns the segment.

    • PartitionId (long) -

      The id of the partition that owns the segment.

    • NumRows (long) -

      The number of rows stored in the segment.

    • State (SegmentState) -

      The state of the segment. See SegmentState.

    • Level (SegmentLevel) -

      The level of the segment (sealed, growing, etc.).

    • IsSorted (bool) -

      Whether the segment is sorted.

    • StorageVersion (long) -

      The storage format version of the segment.

EXCEPTIONS:

  • MilvusException

    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();

GetPersistentSegmentInfoResp result = await client.GetPersistentSegmentInfoAsync(new GetPersistentSegmentInfoReq
{
    CollectionName = "my_collection"
});

foreach (PersistentSegmentInfo info in result.Infos)
{
    Console.WriteLine($"Segment {info.SegmentId}: {info.NumRows} rows, state {info.State}");
}

Try Managed Milvus for Free

Zilliz Cloud is hassle-free, powered by Milvus and 10x faster.

Get Started
Feedback

Was this page helpful?