mirror of https://github.com/apache/druid.git
reuse DataSegment object when a segment found on another server (#10715)
This commit is contained in:
parent
c7f2d3fbb5
commit
01e25f1e69
|
@ -124,7 +124,7 @@ public class BatchServerInventoryView extends AbstractCuratorServerInventoryView
|
|||
Pair<DruidServerMetadata, DataSegment> input
|
||||
)
|
||||
{
|
||||
return input.rhs;
|
||||
return DataSegmentInterner.intern(input.rhs);
|
||||
}
|
||||
}
|
||||
));
|
||||
|
|
|
@ -586,18 +586,19 @@ public class HttpServerInventoryView implements ServerInventoryView, FilteredSer
|
|||
};
|
||||
}
|
||||
|
||||
private void addSegment(final DataSegment segment)
|
||||
private void addSegment(DataSegment segment)
|
||||
{
|
||||
if (finalPredicate.apply(Pair.of(druidServer.getMetadata(), segment))) {
|
||||
if (druidServer.getSegment(segment.getId()) == null) {
|
||||
druidServer.addDataSegment(segment);
|
||||
DataSegment theSegment = DataSegmentInterner.intern(segment);
|
||||
druidServer.addDataSegment(theSegment);
|
||||
runSegmentCallbacks(
|
||||
new Function<SegmentCallback, CallbackAction>()
|
||||
{
|
||||
@Override
|
||||
public CallbackAction apply(SegmentCallback input)
|
||||
{
|
||||
return input.segmentAdded(druidServer.getMetadata(), segment);
|
||||
return input.segmentAdded(druidServer.getMetadata(), theSegment);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
@ -81,7 +81,7 @@ public class SingleServerInventoryView extends AbstractCuratorServerInventoryVie
|
|||
Predicates.or(segmentPredicates.values())
|
||||
);
|
||||
if (predicate.apply(Pair.of(container.getMetadata(), inventory))) {
|
||||
addSingleInventory(container, inventory);
|
||||
addSingleInventory(container, DataSegmentInterner.intern(inventory));
|
||||
}
|
||||
return container;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue