Skip to content

Commit

Permalink
Backport 1.6.3: replication: Don't write request coutners on DR Secon…
Browse files Browse the repository at this point in the history
…dary nodes (#10936) (#10970)

* replication: Don't write request coutners on DR Secondary nodes (#10936)

* Add changelog

* Update 10970.txt
  • Loading branch information
briankassouf authored Feb 22, 2021
1 parent f987079 commit ada9fb1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
4 changes: 4 additions & 0 deletions changelog/10970.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```release-note:bug
replication (enterprise): Don't write request count data on DR Secondaries.
Fixes DR Secondaries becoming out of sync approximately every 30s.
```
17 changes: 11 additions & 6 deletions vault/core_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,18 @@ import (

func (c *Core) metricsLoop(stopCh chan struct{}) {
emitTimer := time.Tick(time.Second)
writeTimer := time.Tick(c.counters.syncInterval)

identityCountTimer := time.Tick(time.Minute * 10)
// Only emit on active node of cluster that is not a DR cecondary.
if standby, _ := c.Standby(); standby || c.IsDRSecondary() {
identityCountTimer = nil
}

writeTimer := time.Tick(c.counters.syncInterval)
// Do not process the writeTimer on DR Secondary nodes
if c.IsDRSecondary() {
writeTimer = nil
}

// This loop covers
// vault.expire.num_leases
Expand Down Expand Up @@ -68,11 +78,6 @@ func (c *Core) metricsLoop(stopCh chan struct{}) {
}
c.stateLock.RUnlock()
case <-identityCountTimer:
// Only emit on active node of cluster that is not a DR cecondary.
if standby, _ := c.Standby(); standby || c.IsDRSecondary() {
break
}

// TODO: this can be replaced by the identity gauge counter; we need to
// sum across all namespaces.
go func() {
Expand Down

0 comments on commit ada9fb1

Please sign in to comment.