Github user tnine commented on a diff in the pull request:
https://github.com/apache/incubator-usergrid/pull/117#discussion_r21563902
--- Diff:
stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
---
@@ -702,7 +703,10 @@ public void rebuildCollectionIndex(UUID appId, String
collection, ProgressObserv
@Override
public void addIndex(final UUID applicationId,final String
indexSuffix,final int shards,final int replicas){
-
getManagerCache().getEntityIndex(CpNamingUtils.getApplicationScope(
applicationId )).addIndex(indexSuffix,shards,replicas);
+ EntityIndex entityIndex =
getManagerCache().getEntityIndex(CpNamingUtils.getApplicationScope(applicationId));
+ if(entityIndex instanceof AliasedEntityIndex) {
+ ((AliasedEntityIndex)entityIndex).addIndex(indexSuffix,
shards, replicas);
+ }
--- End diff --
What if it's not the right instance? Shouldn't we throw an
UnsupportedOperationException? Or, is there a way to just create it from the
factory, so we know it's always the right instance type? Since this happens
very rarely, I don't think we'll need to worry about getting it from the cache.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---