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

Re: (ITS#7682) LMDB: [PATCH] mdb_env_copy should retry open() if O_DIRECT fails

h.b.furuseth@usit.uio.no wrote:
> This was fixed in LMDB 0.9.9, except:  If both O_DIRECT and
> F_NOCACHE are #defined, both are used.  Looks a bit strange.
> Maybe just one should be used in that case.  (Which?)  Also I'm
> still wondering if env_open needs to fail if F_NOCACHE fails.
> Anyway, maybe it should be something like this.  The "else {}"
> is in case O_DIRECT is an unsupported dummy definiton:

Isn't that in the wrong order then? What you suggest here will use O_DIRECT 
even if it's a dummy.

I don't see any reason to fail the operation. They just want to make a 
copy/backup; even if the optimization of avoiding pollution of the buffer 
cache can't be done, they still want the copy to happen.

> #ifdef O_DIRECT
>      if ((rc = fcntl(newfd, F_GETFL)) != -1)
>          (void) fcntl(newfd, F_SETFL, rc | O_DIRECT);
>      else
> #endif
>      {
> #ifdef F_NOCACHE    /* __APPLE__ */
>          (void) fcntl(newfd, F_NOCACHE, 1);
> #endif
>      }

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