lightningstream icon indicating copy to clipboard operation
lightningstream copied to clipboard

Newer LMDB binary format are not supported

Open tbaumann opened this issue 1 year ago • 4 comments

When testing lightningstream with my own project written in JS (See https://github.com/kriszyp/lmdb-js/issues/267) I noticed that the files generated are not readable by lightningstream.

Apparently the LMDB libs were updated and new binary formats introduced. And lmdb-go is still using the old one. (https://github.com/kriszyp/lmdb-js/issues/273) Thankfully lmdb-js can fall-back to v1, but I wonder if it would be good to go with the new format here.

I guess this is more of a lmdb-go issue. Perhaps I should raise it there?

PS: In the first issue I posted I posted some code. Do you see any serious issues with it? It seems to work, but I don't have the feeling that lightningstream is yet much used outside the pdns project...

tbaumann avatar Mar 04 '24 12:03 tbaumann

Thanks for reporting!. It looks like LS is still on 1.9.0 of github.com/PowerDNS/lmdb-go. We need to update that to the latest 1.9.2.

wojas avatar Mar 05 '24 09:03 wojas

Giving it some more thought, I would actually be surprised that an LMDB patch release (from 0.9.28 to 0.9.31) would introduce an incompatible change to the database format.

None of the changelog entries appear to suggest any such change:

LMDB 0.9.31 Release (2023/07/10)
        ITS#8447 - Fix cursor_put(MDB_CURRENT) on DUPSORT DB with different sized data

LMDB 0.9.30 Release (2023/02/08)
        ITS#9806 - LMDB page_split: key threshold depends on page size
        ITS#9916 - avoid gcc optimization bug on sparc64 linux
        ITS#9919 - Mark infrequently used functions as cold
        ITS#9723 - clear C_EOF on cursor with MDB_FIRST_DUP
        ITS#9030 - Use sys/cachectl.h rather than asm/cachectl.h on mips

LMDB 0.9.29 Release (2021/03/16)
        ITS#9461 refix ITS#9376
        ITS#9500 fix regression from ITS#8662

I am not sure what you mean by a v1 and v2 format, this sounds like an lmdb-js thing, not an LMDB thing.

wojas avatar Mar 05 '24 10:03 wojas

https://github.com/kriszyp/lmdb-js/tree/dd08273cc5fa238eb86186f4b64506ee56470a51/dependencies - apparently v1 refers to the 'common' 0.9 lmdb branch, and 'not v1' refers to a copy or fork of https://github.com/LMDB/lmdb/tree/mdb.master3

Habbie avatar Mar 05 '24 10:03 Habbie

It seems to basically come down to two different versions of the lmdb lib. https://github.com/kriszyp/lmdb-js/blob/master/dependencies/lmdb-data-v1/libraries/liblmdb/CHANGES (v0.9.29) And https://github.com/kriszyp/lmdb-js/blob/master/dependencies/lmdb/libraries/liblmdb/lmdb.h which looks like v0.9.90

PS: Ah, thanks Habbie. Looks like you got more context while I was writing

tbaumann avatar Mar 05 '24 10:03 tbaumann