Berkeley DB lost data sometimes when I ran the example ex_sql_multi_thread
When I ran the example ex_sql_multi_thread (the source file is db-5.2.28/examples/sql/c/ex_sql_multi_thread.c) in the release source code of Berkeley DB, it sometimes lost data.
In the example, it creates 20 threads, and 100025 rows were inserted concurrently altogether, so after inserting all the rows, it executed a SQL command “SELECT count(*) FROM university” and it should return 100025. But sometimes it returned 100024, one row was lost! The chances were nearly 7‰.(I ran the example 1000 times.)
sometimes, there was the following log:
DB_LOCK->lock_put: Lock is no longer valid
The information of my test bed is as follows:
Berkeley DB version: db-5.2.28
When I build BDB, I using the following options:
../dist/configure enable-sql_compat enable-test --with-tcl=/usr/lib64
$ uname -a
Linux localhost.localdomain 2.6.32-71.el6.x86_64 #1 SMP Fri May 20 03:51:51 BST 2011 x86_64 x86_64 x86_64 GNU/Linux
Can you help me with that please?