rsrkpatwari1234 commented on code in PR #18174:
URL: https://github.com/apache/pinot/pull/18174#discussion_r3107405139
##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/BaseTableDataManager.java:
##########
@@ -926,17 +926,18 @@ protected void
setZkOperationTimeIfAvailable(ImmutableSegment segment, @Nullable
}
}
- private void reloadSegments(List<SegmentDataManager> segmentDataManagers,
IndexLoadingConfig indexLoadingConfig,
+ private void reloadSegmentDataManagersInParallel(List<SegmentDataManager>
segmentDataManagers,
boolean forceDownload, String reloadJobId)
throws Exception {
+ IndexLoadingConfig indexLoadingConfigTemplate = fetchIndexLoadingConfig();
List<String> failedSegments = new ArrayList<>();
AtomicReference<Throwable> sampleException = new AtomicReference<>();
CompletableFuture.allOf(segmentDataManagers.stream().map(segmentDataManager ->
CompletableFuture.runAsync(() -> {
String segmentName = segmentDataManager.getSegmentName();
try {
_segmentReloadSemaphore.acquire(segmentName, _logger);
try {
- reloadSegment(segmentDataManager, indexLoadingConfig, forceDownload);
+ reloadSegment(segmentDataManager, indexLoadingConfigTemplate.copy(),
forceDownload);
Review Comment:
Dddressed this by fetching table config once and building a Map<tierKey,
IndexLoadingConfig> with one entry per distinct current segment tier (plus a
shared template for realtime paths that only read TableConfig). So we create
O(number of tiers) IndexLoadingConfig instances, not O(number of segments).
Since offline reload mutates IndexLoadingConfig (tier, setTableDataDir,
etc.), so the same instance can’t be used concurrently without coordination. We
synchronized on the per-tier config for immutable-segment reloads so only one
reload runs at a time for a given tier on that shared object; different tiers
can still reload in parallel. Realtime consuming segments don’t mutate the
template, so they can safely share the single fetched template.
##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/BaseTableDataManager.java:
##########
@@ -926,17 +926,18 @@ protected void
setZkOperationTimeIfAvailable(ImmutableSegment segment, @Nullable
}
}
- private void reloadSegments(List<SegmentDataManager> segmentDataManagers,
IndexLoadingConfig indexLoadingConfig,
+ private void reloadSegmentDataManagersInParallel(List<SegmentDataManager>
segmentDataManagers,
boolean forceDownload, String reloadJobId)
throws Exception {
+ IndexLoadingConfig indexLoadingConfigTemplate = fetchIndexLoadingConfig();
List<String> failedSegments = new ArrayList<>();
AtomicReference<Throwable> sampleException = new AtomicReference<>();
CompletableFuture.allOf(segmentDataManagers.stream().map(segmentDataManager ->
CompletableFuture.runAsync(() -> {
String segmentName = segmentDataManager.getSegmentName();
try {
_segmentReloadSemaphore.acquire(segmentName, _logger);
try {
- reloadSegment(segmentDataManager, indexLoadingConfig, forceDownload);
+ reloadSegment(segmentDataManager, indexLoadingConfigTemplate.copy(),
forceDownload);
Review Comment:
Addressed this by fetching table config once and building a Map<tierKey,
IndexLoadingConfig> with one entry per distinct current segment tier (plus a
shared template for realtime paths that only read TableConfig). So we create
O(number of tiers) IndexLoadingConfig instances, not O(number of segments).
Since offline reload mutates IndexLoadingConfig (tier, setTableDataDir,
etc.), so the same instance can’t be used concurrently without coordination. We
synchronized on the per-tier config for immutable-segment reloads so only one
reload runs at a time for a given tier on that shared object; different tiers
can still reload in parallel. Realtime consuming segments don’t mutate the
template, so they can safely share the single fetched template.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]