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

Fix race condition while resetting fullGC variables from oak-run

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.68.0
    • None
    • None

    Description

      We have a potential race condition if we try to reset fullGC database variables from oak-run while fullGC is already running.
       
      fullGCTimeStamp & fullGCId are database properties inside settings collection under versionGC document which would gets overridden if we reset fullGC from oak-run if it is still running.

       

      The flow is like this:

      1. Full GC is running normally.
      2. We reset the variables externally let's say via oak-run.
      3. Oak run removes the variables fullGCTimeStamp & fullGCId from database.
      4. Once the normal cycle of fullGC finishes, it will again add/update those variables, which would nullify the effect of reset.

       
      To fix this, we need to replace the updateAndCreate API (to update full GC variables after each full GC cycle) with findAndModify, this will ensure that in case the they are already removed, they won't get added again.

       

      Once the new cycle of GC starts, it will add them again with values of oldest modified document & its ID.

       

      Note: This race condition won't come in case of dry-run because dry run is not supported in normal flow. We can dry run with only oak run command.

      Attachments

        Issue Links

          Activity

            People

              daim Rishabh Daim
              daim Rishabh Daim
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: