Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: When constructing duplicate data using query expressions, the returned data may be incomplete. #33137

Open
1 task done
lentitude2tk opened this issue May 17, 2024 · 9 comments
Assignees
Labels
kind/bug Issues or changes related a bug triage/accepted Indicates an issue or PR is ready to be actively worked on.
Milestone

Comments

@lentitude2tk
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Environment

- Milvus version: v2.3.13-835862d-
- Deployment mode(standalone or cluster):standalone
- MQ type(rocksmq, pulsar or kafka): None
- SDK version(e.g. pymilvus v2.0.0rc2):java-sdk
- OS(Ubuntu or CentOS): 
- CPU/Memory: 
- GPU: 
- Others:

Current Behavior

  1. I have constructed data and inserted five duplicate sets of data into Milvus, each ranging from 0 to 999.
    private void prepareData() {
        for (int i = 0; i < 5; ++i) {
            insertColumns(1);
        }
        createIndex();
        loadCollection();
    }

    private void insertColumns(int batchCount) {
        for (int batch = 0; batch < batchCount; ++batch) {
            List<List<Float>> vectors = CommonUtils.generateFixFloatVectors(VECTOR_DIM, NUM_ENTITIES);

            List<Long> ages = new ArrayList<>();
            List<Long> ids = new ArrayList<>();
            for (long i = 0L; i < NUM_ENTITIES; ++i) {
                ages.add((long) batch * NUM_ENTITIES + i);
                ids.add((long) batch * NUM_ENTITIES + i);
            }

            List<InsertParam.Field> fields = new ArrayList<>();
            fields.add(new InsertParam.Field(ID_FIELD, ids));
            fields.add(new InsertParam.Field(AGE_FIELD, ages));
            fields.add(new InsertParam.Field(VECTOR_FIELD, vectors));

            InsertParam insertParam = InsertParam.newBuilder()
                    .withCollectionName(COLLECTION_NAME)
                    .withFields(fields)
                    .build();
            R<MutationResult> response = milvusClient.insert(insertParam);
            CommonUtils.handleResponseStatus(response);

            R<FlushResponse> flush = milvusClient.flush(FlushParam.newBuilder().addCollectionName(COLLECTION_NAME).build());
            CommonUtils.handleResponseStatus(flush);

            GetCollectionStatisticsParam collectionStatisticsParam = GetCollectionStatisticsParam.newBuilder().withCollectionName(COLLECTION_NAME).build();
            R<GetCollectionStatisticsResponse> collectionStatistics = milvusClient.getCollectionStatistics(collectionStatisticsParam);
            CommonUtils.handleResponseStatus(collectionStatistics);
            GetCollStatResponseWrapper wrapper = new GetCollStatResponseWrapper(collectionStatistics.getData());

            System.out.printf("Finish insert batch%s, number of entities in Milvus: %s\n", batch, wrapper.getRowCount());
        }
  1. When querying the data using a query expression with offset=0 and limit=900, I found that some data is missing in the returned results. For example, data points 351-354 are missing.
    image

  2. By querying through the interface or using queryIterator for a full query, it can be confirmed that data points 351-354 do actually exist.
    image

Expected Behavior

First, it is expected that the returned data is de-duplicated, and there is no issue with that. However, the returned data should follow the correct sequence, and there should not be any data missing.

Steps To Reproduce

You can reproduce the issue by following steps 1-3

Milvus Log

No response

Anything else?

No response

@lentitude2tk lentitude2tk added kind/bug Issues or changes related a bug needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 17, 2024
@yanliang567
Copy link
Contributor

/assign @congqixia
/unassign

@yanliang567 yanliang567 added triage/needs-information Indicates an issue needs more information in order to work on it. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 18, 2024
@yanliang567 yanliang567 added this to the 2.4.2 milestone May 18, 2024
@xiaofan-luan
Copy link
Contributor

@lentitude2tk
could you try latest milvus and check if this is reproducible?

@xiaofan-luan
Copy link
Contributor

/assign @MrPresent-Han

@lentitude2tk
Copy link
Author

@lentitude2tk could you try latest milvus and check if this is reproducible?

OK, I will upgrade to the latest version 2.4 and run the test.

@lentitude2tk
Copy link
Author

@xiaofan-luan I have upgraded to version 2.4.2-20240514-f48a7ff-72fc31b and conducted tests, which met expectations. From the results, it appears that Milvus 2.4 has optimized its query strategy compared to 2.3.

For the same dataset with offset=0, limit=900, and expr="", querying the data (0-999) repeated 5 times:

  1. Version 2.3 could only return over 300 records, with some data missing.
  2. Version 2.4 returned a complete set of 900 deduplicated records, covering the range 0-999.

image

@longjiquan
Copy link
Contributor

/assign

@longjiquan
Copy link
Contributor

already fixed by #32567 , in this pr, the reduce of query will try the best to get the limit results (availableCount < limit).

for j := 0; j < loopEnd && (limit == -1 || availableCount < limit); j++ {

@lentitude2tk
Copy link
Author

already fixed by #32567 , in this pr, the reduce of query will try the best to get the limit results (availableCount < limit).

for j := 0; j < loopEnd && (limit == -1 || availableCount < limit); j++ {

Can this handling strategy code be synchronized to version 2.3?

@longjiquan
Copy link
Contributor

OK, I'll do it. @lentitude2tk

@yanliang567 yanliang567 added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed triage/needs-information Indicates an issue needs more information in order to work on it. labels May 20, 2024
sre-ci-robot pushed a commit that referenced this issue May 21, 2024
issue: #33137

Signed-off-by: longjiquan <jiquan.long@zilliz.com>
sre-ci-robot pushed a commit that referenced this issue May 21, 2024
issue: #33137
pr: #33178

Signed-off-by: longjiquan <jiquan.long@zilliz.com>
sre-ci-robot pushed a commit that referenced this issue May 21, 2024
issue: #33137
pr: #32567
Co-authored-by: sunby <bingyi.sun@zilliz.com>
Co-authored-by: MrPresent-Han <chun.han@zilliz.com>

---------

Signed-off-by: longjiquan <jiquan.long@zilliz.com>
MrPresent-Han added a commit to MrPresent-Han/milvus that referenced this issue May 23, 2024
…cated keys(milvus-io#33137)

Signed-off-by: MrPresent-Han <chun.han@zilliz.com>
@yanliang567 yanliang567 modified the milestones: 2.4.2, 2.4.3 May 24, 2024
MrPresent-Han added a commit to MrPresent-Han/milvus that referenced this issue May 28, 2024
adding has_more_result_tag for various level's reduce to rectify reduce_stop_for_best

Signed-off-by: MrPresent-Han <chun.han@zilliz.com>
MrPresent-Han added a commit to MrPresent-Han/milvus that referenced this issue May 28, 2024
adding has_more_result_tag for various level's reduce to rectify reduce_stop_for_best

Signed-off-by: MrPresent-Han <chun.han@zilliz.com>
MrPresent-Han added a commit to MrPresent-Han/milvus that referenced this issue May 28, 2024
adding has_more_result_tag for various level's reduce to rectify reduce_stop_for_best

Signed-off-by: MrPresent-Han <chun.han@zilliz.com>
MrPresent-Han added a commit to MrPresent-Han/milvus that referenced this issue May 28, 2024
adding has_more_result_tag for various level's reduce to rectify reduce_stop_for_best

Signed-off-by: MrPresent-Han <chun.han@zilliz.com>
MrPresent-Han added a commit to MrPresent-Han/milvus that referenced this issue May 30, 2024
adding has_more_result_tag for various level's reduce to rectify reduce_stop_for_best

Signed-off-by: MrPresent-Han <chun.han@zilliz.com>
@yanliang567 yanliang567 modified the milestones: 2.4.3, 2.4.4 May 30, 2024
MrPresent-Han added a commit to MrPresent-Han/milvus that referenced this issue May 30, 2024
adding has_more_result_tag for various level's reduce to rectify reduce_stop_for_best

Signed-off-by: MrPresent-Han <chun.han@zilliz.com>
sre-ci-robot pushed a commit that referenced this issue May 30, 2024
related: #33137 
adding has_more_result_tag for various level's reduce to rectify
reduce_stop_for_best

Signed-off-by: MrPresent-Han <chun.han@zilliz.com>
MrPresent-Han added a commit to MrPresent-Han/milvus that referenced this issue May 30, 2024
adding has_more_result_tag for various level's reduce to rectify reduce_stop_for_best

Signed-off-by: MrPresent-Han <chun.han@zilliz.com>
sre-ci-robot pushed a commit that referenced this issue May 31, 2024
related: #33137
pr: #33422

Signed-off-by: MrPresent-Han <chun.han@zilliz.com>
MrPresent-Han added a commit to MrPresent-Han/milvus that referenced this issue May 31, 2024
related: milvus-io#33137 
adding has_more_result_tag for various level's reduce to rectify
reduce_stop_for_best

Signed-off-by: MrPresent-Han <chun.han@zilliz.com>
MrPresent-Han added a commit to MrPresent-Han/milvus that referenced this issue May 31, 2024
pr: milvus-io#33422
issue: milvus-io#33137

Signed-off-by: MrPresent-Han <chun.han@zilliz.com>
MrPresent-Han added a commit to MrPresent-Han/milvus that referenced this issue May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Issues or changes related a bug triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

6 participants