Skip to content

Instantly share code, notes, and snippets.

@stillalex
Last active October 26, 2017 21:50
Show Gist options
  • Save stillalex/d0c9668360337ed53031 to your computer and use it in GitHub Desktop.
Save stillalex/d0c9668360337ed53031 to your computer and use it in GitHub Desktop.
Offline Compaction 1.0 loop
#!/bin/bash
count=${1:-100}
delay=${2:-1} # defaults to 1 second
ts=$(date +"%Y%m%d%H%M")
while [ $count -gt 0 ]; do
printf "==== Compaction run $count ====\n"
printf "Start: $(date)\n" >> compaction.$ts.$count.log
java -Dtar.memoryMapped=true -Dupdate.limit=5000000 -Dcompaction-progress-log=1500000 -Dcompress-interval=10000000 -Dlogback.configurationFile=logback-compaction.xml -Xmx10g -jar oak-run-1.0*.jar compact segmentstore >> compaction.$ts.$count.log 2>&1
printf "\nEnd: $(date)\n" >> compaction.$ts.$count.log
sleep $delay
let count--
done
@stillalex
Copy link
Author

logback-compaction.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
  -->
<configuration>

  <appender name="STDERR" class="ch.qos.logback.core.ConsoleAppender">
    <target>System.err</target>
    <encoder>
      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
    </encoder>
  </appender>

  <logger name="org.apache.jackrabbit.oak.plugins.segment.Compactor" level="DEBUG"/>

  <root level="warn">
    <appender-ref ref="STDERR" />
  </root>

</configuration>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment