Skip to content

Commit

Permalink
Get rid of "grandfathering" and "migrate partitions". This is a step …
Browse files Browse the repository at this point in the history
…towards having just one "rebalancing" code
  • Loading branch information
rsumbaly committed Apr 17, 2011
1 parent befe966 commit c38773e
Show file tree
Hide file tree
Showing 27 changed files with 74 additions and 4,732 deletions.
105 changes: 7 additions & 98 deletions clients/python/voldemort/protocol/voldemort_admin_pb2.py

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions src/java/voldemort/VoldemortAdminTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public static void main(String[] args) throws Exception {
parser.accepts("set-metadata",
"Forceful setting of metadata [ " + MetadataStore.CLUSTER_KEY + " | "
+ MetadataStore.STORES_KEY + " | " + MetadataStore.SERVER_STATE_KEY
+ " ], possibly after grandfathering or partial rebalancing")
+ " ]")
.withRequiredArg()
.describedAs("metadata-key")
.ofType(String.class);
Expand All @@ -156,8 +156,7 @@ public static void main(String[] args) throws Exception {
+ MetadataStore.STORES_KEY + " ] - xml file location, [ "
+ MetadataStore.SERVER_STATE_KEY + " ] - "
+ MetadataStore.VoldemortState.NORMAL_SERVER + ","
+ MetadataStore.VoldemortState.REBALANCING_MASTER_SERVER + ","
+ MetadataStore.VoldemortState.GRANDFATHERING_SERVER)
+ MetadataStore.VoldemortState.REBALANCING_MASTER_SERVER)
.withRequiredArg()
.describedAs("metadata-value")
.ofType(String.class);
Expand Down
48 changes: 0 additions & 48 deletions src/java/voldemort/client/protocol/admin/AdminClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
import voldemort.client.protocol.pb.VAdminProto;
import voldemort.client.protocol.pb.VProto;
import voldemort.client.protocol.pb.VAdminProto.ROStoreVersionDirMap;
import voldemort.client.protocol.pb.VAdminProto.UpdateGrandfatherMetadataRequest;
import voldemort.client.protocol.pb.VProto.RequestType;
import voldemort.client.rebalance.RebalancePartitionsInfo;
import voldemort.cluster.Cluster;
Expand Down Expand Up @@ -1727,51 +1726,4 @@ public void fetchPartitionFiles(int nodeId,

}

/**
* Updates the grandfather metadata on the remote machine and returns the
* current
*
* @param donorNodeId The node id on which to update the metadata
* @param plan The list of all migrating partitions
* @return Returns the current state of the server. If we get back a state
* other than rebalancing it means we have a problem
*/
public Versioned<String> updateGrandfatherMetadata(int donorNodeId,
List<RebalancePartitionsInfo> plans) {
List<VAdminProto.InitiateRebalanceNodeRequest> rebalanceRequests = Lists.newArrayList();

for(RebalancePartitionsInfo plan: plans) {
rebalanceRequests.add(VAdminProto.InitiateRebalanceNodeRequest.newBuilder()
.setAttempt(plan.getAttempt())
.setDonorId(plan.getDonorId())
.setStealerId(plan.getStealerId())
.addAllPartitions(plan.getPartitionList())
.addAllUnbalancedStore(plan.getUnbalancedStoreList())
.addAllDeletePartitions(plan.getDeletePartitionsList())
.addAllStealMasterPartitions(plan.getStealMasterPartitions())
.addAllStealerRoStoreToDir(decodeROStoreVersionDirMap(plan.getStealerNodeROStoreToDir()))
.addAllDonorRoStoreToDir(decodeROStoreVersionDirMap(plan.getDonorNodeROStoreToDir()))
.build());
}

UpdateGrandfatherMetadataRequest metadataRequest = VAdminProto.UpdateGrandfatherMetadataRequest.newBuilder()
.addAllPlan(rebalanceRequests)
.build();
VAdminProto.VoldemortAdminRequest request = VAdminProto.VoldemortAdminRequest.newBuilder()
.setType(VAdminProto.AdminRequestType.UPDATE_GRANDFATHER_METADATA)
.setUpdateGrandfatherMetadata(metadataRequest)
.build();

VAdminProto.UpdateGrandfatherMetadataResponse.Builder response = sendAndReceive(donorNodeId,
request,
VAdminProto.UpdateGrandfatherMetadataResponse.newBuilder());

if(response.hasError()) {
throwException(response.getError());
}

Versioned<byte[]> value = ProtoUtils.decodeVersioned(response.getVersion());
return new Versioned<String>(ByteUtils.getString(value.getValue(), "UTF-8"),
value.getVersion());
}
}
Loading

0 comments on commit c38773e

Please sign in to comment.