Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

code clean up for donor-based rebalancing

  • Loading branch information...
commit 30d183a2904e9ad7d4425e411855d9595607af80 1 parent b410087
Lei Gao authored
View
46 config/test_config1/config/cluster.xml
@@ -1,27 +1,19 @@
-<cluster>
- <name>mycluster</name>
- <server>
- <id>0</id>
- <host>localhost</host>
- <http-port>8081</http-port>
- <socket-port>6666</socket-port>
- <admin-port>6667</admin-port>
- <partitions>0, 1, 2</partitions>
- </server>
- <server>
- <id>1</id>
- <host>localhost</host>
- <http-port>8082</http-port>
- <socket-port>6668</socket-port>
- <admin-port>6669</admin-port>
- <partitions>3</partitions>
- </server>
- <server>
- <id>2</id>
- <host>localhost</host>
- <http-port>8083</http-port>
- <socket-port>6670</socket-port>
- <admin-port>6671</admin-port>
- <partitions />
- </server>
-</cluster>
+<cluster>
+ <name>mycluster</name>
+ <server>
+ <id>0</id>
+ <host>localhost</host>
+ <http-port>8081</http-port>
+ <socket-port>6666</socket-port>
+ <admin-port>6667</admin-port>
+ <partitions>0, 1</partitions>
+ </server>
+ <server>
+ <id>1</id>
+ <host>localhost</host>
+ <http-port>8082</http-port>
+ <socket-port>6668</socket-port>
+ <admin-port>6669</admin-port>
+ <partitions>2, 3</partitions>
+ </server>
+</cluster>
View
46 config/test_config2/config/cluster.xml
@@ -1,27 +1,19 @@
-<cluster>
- <name>mycluster</name>
- <server>
- <id>0</id>
- <host>localhost</host>
- <http-port>8081</http-port>
- <socket-port>6666</socket-port>
- <admin-port>6667</admin-port>
- <partitions>0, 1, 2</partitions>
- </server>
- <server>
- <id>1</id>
- <host>localhost</host>
- <http-port>8082</http-port>
- <socket-port>6668</socket-port>
- <admin-port>6669</admin-port>
- <partitions>3</partitions>
- </server>
- <server>
- <id>2</id>
- <host>localhost</host>
- <http-port>8083</http-port>
- <socket-port>6670</socket-port>
- <admin-port>6671</admin-port>
- <partitions />
- </server>
-</cluster>
+<cluster>
+ <name>mycluster</name>
+ <server>
+ <id>0</id>
+ <host>localhost</host>
+ <http-port>8081</http-port>
+ <socket-port>6666</socket-port>
+ <admin-port>6667</admin-port>
+ <partitions>0, 1</partitions>
+ </server>
+ <server>
+ <id>1</id>
+ <host>localhost</host>
+ <http-port>8082</http-port>
+ <socket-port>6668</socket-port>
+ <admin-port>6669</admin-port>
+ <partitions>2, 3</partitions>
+ </server>
+</cluster>
View
13 src/java/voldemort/VoldemortAdminTool.java
@@ -684,9 +684,8 @@ private static void executeSetMetadata(Integer nodeId,
+ adminClient.getAdminClientCluster()
.getNodeById(currentNodeId)
.getId());
- adminClient.updateRemoteMetadata(currentNodeId,
- key,
- Versioned.value(value.toString(), updatedVersion));
+ adminClient.updateRemoteMetadata(currentNodeId, key, Versioned.value(value.toString(),
+ updatedVersion));
}
}
@@ -747,10 +746,10 @@ private static void executeROMetadata(Integer nodeId,
}
- public static void executeGetMetadata(Integer nodeId,
- AdminClient adminClient,
- String metadataKey,
- String outputDir) throws IOException {
+ private static void executeGetMetadata(Integer nodeId,
+ AdminClient adminClient,
+ String metadataKey,
+ String outputDir) throws IOException {
File directory = null;
if(outputDir != null) {
directory = new File(outputDir);
View
2  src/java/voldemort/VoldemortClientShell.java
@@ -124,7 +124,7 @@ public static void main(String[] args) throws Exception {
System.out.println("Established connection to " + storeName + " via " + bootstrapUrl);
System.out.print(PROMPT);
if(fileReader != null) {
- processCommands(factory, adminClient, fileReader, false);
+ processCommands(factory, adminClient, fileReader, true);
fileReader.close();
}
processCommands(factory, adminClient, inputReader, false);
View
6 src/java/voldemort/utils/Entropy.java
@@ -225,6 +225,9 @@ public void generateEntropy(Cluster cluster,
false);
for(long keyId = 0; keyId < numKeysPerNode && keys.hasNext(); keyId++) {
ByteArray key = keys.next();
+ // entropy returns distinct keys from each
+ // node - record the key only if this node
+ // holds the primary partition of the key
if(RebalanceUtils.getNodeIds(strategy.routeRequest(key.get())
.subList(0, 1))
.contains(node.getId())) {
@@ -251,6 +254,9 @@ public void generateEntropy(Cluster cluster,
false);
while(keys.hasNext() && numKeysStored < numKeys) {
ByteArray key = keys.next();
+ // entropy returns distinct keys from each
+ // node - record the key only if this node
+ // holds the primary partition of the key
if(RebalanceUtils.getNodeIds(strategy.routeRequest(key.get())
.subList(0, 1))
.contains(nodeId)) {
View
11 src/java/voldemort/utils/RebalanceUtils.java
@@ -645,18 +645,11 @@ public static boolean containsPreferenceList(Cluster cluster,
* Updates the existing cluster such that we remove partitions mentioned
* from the stealer node and add them to the donor node
*
- * <<<<<<< HEAD
- *
* @param currentCluster Existing cluster metadata. Both stealer and donor
* node should already exist in this metadata
* @param stealerNodeId Id of node from which we are stealing the partitions
- * @param donorNodeId Id of node to which we are donating
- * @param donatedPartitions List of partitions we are moving =======
- * @param cluster Existing cluster metadata
- * @param stealerNode Node which steals the partitions from another node
- * @param donorNode Node which donates partitions to the stealer
- * @param partitionList List of partitions we are moving >>>>>>>
- * upstream/master
+ * @param donatedPartitions List of partitions we are moving
+ * @param partitionList List of partitions we are moving
* @return Updated cluster metadata
*/
public static Cluster createUpdatedCluster(Cluster currentCluster,
Please sign in to comment.
Something went wrong with that request. Please try again.