[#758] ir: Do not exclude node in maintenance mode from netmap
All checks were successful
DCO action / DCO (pull_request) Successful in 2m59s
Build / Build Components (1.21) (pull_request) Successful in 4m18s
Build / Build Components (1.20) (pull_request) Successful in 4m45s
Vulncheck / Vulncheck (pull_request) Successful in 5m12s
Tests and linters / Tests (1.20) (pull_request) Successful in 9m11s
Tests and linters / Tests (1.21) (pull_request) Successful in 9m10s
Tests and linters / Staticcheck (pull_request) Successful in 9m6s
Tests and linters / Tests with -race (pull_request) Successful in 9m17s
Tests and linters / Lint (pull_request) Successful in 9m41s
All checks were successful
DCO action / DCO (pull_request) Successful in 2m59s
Build / Build Components (1.21) (pull_request) Successful in 4m18s
Build / Build Components (1.20) (pull_request) Successful in 4m45s
Vulncheck / Vulncheck (pull_request) Successful in 5m12s
Tests and linters / Tests (1.20) (pull_request) Successful in 9m11s
Tests and linters / Tests (1.21) (pull_request) Successful in 9m10s
Tests and linters / Staticcheck (pull_request) Successful in 9m6s
Tests and linters / Tests with -race (pull_request) Successful in 9m17s
Tests and linters / Lint (pull_request) Successful in 9m41s
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
5acc13fa94
commit
98da032324
2 changed files with 19 additions and 1 deletions
|
@ -24,6 +24,8 @@ type (
|
|||
epochStamp
|
||||
|
||||
binNodeInfo []byte
|
||||
|
||||
maintenance bool
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -58,6 +60,7 @@ func (c *cleanupTable) update(snapshot netmap.NetMap, now uint64) {
|
|||
}
|
||||
|
||||
access.binNodeInfo = binNodeInfo
|
||||
access.maintenance = nmNodes[i].IsMaintenance()
|
||||
|
||||
newMap[keyString] = access
|
||||
}
|
||||
|
@ -105,7 +108,7 @@ func (c *cleanupTable) forEachRemoveCandidate(epoch uint64, f func(string) error
|
|||
defer c.Unlock()
|
||||
|
||||
for keyString, access := range c.lastAccess {
|
||||
if epoch-access.epoch > c.threshold {
|
||||
if !access.maintenance && epoch-access.epoch > c.threshold {
|
||||
access.removeFlag = true // set remove flag
|
||||
c.lastAccess[keyString] = access
|
||||
|
||||
|
|
|
@ -124,6 +124,21 @@ func TestCleanupTable(t *testing.T) {
|
|||
}))
|
||||
require.EqualValues(t, len(infos)-1, cnt)
|
||||
})
|
||||
|
||||
t.Run("skip maintenance nodes", func(t *testing.T) {
|
||||
cnt := 0
|
||||
infos[1].SetMaintenance()
|
||||
key := netmap.StringifyPublicKey(infos[1])
|
||||
c.update(networkMap, 5)
|
||||
|
||||
require.NoError(t,
|
||||
c.forEachRemoveCandidate(5, func(s string) error {
|
||||
cnt++
|
||||
require.NotEqual(t, s, key)
|
||||
return nil
|
||||
}))
|
||||
require.EqualValues(t, len(infos)-1, cnt)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue