Skip to content

Commit

Permalink
Turn off shared memory map access since it can crash with concurrent …
Browse files Browse the repository at this point in the history
…thread access
  • Loading branch information
kriszyp committed Nov 14, 2023
1 parent 3abd66b commit 6995358
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "lmdb",
"author": "Kris Zyp",
"version": "2.9.0-beta.2",
"version": "2.9.0",
"description": "Simple, efficient, scalable, high-performance LMDB interface",
"license": "MIT",
"repository": {
Expand Down
10 changes: 5 additions & 5 deletions src/cursor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ int CursorWrap::returnEntry(int lastRC, MDB_val &key, MDB_val &data) {
if (result) {
fits = valToBinaryFast(data, dw); // it fit in the global/compression-target buffer
}
if (fits || result == 2 || data.mv_size < SHARED_BUFFER_THRESHOLD) {// if it was decompressed
*((uint32_t*)keyBuffer) = data.mv_size;
*((uint32_t*)(keyBuffer + 4)) = 0; // buffer id of 0
} else {
//if (fits || result == 2 || data.mv_size < SHARED_BUFFER_THRESHOLD) {// if it was decompressed
*((uint32_t*)keyBuffer) = data.mv_size;
*((uint32_t*)(keyBuffer + 4)) = 0; // buffer id of 0
/* } else {
EnvWrap::toSharedBuffer(dw->ew->env, (uint32_t*) dw->ew->keyBuffer, data);
}
}*/
}
if (!(flags & VALUES_FOR_KEY)) {
memcpy(keyBuffer + 32, key.mv_data, key.mv_size);
Expand Down
14 changes: 7 additions & 7 deletions src/dbi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,14 @@ int32_t DbiWrap::doGetByBinary(uint32_t keySize, uint32_t ifNotTxnId, int64_t tx
if (result) {
fits = valToBinaryFast(data, this); // it fits in the global/compression-target buffer
}
if (fits || result == 2 || data.mv_size < SHARED_BUFFER_THRESHOLD) {// result = 2 if it was decompressed
if (data.mv_size < 0x80000000)
return data.mv_size;
*((uint32_t*)keyBuffer) = data.mv_size;
return -30000;
} else {
//if (fits || result == 2 || data.mv_size < SHARED_BUFFER_THRESHOLD) {// result = 2 if it was decompressed
if (data.mv_size < 0x80000000)
return data.mv_size;
*((uint32_t*)keyBuffer) = data.mv_size;
return -30000;
/*} else {
return EnvWrap::toSharedBuffer(ew->env, (uint32_t*) ew->keyBuffer, data);
}
}*/
}

NAPI_FUNCTION(directWrite) {
Expand Down

0 comments on commit 6995358

Please sign in to comment.