Version: lmdb commit 26c7df88e44e31623d0802a564f24781acdefde3
OS: Windows 7 64-bit
Submission from: (NULL) (184.108.40.206)
Dear Howard, lots of thanks for quick fix of ITS#8891, now another issue...
I know your position that Microsoft Visual Studio is crap (it may be, but not
everyone has a choice), but here is the problem:
When building LMDB targeting Win64 using 64-bit compiler in Microsoft Visual
Studio, the database will still be limited to just 2 gigabytes, with mdb_put
returning error as soon as database attempts to grow beyond that.
The problem is "off_t" is incorrectly defined as "long" in MSVC
compatibility layer, and long is 32-bit on windows 64-bit build. As a result
mdb_page_flush (and other functions using off_t) become broken.
I understand this is Microsoft's, not LMDB issue, but still LMDB source contains
lots of workarounds, so probably adding one will save the day for many ppl.
Microsoft has this issue since at least 2008 (And it is still there in latest
Visual Studio Community 2017 version 15.7.6), so no hope for fix from them.
I propose the following fix (as narrow as possible - for example no
MinGW on Windows or MSVC on Linux)
There's no logic in this proposal. The bug is clearly in the MS header files;
the correct fix is to edit the MS header files and use the proper definition.
Fix the actual bugs. Report the actual bugs to the people that are actually
responsible for them.
#if defined(_WIN32) && defined(_MSC_VER)
typedef long long int lmdb_off_t; // 64-bit on both 32- and 64- bit Windows
typedef off_t lmdb_off_t;
And using lmdb_off_t instead of off_t on 4 occasions where it is used.
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/