J-HowHuang opened a new pull request, #15436:
URL: https://github.com/apache/pinot/pull/15436

   ## Description
   Wrap the logger with `TableRebalanceLogger` to format the log messages in 
rebalance-related logs. 
   
   The scope is at job level, namely each rebalance job will have its own 
`TableRebalanceLogger` that formats rebalance job ID in their log messages. 
Objects and method calls that live in rebalance job lifecycle should create or 
receive a `TableRebalanceLogger` for their logging.
   
   ## Examples
   
   In `DefaultRebalancePreChecker`
   ```java
   public Map<String, RebalancePreCheckerResult> check(PreCheckContext 
preCheckContext) {
       String rebalanceJobId = preCheckContext.getRebalanceJobId();
       TableRebalanceLogger tableRebalanceLogger = new 
TableRebalanceLogger(LOGGER, rebalanceJobId);
   
       tableRebalanceLogger.info("Start pre-checks for table: {}", 
tableNameWithType);
       ...
   
   ```
   Result:
   ```
   2025/04/02 12:36:21.684 INFO [DefaultRebalancePreChecker] 
[grizzly-http-server-0] [cc0dab9b-b2b5-45e3-be9b-27079ab277b8] Start pre-checks 
for table: transcript_OFFLINE
   ```
   
   In `TableRebalancer`
   ```java
   private RebalanceResult doRebalance(TableConfig tableConfig, RebalanceConfig 
rebalanceConfig,
         @Nullable String rebalanceJobId, @Nullable Map<String, Set<String>> 
providedTierToSegmentsMap) {
       TableRebalanceLogger tableRebalanceLogger = new 
TableRebalanceLogger(LOGGER, rebalanceJobId);
       ...
       tableRebalanceLogger.info(
           "Start rebalancing table: {} with dryRun: {}, preChecks: {}, 
reassignInstances: {}, "
               + "includeConsuming: {}, bootstrap: {}, downtime: {}, 
minReplicasToKeepUpForNoDowntime: {}, "
               + "enableStrictReplicaGroup: {}, lowDiskMode: {}, bestEfforts: 
{}, externalViewCheckIntervalInMs: {}, "
               + "externalViewStabilizationTimeoutInMs: {}, 
minimizeDataMovement: {}",
           tableNameWithType, dryRun, preChecks, reassignInstances, 
includeConsuming, bootstrap, downtime,
           minReplicasToKeepUpForNoDowntime, enableStrictReplicaGroup, 
lowDiskMode, bestEfforts,
           externalViewCheckIntervalInMs, externalViewStabilizationTimeoutInMs, 
minimizeDataMovement);
   ```
   
   Result:
   ```
   2025/04/02 12:36:21.675 INFO [TableRebalancer] [grizzly-http-server-0] 
[cc0dab9b-b2b5-45e3-be9b-27079ab277b8] Start rebalancing table: 
transcript_OFFLINE with dryRun: true, preChecks: true, reassignInstances: true, 
includeConsuming: true, bootstrap: false, downtime: false, 
minReplicasToKeepUpForNoDowntime: -1, enableStrictReplicaGroup: false, 
lowDiskMode: false, bestEfforts: false, externalViewCheckIntervalInMs: 1000, 
externalViewStabilizationTimeoutInMs: 3600000, minimizeDataMovement: true
   ```
   
   ## Note
   This PR is based on https://github.com/apache/pinot/pull/15368


-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to