Skip to content

Commit

Permalink
In CassandraStorage implement segments as clustering keys within the …
Browse files Browse the repository at this point in the history
…repair_run table.

Change required in IStorage so to identify a segment both by runId and segmentId.

ref:
 - #94
 - #102
  • Loading branch information
michaelsembwever authored and adejanovski committed Jun 23, 2017
1 parent ce09d54 commit 85ef9a2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/main/java/com/spotify/reaper/storage/CassandraStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -405,17 +405,15 @@ public Collection<RepairSegment> getRepairSegmentsForRun(UUID runId) {

private boolean segmentIsWithinRange(RepairSegment segment, RingRange range) {
return range.encloses(new RingRange(segment.getStartToken(), segment.getEndToken()));

}

private RepairSegment createRepairSegmentFromRow(Row segmentRow){
return createRepairSegmentFromRow(segmentRow, segmentRow.getUUID("id"));
}
private RepairSegment createRepairSegmentFromRow(Row segmentRow, UUID segmentId){
private static RepairSegment createRepairSegmentFromRow(Row segmentRow){
return new RepairSegment.Builder(
new RingRange(new BigInteger(segmentRow.getVarint("start_token") +""), new BigInteger(segmentRow.getVarint("end_token")+"")),
new RingRange(
new BigInteger(segmentRow.getVarint("start_token") +""),
new BigInteger(segmentRow.getVarint("end_token")+"")),
segmentRow.getUUID("repair_unit_id"))
.withRunId(segmentRow.getUUID("run_id"))
.withRunId(segmentRow.getUUID("id"))
.coordinatorHost(segmentRow.getString("coordinator_host"))
.endTime(new DateTime(segmentRow.getTimestamp("segment_end_time")))
.failCount(segmentRow.getInt("fail_count"))
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/db/cassandra/003_switch_to_uuids.cql
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ CREATE TABLE IF NOT EXISTS repair_run_by_unit (
AND caching = {'rows_per_partition': 'ALL'};


<<<<<<< ce09d5439e7cb85a0954b6c27c52d5968dc26426
=======

>>>>>>> In CassandraStorage implement segments as clustering keys within the repair_run table.

CREATE TABLE IF NOT EXISTS repair_schedule_v1 (
id timeuuid PRIMARY KEY,
Expand Down

0 comments on commit 85ef9a2

Please sign in to comment.