From: Howard Chu Date: Sat, 28 Oct 2006 08:33:00 +0000 (+0000) Subject: Add region-size patch for posterity X-Git-Tag: OPENLDAP_REL_ENG_2_3_MP~25 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f41d5a1cb111dcb9417211c1dfbe64520910aa27;p=openldap Add region-size patch for posterity --- diff --git a/build/db.4.2.52.patch b/build/db.4.2.52.patch new file mode 100644 index 0000000000..8386b00365 --- /dev/null +++ b/build/db.4.2.52.patch @@ -0,0 +1,55 @@ +As posted to http://www.openldap.org/lists/openldap-devel/200610/msg00027.html + +This is Sleepycat bug #14908. The provided patch is for 4.2.52. The +same bug is present in all versions up to 4.5.20 where it is fixed. + +-------- Original Message -------- +Subject: region size bug Re: [BDB-Alpha] Berkeley DB 4.5.8 ALPHA +Date: Mon, 10 Jul 2006 13:37:33 -0700 +From: Howard Chu +To: support@sleepycat.com +CC: support@symas.com +References: <45A742B5-7DD5-4512-A204-A10FE8FC5DFC@oracle.com> + + +I just ran into this in 4.2.52 but the same calculation occurs in 4.4 +and 4.5.8 alpha: + +This computation gives the wrong results when the number of cache +regions is greater than the number of gigabytes (which we encounter on +Linux using shared memory regions, which are constrained to much smaller +than a gigabyte each). + + +in mp/mp_region.c: + + + roff_t reg_size; + + + /* Figure out how big each cache region is. */ + reg_size = (roff_t)(dbenv->mp_gbytes / dbenv->mp_ncache) * GIGABYTE; + reg_size += ((roff_t)(dbenv->mp_gbytes % + dbenv->mp_ncache) * GIGABYTE) / dbenv->mp_ncache; + reg_size += dbenv->mp_bytes / dbenv->mp_ncache; + *reg_sizep = reg_size; + + +The first reg_size calculation always goes to zero when mp_ncache > +mp_gbytes. +This should have been, instead: + reg_size = GIGABYTE / dbenv->mp_ncache * dbenv->mp_gbytes; + +--- mp/mp_region.c.O 2003-06-30 10:20:19.000000000 -0700 ++++ mp/mp_region.c 2006-10-27 23:25:05.000000000 -0700 +@@ -43,9 +43,7 @@ + int htab_buckets, ret; + + /* Figure out how big each cache region is. */ +- reg_size = (dbenv->mp_gbytes / dbenv->mp_ncache) * GIGABYTE; +- reg_size += ((dbenv->mp_gbytes % +- dbenv->mp_ncache) * GIGABYTE) / dbenv->mp_ncache; ++ reg_size = GIGABYTE / dbenv->mp_ncache * dbenv->mp_gbytes; + reg_size += dbenv->mp_bytes / dbenv->mp_ncache; + + /*