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]: Fix Return Value for Non-Existent Collection,Partition,Index Drop #37249

Open
1 task done
nish112022 opened this issue Oct 29, 2024 · 2 comments
Open
1 task done
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

@nish112022
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Environment

- Milvus version: 2.4.X
- Deployment mode(standalone or cluster):both
- MQ type(rocksmq, pulsar or kafka):    
- SDK version(e.g. pymilvus v2.0.0rc2):pymilvus 2.4.x
- OS(Ubuntu or CentOS): 
- CPU/Memory: 
- GPU: 
- Others:

Current Behavior

Currently in drop_collection_task.go

func (t *dropCollectionTask) Execute(ctx context.Context) error {
	// use max ts to check if latest collection exists.
	// we cannot handle case that
	// dropping collection with `ts1` but a collection exists in catalog with newer ts which is bigger than `ts1`.
	// fortunately, if ddls are promised to execute in sequence, then everything is OK. The `ts1` will always be latest.
	collMeta, err := t.core.meta.GetCollectionByName(ctx, t.Req.GetDbName(), t.Req.GetCollectionName(), typeutil.MaxTimestamp)
	if errors.Is(err, merr.ErrCollectionNotFound) {
		// make dropping collection idempotent.
		log.Warn("drop non-existent collection", zap.String("collection", t.Req.GetCollectionName()))
		return nil
	}

Similarly in drop_partition_task.go

	if partID == common.InvalidPartitionID {
		log.Warn("drop an non-existent partition", zap.String("collection", t.Req.GetCollectionName()), zap.String("partition", t.Req.GetPartitionName()))
		// make dropping partition idempotent.
		return nil
	}

and in index_service.go

	indexes := s.meta.indexMeta.GetIndexesForCollection(req.GetCollectionID(), req.GetIndexName())
	if len(indexes) == 0 {
		log.Info(fmt.Sprintf("there is no index on collection: %d with the index name: %s", req.CollectionID, req.IndexName))
		return merr.Success(), nil
	}

Expected Behavior

We should have proper mechanism to not execute the function any longer in these particular cases.Need to return appropriate values.

Steps To Reproduce

Whenever,these tasks are created in milvus.

Milvus Log

No response

Anything else?

No response

@nish112022 nish112022 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 Oct 29, 2024
@yanliang567
Copy link
Contributor

/assign @congqixia
please help to review the issue and pr
/unassign

@yanliang567 yanliang567 added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Oct 29, 2024
@yanliang567 yanliang567 added this to the 2.4.14 milestone Oct 29, 2024
@xiaofan-luan
Copy link
Collaborator

The ddl design of milvus followed idempotence.
which means drop an existing collection extra performed same as drop an non existing collection. So you can retry drop collection until it succeed when get error.
That's why we don't throw error on dropping on non existing collection

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

4 participants