*/
boolean propagate = true;
-
private static final int COLLECT_N = 1000;
+ private long allowance = 100;
private long spent = 0;
+ private long collectionCounter = 0;
QueryCollectorImpl(QueryProcessor queryProcessor, QueryCollectorSupport support) {
this.queryProcessor = queryProcessor;
@Override
public void collect(int youngTarget, int allowedTimeInMs) {
-
+
long start = System.nanoTime();
// Refresh current size
int size = support.calculateCurrentSize();
+
+// if(collectionCounter > allowance) {
+// collectionCounter = 0;
+// allowance = (allowance * 1100) / 1000;
+// }
+
int bound = queryProcessor.boundQueries;
int young = size - bound;
int youngPct = size > 0 ? 100*young / size : 0;
+
+ // System.err.println("Collect size = " + size + " bound=" + bound + " allowance=" + allowance);
+
+ // Allowance maintains a reasonable set of queries
+ if(size < allowance) return;
+
+ // No need to collect anything if the amount of free queries is small compared to the amount of bound queries
+ if(youngPct < youngTarget) return;
// Initialize support for new run
// If support returns 0 we are starting from 0
support.remove();
propagate = true;
moreAll++;
+ collectionCounter++;
doneAll = false;
return true;
}