[ python-Bugs-982679 ] Bad state of multi btree database file after large inserts

SourceForge.net noreply at sourceforge.net
Mon Jul 12 23:44:17 CEST 2004


Bugs item #982679, was opened at 2004-06-30 11:11
Message generated for change (Comment added) made by mmangino
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=982679&group_id=5470

Category: Extension Modules
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Elerion Elrond (elerionelrond)
Assigned to: Nobody/Anonymous (nobody)
Summary: Bad state of multi btree database file after large inserts

Initial Comment:
The database on file is left in an bad state after
inserting a large number of entries at once in a BTREE
database. This happens when: a) multiple databases are
open in a file, b) the dbtype is DB_BTREE, c) a large
volume of key + data is inserted in the database. The
volume varies with the pagesize of the database. No
error is raised on insertion. However, if we check the
database file after insertion, we get the following
error: (-30980, 'DB_VERIFY_BAD: Database verification
failed -- Subdatabase entry references page 4 of
invalid type 5'). Moreover, running the test suite from
bsddb module yields 6 failures and 2 errors (see the
'bsddb_testrun.txt' attachment). The error condition
can be verified easily with the 'testdb.py' script -
see attachments). It was run with Python 2.3.3 and
2.3.4 on Windows XP, also with  Python 2.3.4 the cygwin
version and Python 2.3+ on Suse Linux 9.0.

----------------------------------------------------------------------

Comment By: Mike Mangino (mmangino)
Date: 2004-07-12 21:44

Message:
Logged In: YES 
user_id=74879

This happens when you open multiple databases inside a
single file without creating a database environment. With
the following code, your sample works.

import bsddb.db as db
                                                           
                    
file = "test.db"
dbenv=db.DBEnv()
dbenv.open(None,db.DB_CREATE|db.DB_INIT_MPOOL)
DB = db.DB(dbenv)
DB1 = db.DB(dbenv)
DB.open(file, "one", db.DB_BTREE, db.DB_CREATE)
DB1.open(file, "two", db.DB_BTREE, db.DB_CREATE)
                                                           
                    
for i in range(10000):
    DB[str(i)] = "1234567890123456"
                                                           
                    
DB.sync()
DB.close()
DB1.sync()
DB1.close()
                                                           
                    
db.DB().verify(file)


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=982679&group_id=5470


More information about the Python-bugs-list mailing list