Skip to content

Commit

Permalink
Possibility for repairs to never be triggered #264
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielwEriksson committed Mar 19, 2024
1 parent 95991d3 commit afb56a4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ dependency-reduced-pom.xml
*.iml
.coverage
*htmlcov
application/statistics/
statistics/
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class RepairConfig

private Priority myPriority = new Priority();

private Interval myInitialDelay = new Interval(30, TimeUnit.DAYS);
private Interval myInitialDelay = new Interval(BACKOFF_MINUTES, TimeUnit.DAYS);

public final Priority getPriority()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class RepairConfiguration
private final RepairOptions.RepairType myRepairType;

private static final long DEFAULT_NEW_TABLE_SLIDEOFF = TimeUnit.DAYS.toMillis(1);
private final long mySlideOff;
private final long myInitialDelay;

private RepairConfiguration(final Builder builder)
{
Expand All @@ -71,7 +71,7 @@ private RepairConfiguration(final Builder builder)
myBackoffInMs = builder.myBackoffInMs;
myRepairType = builder.myRepairType;
myPriorityGranularityUnit = builder.myPriorityGranularityUnit;
mySlideOff = builder.myNewTableSlideOff;
myInitialDelay = builder.myNewTableSlideOff;
}

public TimeUnit getPriorityGranularityUnit()
Expand All @@ -91,7 +91,7 @@ public long getRepairIntervalInMs()

public long getNewTableSlideOff()
{
return mySlideOff;
return myInitialDelay;
}

public long getRepairWarningTimeInMs()
Expand Down Expand Up @@ -170,6 +170,7 @@ public boolean equals(final Object o)
&& myIgnoreTWCSTables == that.myIgnoreTWCSTables
&& myBackoffInMs == that.myBackoffInMs
&& myRepairType == that.myRepairType
&& myInitialDelay == that.myInitialDelay
&& myPriorityGranularityUnit == that.myPriorityGranularityUnit;
}

Expand All @@ -178,7 +179,7 @@ public int hashCode()
{
return Objects.hash(myRepairParallelism, myRepairIntervalInMs, myRepairWarningTimeInMs,
myRepairErrorTimeInMs, myRepairUnwindRatio, myTargetRepairSizeInBytes, myIgnoreTWCSTables,
myBackoffInMs, myRepairType, myPriorityGranularityUnit);
myBackoffInMs, myRepairType, myInitialDelay, myPriorityGranularityUnit);
}

public static class Builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,11 @@ public void testUpdateRepaired()

private void assertRepairStateSnapshot(RepairStateSnapshot repairStateSnapshot, long expectedAtLeastRepairedAt, List<ReplicaRepairGroup> replicaRepairGroups, VnodeRepairStates vnodeRepairStatesBase)
{
long expectedAtMostRepairedAt = expectedAtLeastRepairedAt + TimeUnit.MINUTES.toMillis(1);
long expectedAtMostRepairedAt = expectedAtLeastRepairedAt + TimeUnit.HOURS.toMillis(1);
boolean canRepair = !replicaRepairGroups.isEmpty();

assertThat(repairStateSnapshot).isNotNull();
assertThat(repairStateSnapshot.lastCompletedAt()).isGreaterThanOrEqualTo(expectedAtLeastRepairedAt);
assertThat(repairStateSnapshot.lastCompletedAt()).isLessThanOrEqualTo(expectedAtMostRepairedAt);
assertThat(repairStateSnapshot.getRepairGroups()).isEqualTo(replicaRepairGroups);
assertThat(repairStateSnapshot.canRepair()).isEqualTo(canRepair);
assertThat(repairStateSnapshot.getVnodeRepairStates()).isEqualTo(vnodeRepairStatesBase.combineWithRepairedAt(repairStateSnapshot.lastCompletedAt()));
Expand Down

0 comments on commit afb56a4

Please sign in to comment.