[SCM] Samba Shared Repository - branch master updated
Andrew Bartlett
abartlet at samba.org
Tue Mar 31 01:27:02 UTC 2020
The branch, master has been updated
via 89041a6d18a lib ldb: lmdb clear stale readers on write txn start
from 1cc250b46e9 s3: smbd: RIP smb_filename->original_lcomp.
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 89041a6d18a1d091ea713e6986cac5ca66c2b481
Author: Gary Lockyer <gary at catalyst.net.nz>
Date: Mon Mar 30 12:08:30 2020 +1300
lib ldb: lmdb clear stale readers on write txn start
In use process failures and Bind9 shut downs leave stale entries in the
lmdb reader table. This can result in lmdb filling it's database file, as
the free list can not be reclaimed due to the stale reader.
In this fix we call mdb_reader_check at the start of each transaction,
to free any stale readers. As the default maximum number of readers is
127, this should not impact on performance to any great extent.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14330
Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Tue Mar 31 01:26:07 UTC 2020 on sn-devel-184
-----------------------------------------------------------------------
Summary of changes:
lib/ldb/ldb_mdb/ldb_mdb.c | 17 +++++++++++++++++
lib/ldb/tests/ldb_lmdb_free_list_test.c | 7 ++++++-
2 files changed, 23 insertions(+), 1 deletion(-)
Changeset truncated at 500 lines:
diff --git a/lib/ldb/ldb_mdb/ldb_mdb.c b/lib/ldb/ldb_mdb/ldb_mdb.c
index 6c679c214b8..1187aba578a 100644
--- a/lib/ldb/ldb_mdb/ldb_mdb.c
+++ b/lib/ldb/ldb_mdb/ldb_mdb.c
@@ -641,6 +641,23 @@ static int lmdb_transaction_start(struct ldb_kv_private *ldb_kv)
return LDB_ERR_PROTOCOL_ERROR;
}
+ /*
+ * Clear out any stale readers
+ */
+ {
+ int stale;
+ mdb_reader_check(lmdb->env, &stale);
+ if (stale > 0) {
+ ldb_debug(
+ lmdb->ldb,
+ LDB_DEBUG_ERROR,
+ "LMDB Stale readers, deleted (%d)",
+ stale);
+ }
+ }
+
+
+
ltx_head = lmdb_private_trans_head(lmdb);
tx_parent = lmdb_trans_get_tx(ltx_head);
diff --git a/lib/ldb/tests/ldb_lmdb_free_list_test.c b/lib/ldb/tests/ldb_lmdb_free_list_test.c
index fe78e3ab702..9b295460730 100644
--- a/lib/ldb/tests/ldb_lmdb_free_list_test.c
+++ b/lib/ldb/tests/ldb_lmdb_free_list_test.c
@@ -617,7 +617,12 @@ static void test_free_list_stale_reader(void **state)
ret = ldb_kv->kv_ops->finish_write(ldb_kv);
assert_int_equal(ret, LDB_SUCCESS);
}
- assert_int_equal(ret, LDB_ERR_BUSY);
+ /*
+ * We now do an explicit clear of stale readers at the start of a
+ * write transaction so should not get LDB_ERR_BUSY any more
+ * assert_int_equal(ret, LDB_ERR_BUSY);
+ */
+ assert_int_equal(ret, LDB_SUCCESS);
assert_int_not_equal(i, 0);
/*
--
Samba Shared Repository
More information about the samba-cvs
mailing list