Skip to content

TSM1 reader accessor struct: ensure 64bit alignment#1

Open
skladd wants to merge 1 commit into
simonvetter:1.8.10+big_db_32bitfrom
skladd:1.8.10+big_db_32bit+fix-alignment
Open

TSM1 reader accessor struct: ensure 64bit alignment#1
skladd wants to merge 1 commit into
simonvetter:1.8.10+big_db_32bitfrom
skladd:1.8.10+big_db_32bit+fix-alignment

Conversation

@skladd
Copy link
Copy Markdown

@skladd skladd commented May 22, 2023

  • use pointers to allocated uin64 values instead field values
  • fixes "panic: unaligned 64-bit atomic operation" with Golang v1.20

…64bit alignment

fixes "panic: unaligned 64-bit atomic operation" with Golang v1.20
@skladd
Copy link
Copy Markdown
Author

skladd commented May 22, 2023

If compiling with go 1.20, influxd crashed after some time:

panic: unaligned 64-bit atomic operation

goroutine 23 [running]:
runtime/internal/atomic.panicUnaligned()
    /usr/lib/go-1.20/src/runtime/internal/atomic/unaligned.go:8 +0x24
runtime/internal/atomic.Xadd64(0x30bad54, 0x1)
    /usr/lib/go-1.20/src/runtime/internal/atomic/atomic_arm.s:258 +0x14
github.com/influxdata/influxdb/tsdb/engine/tsm1.(*accessor).incAccess(...)
    /go/github.com/simonvetter/influxdb/tsdb/engine/tsm1/reader.go:1497

This error didn't occur with golang 1.16.
Golang 1.19 brought own atomic.Uint64 types ensuring correct alignment, but this would break compiling using older go releases. Hence this fix via pointers.

Notes regarding alignment for atomic functions:
https://pkg.go.dev/sync/atomic#pkg-notes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant