This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Bad state of multi btree database file after large inserts
Type: Stage:
Components: Extension Modules Versions: Python 2.3
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: elerionelrond, loewis, mmangino
Priority: normal Keywords:

Created on 2004-06-30 11:11 by elerionelrond, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
testdb.py elerionelrond, 2004-06-30 11:11 Script to reproduce the bug
bsddb_testrun.txt elerionelrond, 2004-06-30 11:14 Output of running bsddb test suite
Messages (3)
msg21358 - (view) Author: Elerion Elrond (elerionelrond) Date: 2004-06-30 11:11
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.
msg21359 - (view) Author: Mike Mangino (mmangino) Date: 2004-07-12 21:44
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)
msg21360 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2004-07-13 03:36
Logged In: YES 
user_id=21627

As mmangino says, this is not a bug, so closing it.
History
Date User Action Args
2022-04-11 14:56:05adminsetgithub: 40482
2004-06-30 11:11:17elerionelrondcreate