You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Chetan Mehrotra (JIRA)" <ji...@apache.org> on 2014/09/23 16:18:33 UTC

[jira] [Created] (OAK-2124) Trigger compaction after restart to workaround issue due to long running JCR session

Chetan Mehrotra created OAK-2124:
------------------------------------

             Summary: Trigger compaction after restart to workaround issue due to long running JCR session
                 Key: OAK-2124
                 URL: https://issues.apache.org/jira/browse/OAK-2124
             Project: Jackrabbit Oak
          Issue Type: Improvement
          Components: segmentmk
            Reporter: Chetan Mehrotra
             Fix For: 1.1, 1.0.7


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

# 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
# Post restart the maintainence job on detecting such a flag can trigger compaction and cleanup

Or in terms of pseudo code (by [~tmueller] )
{noformat}
// 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;
}
{noformat}





--
This message was sent by Atlassian JIRA
(v6.3.4#6332)