protected void rollbackCount(int fId) { ((StatisticalAssignmentPolicy)am.getPolicy()).updateStats(fId, -batchSize); }
@Override public int getPlacementForestIndex(DocumentURI uri) { return getPlacementId(uri, forests.length); } }
public DelimitedSplit() { // dummy constructor for Reflection used in deserialization super(null, 0, 0, null); header = new TextArrayWritable(); }
/** * * @param hosts */ public RestrictedHostsUtil(String[] restrictHosts) { this.restrictHosts = Arrays.asList(restrictHosts); mp = new HashMap<>(); q = new PriorityQueue<>(restrictHosts.length, new HostAssginmentComparator()); for (int i = 0; i < restrictHosts.length; i++) { mp.put(restrictHosts[i], new HostAssignment(i)); q.add(restrictHosts[i]); } }
@Deprecated public String getUnparsedUri() { return InternalUtilities.unparse(uri); }
public BucketAssignmentPolicy(String[] forests, LinkedHashSet<String> uForests) { buckets = new int[forests.length][NUM_BUCKET]; initBucketsTable(forests.length); this.forests = forests; this.uForests = uForests; policy = Kind.BUCKET; }
@Override public int getPlacementForestIndex(DocumentURI uri) { return getPlacementId(uri, forests.length); }
public void initBucketPolicy(String[] forests, LinkedHashSet<String> uForests) { policy = new BucketAssignmentPolicy(forests, uForests); }
public void initRangePolicy(long[] docCount, int batchSize) { policy = new RangeAssignmentPolicy(docCount, batchSize); }
public void initQueryPolicy(long[] docCount, int batchSize) { policy = new QueryAssignmentPolicy(docCount, batchSize); }
public void initStatisticalPolicy(long[] docCount, int batchSize) { policy = new StatisticalAssignmentPolicy(docCount, batchSize); }
public void initLegacyPolicy(LinkedHashSet<String> uForests) { policy = new LegacyAssignmentPolicy(uForests); }
public void initSegmentPolicy(LinkedHashSet<String> uForests) { policy = new SegmentAssignmentPolicy(uForests); }
public int getPlacementForestIndex(DocumentURI uri) { return policy.getPlacementForestIndex(uri); }
/** * return the index to the list of updatable forests (all forest - retired - * RO/DO) * * @param uri * @return index in the list of updatable forests */ public int getPlacementForestIndex(DocumentURI uri) { return getBucketPlacementId(uri, buckets, NUM_BUCKET, forests.length, uForests.size()); }
/** * get the index of the forest with smallest number of docs */ @Override public int getPlacementForestIndex(DocumentURI uri) { int idx = 0; try { idx = popAndInsert(); } catch (InterruptedException e) { LOG.error("Statistical assignment gets interrupted"); } return idx; }
@Override public void write(DataOutput out) throws IOException { header.write(out); super.write(out); }
public StatisticalAssignmentPolicy(long[] stats, int batch) { policy = AssignmentPolicy.Kind.STATISTICAL; frmtCount = new long[stats.length]; this.batch = batch; pq = new PriorityBlockingQueue<Stats>(stats.length); for (int i = 0; i < stats.length; i++) { pq.add(new Stats(i, stats[i])); frmtCount[i] = stats[i]; } }
@Override public void readFields(DataInput in) throws IOException { header.readFields(in); super.readFields(in); }
public String getFullPath() { StringBuilder buf = new StringBuilder(); buf.append("fn:doc(\""); buf.append(InternalUtilities.unparse(docUri)); buf.append("\")"); buf.append(path); return buf.toString(); }