Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix build on aarch64 (e.g. Apple Silicon)#218

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
benalexau merged 3 commits intolmdbjava:masterfromwardle:master
Apr 25, 2023
Merged

Fix build on aarch64 (e.g. Apple Silicon)#218

benalexau merged 3 commits intolmdbjava:masterfromwardle:master
Apr 25, 2023

Conversation

@wardle
Copy link
Contributor

@wardlewardle commentedApr 25, 2023
edited
Loading

This pull request adopts an approach in which it is the library client that must consider appropriate map sizes. This is because map size is determined by the use case, and by system architecture. The documentation for LMDB clearly states that map size must be a multiple of the OS virtual memory page size. For most architectures this remains 4KiB, but newer architectures such as aarch64 have used 16KiB or 64KiB. Apple Silicon uses 16KiB.

As such, this pull request only changes tests so that the test suite passes on architectures with a larger page size than 4KiB.

The alternative is to help clients by massaging requested map sizes into something a multiple of the current architecture's page size, but this might be brittle. I would think it a reasonable assumption that consumers of lmdbjava will understand the issues here [although on reflection, perhaps the javadoc should make this very clear]. LMDB itself makes no attempt to fix map size based on its knowledge of system architecture and page size, and I think it reasonable that lmdbjava adopts that approach.

On MacBook Pro M1:

[INFO] [INFO] -------------------------------------------------------[INFO]  T E S T S[INFO] -------------------------------------------------------[INFO] Running org.lmdbjava.MetaTest[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.229 s - in org.lmdbjava.MetaTest[INFO] Running org.lmdbjava.ResultCodeMapperTest[INFO] Tests run: 9, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.039 s - in org.lmdbjava.ResultCodeMapperTest[INFO] Running org.lmdbjava.ByteBufferProxyTest[INFO] Tests run: 10, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.253 s - in org.lmdbjava.ByteBufferProxyTest[INFO] Running org.lmdbjava.KeyRangeTest[INFO] Tests run: 19, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.031 s - in org.lmdbjava.KeyRangeTest[INFO] Running org.lmdbjava.ComparatorTest[INFO] Tests run: 21, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.283 s - in org.lmdbjava.ComparatorTest[INFO] Running org.lmdbjava.TxnTest[INFO] Tests run: 27, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.277 s - in org.lmdbjava.TxnTest[INFO] Running org.lmdbjava.CursorParamTest[INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.296 s - in org.lmdbjava.CursorParamTest[INFO] Running org.lmdbjava.TargetNameTest[INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.027 s - in org.lmdbjava.TargetNameTest[INFO] Running org.lmdbjava.MaskedFlagTest[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.026 s - in org.lmdbjava.MaskedFlagTest[INFO] Running org.lmdbjava.CursorTest[INFO] Tests run: 23, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.271 s - in org.lmdbjava.CursorTest[INFO] Running org.lmdbjava.VerifierTest[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.274 s - in org.lmdbjava.VerifierTest[INFO] Running org.lmdbjava.CursorIterableTest[INFO] Tests run: 28, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.278 s - in org.lmdbjava.CursorIterableTest[INFO] Running org.lmdbjava.EnvTest[INFO] Tests run: 24, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.657 s - in org.lmdbjava.EnvTest[INFO] Running org.lmdbjava.LibraryTest[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.25 s - in org.lmdbjava.LibraryTest[INFO] Running org.lmdbjava.DbiTest[INFO] Tests run: 35, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.595 s - in org.lmdbjava.DbiTest[INFO] Running org.lmdbjava.TutorialTest[INFO] Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.268 s - in org.lmdbjava.TutorialTest[INFO] Running org.lmdbjava.GarbageCollectionTest[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.881 s - in org.lmdbjava.GarbageCollectionTest[INFO] [INFO] Results:[INFO] [INFO] Tests run: 222, Failures: 0, Errors: 0, Skipped: 0[INFO] [INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESS[INFO] ------------------------------------------------------------------------[INFO] Total time:  22.972 s[INFO] Finished at: 2023-04-25T07:40:07+01:00[INFO] ------------------------------------------------------------------------

benalexau reacted with thumbs up emoji
Most architectures such as x86 and x86-64 use 4KiB, while aarch64 systems can use 4, 16 or 64KiB. Apple Silicon machines currently have 16KiB page sizes. The LMDB documentation states that map size should be a multiple of the page size, so a 100KiB default map size for tests fails for systems with a page size that is not 4 KiB.This commit simply increases the map size for tests. Of course, this applies only to these tests, as in production, users can choose the appropriate map size for their requirements and system architecture. It is not straightforward to determine architecture page size at runtime. Otherwise, it might be more appropriate to dynamically determine a minimum map size.
The options for determining architecture page size are a) environment variables, b) unsafe and undocumented JDK internals or c) looking to get answer using FFI. Given this test is asking checking the statistics returned by LMDB, on balance it is reasonable to simply validate we're getting a multiple of 4096 in the statistics report.
@benalexaubenalexau merged commit838a8a0 intolmdbjava:masterApr 25, 2023
@benalexau
Copy link
Member

Thanks@wardle, much appreciated!

wardle reacted with thumbs up emoji

@wardle
Copy link
ContributorAuthor

It's the least I can do. Thank you for all your work!

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

Reviewers

@benalexaubenalexaubenalexau left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@wardle@benalexau

[8]ページ先頭

©2009-2025 Movatter.jp