[GitHub] cassandra pull request #277: 12106 - blacklisting bad partitions for point r...

2018-10-04 Thread sumanth-pasupuleti
GitHub user sumanth-pasupuleti opened a pull request:

https://github.com/apache/cassandra/pull/277

12106 - blacklisting bad partitions for point reads

Based on feedback from design document 
https://docs.google.com/document/d/1obg2IFL-UBU1KErvItxVBQL--oURvaHX-eDjq-Jz9Ys/edit,
 scoped this for point reads.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/sumanth-pasupuleti/cassandra 12106_trunk

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/cassandra/pull/277.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #277


commit 58a9d2ff20e2bd380b8343a652cfa9074798c2f1
Author: sumanthpasupuleti 
Date:   2018-10-04T16:22:50Z

Adding blacklisted partitions feature with tests

commit f4c6f985afc33b72803385c0e7605b792e1abb8f
Author: sumanthpasupuleti 
Date:   2018-10-04T16:36:18Z

Adding nodetool to refresh blacklisted partitions cache

commit 279312033c39fdf5ce8aa3e0f8653bef7485f5ed
Author: sumanthpasupuleti 
Date:   2018-10-04T16:53:14Z

Adding documentation on blacklisting partitions




---

-
To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org
For additional commands, e-mail: pr-h...@cassandra.apache.org



[GitHub] cassandra pull request #276: Repair job tests

2018-10-04 Thread krummas
Github user krummas commented on a diff in the pull request:

https://github.com/apache/cassandra/pull/276#discussion_r222596795
  
--- Diff: test/unit/org/apache/cassandra/repair/RepairJobTest.java ---
@@ -0,0 +1,569 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cassandra.repair;
+
+import java.net.UnknownHostException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.function.Predicate;
+
+import com.google.common.collect.Sets;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Test;
+
+import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.cassandra.dht.ByteOrderedPartitioner;
+import org.apache.cassandra.dht.IPartitioner;
+import org.apache.cassandra.dht.Range;
+import org.apache.cassandra.dht.Token;
+import org.apache.cassandra.locator.InetAddressAndPort;
+import org.apache.cassandra.streaming.PreviewKind;
+import org.apache.cassandra.utils.ByteBufferUtil;
+import org.apache.cassandra.utils.FBUtilities;
+import org.apache.cassandra.utils.MerkleTree;
+import org.apache.cassandra.utils.MerkleTrees;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+public class RepairJobTest
+{
+private static final IPartitioner PARTITIONER = 
ByteOrderedPartitioner.instance;
+
+static InetAddressAndPort addr1;
+static InetAddressAndPort addr2;
+static InetAddressAndPort addr3;
+static InetAddressAndPort addr4;
+static InetAddressAndPort addr5;
+
+static Range range1 = range(0, 1);
+static Range range2 = range(2, 3);
+static Range range3 = range(4, 5);
+static RepairJobDesc desc = new RepairJobDesc(UUID.randomUUID(), 
UUID.randomUUID(), "ks", "cf", Arrays.asList());
+
+@AfterClass
+public static void reset()
+{
+FBUtilities.reset();
+}
+
+static
+{
+try
+{
+addr1 = InetAddressAndPort.getByName("127.0.0.1");
+addr2 = InetAddressAndPort.getByName("127.0.0.2");
+addr3 = InetAddressAndPort.getByName("127.0.0.3");
+addr4 = InetAddressAndPort.getByName("127.0.0.4");
+addr5 = InetAddressAndPort.getByName("127.0.0.5");
+DatabaseDescriptor.setBroadcastAddress(addr1.address);
+}
+catch (UnknownHostException e)
+{
+e.printStackTrace();
+}
+}
+
+@Test
+public void testCreateStandardSyncTasks()
+{
+testCreateStandardSyncTasks(false);
+}
+
+@Test
+public void testCreateStandardSyncTasksPullRepair()
+{
+testCreateStandardSyncTasks(true);
+}
+
+public static void testCreateStandardSyncTasks(boolean pullRepair)
+{
+List treeResponses = 
Arrays.asList(treeResponse(addr1, range1, "same",  range2, "same", range3, 
"same"),
+ 
treeResponse(addr2, range1, "different", range2, "same", range3, "different"),
+ 
treeResponse(addr3, range1, "same",  range2, "same", range3, "same"));
+
+Map tasks = 
toMap(RepairJob.createStandardSyncTasks(desc,
+   
 treeResponses,
+   
 addr1, // local
+   
 noTransient(), // transient
+

[GitHub] cassandra pull request #276: Repair job tests

2018-10-04 Thread krummas
Github user krummas commented on a diff in the pull request:

https://github.com/apache/cassandra/pull/276#discussion_r222610027
  
--- Diff: test/unit/org/apache/cassandra/repair/RepairJobTest.java ---
@@ -0,0 +1,569 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cassandra.repair;
+
+import java.net.UnknownHostException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.function.Predicate;
+
+import com.google.common.collect.Sets;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Test;
+
+import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.cassandra.dht.ByteOrderedPartitioner;
+import org.apache.cassandra.dht.IPartitioner;
+import org.apache.cassandra.dht.Range;
+import org.apache.cassandra.dht.Token;
+import org.apache.cassandra.locator.InetAddressAndPort;
+import org.apache.cassandra.streaming.PreviewKind;
+import org.apache.cassandra.utils.ByteBufferUtil;
+import org.apache.cassandra.utils.FBUtilities;
+import org.apache.cassandra.utils.MerkleTree;
+import org.apache.cassandra.utils.MerkleTrees;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+public class RepairJobTest
+{
+private static final IPartitioner PARTITIONER = 
ByteOrderedPartitioner.instance;
+
+static InetAddressAndPort addr1;
+static InetAddressAndPort addr2;
+static InetAddressAndPort addr3;
+static InetAddressAndPort addr4;
+static InetAddressAndPort addr5;
+
+static Range range1 = range(0, 1);
+static Range range2 = range(2, 3);
+static Range range3 = range(4, 5);
+static RepairJobDesc desc = new RepairJobDesc(UUID.randomUUID(), 
UUID.randomUUID(), "ks", "cf", Arrays.asList());
+
+@AfterClass
+public static void reset()
+{
+FBUtilities.reset();
+}
+
+static
+{
+try
+{
+addr1 = InetAddressAndPort.getByName("127.0.0.1");
+addr2 = InetAddressAndPort.getByName("127.0.0.2");
+addr3 = InetAddressAndPort.getByName("127.0.0.3");
+addr4 = InetAddressAndPort.getByName("127.0.0.4");
+addr5 = InetAddressAndPort.getByName("127.0.0.5");
+DatabaseDescriptor.setBroadcastAddress(addr1.address);
+}
+catch (UnknownHostException e)
+{
+e.printStackTrace();
+}
+}
+
+@Test
+public void testCreateStandardSyncTasks()
+{
+testCreateStandardSyncTasks(false);
+}
+
+@Test
+public void testCreateStandardSyncTasksPullRepair()
+{
+testCreateStandardSyncTasks(true);
+}
+
+public static void testCreateStandardSyncTasks(boolean pullRepair)
+{
+List treeResponses = 
Arrays.asList(treeResponse(addr1, range1, "same",  range2, "same", range3, 
"same"),
+ 
treeResponse(addr2, range1, "different", range2, "same", range3, "different"),
+ 
treeResponse(addr3, range1, "same",  range2, "same", range3, "same"));
+
+Map tasks = 
toMap(RepairJob.createStandardSyncTasks(desc,
+   
 treeResponses,
+   
 addr1, // local
+   
 noTransient(), // transient
+

[GitHub] cassandra pull request #276: Repair job tests

2018-10-04 Thread krummas
Github user krummas commented on a diff in the pull request:

https://github.com/apache/cassandra/pull/276#discussion_r222600025
  
--- Diff: test/unit/org/apache/cassandra/repair/RepairJobTest.java ---
@@ -0,0 +1,569 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cassandra.repair;
+
+import java.net.UnknownHostException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.function.Predicate;
+
+import com.google.common.collect.Sets;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Test;
+
+import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.cassandra.dht.ByteOrderedPartitioner;
+import org.apache.cassandra.dht.IPartitioner;
+import org.apache.cassandra.dht.Range;
+import org.apache.cassandra.dht.Token;
+import org.apache.cassandra.locator.InetAddressAndPort;
+import org.apache.cassandra.streaming.PreviewKind;
+import org.apache.cassandra.utils.ByteBufferUtil;
+import org.apache.cassandra.utils.FBUtilities;
+import org.apache.cassandra.utils.MerkleTree;
+import org.apache.cassandra.utils.MerkleTrees;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+public class RepairJobTest
+{
+private static final IPartitioner PARTITIONER = 
ByteOrderedPartitioner.instance;
+
+static InetAddressAndPort addr1;
+static InetAddressAndPort addr2;
+static InetAddressAndPort addr3;
+static InetAddressAndPort addr4;
+static InetAddressAndPort addr5;
+
+static Range range1 = range(0, 1);
+static Range range2 = range(2, 3);
+static Range range3 = range(4, 5);
+static RepairJobDesc desc = new RepairJobDesc(UUID.randomUUID(), 
UUID.randomUUID(), "ks", "cf", Arrays.asList());
+
+@AfterClass
+public static void reset()
+{
+FBUtilities.reset();
+}
+
+static
+{
+try
+{
+addr1 = InetAddressAndPort.getByName("127.0.0.1");
+addr2 = InetAddressAndPort.getByName("127.0.0.2");
+addr3 = InetAddressAndPort.getByName("127.0.0.3");
+addr4 = InetAddressAndPort.getByName("127.0.0.4");
+addr5 = InetAddressAndPort.getByName("127.0.0.5");
+DatabaseDescriptor.setBroadcastAddress(addr1.address);
+}
+catch (UnknownHostException e)
+{
+e.printStackTrace();
+}
+}
+
+@Test
+public void testCreateStandardSyncTasks()
+{
+testCreateStandardSyncTasks(false);
+}
+
+@Test
+public void testCreateStandardSyncTasksPullRepair()
+{
+testCreateStandardSyncTasks(true);
+}
+
+public static void testCreateStandardSyncTasks(boolean pullRepair)
+{
+List treeResponses = 
Arrays.asList(treeResponse(addr1, range1, "same",  range2, "same", range3, 
"same"),
+ 
treeResponse(addr2, range1, "different", range2, "same", range3, "different"),
+ 
treeResponse(addr3, range1, "same",  range2, "same", range3, "same"));
+
+Map tasks = 
toMap(RepairJob.createStandardSyncTasks(desc,
+   
 treeResponses,
+   
 addr1, // local
+   
 noTransient(), // transient
+

[GitHub] cassandra pull request #276: Repair job tests

2018-10-04 Thread krummas
Github user krummas commented on a diff in the pull request:

https://github.com/apache/cassandra/pull/276#discussion_r222609899
  
--- Diff: test/unit/org/apache/cassandra/repair/RepairJobTest.java ---
@@ -0,0 +1,569 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cassandra.repair;
+
+import java.net.UnknownHostException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.function.Predicate;
+
+import com.google.common.collect.Sets;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Test;
+
+import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.cassandra.dht.ByteOrderedPartitioner;
+import org.apache.cassandra.dht.IPartitioner;
+import org.apache.cassandra.dht.Range;
+import org.apache.cassandra.dht.Token;
+import org.apache.cassandra.locator.InetAddressAndPort;
+import org.apache.cassandra.streaming.PreviewKind;
+import org.apache.cassandra.utils.ByteBufferUtil;
+import org.apache.cassandra.utils.FBUtilities;
+import org.apache.cassandra.utils.MerkleTree;
+import org.apache.cassandra.utils.MerkleTrees;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+public class RepairJobTest
+{
+private static final IPartitioner PARTITIONER = 
ByteOrderedPartitioner.instance;
+
+static InetAddressAndPort addr1;
+static InetAddressAndPort addr2;
+static InetAddressAndPort addr3;
+static InetAddressAndPort addr4;
+static InetAddressAndPort addr5;
+
+static Range range1 = range(0, 1);
+static Range range2 = range(2, 3);
+static Range range3 = range(4, 5);
+static RepairJobDesc desc = new RepairJobDesc(UUID.randomUUID(), 
UUID.randomUUID(), "ks", "cf", Arrays.asList());
+
+@AfterClass
+public static void reset()
+{
+FBUtilities.reset();
+}
+
+static
+{
+try
+{
+addr1 = InetAddressAndPort.getByName("127.0.0.1");
+addr2 = InetAddressAndPort.getByName("127.0.0.2");
+addr3 = InetAddressAndPort.getByName("127.0.0.3");
+addr4 = InetAddressAndPort.getByName("127.0.0.4");
+addr5 = InetAddressAndPort.getByName("127.0.0.5");
+DatabaseDescriptor.setBroadcastAddress(addr1.address);
+}
+catch (UnknownHostException e)
+{
+e.printStackTrace();
+}
+}
+
+@Test
+public void testCreateStandardSyncTasks()
+{
+testCreateStandardSyncTasks(false);
+}
+
+@Test
+public void testCreateStandardSyncTasksPullRepair()
+{
+testCreateStandardSyncTasks(true);
+}
+
+public static void testCreateStandardSyncTasks(boolean pullRepair)
+{
+List treeResponses = 
Arrays.asList(treeResponse(addr1, range1, "same",  range2, "same", range3, 
"same"),
+ 
treeResponse(addr2, range1, "different", range2, "same", range3, "different"),
+ 
treeResponse(addr3, range1, "same",  range2, "same", range3, "same"));
+
+Map tasks = 
toMap(RepairJob.createStandardSyncTasks(desc,
+   
 treeResponses,
+   
 addr1, // local
+   
 noTransient(), // transient
+

[GitHub] cassandra pull request #276: Repair job tests

2018-10-04 Thread krummas
Github user krummas commented on a diff in the pull request:

https://github.com/apache/cassandra/pull/276#discussion_r222603722
  
--- Diff: test/unit/org/apache/cassandra/repair/RepairJobTest.java ---
@@ -0,0 +1,569 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cassandra.repair;
+
+import java.net.UnknownHostException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.function.Predicate;
+
+import com.google.common.collect.Sets;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Test;
+
+import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.cassandra.dht.ByteOrderedPartitioner;
+import org.apache.cassandra.dht.IPartitioner;
+import org.apache.cassandra.dht.Range;
+import org.apache.cassandra.dht.Token;
+import org.apache.cassandra.locator.InetAddressAndPort;
+import org.apache.cassandra.streaming.PreviewKind;
+import org.apache.cassandra.utils.ByteBufferUtil;
+import org.apache.cassandra.utils.FBUtilities;
+import org.apache.cassandra.utils.MerkleTree;
+import org.apache.cassandra.utils.MerkleTrees;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+public class RepairJobTest
+{
+private static final IPartitioner PARTITIONER = 
ByteOrderedPartitioner.instance;
+
+static InetAddressAndPort addr1;
+static InetAddressAndPort addr2;
+static InetAddressAndPort addr3;
+static InetAddressAndPort addr4;
+static InetAddressAndPort addr5;
+
+static Range range1 = range(0, 1);
+static Range range2 = range(2, 3);
+static Range range3 = range(4, 5);
+static RepairJobDesc desc = new RepairJobDesc(UUID.randomUUID(), 
UUID.randomUUID(), "ks", "cf", Arrays.asList());
+
+@AfterClass
+public static void reset()
+{
+FBUtilities.reset();
+}
+
+static
+{
+try
+{
+addr1 = InetAddressAndPort.getByName("127.0.0.1");
+addr2 = InetAddressAndPort.getByName("127.0.0.2");
+addr3 = InetAddressAndPort.getByName("127.0.0.3");
+addr4 = InetAddressAndPort.getByName("127.0.0.4");
+addr5 = InetAddressAndPort.getByName("127.0.0.5");
+DatabaseDescriptor.setBroadcastAddress(addr1.address);
+}
+catch (UnknownHostException e)
+{
+e.printStackTrace();
+}
+}
+
+@Test
+public void testCreateStandardSyncTasks()
+{
+testCreateStandardSyncTasks(false);
+}
+
+@Test
+public void testCreateStandardSyncTasksPullRepair()
+{
+testCreateStandardSyncTasks(true);
+}
+
+public static void testCreateStandardSyncTasks(boolean pullRepair)
+{
+List treeResponses = 
Arrays.asList(treeResponse(addr1, range1, "same",  range2, "same", range3, 
"same"),
+ 
treeResponse(addr2, range1, "different", range2, "same", range3, "different"),
+ 
treeResponse(addr3, range1, "same",  range2, "same", range3, "same"));
+
+Map tasks = 
toMap(RepairJob.createStandardSyncTasks(desc,
+   
 treeResponses,
+   
 addr1, // local
+   
 noTransient(), // transient
+

[GitHub] cassandra pull request #276: Repair job tests

2018-10-04 Thread krummas
Github user krummas commented on a diff in the pull request:

https://github.com/apache/cassandra/pull/276#discussion_r222566547
  
--- Diff: test/unit/org/apache/cassandra/repair/RepairJobTest.java ---
@@ -0,0 +1,569 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cassandra.repair;
+
+import java.net.UnknownHostException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.function.Predicate;
+
+import com.google.common.collect.Sets;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Test;
+
+import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.cassandra.dht.ByteOrderedPartitioner;
+import org.apache.cassandra.dht.IPartitioner;
+import org.apache.cassandra.dht.Range;
+import org.apache.cassandra.dht.Token;
+import org.apache.cassandra.locator.InetAddressAndPort;
+import org.apache.cassandra.streaming.PreviewKind;
+import org.apache.cassandra.utils.ByteBufferUtil;
+import org.apache.cassandra.utils.FBUtilities;
+import org.apache.cassandra.utils.MerkleTree;
+import org.apache.cassandra.utils.MerkleTrees;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+public class RepairJobTest
+{
+private static final IPartitioner PARTITIONER = 
ByteOrderedPartitioner.instance;
+
+static InetAddressAndPort addr1;
+static InetAddressAndPort addr2;
+static InetAddressAndPort addr3;
+static InetAddressAndPort addr4;
+static InetAddressAndPort addr5;
+
+static Range range1 = range(0, 1);
+static Range range2 = range(2, 3);
+static Range range3 = range(4, 5);
+static RepairJobDesc desc = new RepairJobDesc(UUID.randomUUID(), 
UUID.randomUUID(), "ks", "cf", Arrays.asList());
+
+@AfterClass
+public static void reset()
+{
+FBUtilities.reset();
+}
+
+static
+{
+try
+{
+addr1 = InetAddressAndPort.getByName("127.0.0.1");
+addr2 = InetAddressAndPort.getByName("127.0.0.2");
+addr3 = InetAddressAndPort.getByName("127.0.0.3");
+addr4 = InetAddressAndPort.getByName("127.0.0.4");
+addr5 = InetAddressAndPort.getByName("127.0.0.5");
+DatabaseDescriptor.setBroadcastAddress(addr1.address);
+}
+catch (UnknownHostException e)
+{
+e.printStackTrace();
+}
+}
+
+@Test
+public void testCreateStandardSyncTasks()
+{
+testCreateStandardSyncTasks(false);
+}
+
+@Test
+public void testCreateStandardSyncTasksPullRepair()
+{
+testCreateStandardSyncTasks(true);
+}
+
+public static void testCreateStandardSyncTasks(boolean pullRepair)
+{
+List treeResponses = 
Arrays.asList(treeResponse(addr1, range1, "same",  range2, "same", range3, 
"same"),
+ 
treeResponse(addr2, range1, "different", range2, "same", range3, "different"),
+ 
treeResponse(addr3, range1, "same",  range2, "same", range3, "same"));
+
+Map tasks = 
toMap(RepairJob.createStandardSyncTasks(desc,
+   
 treeResponses,
+   
 addr1, // local
+   
 noTransient(), // transient
+

[GitHub] cassandra pull request #276: Repair job tests

2018-10-04 Thread krummas
Github user krummas commented on a diff in the pull request:

https://github.com/apache/cassandra/pull/276#discussion_r222552355
  
--- Diff: src/java/org/apache/cassandra/repair/LocalSyncTask.java ---
@@ -52,15 +52,9 @@
 private static final Logger logger = 
LoggerFactory.getLogger(LocalSyncTask.class);
 
 private final UUID pendingRepair;
-private final boolean requestRanges;
-private final boolean transferRanges;
 
-public LocalSyncTask(RepairJobDesc desc, TreeResponse local, 
TreeResponse remote, UUID pendingRepair,
- boolean requestRanges, boolean transferRanges, 
PreviewKind previewKind)
-{
-this(desc, local.endpoint, remote.endpoint, 
MerkleTrees.difference(local.trees, remote.trees),
- pendingRepair, requestRanges, transferRanges, previewKind);
-}
+protected final boolean requestRanges;
--- End diff --

these could be VisibleForTesting (and perhaps package private)


---

-
To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org
For additional commands, e-mail: pr-h...@cassandra.apache.org



[GitHub] cassandra pull request #267: Consolidate batch write code

2018-10-04 Thread ifesdjeen
Github user ifesdjeen closed the pull request at:

https://github.com/apache/cassandra/pull/267


---

-
To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org
For additional commands, e-mail: pr-h...@cassandra.apache.org