List<CdoSnapshot> fillGapFromRepository(SnapshotReference snapshotReference, int limit) { if (filledGapsCount >= maxGapsToFill && !isInChildValueObjectScope(snapshotReference)) { return Collections.emptyList(); } List<CdoSnapshot> historicals; if (isInChildValueObjectScope(snapshotReference)) { historicals = getHistoricals(snapshotReference.targetId(), snapshotReference, false, limit); query.stats().logQueryInChildValueObjectScope(snapshotReference.targetId(), snapshotReference.timepointCommitId(), historicals.size()); } else { historicals = getHistoricals(snapshotReference.targetId(), snapshotReference, query.isAggregate(), limit); query.stats().logQueryInDeepPlusScope(snapshotReference.targetId(), snapshotReference.timepointCommitId(), historicals.size()); } filledGapsCount++; filledGapsSnapshots.addAll(historicals); return historicals; }