Forum Stats

  • 3,768,732 Users
  • 2,252,842 Discussions
  • 7,874,701 Comments

Discussions

When using BDB-JE/HA+DPL when are objects updated in memory on replicas (if ever)?

Ben Sedgwick
Ben Sedgwick Member Posts: 2
edited Feb 13, 2017 7:05PM in Berkeley DB Java Edition

When using Berkeley DB Java Edition and mapping objects via the DPL/Collections API when/how are read-only (non-master) nodes updated?  Let's say I have an object, Person, stored using the DPL into JE.  I have configured for HA, I have a master and a read-only slave node up and running.  Both nodes read into memory in the JVM the same Person to view it on the screen.  A write is forwarded to the master mutating that Person.name from "Ben" to "George".  Assume all log records have arrived and been applied at all replicas.  How, if at all, is the in-memory version of the object updated to reflect this change?  Is there a notification that should trigger a read of the data?  Is this something the DPL just takes care of (meaning, the next aPerson.getName() call returns "George")?

Same question for the collections.  If the result set for a given collection changes at the master, when does the replica notice?  How?

thanks.

Answers

  • Greybird-Oracle
    Greybird-Oracle Member Posts: 2,690
    edited Feb 13, 2017 5:27PM

    Ben,

    Sorry for the delay responding. There is a forum bug that disables email notifications for no apparent reason and this happened to me again. Normally the notifications can be re-enabled by turning them off and on again, so I've done that and hopefully I will get emails now.

    I'm not 100% sure, but I think you may be assuming that the DPL and Collections API have object caches. They don't. As soon as a committed transaction on the master is applied on a replica node, queries on the replica will see the update.

    The replica has a Btree cache, of course, and that cache is updated as part of applying the write operation. Is this the cache you were asking about?

    --mark

    Ben Sedgwick
  • Ben Sedgwick
    Ben Sedgwick Member Posts: 2
    edited Feb 13, 2017 7:05PM

    Mark,

    I think you've answered my question, thanks.  When an instance of an object stored using DPL at the master is fully committed and replicated the next read of that instance at the master or any replica (assuming the master waited to hear from all the replicas before considering the transaction complete) will provide a consistent view of the object's values as committed to the database at the master.  Yep, it's all coming back now...  thanks.

This discussion has been closed.