Skip to content

Commit

Permalink
test: add comprehensive testing for the semi-sync monitor
Browse files Browse the repository at this point in the history
Signed-off-by: Manan Gupta <manan@planetscale.com>
  • Loading branch information
GuptaManan100 committed Feb 17, 2025
1 parent da4a8f8 commit 6cf02ab
Show file tree
Hide file tree
Showing 2 changed files with 721 additions and 1 deletion.
8 changes: 7 additions & 1 deletion go/vt/vttablet/tabletmanager/semisyncmonitor/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ const (
clearTimerDuration = 24 * time.Hour
)

var (
// waitBetweenWrites is the time to wait between consecutive writes.
// This is a variable instead of a constant only to be tweaked in tests.
waitBetweenWrites = 1 * time.Second
)

// Monitor is a monitor that checks if the primary tablet
// is blocked on a semi-sync ack from the replica.
// If the semi-sync ACK is lost in the network,
Expand Down Expand Up @@ -262,7 +268,7 @@ func (m *Monitor) startWrites() {
// exponentially backing off. We will not do more than maxWritesPermitted writes and once
// all maxWritesPermitted writes are blocked, we'll wait for VTOrc to run an ERS.
go m.write()
<-time.After(1 * time.Second)
<-time.After(waitBetweenWrites)
}
}

Expand Down
Loading

0 comments on commit 6cf02ab

Please sign in to comment.