Skip to content

Commit

Permalink
back merges from 2.1 branch and spotiryf onto incremental repair bran…
Browse files Browse the repository at this point in the history
…ch. Issue spotify#65
  • Loading branch information
zznate committed Nov 6, 2015
2 parents 744bb9b + 42526c0 commit 067fd73
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 26 deletions.
22 changes: 22 additions & 0 deletions resource/cassandra-reaper.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<<<<<<< HEAD
<<<<<<< HEAD
# Cassandra Reaper Configuration Example.
# See a bit more complete example in:
# src/test/resources/cassandra-reaper.yaml
Expand All @@ -13,14 +14,23 @@ repairIntensity: 0.1
>>>>>>> 0d9358eb266e778fce8b0d5cb25b40a57b6820a8
scheduleDaysBetween: 7
daysToExpireAfterDone: 2
=======
segmentCount: 200
repairParallelism: DATACENTER_AWARE
repairIntensity: 0.9
>>>>>>> 42526c03a3532528878d1666bc8c5598929af140
repairRunThreadCount: 15
hangingRepairTimeoutMins: 30
storageType: memory
enableCrossOrigin: true
<<<<<<< HEAD
<<<<<<< HEAD
=======
incrementalRepair: true
>>>>>>> 0d9358eb266e778fce8b0d5cb25b40a57b6820a8
=======
incrementalRepair: false
>>>>>>> 42526c03a3532528878d1666bc8c5598929af140

logging:
level: INFO
Expand All @@ -29,11 +39,15 @@ logging:
org.eclipse.jetty: INFO
appenders:
- type: console
<<<<<<< HEAD
<<<<<<< HEAD
logFormat: "%-6level [%d] [%t] %logger{5} - %msg %n"
=======
logFormat: "%-6level [%d{HH:mm:ss.SSS}] [%t] %logger{5} - %msg %n"
>>>>>>> 0d9358eb266e778fce8b0d5cb25b40a57b6820a8
=======
logFormat: "%-6level [%d{HH:mm:ss.SSS}] [%t] %logger{5} - %msg %n"
>>>>>>> 42526c03a3532528878d1666bc8c5598929af140

server:
type: default
Expand All @@ -46,6 +60,7 @@ server:
port: 8081
bindHost: 0.0.0.0
<<<<<<< HEAD
<<<<<<< HEAD

=======

Expand All @@ -55,3 +70,10 @@ database:
user: pg-user
password: pg-pass
url: jdbc:postgresql://db.example.com/db-prod
=======

database:
driverClass: org.postgresql.Driver
user: pg-user
url: jdbc:postgresql://db.example.com/db-prod
>>>>>>> 42526c03a3532528878d1666bc8c5598929af140
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import javax.ws.rs.DefaultValue;
import java.util.Map;


public class ReaperApplicationConfiguration extends Configuration {

@JsonProperty
Expand Down Expand Up @@ -105,7 +106,7 @@ public double getRepairIntensity() {
public void setRepairIntensity(double repairIntensity) {
this.repairIntensity = repairIntensity;
}

public Integer getScheduleDaysBetween() {
return scheduleDaysBetween;
}
Expand All @@ -122,6 +123,7 @@ public void setDaysToExpireAfterDone(int daysToExpireAfterDone) {
this.daysToExpireAfterDone = daysToExpireAfterDone;
}


public Boolean getIncrementalRepair() {
return incrementalRepair;
}
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/spotify/reaper/core/RepairRun.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ public static class Builder {
private RunState runState;
private DateTime creationTime;
private double intensity;
private boolean incrementalRepair;
private String cause;
private String owner;
private DateTime startTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ public Response addRepairSchedule(
"given schedule_trigger_time is in the past: "
+ CommonTools.dateTimeToISO8601(nextActivation)).build();
}

if(!scheduleDaysBetween.isPresent()) {
return Response.status(Response.Status.BAD_REQUEST).entity(
"missing required parameter: scheduleDaysBetween").build();
}

Double intensity;
if (intensityStr.isPresent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

import org.apache.cassandra.repair.RepairParallelism;
import org.apache.cassandra.service.ActiveRepairService;
import org.apache.cassandra.utils.SimpleCondition;
import org.joda.time.DateTime;
import org.joda.time.Seconds;
import org.slf4j.Logger;
Expand Down
24 changes: 0 additions & 24 deletions src/main/java/com/spotify/reaper/storage/MemoryStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -379,31 +379,7 @@ public Collection<RepairSchedule> getRepairSchedulesForClusterAndKeyspace(String
return foundRepairSchedules;
}

@Override
public Collection<RepairSchedule> getRepairSchedulesForKeyspace(String keyspaceName) {
Collection<RepairSchedule> foundRepairSchedules = new ArrayList<>();
for (RepairSchedule repairSchedule : repairSchedules.values()) {
RepairUnit repairUnit = getRepairUnit(repairSchedule.getRepairUnitId()).get();
if (repairUnit.getKeyspaceName().equals(keyspaceName)) {
foundRepairSchedules.add(repairSchedule);
}
}
return foundRepairSchedules;
}

@Override
public Collection<RepairSchedule> getRepairSchedulesForClusterAndKeyspace(String clusterName,
String keyspaceName) {
Collection<RepairSchedule> foundRepairSchedules = new ArrayList<>();
for (RepairSchedule repairSchedule : repairSchedules.values()) {
RepairUnit repairUnit = getRepairUnit(repairSchedule.getRepairUnitId()).get();
if (repairUnit.getClusterName().equals(clusterName) && repairUnit.getKeyspaceName()
.equals(keyspaceName)) {
foundRepairSchedules.add(repairSchedule);
}
}
return foundRepairSchedules;
}

@Override
public Collection<RepairSchedule> getAllRepairSchedules() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ public RepairRunStatus map(int index, ResultSet r, StatementContext ctx) throws
return new RepairRunStatus(runId, clusterName, keyspaceName, columnFamilies, segmentsRepaired,
totalSegments, state, startTime, endTime, cause, owner, lastEvent,
creationTime, pauseTime, daysToExpireAfterDone, intensity, incrementalRepair, repairParallelism);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ public void setUp() {
config.setScheduleDaysBetween(7);
config.setStorageType("foo");
config.setIncrementalRepair(false);
<<<<<<< HEAD
config.setScheduleDaysBetween(1);
config.setDaysToExpireAfterDone(2);
=======
>>>>>>> 42526c03a3532528878d1666bc8c5598929af140
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ private Response addRepairRun(RepairRunResource resource, UriInfo uriInfo,
segments == null ? Optional.<Integer>absent()
: Optional.of(segments),
Optional.of(REPAIR_PARALLELISM.name()),
<<<<<<< HEAD
Optional.<Integer>absent(),
=======
>>>>>>> 42526c03a3532528878d1666bc8c5598929af140
Optional.<String>absent(),
Optional.<String>absent());
}
Expand Down
3 changes: 3 additions & 0 deletions src/test/resources/cassandra-reaper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ repairRunThreadCount: 15
hangingRepairTimeoutMins: 30

incrementalRepair: false
<<<<<<< HEAD
# You can also use value 0 for scheduleDaysBetween, for continuous repairs.
scheduleDaysBetween: 7

daysToExpireAfterDone: 2
=======
>>>>>>> 42526c03a3532528878d1666bc8c5598929af140

# storageType is either "database" or "memory"
storageType: memory
Expand Down

0 comments on commit 067fd73

Please sign in to comment.