ruby + Berkeley DB: BDB::Fatal

N

Nikolai Krot

Hello!

Situation:

I'm trying to build a Berkeley DB that holds a bilingual dictionary, say
English-Russian, in a single physical database file. English-to-Russian
equivalents go into one subdatabase, Russian-to-English go into another
subdatabase.

The database is opened like this:

# English-to-Russian subdatabase
@trn_db1 = BDB::Hash.open(dbfile, "trans1", BDB::CREATE) # (1)
# Russian-to-English subdatabase
@trn_db2 = BDB::Hash.open(dbfile, "trans2", BDB::CREATE) # (2)

There is also defined a procedure that, from a single English-to-Russian
pair sets/updates data in the two subdatabases in the following way:

@trn_db1[enword] = merge(@trn_db1[enword], newdata...) # (3)
@trn_db2[ruword] = merge(@trn_db2[ruword], newdata...) # (4)

The trouble is...

Running this stuff, I get the following error at (3):

`[]': PANIC: Invalid argument -- DB_RUNRECOVERY: Fatal error, run
database recovery (BDB::Fatal)

But it is still possible to compile the dictionary in two runs, by first
compiling Russian-to-English section (4) and then English-to-Russian
(3). Which surprises me most is that it does not work viceversa, first
(3) then (4)!


Can someone explain what's going on with Ruby/BDB or the bug is in my
head :).

Thanx in advance

Nikolai Krot
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top