From 28208a459a7c3305dd2f7b0e4076b2cd74412bee Mon Sep 17 00:00:00 2001 From: Mark Eichin Date: Mon, 11 Nov 1996 22:03:50 +0000 Subject: [PATCH] * db2: overflow_page fixes, __P redef * db2 tests: better alternate dictionary support (orignal ChangeLogs included) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9373 dc483132-0cff-0310-8789-dd5450dbe970 --- src/util/db2/ChangeLog | 25 +++ src/util/db2/hash/hash.h | 4 +- src/util/db2/hash/hash_page.c | 7 + src/util/db2/include/db.h | 2 + src/util/db2/test/dictionary | 308 ++++++++++++++++++++++++++++++++++ src/util/db2/test/run.test | 16 ++ 6 files changed, 360 insertions(+), 2 deletions(-) create mode 100644 src/util/db2/test/dictionary diff --git a/src/util/db2/ChangeLog b/src/util/db2/ChangeLog index 6d4f9fa34..fdabe09b0 100644 --- a/src/util/db2/ChangeLog +++ b/src/util/db2/ChangeLog @@ -1,3 +1,28 @@ +Mon Nov 11 17:01:29 1996 Mark Eichin + + * db2: overflow_page fixes, __P redef + * db2 tests: better alternate dictionary support + + Tue Oct 8 22:55:01 1996 Mark W. Eichin + + * hash/hash.h (DEF_BUCKET_SIZE, DEF_SEGSIZE): now derived from + DEF_BUCKET_SHIFT and DEF_SEGSIZE_SHIFT respectively, for + consistency. + + Tue Oct 8 22:43:26 1996 Mark W. Eichin + + * hash/hash_page.c (__add_ovflpage, __add_bigpage): overflow_page + can return a 0 indicating a failure -- callers must check it + instead of corrupting the database. + (overflow_page): document apparent error return. + + Fri Aug 30 20:05:57 1996 Ken Raeburn + + * test/dictionary: New file, list of garbage words. + * test/run.test (main): Use it if no other dictionary can be + found. Set dictsize with size of dictionary. + (test12, test20): Skip if dictionary is too small. + Wed Aug 28 17:25:10 1996 Tom Yu * configure.in: Add check for SIZEOF_INT. diff --git a/src/util/db2/hash/hash.h b/src/util/db2/hash/hash.h index 973d543a8..a12c8d4c2 100644 --- a/src/util/db2/hash/hash.h +++ b/src/util/db2/hash/hash.h @@ -110,10 +110,10 @@ typedef struct htab { /* Memory resident data structure */ #define MIN_BUFFERS 6 #define MINHDRSIZE 512 #define DEF_CACHESIZE 65536 -#define DEF_BUCKET_SIZE 4096 #define DEF_BUCKET_SHIFT 12 /* log2(BUCKET) */ -#define DEF_SEGSIZE 256 +#define DEF_BUCKET_SIZE (1<hdr.ffactor = MIN_FFACTOR; } ovfl_num = overflow_page(hashp); + if (!ovfl_num) + return (NULL); if (__new_page(hashp, (u_int32_t)ovfl_num, A_OVFL) != 0) return (NULL); @@ -741,6 +743,8 @@ __add_bigpage(hashp, pagep, ndx, is_basepage) u_int16_t ovfl_num; ovfl_num = overflow_page(hashp); + if (!ovfl_num) + return (NULL); if (__new_page(hashp, (u_int32_t)ovfl_num, A_OVFL) != 0) return (NULL); @@ -1062,6 +1066,9 @@ first_free(map) return (i); } +/* + * returns 0 on error + */ static u_int16_t overflow_page(hashp) HTAB *hashp; diff --git a/src/util/db2/include/db.h b/src/util/db2/include/db.h index db19429e3..53c587b75 100644 --- a/src/util/db2/include/db.h +++ b/src/util/db2/include/db.h @@ -90,11 +90,13 @@ typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE; /* deal with turning prototypes on and off */ +#ifndef __P #if defined(__STDC__) || defined(__cplusplus) #define __P(protos) protos /* full-blown ANSI C */ #else /* !(__STDC__ || __cplusplus) */ #define __P(protos) () /* traditional C preprocessor */ #endif +#endif /* no __P from system */ /* Access method description structure. */ typedef struct __db { diff --git a/src/util/db2/test/dictionary b/src/util/db2/test/dictionary new file mode 100644 index 000000000..53640f016 --- /dev/null +++ b/src/util/db2/test/dictionary @@ -0,0 +1,308 @@ +abintrme +ablatweo +agdbevea +aglamber +aicehayt +alerover +anadanth +ancmirtt +ancthada +angcther +antasikt +arathmsm +arescofa +arthatea +asallyth +asathedl +ascelass +athaneal +atheneri +atheryit +athiopep +athysidc +atyhtiti +auletard +aytthepr +bedthesa +beiofttw +bemofrda +bertedud +bessdide +bestiemb +blllanof +bllssunt +blstther +bttelthh +bulyousi +bupedire +buseatsd +butritat +byeditam +cedvecur +censaith +centhfro +centitar +ceourire +cetheaso +chancora +chavengl +chederas +chemsywh +civadayo +ckedacag +ckstiptr +colither +congchin +corepppl +cronoria +cthilath +cthouthe +ctofowon +cumetbry +dbethere +degeerin +detherai +dingthin +dryslyse +dscesild +ealecerm +edftserh +efosondi +eherrreg +emidesja +ereananm +estersns +etedtili +evermerh +falsuran +faringsi +fawerist +fcedethe +fedhessh +fedlerca +feupbori +ffeedift +fllbasia +foftabll +fomehage +fotsenki +fwisudls +ggeuptha +gswofryt +hedcecou +hereacun +huvedpth +iabengre +ianfovin +iaresice +iasmived +idengedi +ilftisut +ilinefem +imeorran +imsstoft +inararto +indanrei +ingelaly +ingeored +inmotiom +inoatlfr +inoviler +insedihe +intaspan +intowade +inyfeprt +iobloinc +ionepuse +iourofig +ireeingi +irreland +irsfandb +isewhell +isocisad +isriacth +istaverr +ithmblet +itoingri +itongala +itsgrint +ivyttisa +laltthea +lanesmef +lanonepi +lerithay +lllmeris +lysatspa +lysceert +masishio +mathmmat +meastrei +medengny +medwindb +membonam +moronash +mpeotlin +msomirei +msrmstri +mstirtis +nbempeef +ncheckno +nddtthec +ndilymor +nditheiv +ndoncath +nenkingo +ngryasth +nichelnd +nndarrof +nongeatt +noviearc +npecheca +nsttmema +nwiowhan +oalsaldt +obullury +odtenens +offorind +ofoditin +ogarofab +olossofe +olspooth +omajorul +omantrvi +omawevat +onotorit +oorendbe +oosarang +othowong +otinffte +ouatheno +ountshep +ouputope +owhesatu +owiaindh +padisath +pangream +pawicofa +pendamam +pepofond +peroncti +perysege +petotith +plocarov +pomasbor +powholyi +ppllosof +pptinoma +psenesff +puiondit +reestand +rendlabl +rerathsy +rewathat +rirndiff +ritricui +samasome +satameer +sathecur +sbespral +sconbeis +sedfinhe +sharveon +shhoftrd +sianthem +sieaveve +simedera +sinandff +sinulsma +sllobofl +sndfermh +soffatic +soingris +songiorb +sthottsa +suewemat +swicales +tagttisf +tanalatt +tancodbo +tarethal +tbisesia +teftyall +tengstwh +tepeshth +teranand +tevinohi +tgthehal +thansirs +thecequs +thereaco +therimut +therorea +thestiom +theveame +thhastth +thiasatt +thidirve +thingbaa +thithbed +thovires +thswenpe +thublthe +tiamarss +tincthes +tindtofo +tinedave +tisanwex +tlarnste +tleicorb +tnymesie +toftemal +tombeasw +torarsen +totheheo +toudanty +tremywel +treonove +trhandfy +trrhmont +trysnter +tssasofo +ttemaith +ttiserds +ttorissa +tuiabeoi +twirfton +tyhentha +tyngorti +tyoarich +ucatbouc +ungyconh +untinore +uopsaren +upecmuit +ureaidrb +usinittr +ussofedt +usunochp +utbapofo +veveplel +vimathea +walondui +wavairet +waysioft +wceempil +wealttig +wefondio +werdtian +weswevar +whaclthe +wheanler +wheiforv +whisurtr +whrithat +wiesulci +wirofrec +witthile +wtserodr +ybutherr diff --git a/src/util/db2/test/run.test b/src/util/db2/test/run.test index 393aedcad..462a9c2c8 100644 --- a/src/util/db2/test/run.test +++ b/src/util/db2/test/run.test @@ -22,11 +22,15 @@ main() DICT=/usr/dict/words elif [ -f /usr/share/lib/dict/words ]; then DICT=/usr/share/lib/dict/words + elif [ -f $srcdir/../test/dictionary ]; then + DICT=`cd $srcdir/../test && pwd`/dictionary else echo 'run.test: no dictionary' exit 1 fi + dictsize=`wc -l < $DICT` + if [ $# -eq 0 ]; then for t in 1 2 3 4 5 6 7 8 9 10 11 12 13 20; do test$t @@ -543,6 +547,12 @@ test12() echo "Test 12: skipped, rev not found" return fi + if test $dictsize -lt 20001 ; then + echo "Test 12: skipped, dictionary too small" + return + else + : + fi echo "Test 12: btree: lots of keys, small page size" mdata=abcdefghijklmnopqrstuvwxy echo $mdata | @@ -605,6 +615,12 @@ test13() # Try a variety of bucketsizes and fill factors for hashing test20() { + if test $dictsize -lt 10001 ; then + echo "Test 20: skipped, dictionary too small" + return + else + : + fi echo\ "Test 20: hash: bucketsize, fill factor; nelem 25000 cachesize 65536" echo "abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg abcdefg" | -- 2.26.2