@Override protected MergeThread getMergeThread(IndexWriter writer, MergePolicy.OneMerge merge) throws IOException { MergeThread thread = new MyMergeThread(writer, merge); thread.setThreadPriority(getMergeThreadPriority()); thread.setDaemon(true); thread.setName("MyMergeThread"); return thread; }
MergeStatus(OneMerge oneMerge, Directory directory, long size, List<SegmentInfoPerCommit> segments) { _id = UUID.randomUUID().toString(); _directory = directory; _start = System.nanoTime(); _size = size; _oneMerge = oneMerge; _segments = segments; }
private void addMerge(String id, IndexWriter writer, OneMerge merge) throws IOException { MergeWork mergeWork = new MergeWork(id, merge, writer); if (isLargeMerge(merge)) { _largeMergeQueue.add(mergeWork); } else { _smallMergeQueue.add(mergeWork); } }
private boolean isLargeMerge(OneMerge merge) throws IOException { long totalBytesSize = merge.totalBytesSize(); if (totalBytesSize <= _smallMergeThreshold) { return false; } return true; }
protected static SegmentInfo getSegmentInfo(OneMerge oneMerge) { Object segmentInfoPerCommit = getFieldObject(oneMerge, "info"); if (segmentInfoPerCommit == null) { return null; } return (SegmentInfo) getFieldObject(segmentInfoPerCommit, "info"); }
public MyMergeThread(IndexWriter writer, MergePolicy.OneMerge merge) { super(writer, merge); mergeThreadCreated = true; }
@Override protected void doMerge(MergePolicy.OneMerge merge) throws IOException { mergeCalled = true; super.doMerge(merge); }
public MergeWork(String id, OneMerge merge, IndexWriter writer) throws IOException { _id = id; _merge = merge; _writer = writer; _size = merge.totalBytesSize(); }
protected void addMerges(String id, IndexWriter writer) throws IOException { OneMerge merge; while ((merge = writer.getNextMerge()) != null) { addMerge(id, writer, merge); } }