mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 13:44:05 -08:00
Moves the atomically accessed member to the top of the struct (#7365)
* Moves the 64bit atomically accessed field to the top of the struct. Signed-off-by: Bryan Varner <1652015+bvarner@users.noreply.github.com> * Moves the 64bit atomically accessed field to the top of the struct. Signed-off-by: Bryan Varner <1652015+bvarner@users.noreply.github.com> * Fixing up go fmt formatting issues. Signed-off-by: Bryan Varner <1652015+bvarner@users.noreply.github.com> Co-authored-by: Bryan Varner <1652015+bvarner@users.noreply.github.com>
This commit is contained in:
parent
ef4d8a38ca
commit
1627d234da
|
@ -78,13 +78,16 @@ func (e *CorruptionErr) Error() string {
|
||||||
// ChunkDiskMapper is for writing the Head block chunks to the disk
|
// ChunkDiskMapper is for writing the Head block chunks to the disk
|
||||||
// and access chunks via mmapped file.
|
// and access chunks via mmapped file.
|
||||||
type ChunkDiskMapper struct {
|
type ChunkDiskMapper struct {
|
||||||
|
// Keep all 64bit atomically accessed variables at the top of this struct.
|
||||||
|
// See https://golang.org/pkg/sync/atomic/#pkg-note-BUG for more info.
|
||||||
|
curFileNumBytes int64 // Bytes written in current open file.
|
||||||
|
|
||||||
/// Writer.
|
/// Writer.
|
||||||
dir *os.File
|
dir *os.File
|
||||||
|
|
||||||
curFile *os.File // File being written to.
|
curFile *os.File // File being written to.
|
||||||
curFileSequence int // Index of current open file being appended to.
|
curFileSequence int // Index of current open file being appended to.
|
||||||
curFileMaxt int64 // Used for the size retention.
|
curFileMaxt int64 // Used for the size retention.
|
||||||
curFileNumBytes int64 // Bytes written in current open file.
|
|
||||||
|
|
||||||
byteBuf [MaxHeadChunkMetaSize]byte // Buffer used to write the header of the chunk.
|
byteBuf [MaxHeadChunkMetaSize]byte // Buffer used to write the header of the chunk.
|
||||||
chkWriter *bufio.Writer // Writer for the current open file.
|
chkWriter *bufio.Writer // Writer for the current open file.
|
||||||
|
|
Loading…
Reference in a new issue