Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added compulsory param (to MigratePartitions) to indicate whether we …

…want to switch back to normal state at the end of migration
  • Loading branch information...
commit 16387be385ceafced807a96297f5ef24248446b8 1 parent d037852
@rsumbaly rsumbaly authored afeinberg committed
View
25 src/java/voldemort/client/rebalance/MigratePartitions.java
@@ -46,23 +46,6 @@
private final HashMap<Integer, Versioned<String>> donorStates;
private final boolean transitionToNormal;
- public MigratePartitions(Cluster currentCluster,
- Cluster targetCluster,
- List<StoreDefinition> currentStoreDefs,
- List<StoreDefinition> targetStoreDefs,
- AdminClient adminClient,
- VoldemortConfig voldemortConfig,
- List<Integer> stealerNodeIds) {
- this(currentCluster,
- targetCluster,
- currentStoreDefs,
- targetStoreDefs,
- adminClient,
- voldemortConfig,
- stealerNodeIds,
- false);
- }
-
/**
*
* @param currentCluster The cluster as it is now
@@ -256,10 +239,12 @@ public static void main(String[] args) throws IOException {
parser.accepts("cluster-xml", "[REQUIRED] cluster xml file location")
.withRequiredArg()
.describedAs("path");
- parser.accepts("stealer-node-ids", "Comma separated node ids [ Default - all]")
+ parser.accepts("stealer-node-ids", "Comma separated node ids [Default - all]")
.withRequiredArg()
.ofType(Integer.class)
.withValuesSeparatedBy(',');
+ parser.accepts("transition-to-normal",
+ "At the end of migration do we want to transition back to normal state? [Default-false]");
OptionSet options = parser.parse(args);
@@ -282,6 +267,7 @@ public static void main(String[] args) throws IOException {
String currentClusterFile = (String) options.valueOf("cluster-xml");
String currentStoresFile = (String) options.valueOf("stores-xml");
String targetStoresFile = currentStoresFile;
+ boolean transitionToNormal = options.has("transition-to-normal");
if(options.has("target-stores-xml")) {
targetStoresFile = (String) options.valueOf("target-stores-xml");
@@ -317,7 +303,8 @@ public static void main(String[] args) throws IOException {
targetStoreDefs,
adminClient,
voldemortConfig,
- stealerNodeIds);
+ stealerNodeIds,
+ transitionToNormal);
migratePartitions.migrate();
} catch(Exception e) {
View
12 test/unit/voldemort/client/rebalance/MigratePartitionsTest.java
@@ -255,7 +255,8 @@ public void testDonorNodePlanGeneration() {
Lists.newArrayList(afterStoreDef),
adminClient,
voldemortConfig,
- Lists.newArrayList(0));
+ Lists.newArrayList(0),
+ true);
HashMap<Integer, List<RebalancePartitionsInfo>> donorNodePlans = tool.getDonorNodePlan();
Assert.assertEquals(donorNodePlans.size(), 1);
Assert.assertEquals(donorNodePlans.get(1).size(), 1);
@@ -267,7 +268,8 @@ public void testDonorNodePlanGeneration() {
Lists.newArrayList(afterStoreDef),
adminClient,
voldemortConfig,
- Lists.newArrayList(1));
+ Lists.newArrayList(1),
+ true);
donorNodePlans = tool.getDonorNodePlan();
Assert.assertEquals(donorNodePlans.size(), 1);
Assert.assertEquals(donorNodePlans.get(0).size(), 1);
@@ -279,7 +281,8 @@ public void testDonorNodePlanGeneration() {
Lists.newArrayList(afterStoreDef),
adminClient,
voldemortConfig,
- Lists.newArrayList(0, -1));
+ Lists.newArrayList(0, -1),
+ true);
donorNodePlans = tool.getDonorNodePlan();
Assert.assertEquals(donorNodePlans.size(), 1);
Assert.assertEquals(donorNodePlans.get(1).size(), 1);
@@ -291,7 +294,8 @@ public void testDonorNodePlanGeneration() {
Lists.newArrayList(afterStoreDef),
adminClient,
voldemortConfig,
- null);
+ null,
+ true);
donorNodePlans = tool.getDonorNodePlan();
Assert.assertEquals(donorNodePlans.size(), 2);
Assert.assertEquals(donorNodePlans.get(0).size(), 1);
Please sign in to comment.
Something went wrong with that request. Please try again.