Skip to content

Commit

Permalink
Expose QueryScheduler from ServerInstance & Custom interface (apache#…
Browse files Browse the repository at this point in the history
  • Loading branch information
praveenc7 authored Dec 12, 2024
1 parent eec29b8 commit 3584899
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4032,7 +4032,8 @@ public void endReplaceSegments(String tableNameWithType, String segmentLineageEn
if (!waitForSegmentsBecomeOnline(tableNameWithType, segmentsTo)) {
return false;
}

// Could be used to perform operation before segments replacement
preSegmentReplaceUpdateRouting(tableNameWithType, segmentsTo, lineageEntry.getSegmentsFrom());
// Update lineage entry
LineageEntry lineageEntryToUpdate =
new LineageEntry(lineageEntry.getSegmentsFrom(), segmentsTo, LineageEntryState.COMPLETED,
Expand Down Expand Up @@ -4068,6 +4069,31 @@ public void endReplaceSegments(String tableNameWithType, String segmentLineageEn
tableNameWithType, segmentLineageEntryId);
}

/**
* This method can be overridden to perform custom operations before updating the routing table
* to switch routing from the old segments (`segmentsFrom`) to the new segments (`segmentsTo`).
* One example usage of this method could be triggering a pageCache warmup operation on the server
* for the specified table and segments. For refresh tables, this ensures that the new segments
* are warmed up and ready for query availability before the routing table is updated.
*
* Example:
* To warm up specific segments of the "salesData_OFFLINE" table:
* - tableNameWithType: "salesData_OFFLINE"
* - segmentsTo: ["newSegment1", "newSegment2", "newSegment3"]
* - segmentsFrom: ["oldSegment1", "oldSegment2", "oldSegment3"]
*
* @param tableNameWithType The name and type of the table for which operations need to be performed
* before switching routing from `segmentsFrom` to `segmentsTo`.
* @param segmentsTo A list of new segments that need to be prepared (e.g., warmed up) before
* they are made available for querying.
* @param segmentsFrom A list of old segments that are currently routed for queries, in case some operation is needed
* on it.
*/
protected void preSegmentReplaceUpdateRouting(String tableNameWithType, List<String> segmentsTo,
List<String> segmentsFrom) {
// No-op by default
}

/**
* List the segment lineage
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,4 +291,8 @@ public InstanceRequestHandler getInstanceRequestHandler() {
public HelixManager getHelixManager() {
return _helixManager;
}

public QueryScheduler getQueryScheduler() {
return _queryScheduler;
}
}

0 comments on commit 3584899

Please sign in to comment.