[Date Prev][Date Next] [Chronological] [Thread] [Top]

FW: problem with alternate hash functions



FYI. This bug report is relevant to the current back-bdb since I have
recently changed the attribute indices to hash databases with a pass-thru
hash function.

  -- Howard Chu
  Chief Architect, Symas Corp.       Director, Highland Sun
  http://www.symas.com               http://highlandsun.com/hyc
  Symas: Premier OpenSource Development and Support

-----Original Message-----
From: Howard Chu [mailto:hyc@highlandsun.com]
Sent: Monday, December 17, 2001 6:44 PM
To: support@sleepycat.com
Subject: problem with alternate hash functions


The same problem exists in both 3.3.11 and 4.0.14. If a hash database is
created with a user-specified hash function, the standard utilities like
db_stat and db_dump will be unable to open the database. There is a test in
hash/hash.c which checks to see if the database was opened ReadOnly, to
ignore the hash function mismatch. However, the test uses the wrong flag, so
the open always fails. Here is the patch for 3.3.11:

RCS file: RCS/hash.c,v
retrieving revision 1.1
diff -u -r1.1 hash.c
--- hash.c      2001/12/18 02:31:09     1.1
+++ hash.c      2001/12/18 02:31:27
@@ -232,7 +232,7 @@
                if (hashp->h_hash == NULL)
                        hashp->h_hash = hcp->hdr->dbmeta.version < 5
                        ? __ham_func4 : __ham_func5;
-               if (!F_ISSET(dbp, DB_RDONLY) &&
+               if (!F_ISSET(dbp, DB_AM_RDONLY) &&
                    hashp->h_hash(dbp,
                    CHARKEY, sizeof(CHARKEY)) != hcp->hdr->h_charkey) {
                        __db_err(dbp->dbenv,
#######


  -- Howard Chu
  Chief Architect, Symas Corp.       Director, Highland Sun
  http://www.symas.com               http://highlandsun.com/hyc
  Symas: Premier OpenSource Development and Support