From 69953582b6d1ad94904c2fb1813b74a6464ffb3c Mon Sep 17 00:00:00 2001 From: Kris Zyp Date: Tue, 14 Nov 2023 16:29:40 -0700 Subject: [PATCH] Turn off shared memory map access since it can crash with concurrent thread access --- package.json | 2 +- src/cursor.cpp | 10 +++++----- src/dbi.cpp | 14 +++++++------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 623ffb590..dadeb2eaf 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/cursor.cpp b/src/cursor.cpp index dbfaf86e3..cdebef13d 100644 --- a/src/cursor.cpp +++ b/src/cursor.cpp @@ -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); diff --git a/src/dbi.cpp b/src/dbi.cpp index a0730c0d5..d2ca143c9 100644 --- a/src/dbi.cpp +++ b/src/dbi.cpp @@ -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) {