Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport 1.6.3: replication: Don't write request counters on DR Secondary nodes (#10936) #10970

Merged
merged 3 commits into from
Feb 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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