W3C home > Mailing lists > Public > www-jigsaw@w3.org > January to February 1997

w3c.tools.dbm.jdbm for large data

From: Anselm Baird_Smith <abaird@www43.inria.fr>
Date: Fri, 28 Feb 1997 10:57:50 +0100 (MET)
Message-Id: <199702280957.KAA28920@www43.inria.fr>
To: mura@kansai.oki.co.jp (Toshiki Murata)
Cc: www-jigsaw@w3.org
Toshiki Murata writes:
 > I used w3c.tools.dbm.jdbm for very large data(size > 7000).
 > Then w3c.tools.dbm.jdbm#lookup(key) cause
 > 
 >     java.lang.ArrayIndexOutOfBoundsException: 362
 > 	    at w3c.tools.dbm.jdbm.lookupBucket(jdbm.java:687)
 > 	    at w3c.tools.dbm.jdbm.lookup(jdbm.java:738)
 >
 > jdbm#splitBucket(jdbm.java:296)
 > 		dir_size <<= 1 ;
 > 		dir_adr    = allocateSpace(dir_size*4) ;
 > 		int      ndiridx[] = new int[dir_size] ;
 > 		for (int i = 0 ; i < (dir_size/2) ; i++) {
 > 		    ndiridx[2*i]   = diridx[i] ;
 > 		    ndiridx[2*i+1] = diridx[i] ;
 > 		}
 > 		diridx      = ndiridx ;
 > 		dir_bits    = newbits ;
 > 		dir_changed = true ;
 > So diridx[] is increased here.
 > 
 > jdbm#saveDirectory(jdbm.java:452)
 > 	for (int i = 0 ; i < diridx.length ; i++)
 > 	    out.writeInt(diridx[i]) ;
 > And increased diridx[] is written to jdbm file.
 > 
 > But I think jdbm#saveBucket(jdbm.java:439) perhaps over-writes
 > bucket data in diridx[] area.
 > ( because (jdbm.java:556) fileptr is not changed. )
 > 
 > I tried to fix this problem,
 > but it is difficult for me.

That's a difficult bug to track, I haven't tried storing such big
objects within that database. You may want to turn traces on (set
debug = true, in jdbm.java).

I think a related bug has been fixed (some times ago, check comments)
in jdbm::write(jdbmBucket, key, value) a long time ago.

Also you have to make sure to shtdown the database properly between to
runs of your application (otherwise you may have the files in a
inconsistent state), but I guess you did it ?

Anselm.
Received on Friday, 28 February 1997 04:59:33 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:26 GMT