Permalink
Browse files

Adding exact flag

  • Loading branch information...
rsumbaly committed Sep 15, 2012
1 parent 3f7ad51 commit f82b9e973440fe656e1bfd54c64da6ccfd7d2cca
Showing with 189 additions and 88 deletions.
  1. +23 −16 clients/python/voldemort/protocol/voldemort_client_pb2.py
  2. +1 −1 contrib/krati/src/java/voldemort/store/krati/KratiStorageEngine.java
  3. +3 −1 src/java/voldemort/VoldemortClientShell.java
  4. +2 −2 src/java/voldemort/client/DefaultStoreClient.java
  5. +2 −2 src/java/voldemort/client/LazyStoreClient.java
  6. +3 −1 src/java/voldemort/client/StoreClient.java
  7. +1 −0 src/java/voldemort/client/protocol/RequestFormat.java
  8. +2 −0 src/java/voldemort/client/protocol/pb/ProtoBuffClientRequestFormat.java
  9. +67 −24 src/java/voldemort/client/protocol/pb/VProto.java
  10. +2 −0 src/java/voldemort/client/protocol/vold/VoldemortNativeClientRequestFormat.java
  11. +5 −1 src/java/voldemort/server/protocol/vold/VoldemortNativeRequestHandler.java
  12. +2 −2 src/java/voldemort/store/DelegatingStore.java
  13. +2 −1 src/java/voldemort/store/Store.java
  14. +1 −1 src/java/voldemort/store/bdb/BdbStorageEngine.java
  15. +2 −2 src/java/voldemort/store/compress/CompressingStore.java
  16. +1 −1 src/java/voldemort/store/configuration/ConfigurationStorageEngine.java
  17. +2 −1 src/java/voldemort/store/http/HttpStore.java
  18. +2 −2 src/java/voldemort/store/logging/LoggingStore.java
  19. +1 −1 src/java/voldemort/store/memory/InMemoryStorageEngine.java
  20. +1 −1 src/java/voldemort/store/metadata/MetadataStore.java
  21. +1 −1 src/java/voldemort/store/mysql/MysqlStorageEngine.java
  22. +1 −0 src/java/voldemort/store/nonblockingstore/NonblockingStore.java
  23. +2 −1 src/java/voldemort/store/nonblockingstore/ThreadPoolBasedNonblockingStoreImpl.java
  24. +18 −2 src/java/voldemort/store/readonly/ReadOnlyStorageEngine.java
  25. +5 −2 src/java/voldemort/store/routed/PipelineRoutedStore.java
  26. +1 −1 src/java/voldemort/store/routed/ThreadPoolRoutedStore.java
  27. +6 −2 src/java/voldemort/store/routed/action/PerformParallelHasKeysRequests.java
  28. +5 −1 src/java/voldemort/store/routed/action/PerformSerialHasKeysRequests.java
  29. +2 −2 src/java/voldemort/store/serialized/SerializingStore.java
  30. +2 −2 src/java/voldemort/store/slop/SlopStorageEngine.java
  31. +6 −3 src/java/voldemort/store/socket/SocketStore.java
  32. +5 −2 src/java/voldemort/store/socket/clientrequest/HasKeysClientRequest.java
  33. +2 −2 src/java/voldemort/store/views/ViewStorageEngine.java
  34. +1 −0 src/proto/voldemort-client.proto
  35. +1 −1 test/common/voldemort/cluster/failuredetector/MutableStoreVerifier.java
  36. +1 −1 test/common/voldemort/store/DoNothingStore.java
  37. +1 −1 test/common/voldemort/store/FailingReadsStore.java
  38. +1 −1 test/common/voldemort/store/FailingStore.java
  39. +1 −1 test/integration/voldemort/store/noop/NoopStorageEngine.java
  40. +2 −2 test/integration/voldemort/store/pausable/PausableStorageEngine.java

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -104,7 +104,7 @@ public void truncate() {
}
}
- public Map<ByteArray, Boolean> hasKeys(Iterable<ByteArray> keys) {
+ public Map<ByteArray, Boolean> hasKeys(Iterable<ByteArray> keys, boolean exact) {
return StoreUtils.hasKeys(this, keys);
}
@@ -183,7 +183,7 @@ private static void processCommands(StoreClientFactory factory,
} catch(EndOfFileException e) {
// this is okay, just means we are done reading
}
- Map<Object, Boolean> vals = client.hasKeys(keys);
+ Map<Object, Boolean> vals = client.hasKeys(keys, true);
if(vals.size() > 0) {
for(Map.Entry<Object, Boolean> entry: vals.entrySet()) {
System.out.print(entry.getKey());
@@ -296,6 +296,8 @@ private static void processCommands(StoreClientFactory factory,
+ "get key --- Retrieve the value associated with the key.");
System.out.println(PROMPT
+ "getall key1 [key2...] --- Retrieve the value(s) associated with the key(s).");
+ System.out.println(PROMPT
+ + "haskeys key1 [key2...] --- Boolean to signify if the key exists");
System.out.println(PROMPT
+ "delete key --- Remove all values associated with the key.");
System.out.println(PROMPT
@@ -357,15 +357,15 @@ else if(versions.size() == 1)
}
- public Map<K, Boolean> hasKeys(Iterable<K> keys) {
+ public Map<K, Boolean> hasKeys(Iterable<K> keys, boolean exact) {
// Pre-populate with all false
Map<K, Boolean> returnMap = new HashMap<K, Boolean>();
for(K key: keys) {
returnMap.put(key, false);
}
for(int attempts = 0; attempts < this.metadataRefreshAttempts; attempts++) {
try {
- Map<K, Boolean> items = store.hasKeys(keys);
+ Map<K, Boolean> items = store.hasKeys(keys, exact);
for(Map.Entry<K, Boolean> value: items.entrySet()) {
returnMap.put(value.getKey(), value.getValue());
}
@@ -123,8 +123,8 @@ public boolean delete(K key, Version version) {
return getStoreClient().getResponsibleNodes(key);
}
- public Map<K, Boolean> hasKeys(Iterable<K> keys) {
- return getStoreClient().hasKeys(keys);
+ public Map<K, Boolean> hasKeys(Iterable<K> keys, boolean exact) {
+ return getStoreClient().hasKeys(keys, exact);
}
}
@@ -211,9 +211,11 @@
* Given a set of keys, check if it exists
*
* @param keys Set of keys to check
+ * @param exact Do we want an exact answer? If set to false we can get some
+ * false positives as well ( and will be faster )
* @return Map of key to boolean. The guarantee is number of keys = number
* of input keys
*/
- public Map<K, Boolean> hasKeys(Iterable<K> keys);
+ public Map<K, Boolean> hasKeys(Iterable<K> keys, boolean exact);
}
@@ -71,6 +71,7 @@ public void writeGetAllRequest(DataOutputStream output,
public void writeHasKeysRequest(DataOutputStream output,
String storeName,
Iterable<ByteArray> keys,
+ boolean exact,
RequestRoutingType routingType) throws IOException;
public boolean isCompleteHasKeysResponse(ByteBuffer buffer);
@@ -246,12 +246,14 @@ private boolean isCompleteResponse(ByteBuffer buffer) {
public void writeHasKeysRequest(DataOutputStream output,
String storeName,
Iterable<ByteArray> keys,
+ boolean exact,
RequestRoutingType routingType) throws IOException {
StoreUtils.assertValidKeys(keys);
VProto.HasKeysRequest.Builder req = VProto.HasKeysRequest.newBuilder();
for(ByteArray key: keys)
req.addKeys(ByteString.copyFrom(key.get()));
+ req.setExact(exact);
ProtoUtils.writeMessage(output,
VProto.VoldemortRequest.newBuilder()

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit f82b9e9

Please sign in to comment.