[ 
https://issues.apache.org/jira/browse/GEODE-2764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15965125#comment-15965125
 ] 

ASF GitHub Bot commented on GEODE-2764:
---------------------------------------

Github user nabarunnag commented on a diff in the pull request:

    https://github.com/apache/geode/pull/449#discussion_r111037135
  
    --- Diff: 
geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateIndexFunction.java
 ---
    @@ -93,6 +91,31 @@ public void execute(FunctionContext context) {
         }
       }
     
    +  private void setResultInSender(FunctionContext context, IndexInfo 
indexInfo, String memberId,
    +      Cache cache, String regionPath) {
    +    if (regionPath == null) {
    +      String message = 
CliStrings.format(CliStrings.CREATE_INDEX__INVALID__REGIONPATH,
    +          indexInfo.getRegionPath());
    +      context.getResultSender().lastResult(new CliFunctionResult(memberId, 
false, message));
    +    } else {
    +      XmlEntity xmlEntity =
    +          new XmlEntity(CacheXml.REGION, "name", 
cache.getRegion(regionPath).getName());
    +      context.getResultSender().lastResult(new CliFunctionResult(memberId, 
xmlEntity));
    +    }
    +  }
    +
    +  private String getValidRegionName(Cache cache, String regionPath) {
    +    while (cache.getRegion(regionPath) == null && regionPath != null) {
    --- End diff --
    
    Its fixed now.
    thank you !!


> Index entry not entered into cluster config xml if region name contains a 
> function call like entrySet()
> -------------------------------------------------------------------------------------------------------
>
>                 Key: GEODE-2764
>                 URL: https://issues.apache.org/jira/browse/GEODE-2764
>             Project: Geode
>          Issue Type: Bug
>            Reporter: nabarun
>
> Steps to recreate the issue type the following in a gfsh instance:
> 1. start locator --name=locator
> 2. start server --name=server
> 3. create region --name=regionName --type=REPLICATE_PERSISTENT 
> 4. create index --name=regionIndex --region="regionName.entrySet() r" 
> --expression=r.key
> -- this will result in an error message 
> {noformat}
> Failed to create index "regionIndex" due to following reasons
> null
> {noformat}
> Cause:
> The index is created but while putting the entry into the clusterconfig it 
> tries to put the region name as regionName.entrySet() which does not exist. 
> cache.getRegion(regionName.entrySet()) will result in null and no xml entry 
> is added to the clusterconfig. So when the server is restarted, there is no 
> index entry in the cluster config xml hence the index is not re-created.
> Solution:
> If the region name contains the character '(' and ')' spilt the region name 
> at the index of '.' and check if the region exists. 
> If the check returns successful only then enter the entry into the cluster 
> config.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to