frankgh commented on code in PR #231:
URL: https://github.com/apache/cassandra-sidecar/pull/231#discussion_r2714388224
##########
adapters/adapters-base/src/main/java/org/apache/cassandra/sidecar/adapters/base/CassandraStorageOperations.java:
##########
@@ -257,6 +257,26 @@ public void drain() throws IOException,
InterruptedException, ExecutionException
.drain();
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<String> getParentRepairStatus(int cmd)
+ {
+ return jmxClient.proxy(StorageJmxOperations.class,
STORAGE_SERVICE_OBJ_NAME)
+ .getParentRepairStatus(cmd);
Review Comment:
NIT: formatting
```suggestion
return jmxClient.proxy(StorageJmxOperations.class,
STORAGE_SERVICE_OBJ_NAME)
.getParentRepairStatus(cmd);
```
##########
server-common/src/main/java/org/apache/cassandra/sidecar/common/server/StorageOperations.java:
##########
@@ -135,6 +135,24 @@ default void outOfRangeDataCleanup(@NotNull String
keyspace, @NotNull String tab
*/
String clusterName();
+ /**
+ * Triggers a repair operation for the given keyspace and options
+ *
+ * @param keyspace keyspace for the repair operation
+ * @param options repair options
+ * @return an integer value representing the status of the repair
operation; Only returns 0 for replication factor 1
+ * which can be used as a reference to check for the status of the repair
session via {@link #getParentRepairStatus(int)}.
+ */
+ int repairAsync(String keyspace, Map<String, String> options);
+
+ /**
+ * Get the status of a given parent repair session.
+ *
+ * @param cmd the integer value representing a reference to a repair
session`
Review Comment:
```suggestion
* @param cmd the integer value representing a reference to a repair
session
```
##########
integration-framework/src/main/java/org/apache/cassandra/sidecar/testing/SharedClusterIntegrationTestBase.java:
##########
@@ -364,6 +366,14 @@ protected void createTestTable(Consumer<String>
queryExecution, QualifiedName na
queryExecution.accept(String.format(createTableStatement, name));
}
+ protected QualifiedName createUniqueTestTable(String tablePrefix, String
createTableStatement)
Review Comment:
we already have utilities to perform table creation. Can we use that instead?
##########
integration-tests/src/integrationTest/org/apache/cassandra/sidecar/testing/SharedClusterSidecarIntegrationTestBase.java:
##########
@@ -114,7 +115,11 @@ public WebClient trustedClient(String clientKeyStorePath,
String clientKeyStoreP
.setTrustStoreOptions(new JksOptions()
.setPath(trustStorePath)
.setPassword(trustStorePassword))
- .setSsl(true);
+ .setSsl(true)
+ .setIdleTimeout(180000)
Review Comment:
any reason why we need these changes?
##########
server/src/main/java/org/apache/cassandra/sidecar/handlers/data/RepairRequestParam.java:
##########
@@ -0,0 +1,61 @@
+/*
+ * 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.handlers.data;
+
+
+import org.apache.cassandra.sidecar.common.request.data.RepairPayload;
+import org.apache.cassandra.sidecar.common.server.data.Name;
+
+/**
+ * Holder class for the {@link
org.apache.cassandra.sidecar.handlers.RepairHandler}
+ * request parameters
+ */
+public class RepairRequestParam
+{
+ private final Name keyspace;
+ private final RepairPayload requestPayload;
+
+ private RepairRequestParam(Name keyspace, RepairPayload requestPayload)
+ {
+
Review Comment:
NIT : remove extra line break
##########
server/src/main/java/org/apache/cassandra/sidecar/handlers/validations/ValidateKeyspaceExistenceHandler.java:
##########
@@ -0,0 +1,97 @@
+/*
+ * 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.handlers.validations;
+
+import com.datastax.driver.core.KeyspaceMetadata;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import io.netty.handler.codec.http.HttpResponseStatus;
+import io.vertx.core.http.HttpServerRequest;
+import io.vertx.core.net.SocketAddress;
+import io.vertx.ext.web.RoutingContext;
+import org.apache.cassandra.sidecar.common.server.data.Name;
+import org.apache.cassandra.sidecar.concurrent.ExecutorPools;
+import org.apache.cassandra.sidecar.handlers.AbstractHandler;
+import org.apache.cassandra.sidecar.routes.RoutingContextUtils;
+import org.apache.cassandra.sidecar.utils.CassandraInputValidator;
+import org.apache.cassandra.sidecar.utils.InstanceMetadataFetcher;
+import org.jetbrains.annotations.NotNull;
+
+import static
org.apache.cassandra.sidecar.utils.HttpExceptions.wrapHttpException;
+
+/**
+ * Validates that the requested keyspace exists in Cassandra, when the endpoint
+ * contains keyspace name.
+ * On successful validation, it stores the fetched {@link KeyspaceMetadata}
+ * in the {@link RoutingContext}
+ */
+@Singleton
+public class ValidateKeyspaceExistenceHandler extends AbstractHandler<Name>
Review Comment:
this handler duplicates functionality already provided by
`ValidateTableExistenceHandler`. Any reason why we have a different handler?
##########
server/src/main/java/org/apache/cassandra/sidecar/config/yaml/RepairJobsConfigurationImpl.java:
##########
@@ -0,0 +1,80 @@
+/*
+ * 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.config.yaml;
+
+import java.util.concurrent.TimeUnit;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import
org.apache.cassandra.sidecar.common.server.utils.MillisecondBoundConfiguration;
+import org.apache.cassandra.sidecar.config.RepairJobsConfiguration;
+
+/**
+ * Configuration for Repair jobs
+ */
+public class RepairJobsConfigurationImpl implements RepairJobsConfiguration
+{
+ public static final int DEFAULT_VALID_REPAIR_STATUS_ATTEMPTS = 5;
+ public static final long DEFAULT_REPAIR_STATUS_POLLING_INTERVAL_MILLIS =
2_000L;
+
+ @JsonProperty(value = "repair_status_attempts", defaultValue =
DEFAULT_VALID_REPAIR_STATUS_ATTEMPTS + "")
+ protected final int validRepairStatusAttempts;
+
+ @JsonProperty(value = "repair_status_polling_interval", defaultValue =
DEFAULT_REPAIR_STATUS_POLLING_INTERVAL_MILLIS + "")
+ protected final long repairStatusPollIntervalMillis;
Review Comment:
we should use `MillisecondBoundConfiguration` here instead
##########
server/src/main/java/org/apache/cassandra/sidecar/config/yaml/RepairJobsConfigurationImpl.java:
##########
@@ -0,0 +1,80 @@
+/*
+ * 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.config.yaml;
+
+import java.util.concurrent.TimeUnit;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import
org.apache.cassandra.sidecar.common.server.utils.MillisecondBoundConfiguration;
+import org.apache.cassandra.sidecar.config.RepairJobsConfiguration;
+
+/**
+ * Configuration for Repair jobs
+ */
+public class RepairJobsConfigurationImpl implements RepairJobsConfiguration
+{
+ public static final int DEFAULT_VALID_REPAIR_STATUS_ATTEMPTS = 5;
+ public static final long DEFAULT_REPAIR_STATUS_POLLING_INTERVAL_MILLIS =
2_000L;
+
+ @JsonProperty(value = "repair_status_attempts", defaultValue =
DEFAULT_VALID_REPAIR_STATUS_ATTEMPTS + "")
+ protected final int validRepairStatusAttempts;
+
+ @JsonProperty(value = "repair_status_polling_interval", defaultValue =
DEFAULT_REPAIR_STATUS_POLLING_INTERVAL_MILLIS + "")
Review Comment:
we should drop the repair prefix here and defaultValue takes no effect so we
should remove it
##########
server/src/main/java/org/apache/cassandra/sidecar/config/yaml/RepairJobsConfigurationImpl.java:
##########
@@ -0,0 +1,80 @@
+/*
+ * 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.config.yaml;
+
+import java.util.concurrent.TimeUnit;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import
org.apache.cassandra.sidecar.common.server.utils.MillisecondBoundConfiguration;
+import org.apache.cassandra.sidecar.config.RepairJobsConfiguration;
+
+/**
+ * Configuration for Repair jobs
+ */
+public class RepairJobsConfigurationImpl implements RepairJobsConfiguration
+{
+ public static final int DEFAULT_VALID_REPAIR_STATUS_ATTEMPTS = 5;
+ public static final long DEFAULT_REPAIR_STATUS_POLLING_INTERVAL_MILLIS =
2_000L;
+
+ @JsonProperty(value = "repair_status_attempts", defaultValue =
DEFAULT_VALID_REPAIR_STATUS_ATTEMPTS + "")
Review Comment:
we should drop the repair prefix here, and defaultValue takes no effect so
we should not add it.
##########
server/src/main/java/org/apache/cassandra/sidecar/modules/multibindings/VertxRouteMapKeys.java:
##########
@@ -99,6 +99,13 @@ interface CassandraNodeMoveRouteKey extends RouteClassKey
HttpMethod HTTP_METHOD = HttpMethod.PUT;
String ROUTE_URI = ApiEndpointsV1.NODE_MOVE_ROUTE;
}
+
Review Comment:
let's keep the alphabetical order as described in line 36
--
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]