OAK-2019 Compact only if needed
 - added test case, and a guard against division by zero

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/trunk@1619800 13f79535-47bb-0310-9956-ffa450edef68