mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.4-BUG-FIX to HEAD
28143: ALF-8602: Prevent integer overflow in batch size calculation of PatchDAOImpl.getChildAssocsForCrcFix() git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28151 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -424,11 +424,17 @@ public class PatchDAOImpl extends AbstractPatchDAOImpl
|
||||
// requery using the previous maxAssocId
|
||||
minAssocId = maxAssocId;
|
||||
// Double the range multiplier if we have a low hit-rate (<50% of desired size)
|
||||
if (rows.size() < queryMaxResults / 2)
|
||||
// and we can avoid integer overflow
|
||||
if (rows.size() < queryMaxResults / 2 )
|
||||
{
|
||||
rangeMultiplier *= 2L;
|
||||
long newRangeMultiplier = rangeMultiplier * 2L;
|
||||
long newIdRange = maxResults * newRangeMultiplier;
|
||||
if (newIdRange > 0 && newIdRange < maxIdRange)
|
||||
{
|
||||
rangeMultiplier = newRangeMultiplier;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
// Hit a DB problem. Log all the details of the query so that parameters can be adjusted externally.
|
||||
|
Reference in New Issue
Block a user