[Solved] Milvus Error: [ERROR][SERVER][TakeToEUse milvus.has_collection to verify whether the collection exists

Error Messages:

[2022-04-25 23:07:20,681][ERROR][SERVER][TakeToExecute][reqsched_thread] Request failed with code: Error code(30100): Collection xxx does not exist. Use milvus.has_collection to verify whether the collection exists. You also can check whether the collection name exists.

Solution

When deleting, you must delete the index first and then the set. If the order is reversed, an error will be reported

When creating an index, create a set first. If the order is reversed, an error will be reported

    def insert_ini(self, collection_name, vectors, ids=None, partition_tag=None):
        try:
            if self.has_collection(collection_name):
                self.client.drop_index(collection_name)
                self.client.drop_collection(collection_name)
            self.creat_collection(collection_name)
            self.create_index(collection_name)
            print('collection info: {}'.format(self.client.get_collection_info(collection_name)[1]))
            self.create_partition(collection_name, partition_tag)
            if vectors != -1:
                status, ids = self.client.insert(
                    collection_name=collection_name,
                    records=vectors,
                    ids=ids,
                    partition_tag=partition_tag)
                self.client.flush([collection_name])
                print(
                    'Insert {} entities, there are {} entities after insert data.'.
                    format(
                        len(ids), self.client.count_entities(collection_name)[1]))
                return status, ids
            else:
                return -1, ids
        except Exception as e:
            print("Milvus insert error:", e)

After finishing the whole, be sure to check the log in the background of the component to see if there are exceptions

Stand alone version

 cd /home/$USER/milvus/logs

The log is completely normal only when there is no error report

cat milvus-22-04-25-22:22-error.log

Mishards cluster version, or report an error

[2022-04-26 01:13:47,971][ERROR][SERVER][TakeToExecute][reqsched_thread] Request failed with code: Error: Collection already exists and it is in delete state, please wait a second
[2022-04-26 01:13:47,975][ERROR][SERVER][TakeToExecute][reqsched_thread] Request failed with code: Error code(30100): Collection call_12345_prd does not exist. Use milvus.has_collection to verify whether the collection exists. You also can check whether the collection name exists.
[2022-04-26 01:13:47,978][ERROR][SERVER][TakeToExecute][reqsched_thread] Request failed with code: Error code(30100): Collection call_12345_prd does not exist. Use milvus.has_collection to verify whether the collection exists. You also can check whether the collection name exists.
[2022-04-26 01:13:47,981][ERROR][SERVER][TakeToExecute][reqsched_thread] Request failed with code: Error code(30100): Collection call_12345_prd does not exist. Use milvus.has_collection to verify whether the collection exists. You also can check whether the collection name exists.
[2022-04-26 01:13:47,985][ERROR][SERVER][OnExecute][reqsched_thread] [insert][0] Collection call_12345_prd not found
[2022-04-26 01:13:47,985][ERROR][SERVER][TakeToExecute][reqsched_thread] Request failed with code: Error code(30100): Collection call_12345_prd does not exist. Use milvus.has_collection to verify whether the collection exists. You also can check whether the collection name exists.
[2022-04-26 01:13:47,987][ERROR][SERVER][TakeToExecute][reqsched_thread] Request failed with code: Error code(30100): Collection call_12345_prd does not exist. Use milvus.has_collection to verify whether the collection exists. You also can check whether the collection name exists.
[2022-04-26 01:13:47,990][ERROR][SERVER][TakeToExecute][reqsched_thread] Request failed with code: Error code(30100): Collection call_12345_prd does not exist. Use milvus.has_collection to verify whether the collection exists. You also can check whether the collection name exists.

Go to the corresponding node and check the log files one by one.

 	kubectl get pods

    kubectl exec -it milvus-release-mishards-767dc476bf-fxz8v -- /bin/bash

    kubectl exec -it milvus-release-readonly-6cb6c5bcd9-9m4c5 -- /bin/bash
    kubectl exec -it milvus-release-readonly-6cb6c5bcd9-mzrh6 -- /bin/bash

    kubectl exec -it milvus-release-writable-7776777fcc-dsdmv -- /bin/bash

Read More: