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

Trigger compaction after restart to workaround issue due to long running JCR session

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Won't Fix
    • None
    • None
    • segmentmk

    Description

      Due to OAK-2045 we cannot perform efficient compaction on a running system as of now. To workaround that an alternative approach can be used

      1. Regular maintainence job (invoked via RevisionGC MBean) if determines that compaction would reclaim space above certain threshold then it sets a boolean flag under "compactionStatus" to true along with timestamp
      2. Post restart the maintainence job on detecting such a flag can trigger compaction and cleanup

      Or in terms of pseudo code (by tmueller )

      // this is called once a day in a background thread
      dailyMaintenance() {
          if (notSegmentNodeStore()) {
              return;
          }
          // this needs to be stored somewhere in the repo
          lastCompactStart = loadCompactStartFromRepo();
          if (lastCompactStart > whenThisProcessWasStarted()) {
              return;
          }
          // this can take about 1 minute
          estimatedSpaceSaved = estimatedSpaceSavedByCompaction();
          if (estimatedSpaceSaved < minimumSpaceSaved()) {
              return;
          }
          storeLastCompactStartInRepo(now);
          compact();
      }
      
      static long CLASS_LOADED_TIME = System.currentTimeMillis();
      
      whenThisProcessWasStarted() {
          // a simplification, but maybe good enough
          return CLASS_LOADED_TIME;
      }
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              chetanm Chetan Mehrotra
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: