Home Help Center

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.

Comments

  • wwwtigerwwwtiger Member
    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?
  • wwwtigerwwwtiger Member
    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.1
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    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,
    Bernard
  • wwwtigerwwwtiger Member
    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.
  • wwwtigerwwwtiger Member
    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.
Sign In or Register to comment.