You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/03/15 01:27:18 UTC
[30/50] [abbrv] git commit: Correcting document type generation
because . , _ # and | are not allowed.
Correcting document type generation because . , _ # and | are not allowed.
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/24a8f4d4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/24a8f4d4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/24a8f4d4
Branch: refs/heads/asyncqueue
Commit: 24a8f4d42af32657bb8c906475f787591b824f65
Parents: eb844fe
Author: Dave Johnson <dm...@apigee.com>
Authored: Fri Mar 7 08:10:24 2014 -0500
Committer: Dave Johnson <dm...@apigee.com>
Committed: Fri Mar 7 08:10:24 2014 -0500
----------------------------------------------------------------------
stack/corepersistence/queryindex/README.md | 46 +++-----------------
.../index/impl/EsEntityCollectionIndex.java | 23 ++++++----
.../src/test/resources/log4j.properties | 2 +-
3 files changed, 23 insertions(+), 48 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/24a8f4d4/stack/corepersistence/queryindex/README.md
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/README.md b/stack/corepersistence/queryindex/README.md
index f581360..14426ce 100644
--- a/stack/corepersistence/queryindex/README.md
+++ b/stack/corepersistence/queryindex/README.md
@@ -41,56 +41,24 @@ Issues and work remaining
---
* We have to set a Query Cursor Timeout, is that a problem?
+ * No, but how does it work. Does timeout reset on each query?
* We need to set a Refresh Frequency, how do we design around that?
+ * To be determined...
-* What additional tests that should bring in from 1.0?
-
-* Should we add support for connections aka "edges" via Graph module?
-
-* What is a good Chop stress test, just index & query lots of stuff?
-
-* Is it OK to use scope.getName() as ElasticSearch type name? No.
- * Are scope names guaranteed to be unique?
- * Does a type name need to be a composite like "appId|orgId|scope"? Yes.
-
-* What things can be done asyncrhonously here? Is there anything we should parallelize?
-
-* What should happen when an Entity is de-indexed?
- * Only one specific version of Entity should be removed from index?
- * All versions should be deleted?
- * What API should we expose here?
-
-* How should we name the index?
- * root / id / name?
- * One index per organization?
-
-* Use Entity validation utils from Collection Module instead of my own checks
-
-* How do you tell query to return Ids, EntityRefs or Entities?
- * Use multi-get for getting entities
- * Use three different interfaces for Results. one for Ids, one for EntityRefs and that provides Entities.
-
-* Get rid of LOAD LEVEL stuff, allow caller to get whatever he wants.
-
-* Should entity get be parallelized? Maybe.
+* Better to have index for all, or one per organization?
-
__Work remaining:__
-- Figure out the above issues
-
- Figure out why some tests are running out of memory and hanging the build
- Create CHOP-style test cases to stress system
+- Bring in tests from org.apache.usergrid.persistence.query
+- Get rid of Load Level stuff in Results, allow caller to get anything
+- Use Entity Validation utils from Collection instead of my own checks
-
-
-
-
-
-
+- Use mutli-get for fetching entities for results
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/24a8f4d4/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityCollectionIndex.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityCollectionIndex.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityCollectionIndex.java
index 8d0ff76..74fbf20 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityCollectionIndex.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityCollectionIndex.java
@@ -86,6 +86,12 @@ public class EsEntityCollectionIndex implements EntityCollectionIndex {
public static final String ANALYZED_SUFFIX = "_ug_analyzed";
public static final String GEO_SUFFIX = "_ug_geo";
+ public static final String ID_SEPARATOR = "|";
+ public static final String ID_SEPARATOR_SPLITTER = "\\|";
+
+ // These are not allowed in document type names: _ . , | #
+ public static final String TYPE_SEPARATOR = "^";
+
@Inject
public EsEntityCollectionIndex(@Assisted final CollectionScope scope,
IndexFig config,
@@ -142,21 +148,22 @@ public class EsEntityCollectionIndex implements EntityCollectionIndex {
private String createIndexId(Id entityId, UUID version) {
+ String sep = ID_SEPARATOR;
StringBuilder sb = new StringBuilder();
- sb.append( entityId.getUuid() ).append("|");
- sb.append( entityId.getType() ).append("|");
+ sb.append( entityId.getUuid() ).append(sep);
+ sb.append( entityId.getType() ).append(sep);
sb.append( version.toString() );
return sb.toString();
}
public static String createTypeName( CollectionScope scope ) {
- //return scope.getName();
+ String sep = TYPE_SEPARATOR;
StringBuilder sb = new StringBuilder();
- sb.append( scope.getName() ).append("|");
- sb.append( scope.getOwner().getUuid() ).append("|");
- sb.append( scope.getOwner().getType() ).append("|");
- sb.append( scope.getOrganization().getUuid() ).append("|");
+ sb.append( scope.getName() ).append(sep);
+ sb.append( scope.getOwner().getUuid() ).append(sep);
+ sb.append( scope.getOwner().getType() ).append(sep);
+ sb.append( scope.getOrganization().getUuid() ).append(sep);
sb.append( scope.getOrganization().getType() );
return sb.toString();
}
@@ -256,7 +263,7 @@ public class EsEntityCollectionIndex implements EntityCollectionIndex {
for (SearchHit hit : hits.getHits()) {
- String[] idparts = hit.getId().split("\\|");
+ String[] idparts = hit.getId().split( ID_SEPARATOR_SPLITTER );
String id = idparts[0];
String type = idparts[1];
String version = idparts[2];
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/24a8f4d4/stack/corepersistence/queryindex/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/test/resources/log4j.properties b/stack/corepersistence/queryindex/src/test/resources/log4j.properties
index c2f39ef..cc51888 100644
--- a/stack/corepersistence/queryindex/src/test/resources/log4j.properties
+++ b/stack/corepersistence/queryindex/src/test/resources/log4j.properties
@@ -4,7 +4,7 @@ log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %p %c{3}.%M(%L)<%t>- %m%n
-log4j.logger.org.safehaus.guicyfig=DEBUG
+log4j.logger.org.safehaus.guicyfig=ERROR
log4j.logger.org.safehaus.chop.plugin=INFO
log4j.logger.org.safehaus.chop.api.store.amazon=DEBUG