Merge branch 'cassandra-2.1' into cassandra-2.2

This commit is contained in:
Marcus Eriksson 2015-11-17 10:07:04 +01:00
commit d434a33ace
4 changed files with 19 additions and 2 deletions

View File

@ -11,6 +11,7 @@
* Deprecate Pig support (CASSANDRA-10542)
* Reduce contention getting instances of CompositeType (CASSANDRA-10433)
Merged from 2.1:
* Reject incremental repair with subrange repair (CASSANDRA-10422)
* Add a nodetool command to refresh size_estimates (CASSANDRA-9579)
* Shutdown compaction in drain to prevent leak (CASSANDRA-10079)
* Invalidate cache after stream receive task is completed (CASSANDRA-10341)

View File

@ -144,6 +144,9 @@ public class RepairOption
Set<Range<Token>> ranges = new HashSet<>();
if (rangesStr != null)
{
if (incremental)
throw new IllegalArgumentException("Incremental repair can't be requested with subrange repair " +
"because each subrange repair would generate an anti-compacted table");
StringTokenizer tokenizer = new StringTokenizer(rangesStr, ",");
while (tokenizer.hasMoreTokens())
{

View File

@ -2964,6 +2964,10 @@ public class StorageService extends NotificationBroadcasterSupport implements IE
logger.warn("Snapshot-based repair is not yet supported on Windows. Reverting to parallel repair.");
parallelism = RepairParallelism.PARALLEL;
}
if (!fullRepair)
throw new IllegalArgumentException("Incremental repair can't be requested with subrange repair " +
"because each subrange repair would generate an anti-compacted table");
Collection<Range<Token>> repairingRange = createRepairRangeFrom(beginToken, endToken);
RepairOption options = new RepairOption(parallelism, false, !fullRepair, false, 1, repairingRange);

View File

@ -24,6 +24,8 @@ import java.util.Set;
import org.junit.Test;
import com.google.common.collect.ImmutableMap;
import org.apache.cassandra.config.Config;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.dht.IPartitioner;
@ -58,7 +60,7 @@ public class RepairOptionTest
Map<String, String> options = new HashMap<>();
options.put(RepairOption.PARALLELISM_KEY, "parallel");
options.put(RepairOption.PRIMARY_RANGE_KEY, "false");
options.put(RepairOption.INCREMENTAL_KEY, "true");
options.put(RepairOption.INCREMENTAL_KEY, "false");
options.put(RepairOption.RANGES_KEY, "0:10,11:20,21:30");
options.put(RepairOption.COLUMNFAMILIES_KEY, "cf1,cf2,cf3");
options.put(RepairOption.DATACENTERS_KEY, "dc1,dc2,dc3");
@ -67,7 +69,7 @@ public class RepairOptionTest
option = RepairOption.parse(options, partitioner);
assertTrue(option.getParallelism() == RepairParallelism.PARALLEL);
assertFalse(option.isPrimaryRange());
assertTrue(option.isIncremental());
assertFalse(option.isIncremental());
Set<Range<Token>> expectedRanges = new HashSet<>(3);
expectedRanges.add(new Range<>(tokenFactory.fromString("0"), tokenFactory.fromString("10")));
@ -93,4 +95,11 @@ public class RepairOptionTest
expectedHosts.add("127.0.0.3");
assertEquals(expectedHosts, option.getHosts());
}
@Test(expected=IllegalArgumentException.class)
public void testIncrementalRepairWithSubrangesThrows() throws Exception
{
RepairOption.parse(ImmutableMap.of(RepairOption.INCREMENTAL_KEY, "true", RepairOption.RANGES_KEY, ""),
Murmur3Partitioner.instance);
}
}