Skip to content
Merged
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 @@ -20,6 +20,7 @@
package org.apache.druid.metadata;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectReader;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
Expand Down Expand Up @@ -162,6 +163,7 @@ long nanosElapsedFromInitiation()
private final Object pollLock = new Object();

private final ObjectMapper jsonMapper;
private final ObjectReader segmentReader;
private final Duration periodicPollDelay;
private final Supplier<MetadataStorageTablesConfig> dbTables;
private final SQLMetadataConnector connector;
Expand Down Expand Up @@ -259,6 +261,7 @@ public SqlSegmentsMetadataManager(
)
{
this.jsonMapper = jsonMapper;
this.segmentReader = jsonMapper.readerFor(DataSegment.class);
this.periodicPollDelay = config.get().getPollDuration().toStandardDuration();
this.dbTables = dbTables;
this.connector = connector;
Expand Down Expand Up @@ -1048,7 +1051,7 @@ private void doPollSegments()
.setFetchSize(connector.getStreamingFetchSize())
.map((index, r, ctx) -> {
try {
DataSegment segment = jsonMapper.readValue(r.getBytes("payload"), DataSegment.class);
DataSegment segment = segmentReader.readValue(r.getBytes("payload"));
return replaceWithExistingSegmentIfPresent(segment);
}
catch (IOException e) {
Expand Down