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

Cursor.Get handles key return values specicially for Set #97

Merged
merged 5 commits into from
Jan 28, 2017

Conversation

bmatsuo
Copy link
Owner

@bmatsuo bmatsuo commented Jan 28, 2017

Fixes #96

Issue #56 illustrated that working with Go memory using "C-style" memory
does not work well in modern Go runtimes. That problem was thought to
be properly addressed, but #96 showed a lingering case where Set does
not modify MDB_val key passed to mdb_cursor_get.

This commit addresses this lingering case by special-casing return value
processing for the Set operation of Cursor.Get. If LMDB will not modify
the MDB_val, the returned key must use non-standard methods for copying
the value. Likewise, when txn.RawRead is true the Cursor.Get must use a
special method to ensure that the returned key shares memory with the
corresponding input argument.

Fixes #96

Issue #56 illustrated that working with Go memory using "C-style" access
patterns does not work well in modern Go runtimes.  That problem was
thought to be properly addressed, but #96 showed a lingering case where
Set does not modify MDB_val key passed to mdb_cursor_get.

This commit addresses this lingering case by special-casing return value
processing for the Set operation of Cursor.Get.  If LMDB will not modify
the MDB_val, the returned key must use non-standard methods for copying
the value.  Likewise, when txn.RawRead is true the Cursor.Get must use a
special method to ensure that the returned key shares memory with the
corresponding input argument.
@bmatsuo bmatsuo merged commit 8edc62c into master Jan 28, 2017
bmatsuo added a commit that referenced this pull request Jan 28, 2017
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