Skip to content
This repository was archived by the owner on Dec 1, 2024. It is now read-only.
/ rocksdb Public archive

use napi_create_int64 for approximate size#175

Merged
vweevers merged 1 commit intoLevel:masterfrom
larskuhtz:large-approximate-size
Aug 1, 2021
Merged

use napi_create_int64 for approximate size#175
vweevers merged 1 commit intoLevel:masterfrom
larskuhtz:large-approximate-size

Conversation

@larskuhtz
Copy link
Contributor

The PR is a port of this change from Level/leveldown.

Currently the binding for approximateSize stores the result as uint32. This supports only databases of up to 4GB and returns wrong results for larger DBs.

The PR changes the code to use the full uint64 that is returned from RocksDB and converts it to a Javascript number using napi_create_int64. The result is approximate for values that do not satisfy Number.isSafeInteger(). This should be fine because the original value returned by RocksDB is "approximate" in first place.

Copy link
Member

@vweevers vweevers left a comment

Choose a reason for hiding this comment

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

Thank you!

@vweevers vweevers merged commit 891bb7a into Level:master Aug 1, 2021
@vweevers
Copy link
Member

5.1.0

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants