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

Remove the usage of atomic package #582

Closed
wants to merge 2 commits into from
Closed

Remove the usage of atomic package #582

wants to merge 2 commits into from

Conversation

ahrtr
Copy link
Member

@ahrtr ahrtr commented Oct 20, 2023

Fix #577

To resolve the 64bit unaligned issue on arm32.

FYI. https://pkg.go.dev/sync/atomic#pkg-note-BUG

@ahrtr ahrtr marked this pull request as draft October 20, 2023 15:34
@ahrtr ahrtr marked this pull request as ready for review October 20, 2023 18:31
to resolve the 64bit unaligned issue in arm32 by partially reverting
#373.

Refer to discussion in #577

Signed-off-by: Benjamin Wang <wachao@vmware.com>
Refer to #213

Signed-off-by: Benjamin Wang <wachao@vmware.com>
// Note that `Cursor()` may be called by multiple readonly
// transactions concurrently, so we need to hold the lock
// `statlock` when updating the stats.
b.tx.db.statlock.Lock()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that's very nitpicky, but do you know what the perf difference here would be? The cursor is pretty widely used and just taking a lock to increment an int seems a bit much.

tx.stats.IncPageCount(int64(count))
tx.stats.IncPageAlloc(int64(count * tx.db.pageSize))
tx.stats.PageCount += count
tx.stats.PageAlloc += count * tx.db.pageSize
Copy link
Contributor

@tjungblu tjungblu Oct 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

count * tx.db.pageSize

could this overflow? count and page size are int32. edit: this certainly existed before, but maybe we should just declare count int64 directly.

@ahrtr
Copy link
Member Author

ahrtr commented Oct 23, 2023

Won't continue to work on this PR. Let's follow #584

@ahrtr ahrtr closed this Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

panic: 64bit unaligned in arm32
2 participants