4 ms·
Question about the buffered writes and invalidation: is there anything that prevents race conditions between a Del() and a prior Set() on the same key? Just gla
by jeffomatic 7y ago
Question about the buffered writes and invalidation: is there anything that prevents race conditions between a Del() and a prior Set() on the same key? Just glancing at the source, it looks Set() ends up in a channel send, whereas Del() seems to synchronously update the internal map.
- NovaX 7y agoI am not familiar with the Go code, but in the Java version (Caffeine) this is handled by a per-entry state machine. The entry is written to the Map first and the policy work buffered for replaying. If the replay occurs out-of-order (e.g. context switch before appending causing removal=>add), then the entry's state guards against policy corruption. This may not be necessary in their case due to using a sampling policy and other differences.
- mrjn 7y agoFeel free to file an issue. That could cause correctness issue in Ristretto as of today.
- mrjn 7y agoThis issue would fixed with this PR: https://github.com/dgraph-io/ristretto/pull/62 https://github.com/dgraph-io/ristretto/pull/62