forked from TrueCloudLab/frostfs-node
[#132] Put new storage peers in netmap cleaner cache
There is an optimization to send ApprovePeer tx only in case if `touch` returns false. It returns false if node is not in the cache or it was flagged to removal. Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
0c42db2c3c
commit
118f7fb309
1 changed files with 8 additions and 5 deletions
|
@ -28,13 +28,16 @@ func (np *Processor) processAddPeer(node []byte) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
keyString := hex.EncodeToString(nodeInfo.PublicKey)
|
||||||
np.log.Info("approving network map candidate",
|
np.log.Info("approving network map candidate",
|
||||||
zap.String("key", hex.EncodeToString(nodeInfo.PublicKey)),
|
zap.String("key", keyString))
|
||||||
)
|
|
||||||
|
|
||||||
err = invoke.ApprovePeer(np.morphClient, np.netmapContract, node)
|
exists := np.netmapSnapshot.touch(keyString, np.epochState.EpochCounter())
|
||||||
if err != nil {
|
if !exists {
|
||||||
np.log.Error("can't invoke netmap.AddPeer", zap.Error(err))
|
err = invoke.ApprovePeer(np.morphClient, np.netmapContract, node)
|
||||||
|
if err != nil {
|
||||||
|
np.log.Error("can't invoke netmap.AddPeer", zap.Error(err))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue