[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#8021) Wrong mdb_env_sync() with at least MDB_RDONLY



h.b.furuseth@usit.uio.no wrote:
> Full_Name: Hallvard B Furuseth
> Version: lmdb 0.9.14
> OS:
> URL:
> Submission from: (NULL) (81.191.45.22)
> Submitted by: hallvard
>
>
> mdb_env_sync() works with MDB_RDONLY at least on Unix, but
> it syncs MDB_WRITEMAP changes incorrectly: fdatasync instead
> of msync because mdb_env_open() cleared MDB_WRITEMAP.
>
> Users are likely doing the same thing anyway: Using MDB_RDONLY
> instead of MDB_RDONLY|MDB_WRITEMAP on WRITEMAP-written DBs.

mdb_env_sync() shouldn't even be doing any work at all if the env was 
opened RDONLY. We should return nop in that case. RDONLY means RDONLY! 
No writes, no calls that will alter the storage layer.

-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/