Honour ldb:nosync properly
Andrew Bartlett
abartlet at samba.org
Sun Jun 3 10:48:42 UTC 2018
Attached are patches to make this work, both on metadata.tdb and from
python. Mostly this isn't noticed as TDB_NO_FSYNC=1 is often set also.
CI pipeline:
https://gitlab.com/catalyst-samba/samba/pipelines/23095770
Please review and push. This helps us measure LMDB performance against
TDB on a fair basis (as well as data imports).
Thanks,
Andrew Bartlett
--
Andrew Bartlett http://samba.org/~abartlet/
Authentication Developer, Samba Team http://samba.org
Samba Developer, Catalyst IT http://catalyst.net.nz/services/samba
-------------- next part --------------
From 5fdb05e3732b00cd6f213e4d4f7a0648ece37195 Mon Sep 17 00:00:00 2001
From: Andrew Bartlett <abartlet at samba.org>
Date: Sun, 3 Jun 2018 18:35:15 +1200
Subject: [PATCH 1/2] pyldb-samba: Use the same smb.conf variable name as the C
wrapper users for LDB_FLG_NOSYNC
This was never noticed as most wrappers on make test run with TDB_NO_FSYNC
However ldb_mdb has not been told to use this (naturally) and so we rely
on the smb.conf setting to not force an fsync().
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13461
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
---
python/samba/__init__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/python/samba/__init__.py b/python/samba/__init__.py
index 20c7db2bc6c..7b3c6538771 100644
--- a/python/samba/__init__.py
+++ b/python/samba/__init__.py
@@ -105,7 +105,7 @@ class Ldb(_Ldb):
# Allow admins to force non-sync ldb for all databases
if lp is not None:
- nosync_p = lp.get("nosync", "ldb")
+ nosync_p = lp.get("ldb:nosync")
if nosync_p is not None and nosync_p:
flags |= ldb.FLG_NOSYNC
--
2.14.3
From 8317779c466f0237f2f9342f69242060a7c9be86 Mon Sep 17 00:00:00 2001
From: Andrew Bartlett <abartlet at samba.org>
Date: Sun, 3 Jun 2018 18:36:47 +1200
Subject: [PATCH 2/2] dsdb: Honour LDB_FLG_NOSYNC for metadata.tdb
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13462
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
---
source4/dsdb/samdb/ldb_modules/partition_metadata.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/source4/dsdb/samdb/ldb_modules/partition_metadata.c b/source4/dsdb/samdb/ldb_modules/partition_metadata.c
index d44947232ae..197e7b092e0 100644
--- a/source4/dsdb/samdb/ldb_modules/partition_metadata.c
+++ b/source4/dsdb/samdb/ldb_modules/partition_metadata.c
@@ -187,7 +187,7 @@ static int partition_metadata_open(struct ldb_module *module, bool create)
struct partition_private_data *data;
struct loadparm_context *lp_ctx;
char *filename, *dirname;
- int open_flags;
+ int open_flags, tdb_flags, ldb_flags;
struct stat statbuf;
data = talloc_get_type_abort(ldb_module_get_private(module),
@@ -237,9 +237,17 @@ static int partition_metadata_open(struct ldb_module *module, bool create)
lp_ctx = talloc_get_type_abort(ldb_get_opaque(ldb, "loadparm"),
struct loadparm_context);
+ tdb_flags = lpcfg_tdb_flags(lp_ctx, TDB_DEFAULT|TDB_SEQNUM);
+
+ ldb_flags = ldb_module_flags(ldb);
+
+ if (ldb_flags & LDB_FLG_NOSYNC) {
+ tdb_flags |= TDB_NOSYNC;
+ }
+
data->metadata->db = tdb_wrap_open(
data->metadata, filename, 10,
- lpcfg_tdb_flags(lp_ctx, TDB_DEFAULT|TDB_SEQNUM), open_flags, 0660);
+ tdb_flags, open_flags, 0660);
if (data->metadata->db == NULL) {
talloc_free(tmp_ctx);
if (create) {
--
2.14.3
More information about the samba-technical
mailing list