Archived
This forum has been archived. Please start a new discussion on GitHub.
Freeze test error
Hi:
I try to create a table in Berkeley DB by freeze as following:
Freeze::ConnectionPtr connection = Freeze::createConnection(communicator, "db");
StringIntMap map(connection, "simple");
And I do create a folder named "db" with my EXE file. After running it also create a log file and "simple" file in "db" directory, but then error happened:
[ freezetest: Berkeley DB: DbEnv "db": DB_TXN->abort: Log undo failed for LSN: 1
23732: No such file or directory ]
[ freezetest: Berkeley DB: DbEnv "db": PANIC: No such file or directory ]
[ freezetest: Berkeley DB: DbEnv "db": Unable to abort transaction 0x80000053: D
B_RUNRECOVERY: Fatal error, run database recovery ]
[ freezetest: Berkeley DB: DbEnv "db": PANIC: DB_RUNRECOVERY: Fatal error, run d
atabase recovery ]
[ freezetest: Berkeley DB: DbEnv "db": Error: closing the transaction region wit
h active transactions ]
I delete all files in "db" and try several times, it still happen.
I try to create a table in Berkeley DB by freeze as following:
Freeze::ConnectionPtr connection = Freeze::createConnection(communicator, "db");
StringIntMap map(connection, "simple");
And I do create a folder named "db" with my EXE file. After running it also create a log file and "simple" file in "db" directory, but then error happened:
[ freezetest: Berkeley DB: DbEnv "db": DB_TXN->abort: Log undo failed for LSN: 1
23732: No such file or directory ]
[ freezetest: Berkeley DB: DbEnv "db": PANIC: No such file or directory ]
[ freezetest: Berkeley DB: DbEnv "db": Unable to abort transaction 0x80000053: D
B_RUNRECOVERY: Fatal error, run database recovery ]
[ freezetest: Berkeley DB: DbEnv "db": PANIC: DB_RUNRECOVERY: Fatal error, run d
atabase recovery ]
[ freezetest: Berkeley DB: DbEnv "db": Error: closing the transaction region wit
h active transactions ]
I delete all files in "db" and try several times, it still happen.
0
Comments
-
After tracing the code, I find this problem cause by erase function
p = map.find("z");
assert(p != map.end());
map.erase(p);
Insert and update(set) is success but delete(erase) failed.
I'm not familiar with Berkeley DB, have anybody met this problem before?0 -
I solved the problem by use:
p = map.find("z");
assert(p != map.end());
map.erase("z");
There are three method for delete item from map
iterator erase(iterator it);
iterator erase(iterator first, iterator last);
size_type erase(const Key& key);
I find only the last one can work. My test environment is
WindowXP
VISUAL STUDIO .NET 2003
ICE 1.5.10 -
Erasing with an iterator, as in:
p = map.find("z");
assert(p != map.end());
map.erase(p);
should work as well. You just need to be careful to close the iterator to commit its transaction. In C++, p is closed by its destructor or when you assign map.end() to it.
Do you use the Berkeley DB from the Ice Windows binary distribution?
Could you attach a test case?
Cheers,
Bernard0 -
You are right, Bernard. After close iterator, it also works.
p = map.find("z");
assert(p != map.end());
map.erase(p);
p = map.end();
connection->close();
communicator->destroy();
Thanks.0 -
By the way, do this forum have a "real" FAQ for basic ICE questions? I find the f.a.q button is only a guide about how to use the BBS.0