tdb_compat: respect TDB_NO_FSYNC environment variable for tdb2.
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 20 Jun 2011 09:10:34 +0000 (18:40 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 20 Jun 2011 10:32:08 +0000 (12:32 +0200)
I don't think this kind of hack belongs in the tdb2 source, but SAMBA uses
it to speed testing, so we should respect it: handle it in our compat
open wrapper.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-User: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date: Mon Jun 20 12:32:08 CEST 2011 on sn-devel-104

lib/tdb_compat/tdb_compat.c

index f432296a404cfc25685195d164643900826f94fc..a9173fc33d0c79cca35cb130c125c8d3c642b3a3 100644 (file)
@@ -90,6 +90,12 @@ tdb_open_compat_(const char *name, int hash_size_unused,
                attr = &cif;
                tdb_flags &= ~TDB_CLEAR_IF_FIRST;
        }
+
+       /* Testsuite uses this to speed things up. */
+       if (getenv("TDB_NO_FSYNC")) {
+               tdb_flags |= TDB_NOSYNC;
+       }
+
        return tdb_open(name, tdb_flags|TDB_ALLOW_NESTING, open_flags, mode,
                        attr);
 }