Uploaded image for project: 'Jackrabbit Oak'
  1. Jackrabbit Oak
  2. OAK-6087

Avoid reads from MongoDB primary



    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.10.0, 1.9.3
    • Component/s: mongomk
    • Labels:


      With OAK-2106 Oak now attempts to read from a MongoDB secondary when it detects the requested data is available on the secondary.

      When multiple Oak cluster nodes are deployed on a MongoDB replica set, many reads are still directed to the primary. One of the reasons why this is seen in practice, are observers and JCR event listeners that are triggered rather soon after a change happens and therefore read recently modified documents. This makes it difficult for Oak to direct calls to a nearby secondary, because changes may not yet be available there.

      A rather simple solution for the observers may be to delay processing of changes until they are available on the near secondary.

      A more sophisticated solution discussed offline could hide the replica set entirely and always read from the nearest secondary. Writes would obviously still go to the primary, but only return when the write is available also on the nearest secondary. This guarantees that any subsequent read is able to see the preceding write.


        1. OAK-6087.patch
          92 kB
          Marcel Reutegger

          Issue Links



              • Assignee:
                mreutegg Marcel Reutegger
                mreutegg Marcel Reutegger
              • Votes:
                0 Vote for this issue
                3 Start watching this issue


                • Created: