milvus: [Bug]: num_entities is wrong after delete or upsert

Is there an existing issue for this?

  • I have searched the existing issues

Environment

- Milvus version: 2.0.2
- Deployment mode(standalone or cluster): 
- SDK version(e.g. pymilvus v2.0.0rc2): 2.0.2
- OS(Ubuntu or CentOS): 
- CPU/Memory: 
- GPU: 
- Others:

Current Behavior

as the title said.

this is the test script, copied from pymilvs doc:


from pymilvus import connections, Collection, FieldSchema, CollectionSchema, DataType
import random

# add connection config here
# connections.add_connection()
connections.connect()

schema = CollectionSchema([
     FieldSchema("film_id", DataType.INT64, is_primary=True),
     FieldSchema("film_date", DataType.INT64),
     FieldSchema("films", dtype=DataType.FLOAT_VECTOR, dim=2)
 ])

collection = Collection("test_collection_query", schema)

# insert 10 entities, and num_entities is ok
data = [
     [i for i in range(10)],
     [i + 2000 for i in range(10)],
     [[random.random() for _ in range(2)] for _ in range(10)],
 ]


collection.insert(data)

assert collection.num_entities == 10

collection.load()

# query all entities, size is ok 
res = collection.query("film_id >= 0")

assert len(res) == 10

# delete 5 entities, but num_entities is still 10
collection.delete(f"film_id in {[i for i in range(5)]}")

assert collection.num_entities == 10

# however query size is 5, that's ok
res = collection.query("film_id >= 0"]
assert len(res) == 5

Expected Behavior

No response

Steps To Reproduce

No response

Milvus Log

No response

Anything else?

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (9 by maintainers)

Most upvoted comments

Okay. I’ll wait for update. Thanks for your job.

We will have one beta release on 2.3, so it shouldn’t be too long