Skip to content
Browse files

Made repair job request non blocking and scheduled it by default

  • Loading branch information...
1 parent 294aed5 commit a543511b94c7fc5c4a7e47d8cf72e2dcdc76e3ba Chinmay Soman committed with vinothchandar Oct 31, 2011
View
20 src/java/voldemort/client/protocol/admin/AdminClient.java
@@ -1592,14 +1592,22 @@ public void repairJob(int nodeId) {
.setRepairJob(repairJobRequest)
.setType(VAdminProto.AdminRequestType.REPAIR_JOB)
.build();
- VAdminProto.AsyncOperationStatusResponse.Builder response = sendAndReceive(nodeId,
- adminRequest,
- VAdminProto.AsyncOperationStatusResponse.newBuilder());
+ Node node = this.getAdminClientCluster().getNodeById(nodeId);
+ SocketDestination destination = new SocketDestination(node.getHost(),
+ node.getAdminPort(),
+ RequestFormatType.ADMIN_PROTOCOL_BUFFERS);
+ SocketAndStreams sands = pool.checkout(destination);
- if(response.hasError()) {
- throwException(response.getError());
+ try {
+ DataOutputStream outputStream = sands.getOutputStream();
+ ProtoUtils.writeMessage(outputStream, adminRequest);
+ outputStream.flush();
+ } catch(IOException e) {
+ close(sands.getSocket());
+ throw new VoldemortException(e);
+ } finally {
+ pool.checkin(destination, sands);
}
-
return;
}
View
2 src/java/voldemort/server/VoldemortConfig.java
@@ -276,7 +276,7 @@ public VoldemortConfig(Props props) {
this.enableMetadataChecking = props.getBoolean("enable.metadata.checking", true);
this.enableGossip = props.getBoolean("enable.gossip", false);
this.enableRebalanceService = props.getBoolean("enable.rebalancing", true);
- this.enableRepair = props.getBoolean("enable.repair", false);
+ this.enableRepair = props.getBoolean("enable.repair", true);
this.gossipInterval = props.getInt("gossip.interval.ms", 30 * 1000);
View
7 src/java/voldemort/server/protocol/admin/AdminServiceRequestHandler.java
@@ -544,8 +544,11 @@ public StreamRequestHandler handleUpdatePartitionEntries(VAdminProto.UpdateParti
VAdminProto.RepairJobResponse.Builder response = VAdminProto.RepairJobResponse.newBuilder();
try {
RepairJob job = storeRepository.getRepairJob();
- logger.info("Starting the repair job now on ID : " + metadataStore.getNodeId());
- job.run();
+ if(job != null) {
+ logger.info("Starting the repair job now on ID : " + metadataStore.getNodeId());
+ job.run();
+ } else
+ logger.error("RepairJob is not scheduled.");
} catch(VoldemortException e) {
response.setError(ProtoUtils.encodeError(errorCodeMapper, e));
logger.error("Repair job failed for request : " + request.toString() + ")", e);
View
2 src/java/voldemort/server/storage/StorageService.java
@@ -232,7 +232,7 @@ protected void startInner() {
// Create a repair job object and register it with Store repository
if(voldemortConfig.isRepairEnabled()) {
- logger.info("Initializing repair job " + voldemortConfig.getPusherType());
+ logger.info("Initializing repair job.");
RepairJob job = new RepairJob(storeRepository, metadata, scanPermits);
JmxUtils.registerMbean(job, JmxUtils.createObjectName(job.getClass()));
storeRepository.registerRepairJob(job);

0 comments on commit a543511

Please sign in to comment.
Something went wrong with that request. Please try again.