Skip to content

Commit

Permalink
Added Entropy Detection
Browse files Browse the repository at this point in the history
  • Loading branch information
rsumbaly committed Oct 18, 2010
1 parent fef732e commit d696ca8
Show file tree
Hide file tree
Showing 9 changed files with 377 additions and 125 deletions.
7 changes: 7 additions & 0 deletions clients/python/voldemort_admin_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 43 additions & 7 deletions src/java/voldemort/client/protocol/admin/AdminClient.java
Expand Up @@ -285,12 +285,14 @@ private void initiateFetchRequest(DataOutputStream outputStream,
List<Integer> partitionList,
VoldemortFilter filter,
boolean fetchValues,
boolean fetchMasterEntries) throws IOException {
boolean fetchMasterEntries,
long skipRecords) throws IOException {
VAdminProto.FetchPartitionEntriesRequest.Builder fetchRequest = VAdminProto.FetchPartitionEntriesRequest.newBuilder()
.addAllPartitions(partitionList)
.setFetchValues(fetchValues)
.setFetchMasterEntries(fetchMasterEntries)
.setStore(storeName);
.setStore(storeName)
.setSkipRecords(skipRecords);

if(filter != null) {
fetchRequest.setFilter(encodeFilter(filter));
Expand Down Expand Up @@ -334,7 +336,8 @@ private VAdminProto.FetchPartitionEntriesResponse responseFromStream(DataInputSt
* @param partitionList List of the partitions
* @param filter Custom filter implementation to filter out entries which
* should not be fetched.
* @param fetch only entries which belong to Master
* @param fetchMasterEntries Fetch an entry only if master replica
* @param skipRecords Number of records to skip
* @return An iterator which allows entries to be streamed as they're being
* iterated over.
* @throws VoldemortException
Expand All @@ -343,7 +346,9 @@ public Iterator<Pair<ByteArray, Versioned<byte[]>>> fetchEntries(int nodeId,
String storeName,
List<Integer> partitionList,
VoldemortFilter filter,
boolean fetchMasterEntries) {
boolean fetchMasterEntries,
long skipRecords) {

Node node = this.getAdminClientCluster().getNodeById(nodeId);
final SocketDestination destination = new SocketDestination(node.getHost(),
node.getAdminPort(),
Expand All @@ -358,7 +363,8 @@ public Iterator<Pair<ByteArray, Versioned<byte[]>>> fetchEntries(int nodeId,
partitionList,
filter,
true,
fetchMasterEntries);
fetchMasterEntries,
skipRecords);
} catch(IOException e) {
close(sands.getSocket());
pool.checkin(destination, sands);
Expand Down Expand Up @@ -398,6 +404,19 @@ public Pair<ByteArray, Versioned<byte[]>> computeNext() {

}

/**
* See documentation for
* {@link AdminClient#fetchEntries(int, String, List, VoldemortFilter, boolean, long)}
* . Kept for backwards compatibility
*/
public Iterator<Pair<ByteArray, Versioned<byte[]>>> fetchEntries(int nodeId,
String storeName,
List<Integer> partitionList,
VoldemortFilter filter,
boolean fetchMasterEntries) {
return fetchEntries(nodeId, storeName, partitionList, filter, fetchMasterEntries, 0);
}

/**
* Fetch All keys belonging to partitionList from requested node. Identical
* to {@link AdminClient#fetchEntries} but will <em>only fetch the keys</em>
Expand All @@ -407,13 +426,16 @@ public Pair<ByteArray, Versioned<byte[]>> computeNext() {
* @param partitionList See documentation for
* {@link AdminClient#fetchEntries}
* @param filter See documentation for {@link AdminClient#fetchEntries}
* @param skipRecords See documentation for
* {@link AdminClient#fetchEntries(int, String, List, VoldemortFilter, boolean, long)}
* @return See documentation for {@link AdminClient#fetchEntries}
*/
public Iterator<ByteArray> fetchKeys(int nodeId,
String storeName,
List<Integer> partitionList,
VoldemortFilter filter,
boolean fetchMasterEntries) {
boolean fetchMasterEntries,
long skipRecords) {
Node node = this.getAdminClientCluster().getNodeById(nodeId);
final SocketDestination destination = new SocketDestination(node.getHost(),
node.getAdminPort(),
Expand All @@ -428,7 +450,8 @@ public Iterator<ByteArray> fetchKeys(int nodeId,
partitionList,
filter,
false,
fetchMasterEntries);
fetchMasterEntries,
skipRecords);
} catch(IOException e) {
close(sands.getSocket());
pool.checkin(destination, sands);
Expand Down Expand Up @@ -465,6 +488,19 @@ public ByteArray computeNext() {
};
}

/**
* See documentation for
* {@link AdminClient#fetchKeys(int, String, List, VoldemortFilter, boolean, long)}
* . Kept for backwards compatibility
*/
public Iterator<ByteArray> fetchKeys(int nodeId,
String storeName,
List<Integer> partitionList,
VoldemortFilter filter,
boolean fetchMasterEntries) {
return fetchKeys(nodeId, storeName, partitionList, filter, fetchMasterEntries, 0);
}

/**
* RestoreData from copies on other machines for the given nodeId
* <p>
Expand Down

0 comments on commit d696ca8

Please sign in to comment.