Forum Stats

  • 3,816,545 Users
  • 2,259,204 Discussions
  • 7,893,507 Comments

Discussions

Close join cursor cause BDB0059 assert failure in debug library

614636
614636 Member Posts: 3
edited Apr 11, 2013 11:22AM in Berkeley DB
I join 3 cursors in transaction mode. I manually start and and commit transaction in the database, but I need to set DB_AUTO_COMMIT flag when I open index (secondary) databases used in thees 3 cursors. If not, I can not join cursors because I got error "not transactional".

I read join cursor, close opened join cursors with no errors.

Then I close join cursor itself.

In case of using debug library BDB 5.3.21 I got BDB0059 assert failure: ..\..\src\db\db_join.c/267: "((ip)->dbth_state == THREAD_ACTIVE || (ip)->dbth_state == THREAD_FAILCHK)"

in the __db_join_close_pp(dbc).

Release version of the BDB library do not assert.

I checked join cursor just combines joined cursors using correct transaction, of course join cursor points to NULL transaction itself.

Code:

if (r = mdbs->dbenvp->txn_begin(mdbs->dbenvp, NULL, &txn, 0))
return r;
...
// get join or ordinal cursor
cursorp = getCatalogCursor(mdbs, txn, (DBC ***) &joincursors,
&joincursor_count,
&search_criteria);

// get records
if (joincursor_count == 0) {
if (search_criteria.id) {
LONG64 catid = *search_criteria.id; // ordinal cursor
cflags = DB_SET;
key.data = &catid;
key.size = sizeof(LONG64);
} else
cflags = DB_NEXT; // join cursor
} else
cflags = 0;
...
r = cursorp->get(cursorp, &key, &data, cflags);
}

// close all cursors in join if exists
close_joined_cursors(mdbs, (DBC***)&joincursors, &joincursor_count);
// close join or ordinal cursor
if (cursorp != NULL)
cursorp->close(cursorp); // ASSERTION in debug BDB

r = txn->commit(txn, 0);

What I doing wrong?

Answers

This discussion has been closed.