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

Re: Tests fail on RedHat 6.0 (ITS#156)



On Mon, May 24, 1999 at 02:38:39PM +0200, Jochen Wiedmann wrote:
> 
> Hi,
> 
> your problem is obviously caused by the following lines in db2/db/db.c,
> part of the BerkeleyDB2 implementation of glibs 2.1:
> 
> 	if (dbinfo != NULL && dbinfo->db_cachesize != 0) {
> 		__db_err(dbenv,
> 		    "cachesize will be ignored if environment exists");
> 		return (EINVAL);
> 	}
> 
> In other words, the reason lies in libraries/libldbm/ldbm.c:
> 
>     #ifdef HAVE_BERKELEY_DB2
> 	DB_INFO dbinfo;
> 	int result;
> 
> 	memset( &dbinfo, 0, sizeof( dbinfo ));
> 	dbinfo.db_cachesize = dbcachesize;
> 	dbinfo.db_pagesize  = DEFAULT_DB_PAGE_SIZE;
> 	dbinfo.db_malloc    = ldbm_malloc;
> 
> 	LDBM_LOCK;
> 	result = db_open( name, DB_TYPE, rw, mode, &ldbm_Env, &dbinfo, &ret );
> 	printf("db_open returns %d\n", result);
> 	LDBM_UNLOCK;
> 
> The above code will *always* send a Non-NULL ldbm_Env, thus any value
> for dbcachesize different from 0 will cause the db2 library to return
> EINVAL immediately.
> 
> I don't know why this problem arises suddenly, perhaps something
> changed between glibc 2.0 and 2.1.

The changes in glibc 2.0 -> 2.1 that pertains to this is th change from db1
to db2. In glibc 2.0 the configure script detects and uses db1, so you wont
compile the code you have above. I'm not sure why it fails, as I have not
tested this at all.

> As a workaround I have changed
> 
> 	dbinfo.db_cachesize = dbcachesize;
> 
> to
> 
> 	dbinfo.db_cachesize = 0;
> 
> which is obviously not the ultimate solution, but I don't understand the
> details of the BerkeleyDB implementation, in particular not why both
> an "environment" (ldbm_Env) and the dbinfo variables are used.
> 
> An optimal solution would try to detect whether glibc 2.1 is used and
> then enable some workaround.

The proper thing is probably to find out why this fails in the db 2.4.x in
glibc 2.1. Any ideas?