From c79450483b6cc9237d990a55d9ed1ceeddbe744f Mon Sep 17 00:00:00 2001 From: Jay J Wylie Date: Wed, 22 May 2013 13:43:53 -0700 Subject: [PATCH] Minor TODO and copyright cleanup. --- .../task/DonorBasedRebalanceTask.java | 16 +++++++ .../client/rebalance/task/RebalanceTask.java | 16 +++++++ .../task/StealerBasedRebalanceTask.java | 16 +++++++ .../routing/ConsistentRoutingStrategy.java | 2 +- .../voldemort/routing/RouteToAllStrategy.java | 2 +- .../async/RebalanceAsyncOperation.java | 16 +++++++ src/java/voldemort/store/StorageEngine.java | 2 +- .../store/rebalancing/RedirectingStore.java | 2 +- .../tools/RebalanceControllerCLI.java | 3 -- .../voldemort/tools/RebalancePlanCLI.java | 35 +++++++------- test/common/voldemort/ClusterTestUtils.java | 3 +- .../rebalance/AbstractRebalanceTest.java | 3 -- .../RebalancePartitionsInfoTest.java | 16 +++++++ .../routing/StoreRoutingPlanTest.java | 48 ++++++++++++++----- .../server/rebalance/RebalancerStateTest.java | 2 +- .../store/metadata/MetadataStoreTest.java | 2 +- .../rebalancing/RedirectingStoreTest.java | 2 +- 17 files changed, 142 insertions(+), 44 deletions(-) diff --git a/src/java/voldemort/client/rebalance/task/DonorBasedRebalanceTask.java b/src/java/voldemort/client/rebalance/task/DonorBasedRebalanceTask.java index 512357d9ef..65720a9f01 100644 --- a/src/java/voldemort/client/rebalance/task/DonorBasedRebalanceTask.java +++ b/src/java/voldemort/client/rebalance/task/DonorBasedRebalanceTask.java @@ -1,3 +1,19 @@ +/* + * Copyright 2013 LinkedIn, Inc + * + * Licensed 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 voldemort.client.rebalance.task; import java.util.List; diff --git a/src/java/voldemort/client/rebalance/task/RebalanceTask.java b/src/java/voldemort/client/rebalance/task/RebalanceTask.java index 56a1d78ca9..7c2234e224 100644 --- a/src/java/voldemort/client/rebalance/task/RebalanceTask.java +++ b/src/java/voldemort/client/rebalance/task/RebalanceTask.java @@ -1,3 +1,19 @@ +/* + * Copyright 2013 LinkedIn, Inc + * + * Licensed 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 voldemort.client.rebalance.task; import java.util.List; diff --git a/src/java/voldemort/client/rebalance/task/StealerBasedRebalanceTask.java b/src/java/voldemort/client/rebalance/task/StealerBasedRebalanceTask.java index 97167485cf..9ef971cd59 100644 --- a/src/java/voldemort/client/rebalance/task/StealerBasedRebalanceTask.java +++ b/src/java/voldemort/client/rebalance/task/StealerBasedRebalanceTask.java @@ -1,3 +1,19 @@ +/* + * Copyright 2013 LinkedIn, Inc + * + * Licensed 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 voldemort.client.rebalance.task; import java.util.concurrent.Semaphore; diff --git a/src/java/voldemort/routing/ConsistentRoutingStrategy.java b/src/java/voldemort/routing/ConsistentRoutingStrategy.java index 19e75af13b..ccf86e7571 100644 --- a/src/java/voldemort/routing/ConsistentRoutingStrategy.java +++ b/src/java/voldemort/routing/ConsistentRoutingStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2009 LinkedIn, Inc + * Copyright 2008-2013 LinkedIn, Inc * * Licensed 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 diff --git a/src/java/voldemort/routing/RouteToAllStrategy.java b/src/java/voldemort/routing/RouteToAllStrategy.java index 825fdc9446..3db08f2b10 100644 --- a/src/java/voldemort/routing/RouteToAllStrategy.java +++ b/src/java/voldemort/routing/RouteToAllStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2009 LinkedIn, Inc + * Copyright 2008-2013 LinkedIn, Inc * * Licensed 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 diff --git a/src/java/voldemort/server/rebalance/async/RebalanceAsyncOperation.java b/src/java/voldemort/server/rebalance/async/RebalanceAsyncOperation.java index ea6bcfee2d..19c440e869 100644 --- a/src/java/voldemort/server/rebalance/async/RebalanceAsyncOperation.java +++ b/src/java/voldemort/server/rebalance/async/RebalanceAsyncOperation.java @@ -1,3 +1,19 @@ +/* + * Copyright 2013 LinkedIn, Inc + * + * Licensed 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 voldemort.server.rebalance.async; import java.util.concurrent.ExecutorService; diff --git a/src/java/voldemort/store/StorageEngine.java b/src/java/voldemort/store/StorageEngine.java index d48b25f497..b75852b29e 100644 --- a/src/java/voldemort/store/StorageEngine.java +++ b/src/java/voldemort/store/StorageEngine.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2009 LinkedIn, Inc + * Copyright 2008-2013 LinkedIn, Inc * * Licensed 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 diff --git a/src/java/voldemort/store/rebalancing/RedirectingStore.java b/src/java/voldemort/store/rebalancing/RedirectingStore.java index 14b0a10d92..b48e189ffa 100644 --- a/src/java/voldemort/store/rebalancing/RedirectingStore.java +++ b/src/java/voldemort/store/rebalancing/RedirectingStore.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2010 LinkedIn, Inc + * Copyright 2008-2013 LinkedIn, Inc * * Licensed 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 diff --git a/src/java/voldemort/tools/RebalanceControllerCLI.java b/src/java/voldemort/tools/RebalanceControllerCLI.java index 22eab8d4f6..52f2981b35 100644 --- a/src/java/voldemort/tools/RebalanceControllerCLI.java +++ b/src/java/voldemort/tools/RebalanceControllerCLI.java @@ -51,7 +51,6 @@ private static void setupParser() { parser.accepts("url", "Url to bootstrap from ").withRequiredArg().describedAs("url"); parser.accepts("donor-based", "Execute donor-based rebalancing."); parser.accepts("stealer-based", "Execute stealer-based rebalancing (default)."); - // TODO: Can this option be deprecated? parser.accepts("tries", "Tries during stealer-based rebalance [ Default: " @@ -59,14 +58,12 @@ private static void setupParser() { .withRequiredArg() .ofType(Integer.class) .describedAs("num-tries"); - // TODO: Can this option be described better? parser.accepts("parallelism", "Number of servers running stealer- or donor-based tasks in parallel [ Default:" + RebalanceController.MAX_PARALLEL_REBALANCING + " ]") .withRequiredArg() .ofType(Integer.class) .describedAs("parallelism"); - parser.accepts("final-cluster", "Path to target cluster xml") .withRequiredArg() .describedAs("cluster.xml"); diff --git a/src/java/voldemort/tools/RebalancePlanCLI.java b/src/java/voldemort/tools/RebalancePlanCLI.java index 647d50ca95..3f80241a7a 100644 --- a/src/java/voldemort/tools/RebalancePlanCLI.java +++ b/src/java/voldemort/tools/RebalancePlanCLI.java @@ -49,15 +49,15 @@ private static void setupParser() { parser.accepts("current-cluster", "Path to current cluster xml") .withRequiredArg() .describedAs("cluster.xml"); - parser.accepts("target-cluster", "Path to target cluster xml") + parser.accepts("final-cluster", "Path to final cluster xml") .withRequiredArg() .describedAs("cluster.xml"); parser.accepts("current-stores", "Path to current store definition xml. Needed for cluster and zone expansion.") .withRequiredArg() .describedAs("stores.xml"); - parser.accepts("target-stores", - "Path to target store definition xml. Needed for zone expansion.") + parser.accepts("final-stores", + "Path to final store definition xml. Needed for zone expansion.") .withRequiredArg() .describedAs("stores.xml"); parser.accepts("batch-size", @@ -82,8 +82,8 @@ private static void printUsage() { help.append(" --current-cluster \n"); help.append(" --current-stores \n"); help.append(" Optional:\n"); - help.append(" --target-cluster [ Needed for cluster or zone expansion ]\n"); - help.append(" --target-stores [ Needed for zone expansion ]\n"); + help.append(" --final-cluster [ Needed for cluster or zone expansion ]\n"); + help.append(" --final-stores [ Needed for zone expansion ]\n"); help.append(" --batch [ Number of primary partitions to move in each rebalancing batch. ]\n"); help.append(" --output-dir [ Directory in which cluster metadata is dumped for each batch of the plan. ]\n"); @@ -117,14 +117,13 @@ private static OptionSet getValidOptions(String[] args) { if(missing.size() > 0) { printUsageAndDie("Missing required arguments: " + Joiner.on(", ").join(missing)); } - if(options.has("target-stores") && !options.has("target-cluster")) { - printUsageAndDie("target-stores specified, but target-cluster not specified."); + if(options.has("final-stores") && !options.has("final-cluster")) { + printUsageAndDie("final-stores specified, but final-cluster not specified."); } return options; } - // TODO: (refactor) Rename target-cluster target-stores to final-* public static void main(String[] args) throws Exception { setupParser(); OptionSet options = getValidOptions(args); @@ -134,19 +133,19 @@ public static void main(String[] args) throws Exception { String currentStoresXML = (String) options.valueOf("current-stores"); // Required args for some use cases - String targetClusterXML = new String(currentClusterXML); - if(options.has("target-cluster")) { - targetClusterXML = (String) options.valueOf("target-cluster"); + String finalClusterXML = new String(currentClusterXML); + if(options.has("final-cluster")) { + finalClusterXML = (String) options.valueOf("final-cluster"); } - String targetStoresXML = new String(currentStoresXML); - if(options.has("target-stores")) { - targetStoresXML = (String) options.valueOf("target-stores"); + String finalStoresXML = new String(currentStoresXML); + if(options.has("final-stores")) { + finalStoresXML = (String) options.valueOf("final-stores"); } Cluster currentCluster = new ClusterMapper().readCluster(new File(currentClusterXML)); List currentStoreDefs = new StoreDefinitionsMapper().readStoreList(new File(currentStoresXML)); - Cluster targetCluster = new ClusterMapper().readCluster(new File(targetClusterXML)); - List targetStoreDefs = new StoreDefinitionsMapper().readStoreList(new File(targetStoresXML)); + Cluster finalCluster = new ClusterMapper().readCluster(new File(finalClusterXML)); + List finalStoreDefs = new StoreDefinitionsMapper().readStoreList(new File(finalStoresXML)); // Optional args int batchSize = CmdUtils.valueOf(options, "batch-size", RebalancePlan.BATCH_SIZE); @@ -158,8 +157,8 @@ public static void main(String[] args) throws Exception { new RebalancePlan(currentCluster, currentStoreDefs, - targetCluster, - targetStoreDefs, + finalCluster, + finalStoreDefs, batchSize, outputDir); } diff --git a/test/common/voldemort/ClusterTestUtils.java b/test/common/voldemort/ClusterTestUtils.java index a5c106dbc6..5c96e3054a 100644 --- a/test/common/voldemort/ClusterTestUtils.java +++ b/test/common/voldemort/ClusterTestUtils.java @@ -1,5 +1,5 @@ /* - * 2013 LinkedIn, Inc + * Copyright 2013 LinkedIn, Inc * * Licensed 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 @@ -13,6 +13,7 @@ * License for the specific language governing permissions and limitations under * the License. */ + package voldemort; import java.util.ArrayList; diff --git a/test/unit/voldemort/client/rebalance/AbstractRebalanceTest.java b/test/unit/voldemort/client/rebalance/AbstractRebalanceTest.java index c101a23226..c707e2094c 100644 --- a/test/unit/voldemort/client/rebalance/AbstractRebalanceTest.java +++ b/test/unit/voldemort/client/rebalance/AbstractRebalanceTest.java @@ -202,9 +202,6 @@ protected void rebalanceAndCheck(RebalancePlan rebalancePlan, * @param baselineTuples * @param baselineVersions */ - // TODO: (atomic cluster/store update) change from storeDefs to - // currentStoreDefs and finalStoreDefs to - // handle zone expansion/shrink tests. protected void checkEntriesPostRebalance(Cluster currentCluster, Cluster targetCluster, List storeDefs, diff --git a/test/unit/voldemort/client/rebalance/RebalancePartitionsInfoTest.java b/test/unit/voldemort/client/rebalance/RebalancePartitionsInfoTest.java index b454cbfb2c..3244c53be8 100644 --- a/test/unit/voldemort/client/rebalance/RebalancePartitionsInfoTest.java +++ b/test/unit/voldemort/client/rebalance/RebalancePartitionsInfoTest.java @@ -1,3 +1,19 @@ +/* + * Copyright 2013 LinkedIn, Inc + * + * Licensed 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 voldemort.client.rebalance; import static org.junit.Assert.assertEquals; diff --git a/test/unit/voldemort/routing/StoreRoutingPlanTest.java b/test/unit/voldemort/routing/StoreRoutingPlanTest.java index fe43291ccb..1de57d669d 100644 --- a/test/unit/voldemort/routing/StoreRoutingPlanTest.java +++ b/test/unit/voldemort/routing/StoreRoutingPlanTest.java @@ -1,3 +1,19 @@ +/* + * Copyright 2013 LinkedIn, Inc + * + * Licensed 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 voldemort.routing; import static org.junit.Assert.assertEquals; @@ -109,16 +125,24 @@ public void testZonedStoreRoutingPlan() { assertEquals("Replica owner should be 1", 1, - zonedRoutingPlan.getNodeIdForZoneNary(0, 1, samplePartitionKeysMap.get(2).get(0))); + zonedRoutingPlan.getNodeIdForZoneNary(0, + 1, + samplePartitionKeysMap.get(2).get(0))); assertEquals("Replica owner should be 1", 1, - zonedRoutingPlan.getNodeIdForZoneNary(0, 0, samplePartitionKeysMap.get(3).get(0))); + zonedRoutingPlan.getNodeIdForZoneNary(0, + 0, + samplePartitionKeysMap.get(3).get(0))); assertEquals("Replica owner should be 4", 4, - zonedRoutingPlan.getNodeIdForZoneNary(1, 1, samplePartitionKeysMap.get(1).get(0))); + zonedRoutingPlan.getNodeIdForZoneNary(1, + 1, + samplePartitionKeysMap.get(1).get(0))); assertEquals("Replica owner should be 3", 3, - zonedRoutingPlan.getNodeIdForZoneNary(1, 0, samplePartitionKeysMap.get(2).get(0))); + zonedRoutingPlan.getNodeIdForZoneNary(1, + 0, + samplePartitionKeysMap.get(2).get(0))); } @Test @@ -137,23 +161,23 @@ public void testNonZonedStoreRoutingPlan() { assertEquals("Zone replica type should be 1", 1, nonZonedRoutingPlan.getZoneNAry(Zone.DEFAULT_ZONE_ID, - 2, - samplePartitionKeysMap.get(1).get(0))); + 2, + samplePartitionKeysMap.get(1).get(0))); assertEquals("Zone replica type should be 0", 0, nonZonedRoutingPlan.getZoneNAry(Zone.DEFAULT_ZONE_ID, - 1, - samplePartitionKeysMap.get(3).get(0))); + 1, + samplePartitionKeysMap.get(3).get(0))); assertEquals("Replica owner should be 2", 2, nonZonedRoutingPlan.getNodeIdForZoneNary(Zone.DEFAULT_ZONE_ID, - 1, - samplePartitionKeysMap.get(1).get(0))); + 1, + samplePartitionKeysMap.get(1).get(0))); assertEquals("Replica owner should be 1", 1, nonZonedRoutingPlan.getNodeIdForZoneNary(Zone.DEFAULT_ZONE_ID, - 0, - samplePartitionKeysMap.get(3).get(0))); + 0, + samplePartitionKeysMap.get(3).get(0))); } @After diff --git a/test/unit/voldemort/server/rebalance/RebalancerStateTest.java b/test/unit/voldemort/server/rebalance/RebalancerStateTest.java index c7e7e7550c..d19f24a13f 100644 --- a/test/unit/voldemort/server/rebalance/RebalancerStateTest.java +++ b/test/unit/voldemort/server/rebalance/RebalancerStateTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2009 LinkedIn, Inc + * Copyright 2008-2013 LinkedIn, Inc * * Licensed 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 diff --git a/test/unit/voldemort/store/metadata/MetadataStoreTest.java b/test/unit/voldemort/store/metadata/MetadataStoreTest.java index 389796e9d4..77c50e9853 100644 --- a/test/unit/voldemort/store/metadata/MetadataStoreTest.java +++ b/test/unit/voldemort/store/metadata/MetadataStoreTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2009 LinkedIn, Inc + * Copyright 2008-2013 LinkedIn, Inc * * Licensed 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 diff --git a/test/unit/voldemort/store/rebalancing/RedirectingStoreTest.java b/test/unit/voldemort/store/rebalancing/RedirectingStoreTest.java index f4bc7d25ce..3ac84ee901 100644 --- a/test/unit/voldemort/store/rebalancing/RedirectingStoreTest.java +++ b/test/unit/voldemort/store/rebalancing/RedirectingStoreTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2008-2010 LinkedIn, Inc + * Copyright 2008-2013 LinkedIn, Inc * * Licensed 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