-
Notifications
You must be signed in to change notification settings - Fork 217
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
Add cassandra storage #2
Conversation
@@ -1,156 +1,167 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-blocking:
the diff of this file is hard to read with the reformatting (i presume from your IDE) changing more of the file than is explicit to this PR. it's help a lot if such reformatting changes are kept isolated in separate commits, or if you can disable reformatting in your IDE.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try to do major reformattings in separate commits, you're right.
|
||
CREATE TABLE IF NOT EXISTS repair_run ( | ||
id bigint PRIMARY KEY, | ||
cluster_name TEXT, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: sometimes text is uppercase, sometimes its lowercase…? same with int.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. I fixed formatting to be consistent
|
||
Collection<RepairSchedule> repairSchedules = context.storage.getRepairSchedulesForClusterAndKeyspace(repairUnit.getClusterName(), repairUnit.getKeyspaceName()); | ||
for(RepairSchedule sched:repairSchedules){ | ||
Optional<RepairUnit> repairUnitForSched = context.storage.getRepairUnit(sched.getRepairUnitId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blocking: replace tabs with whitespace. (happens in many of the edited files in this PR)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to spaces by default.
if((repairUnitForSched.get().getColumnFamilies().size()==0 && repairUnit.getColumnFamilies().size()==0) | ||
|| repairUnitForSched.get().getColumnFamilies().size()==0 && repairUnit.getColumnFamilies().size()!=0 | ||
|| repairUnitForSched.get().getColumnFamilies().size()!=0 && repairUnit.getColumnFamilies().size()==0 | ||
|| Sets.intersection(repairUnit.getColumnFamilies(),repairUnitForSched.get().getColumnFamilies()).size() >0){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-blocking:
could be made easier to read: if these two if statement conditionals were made into methods with intuitive descriptive names.
eg (names could be better…)
if (isEqual(repairUnitForSched, repairUnit) {
if (isRepairInProgress(repairUnitForSched, repairUnit)) {
String errMsg = String.format(
"A repair schedule already exists for cluster \"%s\",keyspace \"%s\", and column families: %s",
cluster.getName(),
repairUnit.getKeyspaceName(),
Sets.intersection(repairUnit.getColumnFamilies(),repairUnitForSched.get().getColumnFamilies()));
LOG.error(errMsg);
throw new ReaperException(errMsg);
}
}
private static boolean isValid(Optional<RepairUnit> repairUnitForSched, RepairUnit repairUnit) {
return repairUnitForSched.isPresent()
&& repairUnitForSched.get().getClusterName().equals(repairUnit.getClusterName())
&& repairUnitForSched.get().getKeyspaceName().equals(repairUnit.getKeyspaceName());
}
private static boolean isRepairInProgress(Optional<RepairUnit> repairUnitForSched, RepairUnit repairUnit) {
return (repairUnitForSched.get().getColumnFamilies().size()==0 && repairUnit.getColumnFamilies().size()==0)
|| repairUnitForSched.get().getColumnFamilies().size()==0 && repairUnit.getColumnFamilies().size()!=0
|| repairUnitForSched.get().getColumnFamilies().size()!=0 && repairUnit.getColumnFamilies().size()==0
|| Sets.intersection(repairUnit.getColumnFamilies(),repairUnitForSched.get().getColumnFamilies()).size() >0;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I refactored the condition into a separate method.
Good catch
@@ -62,6 +63,7 @@ | |||
private static final Logger LOG = LoggerFactory.getLogger(RepairRunResource.class); | |||
|
|||
private final AppContext context; | |||
private Boolean alreadyRunning; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is this used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
// Check that no other repair run exists with a status different than DONE for this repair unit | ||
Collection<RepairRun> repairRuns = context.storage.getRepairRunsForUnit(repairRun.get().getRepairUnitId()); | ||
|
||
boolean alreadyRunning = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is this used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
@@ -30,7 +30,7 @@ public static void start(AppContext context) { | |||
LOG.info("Starting new SchedulingManager instance"); | |||
schedulingManager = new SchedulingManager(context); | |||
Timer timer = new Timer("SchedulingManagerTimer"); | |||
timer.schedule(schedulingManager, 1000, 1000 * 60 * 10); // activate once per ten minutes | |||
timer.schedule(schedulingManager, 1000, 1000 * 60); // activate once per ten minutes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the comment still true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alas, it is not 😄
Removed
@Override | ||
public Collection<RepairScheduleStatus> getClusterScheduleStatuses(String clusterName) { | ||
// TODO Auto-generated method stub | ||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forgotten?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did forgot those two indeed 🤔
They are implemented now, thanks !
LGTM. remember to collapse ( |
Easiest to merge with |
2d03292
to
a076cec
Compare
Squashed + rebased |
LGTM |
Oops. Looks like this butted heads with pull 3. @adejanovski can you rebase and double check the |
fixed version, fixed build script Add cassandra as a storage option Prevent concurrent active repair runs on the same keyspace/table Prevent creation of multiple schedules for the same keyspace/table Fix formatting (tabs -> spaces) Refactor big fat condition into a method Removed obsolete comment Fix case on types to have a consistent set of statements Remove unused variables Implement the last two methods of IStorage : getClusterScheduleStatuses and getClusterRunStatuses Switched some logs to DEBUG level to unclutter the output Switch log level back to INFO in the config file
a076cec
to
56caf9b
Compare
Rebased and fixed conflict. |
…ersions-integration-test Make the schema BasicSteps creates for integration tests compatible with Cassandra 1.2
> This is a combination of 5 commits. > This is the 1st commit message: Enable errexit > This is the commit message thelastpickle#2: Refactor JAR search logic This adds to code reuse. > This is the commit message thelastpickle#3: A bit more concise CONFIG_PATH selection Not really useful, but avoids the unnecessary string literal duplication. > This is the commit message thelastpickle#4: Refine REAPER_JAR search Do not search from '/' to avoid log cluttering and save startup time. And anyway, searching from '/' kills the very idea of searching for a *user* JAR (as apposed to a system JAR) and also makes the search result less predictable (as *all* JARs will eventually be found). The main motivation was that systemd services start with '/' as the working directory, so the system log gets filled with errors on each service start. While b970844 fixes searching from '/' for systemd service, still an explicit check pursues additional goals. > This is the commit message thelastpickle#5: Add SSL/TLS support To support clusters that have their JMX protected with SSL/TLS encryption, let us allow to configure the respective Java parameters.
> This is a combination of 5 commits. > This is the 1st commit message: Enable errexit > This is the commit message #2: Refactor JAR search logic This adds to code reuse. > This is the commit message #3: A bit more concise CONFIG_PATH selection Not really useful, but avoids the unnecessary string literal duplication. > This is the commit message #4: Refine REAPER_JAR search Do not search from '/' to avoid log cluttering and save startup time. And anyway, searching from '/' kills the very idea of searching for a *user* JAR (as apposed to a system JAR) and also makes the search result less predictable (as *all* JARs will eventually be found). The main motivation was that systemd services start with '/' as the working directory, so the system log gets filled with errors on each service start. While b970844 fixes searching from '/' for systemd service, still an explicit check pursues additional goals. > This is the commit message #5: Add SSL/TLS support To support clusters that have their JMX protected with SSL/TLS encryption, let us allow to configure the respective Java parameters.
Co-authored-by: Miles-Garnsey <miles.garnsey@datastax.com>
Co-authored-by: Miles-Garnsey <miles.garnsey@datastax.com>
Co-authored-by: Miles-Garnsey <miles.garnsey@datastax.com>
Co-authored-by: Miles-Garnsey <miles.garnsey@datastax.com>
Co-authored-by: Miles-Garnsey <miles.garnsey@datastax.com>
Adds Cassandra as a storage option for reaper internal data.
I've also added checks so that we cannot run two concurrent repair sessions for the same repair unit, and so that we cannot create two different repair schedules that have the same table in it.