Permalink
Browse files

Include grandfather script and fixed bug in Admin Client during fetch

  • Loading branch information...
1 parent 1a9109d commit f93a1e0db1c90dc26531dca507ca34af56f279ee @rsumbaly rsumbaly committed Aug 18, 2010
Showing with 77 additions and 10 deletions.
  1. +54 −0 bin/grandfather-readonly.sh
  2. +23 −10 src/java/voldemort/client/protocol/admin/AdminClient.java
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+#
+# Copyright 2010 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.
+#
+if [ $# -ne 1 ];
+then
+ echo 'USAGE: bin/grandfather-readonly.sh [readonly-folder]'
+ exit 1
+fi
+# Read args
+READ_ONLY_DIR=$1
+
+for stores in $READ_ONLY_DIR/*
+do
+ if [ -d $stores ]; then
+
+ # Convert all to .temp
+ numVersions=`find $stores -name version-* | grep -v .bak | grep -v .temp | wc -l`
+ if [ $numVersions -gt 1 ]; then
+ maxVersion=`find $stores -name version-* | grep -v .bak | grep -v .temp | awk -F'-' '{print $2}' | sort -n | tail -1`
+ for versionDirNo in `find $stores -name version-* | grep -v .bak | grep -v .temp | awk -F'-' '{print $2}' | sort -n`
+ do
+ echo $stores/version-$versionDirNo $stores/version-$maxVersion.temp
+ mv $stores/version-$versionDirNo $stores/version-$maxVersion.temp
+ let maxVersion=maxVersion-1
+ done
+ echo '-------'
+ fi
+
+ # Convert all .temp to normal
+ numVersionsTmp=`find $stores -name version-*.temp | grep -v .bak | wc -l`
+ if [ $numVersionsTmp -gt 1 ]; then
+ for versionDir in `find $stores -name version-*.temp | grep -v .bak | awk -F'.' '{print $1}'`
+ do
+ mv $versionDir.temp $versionDir
+ done
+ echo '======='
+ fi
+ fi
+done
+
@@ -735,12 +735,26 @@ public AsyncOperationStatus getAsyncRequestStatus(int nodeId, int requestId) {
return status;
}
- // TODO: Javadoc, "integration" test
+ /**
+ * Retrieves a list of asynchronous request ids on the server. Does not
+ * include the completed requests
+ *
+ * @param nodeId The id of the node whose request ids we want
+ * @return List of async request ids
+ */
public List<Integer> getAsyncRequestList(int nodeId) {
return getAsyncRequestList(nodeId, false);
}
- // TODO: Javadoc, "integration" test
+ /**
+ * Retrieves a list of asynchronous request ids on the server. Depending on
+ * the boolean passed also retrieves the completed requests
+ *
+ * @param nodeId The id of the node whose request ids we want
+ * @param showComplete Boolean to indicate if we want to include the
+ * completed requests as well
+ * @return List of async request ids
+ */
public List<Integer> getAsyncRequestList(int nodeId, boolean showComplete) {
VAdminProto.AsyncOperationListRequest asyncOperationListRequest = VAdminProto.AsyncOperationListRequest.newBuilder()
.setShowComplete(showComplete)
@@ -758,7 +772,12 @@ public AsyncOperationStatus getAsyncRequestStatus(int nodeId, int requestId) {
return response.getRequestIdsList();
}
- // TODO: Javadoc, "integration" test
+ /**
+ * To stop an asynchronous request on the particular node
+ *
+ * @param nodeId The id of the node on which the request is running
+ * @param requestId The id of the request to terminate
+ */
public void stopAsyncRequest(int nodeId, int requestId) {
VAdminProto.AsyncOperationStopRequest asyncOperationStopRequest = VAdminProto.AsyncOperationStopRequest.newBuilder()
.setRequestId(requestId)
@@ -1215,13 +1234,7 @@ public String fetchStore(int nodeId,
}
int asyncId = response.getRequestId();
- try {
- return waitForCompletion(nodeId, asyncId, timeoutMs, TimeUnit.MILLISECONDS);
- } catch(VoldemortException e) {
- // Need to close async fetch operation
- stopAsyncRequest(nodeId, asyncId);
- throw e;
- }
+ return waitForCompletion(nodeId, asyncId, timeoutMs, TimeUnit.MILLISECONDS);
}
/**

0 comments on commit f93a1e0

Please sign in to comment.