Skip to content

Commit

Permalink
Cassandra backend improvements (#109)
Browse files Browse the repository at this point in the history
* Cassandra performance: Replace sequence ids with time-based UUIDs
  Makes the schema changes in a separate migration step, so that data in the repair_unit and repair_schedule tables can be migrated over.

ref:
 - #99
 - #94
 - #99 (comment)

* Simplify the creation of repair runs and their segments.
 Repair runs and their segments are one unit of work in concept and the persistence layer should be designed accordingly.
 Previous they were separated because the concern of sequence generation for IDs were exposed in the code. This is now encapsulated within storage implementations.
 This work allows the CassandraStorage to implement segments as clustering keys within the repair_run table.

ref:
 - #94
 - #101

* In CassandraStorage implement segments as clustering keys within the repair_run table.
Change required in IStorage so to identify a segment both by runId and segmentId.

ref:
 - #94
 - #102

* Fix number of parallel repair computation
Downgrade to Dropwizard 1.0.7 and Guava 19.0 to fix dependency issues
Make repair manager schedule cycle configurable (was 30s hardcoded)

ref: #108

* In CassandraStorage replace the table scan on `repair_run` with a async break-down of per cluster run-throughs of known run IDs.

 ref: #105
  • Loading branch information
adejanovski authored Jun 1, 2017
1 parent d34b305 commit 52cda6b
Show file tree
Hide file tree
Showing 45 changed files with 1,002 additions and 680 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<dropwizard.version>1.1.0</dropwizard.version>
<dropwizard.version>1.0.7</dropwizard.version>
<dropwizard.cassandra.version>4.1.0</dropwizard.cassandra.version>
<cassandra.version>2.2.7</cassandra.version>
<cucumber.version>1.2.5</cucumber.version>
Expand Down
1 change: 1 addition & 0 deletions resource/cassandra-reaper-cassandra-ssl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ enableCrossOrigin: true
incrementalRepair: false
allowUnreachableNodes: false
enableDynamicSeedList: true
repairManagerSchedulingIntervalSeconds: 30

jmxPorts:
127.0.0.1: 7198
Expand Down
1 change: 1 addition & 0 deletions resource/cassandra-reaper-cassandra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ enableCrossOrigin: true
incrementalRepair: false
allowUnreachableNodes: false
enableDynamicSeedList: true
repairManagerSchedulingIntervalSeconds: 30

jmxPorts:
127.0.0.1: 7100
Expand Down
1 change: 1 addition & 0 deletions resource/cassandra-reaper-h2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ enableCrossOrigin: true
incrementalRepair: false
allowUnreachableNodes: false
enableDynamicSeedList: true
repairManagerSchedulingIntervalSeconds: 30

jmxPorts:
127.0.0.1: 7100
Expand Down
1 change: 1 addition & 0 deletions resource/cassandra-reaper-memory.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ enableCrossOrigin: true
incrementalRepair: false
allowUnreachableNodes: false
enableDynamicSeedList: true
repairManagerSchedulingIntervalSeconds: 30

jmxPorts:
127.0.0.1: 7100
Expand Down
1 change: 1 addition & 0 deletions resource/cassandra-reaper-postgres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ enableCrossOrigin: true
incrementalRepair: false
allowUnreachableNodes: false
enableDynamicSeedList: true
repairManagerSchedulingIntervalSeconds: 30

jmxPorts:
127.0.0.1: 7100
Expand Down
1 change: 1 addition & 0 deletions resource/cassandra-reaper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ enableCrossOrigin: true
incrementalRepair: false
allowUnreachableNodes: false
enableDynamicSeedList: true
repairManagerSchedulingIntervalSeconds: 30

jmxPorts:
127.0.0.1: 7100
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/spotify/reaper/ReaperApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void run(ReaperApplicationConfiguration config,
context.repairManager.initializeThreadPool(
config.getRepairRunThreadCount(),
config.getHangingRepairTimeoutMins(), TimeUnit.MINUTES,
30, TimeUnit.SECONDS);
config.getRepairManagerSchedulingIntervalSeconds(), TimeUnit.SECONDS);

if (context.storage == null) {
LOG.info("initializing storage of type: {}", config.getStorageType());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public class ReaperApplicationConfiguration extends Configuration {

private String enableCrossOrigin;


@JsonProperty
private DataSourceFactory database = new DataSourceFactory();

Expand All @@ -86,14 +86,17 @@ public class ReaperApplicationConfiguration extends Configuration {
@JsonProperty
@DefaultValue("false")
private Boolean allowUnreachableNodes;

@JsonProperty
private AutoSchedulingConfiguration autoScheduling;

@JsonProperty
@DefaultValue("true")
private Boolean enableDynamicSeedList;

@JsonProperty
private Integer repairManagerSchedulingIntervalSeconds;

public int getSegmentCount() {
return segmentCount;
}
Expand All @@ -117,15 +120,15 @@ public double getRepairIntensity() {
public void setRepairIntensity(double repairIntensity) {
this.repairIntensity = repairIntensity;
}

public Boolean getIncrementalRepair() {
return incrementalRepair;
}

public void setIncrementalRepair(Boolean incrementalRepair) {
this.incrementalRepair = incrementalRepair;
}

public Integer getScheduleDaysBetween() {
return scheduleDaysBetween;
}
Expand Down Expand Up @@ -170,13 +173,13 @@ public void setDataSourceFactory(DataSourceFactory database) {
this.database = database;
}

public int getHangingRepairTimeoutMins() {
return hangingRepairTimeoutMins;
public int getRepairManagerSchedulingIntervalSeconds() {
return this.repairManagerSchedulingIntervalSeconds==null?30:this.repairManagerSchedulingIntervalSeconds;
}

@JsonProperty
public void setHangingRepairTimeoutMins(int hangingRepairTimeoutMins) {
this.hangingRepairTimeoutMins = hangingRepairTimeoutMins;
public void setRepairManagerSchedulingIntervalSeconds(int repairManagerSchedulingIntervalSeconds) {
this.repairManagerSchedulingIntervalSeconds = repairManagerSchedulingIntervalSeconds;
}

public Map<String, Integer> getJmxPorts() {
Expand Down Expand Up @@ -206,11 +209,11 @@ public AutoSchedulingConfiguration getAutoScheduling() {
public void setAutoScheduling(AutoSchedulingConfiguration autoRepairScheduling) {
this.autoScheduling = autoRepairScheduling;
}

public void setEnableDynamicSeedList(Boolean enableDynamicSeedList) {
this.enableDynamicSeedList = enableDynamicSeedList;
}

public Boolean getEnableDynamicSeedList() {
return this.enableDynamicSeedList==null?Boolean.TRUE:this.enableDynamicSeedList;
}
Expand Down Expand Up @@ -239,8 +242,8 @@ public String getPassword() {
}

}


private CassandraFactory cassandra = new CassandraFactory();

@JsonProperty("cassandra")
Expand All @@ -252,15 +255,24 @@ public CassandraFactory getCassandraFactory() {
public void setCassandraFactory(CassandraFactory cassandra) {
this.cassandra = cassandra;
}

public Boolean getAllowUnreachableNodes() {
return allowUnreachableNodes;
return allowUnreachableNodes != null ? allowUnreachableNodes : false;
}

public void setAllowUnreachableNodes(Boolean allow) {
this.allowUnreachableNodes = allow;
}


public int getHangingRepairTimeoutMins() {
return hangingRepairTimeoutMins;
}

@JsonProperty
public void setHangingRepairTimeoutMins(int hangingRepairTimeoutMins) {
this.hangingRepairTimeoutMins = hangingRepairTimeoutMins;
}

public static class AutoSchedulingConfiguration {

@JsonProperty
Expand All @@ -277,7 +289,7 @@ public static class AutoSchedulingConfiguration {

@JsonProperty
private Duration scheduleSpreadPeriod;

@JsonProperty
private List<String> excludedKeyspaces = Collections.emptyList();

Expand Down Expand Up @@ -324,7 +336,7 @@ public void setScheduleSpreadPeriod(Duration scheduleSpreadPeriod) {
public boolean hasScheduleSpreadPeriod() {
return scheduleSpreadPeriod != null;
}

public void setExcludedKeyspaces(List<String> excludedKeyspaces) {
this.excludedKeyspaces = excludedKeyspaces;
}
Expand Down
Loading

0 comments on commit 52cda6b

Please sign in to comment.