Skip to content

Commit

Permalink
Fix issue with upgrades on postgres and h2 when coming from pre-0.8 v…
Browse files Browse the repository at this point in the history
…ersions
  • Loading branch information
adejanovski committed Oct 31, 2017
1 parent c6723c7 commit 20f5558
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,23 @@ public RepairRunStatus map(int index, ResultSet rs, StatementContext ctx) throws
RepairParallelism repairParallelism = RepairParallelism.fromName(
rs.getString("repair_parallelism").toLowerCase().replace("datacenter_aware", "dc_parallel"));

Collection<String> nodes = ImmutableSet.copyOf(getStringArray(rs.getArray("nodes").getArray()));
Collection<String> nodes =
ImmutableSet.copyOf(
rs.getArray("nodes") == null
? new String[] {}
: getStringArray(rs.getArray("nodes").getArray()));
Collection<String> datacenters =
ImmutableSet.copyOf(getStringArray(rs.getArray("datacenters").getArray()));
ImmutableSet.copyOf(
getStringArray(
rs.getArray("datacenters") == null
? new String[] {}
: rs.getArray("datacenters").getArray()));
Collection<String> blacklistedTables =
ImmutableSet.copyOf(getStringArray(rs.getArray("blacklisted_tables").getArray()));
ImmutableSet.copyOf(
getStringArray(
rs.getArray("blacklisted_tables") == null
? new String[] {}
: rs.getArray("blacklisted_tables").getArray()));

return new RepairRunStatus(
UuidUtil.fromSequenceId(runId),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,18 @@ public RepairScheduleStatus map(int index, ResultSet rs, StatementContext ctx) t
.toLowerCase()
.replace("datacenter_aware", "dc_parallel")),
rs.getInt("days_between"),
ImmutableSet.copyOf(getStringArray(rs.getArray("nodes").getArray())),
ImmutableSet.copyOf(getStringArray(rs.getArray("datacenters").getArray())),
ImmutableSet.copyOf(getStringArray(rs.getArray("blacklisted_tables").getArray())),
ImmutableSet.copyOf(
rs.getArray("nodes") == null
? new String[] {}
: getStringArray(rs.getArray("nodes").getArray())),
ImmutableSet.copyOf(
rs.getArray("datacenters") == null
? new String[] {}
: getStringArray(rs.getArray("datacenters").getArray())),
ImmutableSet.copyOf(
rs.getArray("blacklisted_tables") == null
? new String[] {}
: getStringArray(rs.getArray("blacklisted_tables").getArray())),
rs.getInt("segment_count_per_node"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,18 @@ public final class RepairUnitMapper implements ResultSetMapper<RepairUnit> {
public RepairUnit map(int index, ResultSet rs, StatementContext ctx) throws SQLException {

String[] columnFamilies = parseStringArray(rs.getArray("column_families").getArray());
String[] nodes = parseStringArray(rs.getArray("nodes").getArray());
String[] datacenters = parseStringArray(rs.getArray("datacenters").getArray());
String[] blacklistedTables = parseStringArray(rs.getArray("blacklisted_tables").getArray());
String[] nodes =
rs.getArray("nodes") == null
? new String[] {}
: parseStringArray(rs.getArray("nodes").getArray());
String[] datacenters =
rs.getArray("datacenters") == null
? new String[] {}
: parseStringArray(rs.getArray("datacenters").getArray());
String[] blacklistedTables =
rs.getArray("blacklisted_tables") == null
? new String[] {}
: parseStringArray(rs.getArray("blacklisted_tables").getArray());

RepairUnit.Builder builder =
new RepairUnit.Builder(
Expand Down

0 comments on commit 20f5558

Please sign in to comment.