|
|
6f51e1 |
From e52c519a8553dd8abee5740714054ebbdd59e51a Mon Sep 17 00:00:00 2001
|
|
|
6f51e1 |
From: William Brown <firstyear@redhat.com>
|
|
|
6f51e1 |
Date: Tue, 23 May 2017 11:03:24 +1000
|
|
|
6f51e1 |
Subject: [PATCH] Ticket 49267 - autosize split of 0 results in dbcache of 0
|
|
|
6f51e1 |
|
|
|
6f51e1 |
Bug Description: autosize split of 0 results in a dbcache of 0. This was
|
|
|
6f51e1 |
due to a missing bounds check on the value for 0. In theory this could
|
|
|
6f51e1 |
still be problematic if the value was say 1% ... But hopefully we don't
|
|
|
6f51e1 |
see that :)
|
|
|
6f51e1 |
|
|
|
6f51e1 |
Fix Description: Add the bounds check.
|
|
|
6f51e1 |
|
|
|
6f51e1 |
https://pagure.io/389-ds-base/issue/49267
|
|
|
6f51e1 |
|
|
|
6f51e1 |
Author: wibrown
|
|
|
6f51e1 |
|
|
|
6f51e1 |
Review by: mreynolds (Thanks!)
|
|
|
6f51e1 |
|
|
|
6f51e1 |
(cherry picked from commit 22d4865ea20acb6e6c11aed10d09241b09bb711c)
|
|
|
6f51e1 |
---
|
|
|
6f51e1 |
ldap/servers/slapd/back-ldbm/start.c | 14 +++++++++++++-
|
|
|
6f51e1 |
1 file changed, 13 insertions(+), 1 deletion(-)
|
|
|
6f51e1 |
|
|
|
6f51e1 |
diff --git a/ldap/servers/slapd/back-ldbm/start.c b/ldap/servers/slapd/back-ldbm/start.c
|
|
|
6f51e1 |
index a207bd8..1834a19 100644
|
|
|
6f51e1 |
--- a/ldap/servers/slapd/back-ldbm/start.c
|
|
|
6f51e1 |
+++ b/ldap/servers/slapd/back-ldbm/start.c
|
|
|
6f51e1 |
@@ -101,7 +101,11 @@ ldbm_back_start_autotune(struct ldbminfo *li) {
|
|
|
6f51e1 |
/* This doesn't control the availability of the feature, so we can take the
|
|
|
6f51e1 |
* default from ldbm_config.c
|
|
|
6f51e1 |
*/
|
|
|
6f51e1 |
- autosize_db_percentage_split = li->li_cache_autosize_split;
|
|
|
6f51e1 |
+ if (li->li_cache_autosize_split == 0) {
|
|
|
6f51e1 |
+ autosize_db_percentage_split = 40;
|
|
|
6f51e1 |
+ } else {
|
|
|
6f51e1 |
+ autosize_db_percentage_split = li->li_cache_autosize_split;
|
|
|
6f51e1 |
+ }
|
|
|
6f51e1 |
|
|
|
6f51e1 |
|
|
|
6f51e1 |
/* Check the values are sane. */
|
|
|
6f51e1 |
@@ -131,10 +135,18 @@ ldbm_back_start_autotune(struct ldbminfo *li) {
|
|
|
6f51e1 |
db_size = (autosize_db_percentage_split * zone_size) / 100;
|
|
|
6f51e1 |
|
|
|
6f51e1 |
/* Cap the DB size at 512MB, as this doesn't help perf much more (lkrispen's advice) */
|
|
|
6f51e1 |
+ /* NOTE: Do we need a minimum DB size? */
|
|
|
6f51e1 |
if (db_size > (512 * MEGABYTE)) {
|
|
|
6f51e1 |
db_size = (512 * MEGABYTE);
|
|
|
6f51e1 |
}
|
|
|
6f51e1 |
|
|
|
6f51e1 |
+ /* NOTE: Because of how we workout entry_size, even if
|
|
|
6f51e1 |
+ * have autosize split to say ... 90% for dbcache, because
|
|
|
6f51e1 |
+ * we cap db_size, we use zone_size - db_size, meaning that entry
|
|
|
6f51e1 |
+ * cache still gets the remaining memory *even* though we didn't use it all.
|
|
|
6f51e1 |
+ * If we didn't do this, entry_cache would only get 10% of of the avail, even
|
|
|
6f51e1 |
+ * if db_size was caped at say 5% down from 90.
|
|
|
6f51e1 |
+ */
|
|
|
6f51e1 |
if (backend_count > 0 ) {
|
|
|
6f51e1 |
/* Number of entry cache pages per backend. */
|
|
|
6f51e1 |
entry_size = (zone_size - db_size) / backend_count;
|
|
|
6f51e1 |
--
|
|
|
6f51e1 |
2.9.4
|
|
|
6f51e1 |
|