J-HowHuang commented on code in PR #16455: URL: https://github.com/apache/pinot/pull/16455#discussion_r2294486468
########## pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/rebalance/tenant/TenantRebalanceContext.java: ########## @@ -0,0 +1,87 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.pinot.controller.helix.core.rebalance.tenant; + +import com.fasterxml.jackson.annotation.JsonProperty; + + +/** + * Abstract class for tracking job configs and attempt numbers as part of the job ZK metadata to retry failed tenant + * rebalance. + */ +public abstract class TenantRebalanceContext { + protected static final int INITIAL_ATTEMPT_ID = 1; + @JsonProperty("jobId") + private final String _jobId; + @JsonProperty("originalJobId") + private final String _originalJobId; + @JsonProperty("config") + private final TenantRebalanceConfig _config; + @JsonProperty("attemptId") + private final int _attemptId; + // Default to true for all user initiated rebalances, so that they can be retried if they fail or get stuck. + @JsonProperty("allowRetries") + private final boolean _allowRetries; Review Comment: removed. this was copied from `TableRebalanceContext` ########## pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/rebalance/tenant/DefaultTenantRebalanceContext.java: ########## @@ -0,0 +1,87 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.pinot.controller.helix.core.rebalance.tenant; + +import java.util.LinkedList; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedDeque; +import java.util.concurrent.ConcurrentLinkedQueue; + + +/** + * Default implementation of TenantRebalanceContext that includes parallel and sequential queues + * for managing tenant rebalance operations. + */ +public class DefaultTenantRebalanceContext extends TenantRebalanceContext { + private final ConcurrentLinkedDeque<TenantRebalancer.TenantTableRebalanceJobContext> _parallelQueue; + private final Queue<TenantRebalancer.TenantTableRebalanceJobContext> _sequentialQueue; + private final ConcurrentLinkedQueue<TenantRebalancer.TenantTableRebalanceJobContext> _ongoingJobsQueue; + + public DefaultTenantRebalanceContext() { + super(); + _parallelQueue = new ConcurrentLinkedDeque<>(); + _sequentialQueue = new LinkedList<>(); + _ongoingJobsQueue = new ConcurrentLinkedQueue<>(); + } + + public DefaultTenantRebalanceContext(String originalJobId, TenantRebalanceConfig config, int attemptId, + boolean allowRetries, ConcurrentLinkedDeque<TenantRebalancer.TenantTableRebalanceJobContext> parallelQueue, Review Comment: removed. this was copied from `TableRebalanceContext` -- 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]
