Skip to content

Validate shared hash tags in drop_keys on Redis Cluster - #774

Open
Hashim1999164 wants to merge 1 commit into
redis:mainfrom
Hashim1999164:fix/drop-keys-cluster-hash-tag
Open

Hashim1999164 wants to merge 1 commit into
redis:mainfrom
Hashim1999164:fix/drop-keys-cluster-hash-tag

Conversation

@Hashim1999164

@Hashim1999164 Hashim1999164 commented Oct 18, 2026 •

Copy link
Copy Markdown

Summary

Fixes #601 by applying the same Redis Cluster hash tag check in SearchIndex.drop_keys and AsyncSearchIndex.drop_keys that drop_documents already uses.

On cluster, multi key drop_keys now raises ValueError when keys do not share a hash tag, so the SemanticCache.drop(keys=...) path matches drop(ids=...) instead of failing later or partially.

Test plan

  • Added unit coverage for sync and async drop_keys cluster validation success, failure, and non cluster skip
  • CI unit tests on this PR

Note

Medium Risk
Changes deletion error semantics on Redis Cluster for multi-key drop_keys (fail-fast ValueError instead of per-key unlink or ambiguous partial behavior), which may surface mis-tagged callers that previously appeared to succeed.

Overview
Aligns Redis Cluster behavior for bulk drop_keys with drop_documents on both SearchIndex and AsyncSearchIndex.

For a list of keys on cluster, the methods now call _keys_share_hash_tag before any batched UNLINK work and raise ValueError with the same message as drop_documents when hash tags differ. Single-key and non-cluster paths are unchanged. Docstrings note the cluster requirement and document the new raise.

Unit tests extend cluster validation coverage to sync/async drop_keys (success, failure, and no validation on standalone Redis).

Reviewed by Cursor Bugbot for commit e878ee9. Bugbot is set up for automated code reviews on this repo. Configure here.

@Hashim1999164
Hashim1999164 force-pushed the fix/drop-keys-cluster-hash-tag branch from 1c8c783 to e23339f Compare October 18, 2026 21:17
Match drop_documents so SemanticCache keys= and ids= paths fail the same way when keys span slots.
@Hashim1999164
Hashim1999164 force-pushed the fix/drop-keys-cluster-hash-tag branch from e23339f to e878ee9 Compare October 19, 2026 04:17
@vishal-bala

Copy link
Copy Markdown
Collaborator

Hi, thanks for your contribution! Can you rebase onto the latest origin/main and follow the new contribution process?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SearchIndex.drop_keys does not validate cluster hash-tag co-location (inconsistent with drop_documents)

2 participants