[fix] Make clear operations idempotent#126
Merged
Merged
Conversation
CLA Signature Pass0oshowero0, thanks for your pull request. All authors of the commits have signed the CLA. 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
Previously, the clear operations (
kv_clear,(async_)clear_samples, and(async_)clear_partition) were not idempotent: they would raise errors when asked to clear non-existent keys or partitions.This strict behavior was originally intended to expose potential implementation bugs. As the codebase has matured, we now align these operations with the common idempotent clear semantics, where clearing non-existent data is a no-op and is only logged.
Changes
clear_meta/clear_partition/reset_consumptionValueError.clear_meta, continue processing remaining partitions when one partition does not exist, instead of returning early.kv_retrieve_metacreate=False, filter out non-existent keys and return aBatchMetacontaining only the existing keys, instead of returning an emptyBatchMeta.kv_clearnaturally idempotent for partial or fully missing keys.test_controller_clear_meta_idempotentto verify idempotentclear_metabehavior.test_controller_kv_retrieve_meta_partial_keys_without_createto verify partial key retrieval.test_kv_clear_idempotentinTestKVClearE2Eto cover clearing non-existent keys, non-existent partitions, mixed existent/non-existent keys, and repeated clears.