mansikhara commented on code in PR #350: URL: https://github.com/apache/cassandra-sidecar/pull/350#discussion_r3263143355
########## server/src/main/java/org/apache/cassandra/sidecar/restore/RestoreJobStatusChecker.java: ########## @@ -0,0 +1,132 @@ +/* + * 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.cassandra.sidecar.restore; + +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.atomic.AtomicBoolean; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.inject.Inject; +import com.google.inject.Singleton; +import io.vertx.core.Promise; +import org.apache.cassandra.sidecar.common.server.utils.DurationSpec; +import org.apache.cassandra.sidecar.config.RestoreJobConfiguration; +import org.apache.cassandra.sidecar.config.SidecarConfiguration; +import org.apache.cassandra.sidecar.db.RestoreJob; +import org.apache.cassandra.sidecar.db.RestoreJobDatabaseAccessor; +import org.apache.cassandra.sidecar.db.schema.SidecarSchema; +import org.apache.cassandra.sidecar.tasks.PeriodicTask; +import org.apache.cassandra.sidecar.tasks.ScheduleDecision; + +/** + * Fast status-check loop complement to {@link RestoreJobDiscoverer}. Runs on a short interval + * (see {@link RestoreJobConfiguration#jobDiscoveryStatusCheckInterval()}) and performs cheap + * point-reads of {@code job.status} for the in-flight jobs already known to the discoverer. + * When a status transition is detected it delegates to + * {@link RestoreJobDiscoverer#handleStatusTransition(RestoreJob)} so that sidecars react to + * phase signals without waiting for the slow full-scan loop. The slow loop remains the + * correctness and recovery guarantee (new-job discovery, expired-job aborts, etc.). + */ +@Singleton +public class RestoreJobStatusChecker implements PeriodicTask Review Comment: great suggestion! Done -- 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]

