Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,12 @@ public String toString() {

@Override
public boolean equals(Object o) {
WriterFileSet other = (WriterFileSet) o;
return this.directory.equals(other.directory) && this.files.equals(other.files) && this.getWriterGeneration() == other.getWriterGeneration();
if (this == o) return true;
if (!(o instanceof WriterFileSet other)) return false;

return this.getWriterGeneration() == other.getWriterGeneration()
&& this.directory.equals(other.directory)
&& this.files.equals(other.files);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,7 @@

import java.io.IOException;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.*;

public class CompositeMergePolicy implements MergePolicy.MergeContext {
private final MergePolicy luceneMergePolicy;
Expand Down Expand Up @@ -210,6 +202,7 @@ public synchronized void removeMergingSegment(Collection<Segment> segments) {

private static class SegmentWrapper extends SegmentCommitInfo {
private final long totalSizeBytes;
private final Segment segment;

public SegmentWrapper(Segment segment, long totalSizeBytes, long totalNumDocs) throws IOException {
super(
Expand Down Expand Up @@ -253,6 +246,7 @@ public SegmentWrapper(Segment segment, long totalSizeBytes, long totalNumDocs) t
// id
UUID.randomUUID().toString().substring(0,16).getBytes());
this.totalSizeBytes = totalSizeBytes;
this.segment = segment;
}

@Override
Expand All @@ -264,6 +258,21 @@ public long sizeInBytes() {
public int getDelCount() {
return 0;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof SegmentWrapper other)) return false;

if (this.segment.getGeneration() != other.segment.getGeneration()) return false;
return Objects.equals(this.segment.getDFGroupedSearchableFiles(),
other.segment.getDFGroupedSearchableFiles());
}

@Override
public int hashCode() {
return Long.hashCode(segment.getGeneration());
}
}
}

Loading