* db2: overflow_page fixes, __P redef
authorMark Eichin <eichin@mit.edu>
Mon, 11 Nov 1996 22:03:50 +0000 (22:03 +0000)
committerMark Eichin <eichin@mit.edu>
Mon, 11 Nov 1996 22:03:50 +0000 (22:03 +0000)
* 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
src/util/db2/hash/hash.h
src/util/db2/hash/hash_page.c
src/util/db2/include/db.h
src/util/db2/test/dictionary [new file with mode: 0644]
src/util/db2/test/run.test

index 6d4f9fa34d316b1d3ae60d7e984d4ef03669cc45..fdabe09b0ea4d2eb9f7a7348da95ce245f9f7c76 100644 (file)
@@ -1,3 +1,28 @@
+Mon Nov 11 17:01:29 1996  Mark Eichin  <eichin@cygnus.com>
+
+       * db2: overflow_page fixes, __P redef
+       * db2 tests: better alternate dictionary support
+
+       Tue Oct  8 22:55:01 1996  Mark W. Eichin  <eichin@cygnus.com>
+
+       * 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  <eichin@cygnus.com>
+
+       * 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  <raeburn@cygnus.com>
+
+       * 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  <tlyu@mit.edu>
 
        * configure.in: Add check for SIZEOF_INT.
index 973d543a8564e92b60f62a22a9914cb19193acbd..a12c8d4c2e493bcba632df01a466f17307580560 100644 (file)
@@ -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<<DEF_BUCKET_SHIFT)
 #define DEF_SEGSIZE_SHIFT      8               /* log2(SEGSIZE)         */
+#define DEF_SEGSIZE            (1<<DEF_SEGSIZE_SHIFT)
 #define DEF_DIRSIZE            256
 #define DEF_FFACTOR            65536
 #define MIN_FFACTOR            4
index 55acac81a9823f2f0af46fc11c0c21cfd1b98920..304b0fc8adf2ac37f62ec973034a28871546229b 100644 (file)
@@ -701,6 +701,8 @@ __add_ovflpage(hashp, pagep)
                        hashp->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;
index db19429e357c5f35b9c29d56b9849364b2e2a06c..53c587b75646f84efff367ba534445783d798cc3 100644 (file)
@@ -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 (file)
index 0000000..53640f0
--- /dev/null
@@ -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
index 393aedcad2b1ca88a6ebbbcfefbd3510bde6d6be..462a9c2c81eb6fc9ee8dcf01c311a432958f6c09 100644 (file)
@@ -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" |