Skip to content

Commit

Permalink
Fixed issue 205. No longer trying to do proxyGetAll if there are *no*…
Browse files Browse the repository at this point in the history
… redirecting keys at all.
  • Loading branch information
afeinberg committed Feb 1, 2010
1 parent e4cd7fe commit cad759a
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/java/voldemort/store/rebalancing/RedirectingStore.java
Expand Up @@ -16,6 +16,7 @@

package voldemort.store.rebalancing;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

Expand All @@ -41,9 +42,6 @@
import voldemort.versioning.Version;
import voldemort.versioning.Versioned;

import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;

/**
* The RedirectingStore extends {@link DelegatingStore}
* <p>
Expand Down Expand Up @@ -120,13 +118,13 @@ public List<Version> getVersions(ByteArray key) {
@Override
public Map<ByteArray, List<Versioned<byte[]>>> getAll(Iterable<ByteArray> keys)
throws VoldemortException {

proxyGetAllAndLocalPut(Iterables.filter(keys, new Predicate<ByteArray>() {

public boolean apply(ByteArray key) {
return redirectingKey(key);
}
}));
List<ByteArray> redirectingKeys = new ArrayList<ByteArray>();
for (ByteArray key: keys) {
if (redirectingKey(key))
redirectingKeys.add(key);
}
if (!redirectingKeys.isEmpty())
proxyGetAllAndLocalPut(redirectingKeys);

return getInnerStore().getAll(keys);
}
Expand Down

0 comments on commit cad759a

Please sign in to comment.