milvus-io/milvus-sdk-java

[BUG]: Compatibility issue--Create index repeatedly,return error:‘ CreateIndexRequest RPC failed! io.grpc.StatusRuntimeException: CANCELLED: Failed to read message.’

Closed this issue · 2 comments

java-sdk version: v2.2.15
milvus-server: v2.3-latest or master-latest

STEPS:

@Test
public void repeatCreateIndex(){
    String collection = CommonFunction.createNewCollection();
    // 1. create index params
    CreateIndexParam createIndexParams = CreateIndexParam.newBuilder()
            .withCollectionName(collection)
            .withFieldName(CommonData.defaultVectorField)
            .withMetricType(MetricType.L2)
            .withIndexType(IndexType.HNSW)
            .withExtraParam(CommonFunction.provideExtraParam(IndexType.HNSW))
            .withSyncMode(Boolean.TRUE)
            .withSyncWaitingTimeout(30L)
            .withSyncWaitingInterval(500L)
            .build();
    // 2. create index
    R<RpcStatus> rpcStatusR = milvusClient.createIndex(createIndexParams);
    System.out.println("Create index" + rpcStatusR);
    Assert.assertEquals(rpcStatusR.getStatus().intValue(), 0);
    Assert.assertEquals(rpcStatusR.getData().getMsg(), "Success");
    // 3. load collection
    R<RpcStatus> rpcStatusR2 = milvusClient.loadCollection(
            LoadCollectionParam.newBuilder()
                    .withCollectionName(collection)
                    .withSyncLoad(Boolean.TRUE)
                    .build());
    System.out.println("Load collection " + rpcStatusR);
    Assert.assertEquals(rpcStatusR2.getStatus().intValue(), 0);
    Assert.assertEquals(rpcStatusR2.getData().getMsg(), "Success");
    // repeat createIndex
    CreateIndexParam createIndexParams2 = CreateIndexParam.newBuilder()
            .withCollectionName(collection)
            .withFieldName(CommonData.defaultVectorField)
            .withMetricType(MetricType.L2)
            .withIndexType(IndexType.IVF_FLAT)
            .withExtraParam(CommonFunction.provideExtraParam(IndexType.IVF_FLAT))
            .withSyncMode(Boolean.TRUE)
            .withSyncWaitingTimeout(30L)
            .withSyncWaitingInterval(500L)
            .build();
    R<RpcStatus> rpcStatusR3 = milvusClient.createIndex(createIndexParams2);
    System.out.println("Create index" + rpcStatusR2);
    Assert.assertEquals(rpcStatusR3.getStatus().intValue(), 0);
    Assert.assertEquals(rpcStatusR3.getData().getMsg(), "Success");
}

Current result

09:10:59.170 [main] [ERROR] io.milvus.client.AbstractMilvusGrpcClient:3072 --- CreateIndexRequest RPC failed! Collection name:Collection_fTZ5bNfshA, Field name:book_intro
io.grpc.StatusRuntimeException: CANCELLED: Failed to read message.

use milvus server :v2.2.16,Return correctly:

09:29:48.014 [main] [ERROR] io.milvus.client.AbstractMilvusGrpcClient:3072 --- CreateIndexRequest failed:CreateIndex failed: at most one distinct index is allowed per field
Create indexR{exception=Exception: CreateIndex failed: at most one distinct index is allowed per field, status=1, data=null}

protobuf dependency conflict

protobuf dependency conflict

How to solve the conflict?