Ensure deterministic ordering of keys when applying KVCache

This commit is contained in:
Ethan Frey 2017-08-03 17:07:59 +02:00
parent 7cf20ef70a
commit e63f3bc2d9
1 changed files with 2 additions and 1 deletions

View File

@ -131,7 +131,8 @@ func (c *MemKVCache) Commit(sub SimpleDB) error {
// applyCache will apply all the cache methods to the underlying store
func (c *MemKVCache) applyCache() {
for k, v := range c.cache.m {
for _, k := range c.cache.keysInRange(nil, nil) {
v := c.cache.m[k]
if v == nil {
c.store.Remove([]byte(k))
} else {