Archived

This forum has been archived. Please start a new discussion on GitHub.

Traversing a large Freeze Map with few locks

Can someone point me to an example of stepping through a large Freeze Map without exceeding the limit on DB locks. I found the thread on increasing the limit on max number of locks but it seems like a hack.

I'm guessing I need to release the lock every so often by letting the iterator drop out of scope. Is there an example of this somewhere? Checked the manual, the demos, and the newsletter but couldn't find anything which actually involved traversing the whole map.

(If it makes a difference, I just want to read every element of the map to summarize their values. So a const_iterator is all I need.)

Cheers, alex

Comments

  • bernard
    bernard Jupiter, FL
    Hi Alex,

    Increasing the number of locks is not a hack, it's just the way Berkeley DB works:
    Berkeley DB Reference Guide: Configuring locking: sizing the system

    In the absence of transaction (you use a const_iterator with no explicit transaction), iterators provide repeatable reads:
    Berkeley DB Reference Guide: Cursor stability

    (which is of limited use with forward-only iterators).

    Berkeley DB provides additional isolation options: Berkeley DB: Db::cursor

    However I don't know if they work with non-transactional cursors. Currently Freeze uses just the default (flags == 0).

    Cheers,
    Bernard
  • Hi Bernard, thanks for the pointers.

    It's not very clear to me why it needs thousands of locks just to step through the records but of course I haven't tried very hard to understand it. I'll get back to it sometime.

    For now, the config file works and it's good to know that it's the official way of doing it.

    thanks again, alex