prevent excessive ring fragmentation due to repeated space requests
Merging a ring now indicates whether the ring has been updated. This prevents excessive allocation retries, which in turn can result in repeated space requests - i.e. if an allocation cannot proceed due to lack of space - which in turn can result in excessive ring fragmentation since many of the requests will result in the creation of a new ring entries, due to the need to split ranges. Fixes #2181.
This commit is contained in:
1 parent
0e54de63cc
commit
27632b118f
4 files changed
+72
-47
No files matched your search
+3
-3
@@ -709,7 +709,6 @@ func (alloc *Allocator) update(sender mesh.PeerName, msg []byte) error {
|
||||
reader := bytes.NewReader(msg)
|
||||
decoder := gob.NewDecoder(reader)
|
||||
var data gossipState
|
||||
var err error
|
||||
|
||||
if err := decoder.Decode(&data); err != nil {
|
||||
return err
|
||||
@@ -724,9 +723,10 @@ func (alloc *Allocator) update(sender mesh.PeerName, msg []byte) error {
|
||||
// If someone sent us a ring, merge it into ours. Note this will move us
|
||||
// out of the awaiting-consensus state if we didn't have a ring already.
|
||||
case data.Ring != nil:
|
||||
switch err = alloc.ring.Merge(*data.Ring); err {
|
||||
updated, err := alloc.ring.Merge(*data.Ring)
|
||||
switch err {
|
||||
case nil:
|
||||
if !alloc.ring.Empty() {
|
||||
if updated {
|
||||
alloc.pruneNicknames()
|
||||
alloc.ringUpdated()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user