-
Notifications
You must be signed in to change notification settings - Fork 58
CASSSIDECAR-268 Adds endpoint to perform repair for a given keyspace … #231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
1c6d3fb
CASSSIDECAR-268 Adds endpoint to perform repair for a given keyspace …
arjunashok 0d58e01
Fix repair config
arjunashok a856636
Tagging repair integ tests as heavy
arjunashok c9ac61e
Fix test
arjunashok 310ec4e
Bump up no rows written to simulate long-running repair
arjunashok e3640e4
Minor cleanup
arjunashok 87c401c
Addressing PR comments
arjunashok 7f86ae4
Address PR comments
arjunashok d711e50
Improved empty status handling before repair starts
arjunashok 2706ff2
Update to only perform retries until a valid repair status is receive…
arjunashok 1f6d36f
Fix checkstyle
arjunashok fca8c93
Addressed comments
arjunashok de534c5
Addressed comments
arjunashok c2a7b00
Fix config test
arjunashok 896d3d0
Rebase and address PR comments
arjunashok cad3b32
Fix test
arjunashok 6bdc0da
Address comments
arjunashok 037a10d
Fix integ tests
arjunashok 0b7bdf9
Address PR comments
arjunashok ae0b093
Fix PeriodicTaskExecutor mocks in RepairJobTest
arjunashok 88b7fc9
Checkstyle fix
arjunashok 9502b02
Fix repair integ tests for 5.1
arjunashok f589d29
Applying patch addressing PR comments
arjunashok File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
...adapters-base/src/main/java/org/apache/cassandra/sidecar/adapters/base/RepairOptions.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| /* | ||
| * 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.adapters.base; | ||
|
|
||
| /** | ||
| * Enum representing the repair options supported. | ||
| * This class mimics the options supported by the repair operation in Apache Cassandra | ||
| * as defined in org.apache.cassandra.repair.messages.RepairOption | ||
| * (<a href="https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/repair/messages/RepairOption.java">...</a>) | ||
| */ | ||
| public enum RepairOptions | ||
| { | ||
| /** | ||
| * Whether to repair only the primary range of the node (true/false) | ||
| */ | ||
| PRIMARY_RANGE("primaryRange"), | ||
| /** | ||
| * Whether to perform an incremental repair (true/false) | ||
| * If false, a full repair is performed | ||
| */ | ||
| INCREMENTAL("incremental"), | ||
| /** | ||
| * Specific token ranges to repair | ||
| */ | ||
| RANGES("ranges"), | ||
| /** | ||
| * List of column families (tables) to repair (comma-separated) | ||
| */ | ||
| COLUMN_FAMILIES("columnFamilies"), | ||
| /** | ||
| * Restrict repair to specific data centers (comma-separated) | ||
| */ | ||
| DATACENTERS("dataCenters"), | ||
| /** | ||
| * Restrict repair to specific hosts (comma-separated IPs or hostnames) | ||
| */ | ||
| HOSTS("hosts"), | ||
| /** | ||
| * Force the repair operation | ||
| */ | ||
| FORCE_REPAIR("forceRepair"), | ||
| /** | ||
| * Type of preview repair to run before actual repair | ||
| * Options: "none", "auto", "running", "full" | ||
| * Mainly used to assess data consistency without actually repairing | ||
| */ | ||
| PREVIEW("previewKind"); | ||
|
|
||
| private final String value; | ||
|
|
||
| RepairOptions(String value) | ||
| { | ||
| this.value = value; | ||
| } | ||
|
|
||
| /** | ||
| * @return Name corresponding to the repair option | ||
| */ | ||
| public String optionName() | ||
| { | ||
| return value; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
client-common/src/main/java/org/apache/cassandra/sidecar/common/request/RepairRequest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| /* | ||
| * 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.common.request; | ||
|
|
||
| import io.netty.handler.codec.http.HttpMethod; | ||
| import org.apache.cassandra.sidecar.common.ApiEndpointsV1; | ||
| import org.apache.cassandra.sidecar.common.request.data.RepairPayload; | ||
| import org.apache.cassandra.sidecar.common.response.OperationalJobResponse; | ||
|
|
||
| /** | ||
| * Class representing the repair API request | ||
| */ | ||
| public class RepairRequest extends JsonRequest<OperationalJobResponse> | ||
| { | ||
| private final RepairPayload repairRequestPayload; | ||
|
|
||
|
|
||
| /** | ||
| * Constructs a Sidecar repair request with the given parameters. | ||
| * | ||
| * @param keyspace name of the keyspace in the cluster | ||
| * @param repairRequestPayload request payload | ||
| */ | ||
| public RepairRequest(String keyspace, RepairPayload repairRequestPayload) | ||
|
arjunashok marked this conversation as resolved.
|
||
| { | ||
| super(requestURI(keyspace)); | ||
| this.repairRequestPayload = repairRequestPayload; | ||
| } | ||
|
|
||
| @Override | ||
| public HttpMethod method() | ||
| { | ||
| return HttpMethod.PUT; | ||
| } | ||
|
|
||
| @Override | ||
| public Object requestBody() | ||
| { | ||
| return repairRequestPayload; | ||
| } | ||
|
|
||
| static String requestURI(String keyspace) | ||
| { | ||
| return ApiEndpointsV1.REPAIR_ROUTE | ||
| .replaceAll(ApiEndpointsV1.KEYSPACE_PATH_PARAM, keyspace); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.