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

Prevent missing checkpoint due to unstable topology from causing complete reindexing

    XMLWordPrintableJSON

Details

    Description

      Async indexing logic relies on embedding application to ensure that async indexing job is run as a singleton in a cluster. For Sling based apps it depends on Sling Discovery support. At times it is being seen that if topology is not stable then different cluster nodes can consider them as leader and execute the async indexing job concurrently.

      This can cause problem as both cluster node might not see same repository state (due to write skew and eventual consistency) and might remove the checkpoint which other cluster node is still relying upon. For e.g. consider a 2 node cluster N1 and N2 where both are performing async indexing.

      1. Base state - CP1 is the checkpoint for "async" job
      2. N2 starts indexing and removes changes CP1 to CP2. For Mongo the checkpoints are saved in settings collection
      3. N1 also decides to execute indexing but has yet not seen the latest repository state so still thinks that CP1 is the base checkpoint and tries to read it. However CP1 is already removed from settings and this makes N1 think that checkpoint is missing and it decides to reindex everything!

      To avoid this topology must be stable but at Oak level we should still handle such a case and avoid doing a full reindexing. So we would need to have a MissingCheckpointStrategy similar to MissingIndexEditorStrategy as done in OAK-2203

      Possible approaches

      1. A1 - Fail the indexing run if checkpoint is missing - Checkpoint being missing can have valid reason and invalid reason. Need to see what are valid scenarios where a checkpoint can go missing
      2. A2 - When a checkpoint is created also store the creation time. When a checkpoint is found to be missing and its a recent checkpoint then fail the run. For e.g. we would fail the run till checkpoint found to be missing is less than an hour old (for just started take startup time into account)

      Attachments

        1. AsyncIndexUpdateClusterTest.java
          8 kB
          Chetan Mehrotra
        2. OAK-3436-0.patch
          15 kB
          Chetan Mehrotra
        3. OAK-3436-tests.patch
          23 kB
          Alex Deparvu
        4. OAK-3436-v2.patch
          26 kB
          Alex Deparvu
        5. OAK-3436-part2.patch
          4 kB
          Alex Deparvu
        6. OAK-3436-part2-v2.patch
          4 kB
          Alex Deparvu

        Issue Links

          Activity

            People

              stillalex Alex Deparvu
              chetanm Chetan Mehrotra
              Votes:
              15 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: