Log a small subset of segments to refresh for debugging Coordinator refresh logic (#16998)

* Log a small number of segments to refresh per datasource in the Coordinator

* review comments

* Update log message
This commit is contained in:
Rishabh Singh 2024-09-05 11:00:25 +05:30 committed by GitHub
parent 39161b0b23
commit 18a9a7570a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 0 deletions

View File

@ -761,6 +761,9 @@ public abstract class AbstractSegmentMetadataCache<T extends DataSourceInformati
final Map<String, SegmentId> segmentIdMap = Maps.uniqueIndex(segments, SegmentId::toString);
final Set<SegmentId> retVal = new HashSet<>();
logSegmentsToRefresh(dataSource, segments);
final Sequence<SegmentAnalysis> sequence = runSegmentMetadataQuery(
Iterables.limit(segments, MAX_SEGMENTS_PER_QUERY)
);
@ -805,6 +808,14 @@ public abstract class AbstractSegmentMetadataCache<T extends DataSourceInformati
return retVal;
}
/**
* Log the segment details for a datasource to be refreshed for debugging purpose.
*/
void logSegmentsToRefresh(String dataSource, Set<SegmentId> ids)
{
// no-op
}
/**
* Action to be executed on the result of Segment metadata query.
* Returns if the segment metadata was updated.

View File

@ -23,6 +23,7 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Supplier;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Sets;
import com.google.inject.Inject;
import org.apache.druid.client.CoordinatorServerView;
@ -529,6 +530,12 @@ public class CoordinatorSegmentMetadataCache extends AbstractSegmentMetadataCach
}
}
@Override
void logSegmentsToRefresh(String dataSource, Set<SegmentId> ids)
{
log.info("Logging a sample of 5 segments [%s] to be refreshed for datasource [%s]", Iterables.limit(ids, 5), dataSource);
}
private void filterRealtimeSegments(Set<SegmentId> segmentIds)
{
synchronized (lock) {