hrissan@mail.ru wrote:
Full_Name: Hrissan Version: lmdb commit 26c7df88e44e31623d0802a564f24781acdefde3 OS: Windows 7 64-bit URL: ftp://ftp.openldap.org/incoming/ Submission from: (NULL) (108.61.166.173)
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 posix 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 fix for 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 #else typedef off_t lmdb_off_t; #endif
And using lmdb_off_t instead of off_t on 4 occasions where it is used.