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

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

jujoramos commented on issue #987: Fix for GEODE-3898
URL: https://github.com/apache/geode/pull/987#issuecomment-340192124
 
 
   Hey @jinmeiliao, thanks for having a look at this.
   I might be missing something, but within `CreateIndexCommand` you can just 
persist one `XmlEntity` to the cluster configuration service because you only 
have one index created on a single region.
   In this particular case, `CreateDefinedIndexesCommand` can create more than 
one index and not necessarily for the same region, that's why all of the  
`XmlEntity` should be persisted to the cluster configuration service.
   As an example:
   
   ```
   gfsh -e "connect --locator=localhost[10101]" \
        -e "create region --name=TestRegion1 --type=REPLICATE" \
        -e "create region --name=TestRegion2 --type=REPLICATE"
   gfsh -e "connect --locator=localhost[10101]" \
        -e "define index --name=index1 --expression=value1 
--region=TestRegion1" \
        -e "define index --name=index2 --expression=value2 --region=TestRegion2"
   
   gfsh -e "connect --locator=localhost[10101]" -e "create defined indexes"
   ```
   
   In the above case, the server will need to return two `CliFunctionResult` 
with two `XmlEntity` instances (one for each region), and the 
`CreateDefinedIndexesCommand` must persist both entities to the cluster 
configuration service to make sure we don't loose anything:
   
   ```
   XmlEntity [namespace=http://geode.apache.org/schema/cache, type=region, 
attributes={name=TestRegion2}, xmlDefinition=<?xml version="1.0" 
encoding="UTF-8"?><region name="TestRegion2" 
xmlns="http://geode.apache.org/schema/cache";>
         <region-attributes data-policy="replicate" scope="distributed-ack"/>
         <index expression="value2" from-clause="/TestRegion2" 
key-index="false" name="index2" type="range"/>
       </region>]
   
   XmlEntity [namespace=http://geode.apache.org/schema/cache, type=region, 
attributes={name=TestRegion1}, xmlDefinition=<?xml version="1.0" 
encoding="UTF-8"?><region name="TestRegion1" 
xmlns="http://geode.apache.org/schema/cache";>
         <region-attributes data-policy="replicate" scope="distributed-ack"/>
         <index expression="value1" from-clause="/TestRegion1" 
key-index="false" name="index1" type="range"/>
       </region>]
   ```
   
   Am I missing something?.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Indexes created through the `create defined indexes` command are not 
> persisted to the cluster configuration service
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: GEODE-3898
>                 URL: https://issues.apache.org/jira/browse/GEODE-3898
>             Project: Geode
>          Issue Type: Bug
>          Components: querying
>            Reporter: Juan José Ramos Cassella
>            Assignee: Juan José Ramos Cassella
>              Labels: configuration, gfsh
>
> When using the cluster configuration service, indexes created through {{gfsh 
> define index}} + {{gfsh create defined indexes}} are not persisted to the 
> cluster configuration service.
> Steps to reproduce:
> # Start a locator with {{enable-cluster-configuration-enabled=true}}.
> # Start a server with {{enable-cluster-configuration-enabled=true}}.
> # Create a sample region: {{gfsh create region --name=TestRegion 
> --type=REPLICATE}}.
> # Define an index: {{gfsh define index --name=index1 --expression=value1 
> --region=TestRegion}}.
> # Created the defined indexes: {{gfsh create defined indexes}}.
> # Restart the cluster.
> # Execute {{list indexes}}. The command returns no indexes.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to