OAK-2305 - Merge OAK-2202 into the 1.0 branch

manually resolved conflicts and avoided the dependecy of OAK-1977



git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/branches/1.0@1642309 13f79535-47bb-0310-9956-ffa450edef68
OAK-2077: Improve the resilence of the OrderedIndex for dangling links

merged into 1.0



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