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
Unique guards: upserts race with creates, floats cannot be written back, and collections are accepted #82
Priority: medium. Three ways unique guards get out of step with their items:
An upsert that finds no item adds no "still missing" condition (repository.py, upserts in _plan_update; _plan_put adds partition.not_exists() in this case). If another writer creates the item with its own unique value between the read and the transaction, the upsert overwrites that value and never deletes the other writer's guard, which stays taken forever. Reproduced with a middleware that creates the item right after the upsert's GetItem.
Unique float fields cannot be written after a read (_plan_guards compares guard values with ==): the stored Decimal("0.1") differs from the float 0.1, so the plan deletes and puts the same guard item, which DynamoDB refuses ("cannot include multiple operations on one item"). save(), put() and update(latitude.set(0.1)) of a read-back instance fail even with the value unchanged. Compare with stored_identity.
unique=True is accepted on set, list and map fields (schema.py, constraints.py): the guard key is str(value), and a set's text depends on the hash seed, so processes compute different guards for the same value. Refuse it, or render a canonical form.
Found in a review of the library for bugs (fctl session); the fixes that fit in its ten pull requests are #61 to #65, #67 to #70 and #72.
Activity
fix(unique)!: upserts that race with creates, unique floats written b…