Skip to content

Commit

Permalink
Merge remote branch 'upstream/li-r1044' into li-r1044-admin
Browse files Browse the repository at this point in the history
  • Loading branch information
rsumbaly committed Nov 3, 2010
2 parents 0fa576d + f9d9e55 commit 718c1fb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import voldemort.store.StorageEngine;
import voldemort.store.readonly.FileFetcher;
import voldemort.store.readonly.ReadOnlyStorageEngine;
import voldemort.store.readonly.ReadOnlyUtils;
import voldemort.utils.ByteArray;
import voldemort.utils.Props;
import voldemort.utils.ReflectUtils;
Expand Down Expand Up @@ -186,7 +187,17 @@ private void doFetch(HttpServletRequest req, HttpServletResponse resp) throws IO

long pushVersion;
if(pushVersionString == null) {
pushVersion = store.getCurrentVersionId() + 1;
// Find the max version
long maxVersion;
File[] storeDirList = ReadOnlyUtils.getVersionDirs(new File(store.getStoreDirPath()));
if(storeDirList == null || storeDirList.length == 0) {
throw new ServletException("Push version required since no version folders exist");
} else {
maxVersion = ReadOnlyUtils.getVersionId(ReadOnlyUtils.findKthVersionedDir(storeDirList,
storeDirList.length - 1,
storeDirList.length - 1)[0]);
}
pushVersion = maxVersion + 1;
} else {
pushVersion = Long.parseLong(pushVersionString);
if(pushVersion <= store.getCurrentVersionId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,17 @@ public VAdminProto.AsyncOperationStatusResponse handleFetchStore(VAdminProto.Fet
+ ") should be greater than current version "
+ store.getCurrentVersionId());
} else {
pushVersion = store.getCurrentVersionId() + 1;
// Find the max version
long maxVersion;
File[] storeDirList = ReadOnlyUtils.getVersionDirs(new File(store.getStoreDirPath()));
if(storeDirList == null || storeDirList.length == 0) {
throw new VoldemortException("Push version required since no version folders exist");
} else {
maxVersion = ReadOnlyUtils.getVersionId(ReadOnlyUtils.findKthVersionedDir(storeDirList,
storeDirList.length - 1,
storeDirList.length - 1)[0]);
}
pushVersion = maxVersion + 1;
}

asyncService.submitOperation(requestId, new AsyncOperation(requestId, "Fetch store") {
Expand Down

0 comments on commit 718c1fb

Please sign in to comment.