Merge pull request #116477 from twz123/synctrack-64bit-alignment

Properly align synctrack.SingleFileTracker struct
This commit is contained in:
Kubernetes Prow Robot 2023-03-13 12:15:02 -07:00 committed by GitHub
commit 077ca3b736
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,9 +78,13 @@ func (t *AsyncTracker[T]) HasSynced() bool {
// SingleFileTracker helps propagate HasSynced when events are processed in
// order (i.e. via a queue).
type SingleFileTracker struct {
UpstreamHasSynced func() bool
// Important: count is used with atomic operations so it must be 64-bit
// aligned, otherwise atomic operations will panic. Having it at the top of
// the struct will guarantee that, even on 32-bit arches.
// See https://pkg.go.dev/sync/atomic#pkg-note-BUG for more information.
count int64
UpstreamHasSynced func() bool
}
// Start should be called prior to processing each key which is part of the