You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sf...@apache.org on 2015/07/22 21:38:44 UTC
incubator-usergrid git commit: fix index init logic
Repository: incubator-usergrid
Updated Branches:
refs/heads/two-dot-o-dev e85753ca6 -> d22e61943
fix index init logic
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/d22e6194
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/d22e6194
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/d22e6194
Branch: refs/heads/two-dot-o-dev
Commit: d22e61943581846d44b352ee18939a998434df51
Parents: e85753c
Author: Shawn Feldman <sf...@apache.org>
Authored: Wed Jul 22 12:53:26 2015 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Wed Jul 22 12:53:26 2015 -0600
----------------------------------------------------------------------
.../corepersistence/CpEntityManager.java | 122 ++++++++++---------
.../corepersistence/CpEntityManagerFactory.java | 6 +-
.../index/ApplicationIndexLocationStrategy.java | 2 +-
.../index/ReplicatedIndexLocationStrategy.java | 2 +-
.../usergrid/persistence/EntityManager.java | 5 +
.../index/impl/EsEntityIndexImpl.java | 2 +
6 files changed, 75 insertions(+), 64 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d22e6194/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
index b530715..d998de0 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
@@ -437,10 +437,10 @@ public class CpEntityManager implements EntityManager {
if(entity == null) {
return null;
}
- Class clazz = Schema.getDefaultSchema().getEntityClass( entity.getId().getType() );
+ Class clazz = Schema.getDefaultSchema().getEntityClass(entity.getId().getType());
- Entity oldFormatEntity = EntityFactory.newEntity( entity.getId().getUuid(), entity.getId().getType(), clazz );
- oldFormatEntity.setProperties( CpEntityMapUtils.toMap( entity ) );
+ Entity oldFormatEntity = EntityFactory.newEntity(entity.getId().getUuid(), entity.getId().getType(), clazz);
+ oldFormatEntity.setProperties(CpEntityMapUtils.toMap(entity));
return oldFormatEntity;
}
@@ -717,7 +717,7 @@ public class CpEntityManager implements EntityManager {
public void decrementEntityCollection( String collection_name ) {
long cassandraTimestamp = cass.createTimestamp();
- decrementEntityCollection( collection_name, cassandraTimestamp );
+ decrementEntityCollection(collection_name, cassandraTimestamp);
}
@@ -749,7 +749,7 @@ public class CpEntityManager implements EntityManager {
@Override
public Results searchCollectionConsistent( EntityRef entityRef, String collectionName, Query query, int expectedResults) throws Exception {
- return getRelationManager( entityRef ).searchCollectionConsistent(collectionName, query, expectedResults );
+ return getRelationManager( entityRef ).searchCollectionConsistent(collectionName, query, expectedResults);
}
@@ -777,14 +777,14 @@ public class CpEntityManager implements EntityManager {
@Override
public void updateApplication( Map<String, Object> properties ) throws Exception {
- this.updateProperties( new SimpleEntityRef( Application.ENTITY_TYPE, applicationId ), properties );
+ this.updateProperties(new SimpleEntityRef(Application.ENTITY_TYPE, applicationId), properties);
this.application = get( applicationId, Application.class );
}
@Override
public RelationManager getRelationManager( EntityRef entityRef ) {
- Preconditions.checkNotNull( entityRef, "entityRef cannot be null" );
+ Preconditions.checkNotNull(entityRef, "entityRef cannot be null");
CpRelationManager relationManager =
new CpRelationManager( managerCache, indexService, collectionService, connectionService, this, entityManagerFig, applicationId, entityRef );
@@ -875,7 +875,7 @@ public class CpEntityManager implements EntityManager {
@Override
public EntityRef getAlias( String aliasType, String alias ) throws Exception {
- return getAlias( new SimpleEntityRef( Application.ENTITY_TYPE, applicationId ), aliasType, alias );
+ return getAlias(new SimpleEntityRef(Application.ENTITY_TYPE, applicationId), aliasType, alias);
}
@@ -904,7 +904,7 @@ public class CpEntityManager implements EntityManager {
new Object[] { ownerRef, collectionType, aliasValue } );
}
- return results.get( aliasValue );
+ return results.get(aliasValue);
}
@@ -913,7 +913,7 @@ public class CpEntityManager implements EntityManager {
String collName = Schema.defaultCollectionName( aliasType );
- return getAlias( new SimpleEntityRef( Application.ENTITY_TYPE, applicationId ), collName, aliases );
+ return getAlias(new SimpleEntityRef(Application.ENTITY_TYPE, applicationId), collName, aliases);
}
@@ -960,7 +960,7 @@ public class CpEntityManager implements EntityManager {
@Override
public EntityRef validate( EntityRef entityRef ) throws Exception {
- return validate( entityRef, true );
+ return validate(entityRef, true);
}
@@ -1041,7 +1041,7 @@ public class CpEntityManager implements EntityManager {
entity.setProperty( propertyName, propertyValue );
entity.setProperty( PROPERTY_MODIFIED, UUIDUtils.getTimestampInMillis( UUIDUtils.newTimeUUID() ) );
- update( entity );
+ update(entity);
}
@@ -1059,7 +1059,7 @@ public class CpEntityManager implements EntityManager {
Entity entity = get( entityRef );
- properties.put( PROPERTY_MODIFIED, UUIDUtils.getTimestampInMillis( UUIDUtils.newTimeUUID() ) );
+ properties.put(PROPERTY_MODIFIED, UUIDUtils.getTimestampInMillis(UUIDUtils.newTimeUUID()));
for ( String propertyName : properties.keySet() ) {
Object propertyValue = properties.get( propertyName );
@@ -1111,13 +1111,13 @@ public class CpEntityManager implements EntityManager {
//TODO: does this call and others like it need a graphite reporter?
cpEntity = ecm.write( cpEntity ).toBlocking().last();
- logger.debug( "Wrote {}:{} version {}", new Object[] {
+ logger.debug("Wrote {}:{} version {}", new Object[]{
cpEntity.getId().getType(), cpEntity.getId().getUuid(), cpEntity.getVersion()
- } );
+ });
//Adding graphite metrics
- indexService.queueEntityIndexUpdate( applicationScope, cpEntity );
+ indexService.queueEntityIndexUpdate(applicationScope, cpEntity);
}
@@ -1216,7 +1216,7 @@ public class CpEntityManager implements EntityManager {
ApplicationCF dictionaryCf = null;
- boolean entityHasDictionary = Schema.getDefaultSchema().hasDictionary( entity.getType(), dictionaryName );
+ boolean entityHasDictionary = Schema.getDefaultSchema().hasDictionary(entity.getType(), dictionaryName);
if ( entityHasDictionary ) {
dictionaryCf = ENTITY_DICTIONARIES;
@@ -1225,13 +1225,13 @@ public class CpEntityManager implements EntityManager {
dictionaryCf = ENTITY_COMPOSITE_DICTIONARIES;
}
- Class<?> setType = Schema.getDefaultSchema().getDictionaryKeyType( entity.getType(), dictionaryName );
- Class<?> setCoType = Schema.getDefaultSchema().getDictionaryValueType( entity.getType(), dictionaryName );
+ Class<?> setType = Schema.getDefaultSchema().getDictionaryKeyType(entity.getType(), dictionaryName);
+ Class<?> setCoType = Schema.getDefaultSchema().getDictionaryValueType(entity.getType(), dictionaryName);
boolean coTypeIsBasic = ClassUtils.isBasicType( setCoType );
List<HColumn<ByteBuffer, ByteBuffer>> results =
- cass.getAllColumns( cass.getApplicationKeyspace( applicationId ), dictionaryCf,
- CassandraPersistenceUtils.key( entity.getUuid(), dictionaryName ), be, be );
+ cass.getAllColumns(cass.getApplicationKeyspace(applicationId), dictionaryCf,
+ CassandraPersistenceUtils.key(entity.getUuid(), dictionaryName), be, be);
for ( HColumn<ByteBuffer, ByteBuffer> result : results ) {
Object name = null;
if ( entityHasDictionary ) {
@@ -1280,7 +1280,7 @@ public class CpEntityManager implements EntityManager {
ApplicationCF dictionaryCf = null;
- boolean entityHasDictionary = Schema.getDefaultSchema().hasDictionary( entity.getType(), dictionaryName );
+ boolean entityHasDictionary = Schema.getDefaultSchema().hasDictionary(entity.getType(), dictionaryName);
if ( entityHasDictionary ) {
dictionaryCf = ENTITY_DICTIONARIES;
@@ -1294,10 +1294,10 @@ public class CpEntityManager implements EntityManager {
boolean coTypeIsBasic = ClassUtils.isBasicType( dictionaryCoType );
HColumn<ByteBuffer, ByteBuffer> result =
- cass.getColumn( cass.getApplicationKeyspace( applicationId ), dictionaryCf,
- CassandraPersistenceUtils.key( entity.getUuid(), dictionaryName ),
- entityHasDictionary ? bytebuffer( elementName ) : DynamicComposite.toByteBuffer( elementName ), be,
- be );
+ cass.getColumn(cass.getApplicationKeyspace(applicationId), dictionaryCf,
+ CassandraPersistenceUtils.key(entity.getUuid(), dictionaryName),
+ entityHasDictionary ? bytebuffer(elementName) : DynamicComposite.toByteBuffer(elementName), be,
+ be);
if ( result != null ) {
if ( entityHasDictionary && coTypeIsBasic ) {
@@ -1333,7 +1333,7 @@ public class CpEntityManager implements EntityManager {
Class<?> dictionaryCoType =
Schema.getDefaultSchema().getDictionaryValueType( entity.getType(), dictionaryName );
- boolean coTypeIsBasic = ClassUtils.isBasicType( dictionaryCoType );
+ boolean coTypeIsBasic = ClassUtils.isBasicType(dictionaryCoType);
ByteBuffer[] columnNames = new ByteBuffer[elementNames.length];
for ( int i = 0; i < elementNames.length; i++ ) {
@@ -1342,8 +1342,8 @@ public class CpEntityManager implements EntityManager {
}
ColumnSlice<ByteBuffer, ByteBuffer> results =
- cass.getColumns( cass.getApplicationKeyspace( applicationId ), dictionaryCf,
- CassandraPersistenceUtils.key( entity.getUuid(), dictionaryName ), columnNames, be, be );
+ cass.getColumns(cass.getApplicationKeyspace(applicationId), dictionaryCf,
+ CassandraPersistenceUtils.key(entity.getUuid(), dictionaryName), columnNames, be, be);
if ( results != null ) {
values = new HashMap<String, Object>();
for ( HColumn<ByteBuffer, ByteBuffer> result : results.getColumns() ) {
@@ -1359,7 +1359,7 @@ public class CpEntityManager implements EntityManager {
}
}
else {
- logger.error( "Results of CpEntityManagerImpl.getDictionaryElementValues is null" );
+ logger.error("Results of CpEntityManagerImpl.getDictionaryElementValues is null");
}
return values;
@@ -1373,7 +1373,7 @@ public class CpEntityManager implements EntityManager {
return;
}
- EntityRef entity = get( entityRef );
+ EntityRef entity = get(entityRef);
UUID timestampUuid = UUIDUtils.newTimeUUID();
Mutator<ByteBuffer> batch = createMutator( cass.getApplicationKeyspace( applicationId ), be );
@@ -1403,14 +1403,14 @@ public class CpEntityManager implements EntityManager {
@Override
public boolean isCollectionMember( EntityRef owner, String collectionName, EntityRef entity ) throws Exception {
- return getRelationManager( owner ).isCollectionMember( collectionName, entity );
+ return getRelationManager( owner ).isCollectionMember(collectionName, entity);
}
@Override
public boolean isConnectionMember( EntityRef owner, String connectionName, EntityRef entity ) throws Exception {
- return getRelationManager( owner ).isConnectionMember( connectionName, entity );
+ return getRelationManager( owner ).isConnectionMember(connectionName, entity);
}
@@ -1426,7 +1426,7 @@ public class CpEntityManager implements EntityManager {
Level resultsLevel, boolean reversed ) throws Exception {
return getRelationManager( entityRef )
- .getCollection( collectionName, startResult, count, resultsLevel, reversed );
+ .getCollection(collectionName, startResult, count, resultsLevel, reversed);
}
@@ -1442,7 +1442,7 @@ public class CpEntityManager implements EntityManager {
@Override
public Entity addToCollection( EntityRef entityRef, String collectionName, EntityRef itemRef ) throws Exception {
- return getRelationManager( entityRef ).addToCollection( collectionName, itemRef );
+ return getRelationManager( entityRef ).addToCollection(collectionName, itemRef);
}
@@ -1509,7 +1509,7 @@ public class CpEntityManager implements EntityManager {
public ConnectionRef createConnection( EntityRef connectingEntity, String connectionType,
EntityRef connectedEntityRef ) throws Exception {
- return getRelationManager( connectingEntity ).createConnection( connectionType, connectedEntityRef );
+ return getRelationManager( connectingEntity ).createConnection(connectionType, connectedEntityRef);
}
@@ -1519,7 +1519,7 @@ public class CpEntityManager implements EntityManager {
throws Exception {
return getRelationManager( connectingEntity )
- .createConnection( pairedConnectionType, pairedEntity, connectionType, connectedEntityRef );
+ .createConnection(pairedConnectionType, pairedEntity, connectionType, connectedEntityRef);
}
@@ -1527,7 +1527,7 @@ public class CpEntityManager implements EntityManager {
public ConnectionRef createConnection( EntityRef connectingEntity, ConnectedEntityRef... connections )
throws Exception {
- return getRelationManager( connectingEntity ).connectionRef( connections );
+ return getRelationManager( connectingEntity ).connectionRef(connections);
}
@@ -1552,7 +1552,7 @@ public class CpEntityManager implements EntityManager {
@Override
public ConnectionRef connectionRef( EntityRef connectingEntity, ConnectedEntityRef... connections ) {
- return getRelationManager( connectingEntity ).connectionRef( connections );
+ return getRelationManager( connectingEntity ).connectionRef(connections);
}
@@ -1608,13 +1608,13 @@ public class CpEntityManager implements EntityManager {
@Override
public Set<String> getConnectionIndexes( EntityRef entity, String connectionType ) throws Exception {
- return getRelationManager( entity ).getConnectionIndexes( connectionType );
+ return getRelationManager( entity ).getConnectionIndexes(connectionType);
}
@Override
public Map<String, String> getRoles() throws Exception {
- return cast( getDictionaryAsMap( getApplicationRef(), DICTIONARY_ROLENAMES ) );
+ return cast(getDictionaryAsMap(getApplicationRef(), DICTIONARY_ROLENAMES));
}
@@ -1853,12 +1853,12 @@ public class CpEntityManager implements EntityManager {
permission = permission.toLowerCase();
long timestamp = cass.createTimestamp();
Mutator<ByteBuffer> batch = createMutator( cass.getApplicationKeyspace( applicationId ), be );
- CassandraPersistenceUtils.addInsertToMutator( batch, ApplicationCF.ENTITY_DICTIONARIES,
- getRolePermissionsKey( groupId, roleName ), permission, ByteBuffer.allocate( 0 ), timestamp );
+ CassandraPersistenceUtils.addInsertToMutator(batch, ApplicationCF.ENTITY_DICTIONARIES,
+ getRolePermissionsKey(groupId, roleName), permission, ByteBuffer.allocate(0), timestamp);
//Adding graphite metrics
Timer.Context timeGroupRolePermission = entGrantGroupPermissionTimer.time();
- CassandraPersistenceUtils.batchExecute( batch, CassandraService.RETRY_COUNT );
+ CassandraPersistenceUtils.batchExecute(batch, CassandraService.RETRY_COUNT);
timeGroupRolePermission.stop();
}
@@ -1869,8 +1869,8 @@ public class CpEntityManager implements EntityManager {
permission = permission.toLowerCase();
long timestamp = cass.createTimestamp();
Mutator<ByteBuffer> batch = createMutator( cass.getApplicationKeyspace( applicationId ), be );
- CassandraPersistenceUtils.addDeleteToMutator( batch, ApplicationCF.ENTITY_DICTIONARIES,
- getRolePermissionsKey( groupId, roleName ), permission, timestamp );
+ CassandraPersistenceUtils.addDeleteToMutator(batch, ApplicationCF.ENTITY_DICTIONARIES,
+ getRolePermissionsKey(groupId, roleName), permission, timestamp);
//Adding graphite metrics
Timer.Context timeRevokeGroupRolePermission = entRevokeGroupPermissionTimer.time();
CassandraPersistenceUtils.batchExecute( batch, CassandraService.RETRY_COUNT );
@@ -1939,7 +1939,7 @@ public class CpEntityManager implements EntityManager {
@Override
public void revokeUserPermission( UUID userId, String permission ) throws Exception {
permission = permission.toLowerCase();
- removeFromDictionary( userRef( userId ), DICTIONARY_PERMISSIONS, permission );
+ removeFromDictionary(userRef(userId), DICTIONARY_PERMISSIONS, permission);
}
@@ -1968,8 +1968,8 @@ public class CpEntityManager implements EntityManager {
EntityRef memberRef = userRef( userId );
EntityRef roleRef = getRoleRef( roleName );
removeFromDictionary( memberRef, DICTIONARY_ROLENAMES, roleName );
- removeFromCollection( memberRef, COLLECTION_ROLES, roleRef );
- removeFromCollection( roleRef, COLLECTION_USERS, userRef( userId ) );
+ removeFromCollection(memberRef, COLLECTION_ROLES, roleRef);
+ removeFromCollection(roleRef, COLLECTION_USERS, userRef(userId));
}
@@ -2335,7 +2335,7 @@ public class CpEntityManager implements EntityManager {
private MapManager getMapManagerForTypes() {
Id mapOwner = new SimpleId( applicationId, TYPE_APPLICATION );
- final MapScope ms = CpNamingUtils.getEntityTypeMapScope( mapOwner );
+ final MapScope ms = CpNamingUtils.getEntityTypeMapScope(mapOwner);
MapManager mm = managerCache.getMapManager( ms );
@@ -2350,14 +2350,14 @@ public class CpEntityManager implements EntityManager {
return null;
}
- Entity entity = get( entityRef );
+ Entity entity = get(entityRef);
if ( entity == null ) {
logger.warn( "Entity {}/{} not found ", entityRef.getUuid(), entityRef.getType() );
return null;
}
- A ret = EntityFactory.newEntity( entityRef.getUuid(), entityRef.getType(), entityClass );
+ A ret = EntityFactory.newEntity(entityRef.getUuid(), entityRef.getType(), entityClass);
ret.setProperties( entity.getProperties() );
return ret;
@@ -2448,7 +2448,7 @@ public class CpEntityManager implements EntityManager {
@Override
public Map<String, Role> getGroupRolesWithTitles( UUID groupId ) throws Exception {
return getRolesWithTitles(
- ( Set<String> ) cast( getDictionaryAsSet( groupRef( groupId ), DICTIONARY_ROLENAMES ) ) );
+ ( Set<String> ) cast( getDictionaryAsSet( groupRef(groupId), DICTIONARY_ROLENAMES ) ) );
}
@@ -2463,8 +2463,8 @@ public class CpEntityManager implements EntityManager {
@Override
public void removeGroupFromRole( UUID groupId, String roleName ) throws Exception {
roleName = roleName.toLowerCase();
- removeFromDictionary( groupRef( groupId ), DICTIONARY_ROLENAMES, roleName );
- removeFromCollection( groupRef( groupId ), COLLECTION_ROLES, getRoleRef( roleName ) );
+ removeFromDictionary(groupRef(groupId), DICTIONARY_ROLENAMES, roleName);
+ removeFromCollection(groupRef(groupId), COLLECTION_ROLES, getRoleRef(roleName));
}
@@ -2484,7 +2484,7 @@ public class CpEntityManager implements EntityManager {
@Override
public void revokeGroupPermission( UUID groupId, String permission ) throws Exception {
permission = permission.toLowerCase();
- removeFromDictionary( groupRef( groupId ), DICTIONARY_PERMISSIONS, permission );
+ removeFromDictionary(groupRef(groupId), DICTIONARY_PERMISSIONS, permission);
}
@@ -2881,7 +2881,7 @@ public class CpEntityManager implements EntityManager {
@Override
public Set<String> getConnectionsAsSource( final EntityRef entityRef ) {
- Preconditions.checkNotNull( entityRef, "entityRef cannot be null" );
+ Preconditions.checkNotNull(entityRef, "entityRef cannot be null");
final GraphManager graphManager = graphManagerFactory.createEdgeManager( applicationScope );
@@ -2900,16 +2900,20 @@ public class CpEntityManager implements EntityManager {
final SearchEdgeType searchByEdgeType = createConnectionTypeSearch( entityRef.asId() );
- return graphManager.getEdgeTypesToTarget( searchByEdgeType ).map(
+ return graphManager.getEdgeTypesToTarget(searchByEdgeType).map(
edgeName -> getConnectionNameFromEdgeName( edgeName ) ).collect( () -> new HashSet<String>( ), ( r, s ) -> r.add(s) ).toBlocking().last();
}
@Override
public void addIndex(final String newIndexName,final int shards,final int replicas, final String writeConsistency){
- managerCache.getEntityIndex(applicationScope).addIndex( newIndexName, shards, replicas, writeConsistency);
+ managerCache.getEntityIndex(applicationScope).addIndex(newIndexName, shards, replicas, writeConsistency);
}
+ @Override
+ public void initializeIndex(){
+ managerCache.getEntityIndex(applicationScope).initialize();
+ }
/**
* TODO, these 3 methods are super janky. During refactoring we should clean this model up
*/
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d22e6194/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
index 7181328..b91a758 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
@@ -250,8 +250,9 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
init();
EntityManager managementEm = getEntityManager( getManagementAppId() );
+ EntityManager appEm = getEntityManager(applicationId);
- final String appName = buildAppName( organizationName, name );
+ final String appName = buildAppName(organizationName, name);
// check for pre-existing application
@@ -260,13 +261,12 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
}
getSetup().setupApplicationKeyspace( applicationId, appName );
+ appEm.initializeIndex();
indexService.queueInitializeApplicationIndex(CpNamingUtils.getApplicationScope(applicationId));
-
if ( properties == null ) {
properties = new TreeMap<>( CASE_INSENSITIVE_ORDER);
}
properties.put( PROPERTY_NAME, appName );
- EntityManager appEm = getEntityManager(applicationId);
appEm.create(applicationId, TYPE_APPLICATION, properties);
appEm.resetRoles();
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d22e6194/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ApplicationIndexLocationStrategy.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ApplicationIndexLocationStrategy.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ApplicationIndexLocationStrategy.java
index c105119..efeaa18 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ApplicationIndexLocationStrategy.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ApplicationIndexLocationStrategy.java
@@ -45,8 +45,8 @@ class ApplicationIndexLocationStrategy implements IndexLocationStrategy {
this.indexFig = indexFig;
this.applicationScope = applicationScope;
this.indexRootName = clusterFig.getClusterName() + "_" + cassandraFig.getApplicationKeyspace().toLowerCase();
- this.alias = new ApplicationIndexAlias(indexFig, applicationScope, indexRootName);
this.indexBucketName = indexRootName + "_applications_" + applicationIndexBucketLocator.getBucket(applicationScope);
+ this.alias = new ApplicationIndexAlias(indexFig, applicationScope, indexRootName);
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d22e6194/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ReplicatedIndexLocationStrategy.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ReplicatedIndexLocationStrategy.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ReplicatedIndexLocationStrategy.java
index 4dd237a..9192fc7 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ReplicatedIndexLocationStrategy.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ReplicatedIndexLocationStrategy.java
@@ -42,12 +42,12 @@ public class ReplicatedIndexLocationStrategy implements IndexLocationStrategy {
}
public ReplicatedIndexLocationStrategy(IndexLocationStrategy indexLocationStrategy){
- alias = new ReplicatedIndexAlias( indexLocationStrategy.getAlias() );
rootName = indexLocationStrategy.getIndexRootName();
indexInitialName = indexLocationStrategy.getIndexInitialName();
applicationScope = indexLocationStrategy.getApplicationScope();
numberShards = indexLocationStrategy.getNumberOfShards();
numberReplicas = indexLocationStrategy.getNumberOfReplicas();
+ alias = new ReplicatedIndexAlias( indexLocationStrategy.getAlias() );
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d22e6194/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManager.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManager.java b/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManager.java
index c4a77ac..17dc497 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManager.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManager.java
@@ -728,5 +728,10 @@ public interface EntityManager {
*/
void addIndex(final String newIndexName,final int shards,final int replicas, final String writeConsistency);
+ /**
+ * init the index
+ */
+ void initializeIndex();
+
IndexRefreshCommand.IndexRefreshCommandInfo refreshIndex();
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d22e6194/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
index e21c242..ef2c32d 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
@@ -182,6 +182,8 @@ public class EsEntityIndexImpl implements EntityIndex,VersionedData {
//get index name with bucket attached
Preconditions.checkNotNull(indexName,"must have an indexname");
+ Preconditions.checkArgument(!indexName.contains("alias"),indexName + " name cannot contain alias " );
+
//Create index
try {
final AdminClient admin = esProvider.getClient().admin();