You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Concurrent kv_put(tag=...) on one key loses tag updates #188
Concurrent tag updates on the same key lose updates. Two writers that set different tag names on one key can leave it with only one of them.
kv_put(key, partition_id, tag={...}) (and kv_batch_put(..., tags=[...]), plus the async versions) is a read-modify-write split between client and controller:
The client fetches the key's metadata, including its current tags.
It merges the new tag into that copy locally (BatchMeta.update_custom_meta).
It sends the whole merged dict back, and the controller stores it with custom_meta.update(...) (DataPartitionStatus.set_custom_meta), which replaces each sample's dict.
When two writers interleave between steps 1 and 3, the second one writes a dict that was read before the first one's tag landed, so the first tag is dropped.
Retry or bookkeeping logic that keeps state in tags (for example an attempt id written by one worker while another writes a score) silently loses one of the writes. Callers can work around it today by holding a lock around the update (the KV locks in #186), but a tag-only update should be safe on its own.
Suggested fix
Merge per key in the controller instead of on the client: send only the new tag entries, and have the controller apply them to the sample's existing dict (custom_meta.setdefault(idx, {}).update(new_tags)) in its single request loop. That makes each tag update atomic without any lock.
Activity