1 Reply Latest reply on Feb 28, 2013 2:36 PM by userBDBDMS-Oracle

    Modifying a DB in-place with db_load without reopening

      I have an application that opens a hash table with the usual sequence of db_create(), db->open(). The open call gets DB_RDONLY as its only flag. Periodically I need to update the contents of that DB. I try this using db_load, which appears to update the file in-place (no inode number change, at least). However, the application apparently won't see the new or updated records unless I restart it, which is inconvenient.

      Is there some step I'm missing to cause the application to notice the revised records without having to close and reopen the database?

      This is with Berkeley DB 5.0.26.
        • 1. Re: Modifying a DB in-place with db_load without reopening
          When db_load is run, it will recreate the environment files. Once this happens then any process connected to the db prior to the db_load needs to disconnect and then reconnect. If you want the reader to see the updates done, then you should be using db->put operations. This will allow the reader to see the changes. If the reader is reading under transaction control then it will need to commit its read only txn and start another txn before it can see the changes from the put (assuming it committed as well).