Fix concurrent map access.

Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>
This commit is contained in:
Goutham Veeramachaneni 2017-05-24 16:58:04 +05:30
parent bacb143b7e
commit c211ec4f49
No known key found for this signature in database
GPG key ID: F1C217E8E9023CAD

View file

@ -260,9 +260,12 @@ Outer:
return err
}
// Map is accessed in other places also, so protect it.
h.mtx.Lock()
for k, v := range newStones {
h.tombstones[k] = h.tombstones[k].add(v[0])
}
h.mtx.Unlock()
h.meta.NumTombstones = int64(len(h.tombstones))
return nil