You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by to...@apache.org on 2015/06/12 23:01:04 UTC
[11/23] incubator-usergrid git commit: bucket comments
bucket comments
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/b4789550
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/b4789550
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/b4789550
Branch: refs/heads/USERGRID-744
Commit: b4789550e09a6801fbf4f0c7b346977425ccd8b2
Parents: 1ca2dea
Author: Shawn Feldman <sf...@apache.org>
Authored: Thu Jun 11 15:29:51 2015 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Thu Jun 11 15:29:51 2015 -0600
----------------------------------------------------------------------
.../index/ApplicationIndexBucketLocator.java | 9 +++++----
.../apache/usergrid/corepersistence/index/CoreIndexFig.java | 6 ++++--
2 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b4789550/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ApplicationIndexBucketLocator.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ApplicationIndexBucketLocator.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ApplicationIndexBucketLocator.java
index a828739..12359c1 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ApplicationIndexBucketLocator.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ApplicationIndexBucketLocator.java
@@ -20,7 +20,6 @@
package org.apache.usergrid.corepersistence.index;
import com.google.common.hash.Funnel;
-import com.google.common.hash.PrimitiveSink;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import org.apache.usergrid.persistence.core.scope.ApplicationScope;
@@ -48,18 +47,20 @@ public class ApplicationIndexBucketLocator{
/**
* Startseed for buckets
*/
- private final int indexBucketSeed;
+ private final int indexBucketOffset;
@Inject
public ApplicationIndexBucketLocator(CoreIndexFig indexFig){
numberOfBuckets = indexFig.getNumberOfIndexBuckets();
mapKeyFunnel = (key, into) -> into.putString( key, StringHashUtils.UTF8 );
- indexBucketSeed = indexFig.getBucketSeed();
+ indexBucketOffset = indexFig.getBucketOffset();
bucketLocator = new ExpandingShardLocator<>(mapKeyFunnel, numberOfBuckets);
}
public int getBucket(ApplicationScope applicationScope){
- return indexBucketSeed + bucketLocator.getCurrentBucket(applicationScope.getApplication().getUuid().toString());
+ //potentially add offset to remove old buckets
+ //if set is 1-5 then +5 would change range to 6-10
+ return indexBucketOffset + bucketLocator.getCurrentBucket(applicationScope.getApplication().getUuid().toString());
}
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b4789550/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/CoreIndexFig.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/CoreIndexFig.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/CoreIndexFig.java
index e31a39b..90a3191 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/CoreIndexFig.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/CoreIndexFig.java
@@ -49,7 +49,9 @@ public interface CoreIndexFig extends GuicyFig {
int getNumberOfIndexBuckets();
+ //offset the bucket by a certain amount to remove older buckets from range e.g
+ // if range was 1-5 offset should be 5 to remove 1-5 from set
@Default( "0" )
- @Key( "elasticsearch.index_bucket_seed" )
- int getBucketSeed();
+ @Key( "elasticsearch.index_bucket_offset" )
+ int getBucketOffset();
}