Skip to content

Instantly share code, notes, and snippets.

@chetanmeh
Last active September 18, 2017 15:27
Show Gist options
  • Save chetanmeh/bca50463d3036089a90047591e8316e2 to your computer and use it in GitHub Desktop.
Save chetanmeh/bca50463d3036089a90047591e8316e2 to your computer and use it in GitHub Desktop.
Last Rev Recovery
import com.google.common.base.Stopwatch
import org.apache.jackrabbit.oak.spi.state.NodeStore
import org.slf4j.Logger
import org.slf4j.LoggerFactory
NodeStore ns = getStore()
def agent = ns.getLastRevRecoveryAgent()
def lastRevUtil = agent.missingLastRevUtil
def time = 1504742400000
def endTime = System.currentTimeMillis()
Stopwatch w = Stopwatch.createStarted()
Logger log = LoggerFactory.getLogger("org.apache.jackrabbit.oak.plugins.document")
log.info("===== Starting recovery")
assert ns.clusterId != 4 : "ClusterId should not be 1"
def count = agent.recoverCandidates(4, time)
log.info("===== Recovery completed in $w for $count nodes")
def getStore(){
osgi.getService(org.apache.sling.jcr.api.SlingRepository.class).manager.store
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment