You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "Mario Kevo (Jira)" <ji...@apache.org> on 2021/12/21 09:19:00 UTC

[jira] [Commented] (GEODE-7875) The gfsh create index command sometimes fails with 'Index already exists. Create failed due to duplicate name.' message

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

Mario Kevo commented on GEODE-7875:
-----------------------------------

When creating an index on the partitioned region, the create index is sent to all members to create an index on all buckets.
After that, it checks on all members if there is already an index created or the creation is in progress.
In case it is already created it will respond with returning index in case the request is remotely originated. In case the request is locally it will throw exception IndexNameConflictException.
In case it is not already created, it checks if it has FutureTask, which means that index creation is in progress. If there is no FutureTask for this indexTask it will create it locally and send it to all members and wait for their response.
In case the index creation is in progress on some of the threads, it will wait until it is initialized from that thread. If the request was remotely originated it will return ind to the server from which the request comes to know that it is created on that server.
In case the request is local, it will also wait until the index creation is finished by some thread which already started creation, before this request comes, and throw IndexNameConflictException as it is already created.
In that case, the command is not successful and the cluster config is not updated.

 

The mail discussion is available on the dev list.  https://markmail.org/message/uxhlysb2nx3u7p6y#query:+page:1+mid:v367uwf67hlpcr7t+state:results

> The gfsh create index command sometimes fails with 'Index already exists. Create failed due to duplicate name.' message
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: GEODE-7875
>                 URL: https://issues.apache.org/jira/browse/GEODE-7875
>             Project: Geode
>          Issue Type: Bug
>          Components: gfsh, querying
>            Reporter: Barrett Oglesby
>            Assignee: Mario Kevo
>            Priority: Major
>              Labels: pull-request-available
>
> Here is output from the connect, list indexes, create index commands:
> {noformat}
> (1) Executing - connect --locator=localhost[23456]
> Connecting to Locator at [host=localhost, port=23456] ..
> Connecting to Manager at [host=boglesbymac.local, port=1099] ..
> Successfully connected to: [host=boglesbymac.local, port=1099]
> (2) Executing - list indexes
> No Indexes Found
> (3) Executing - create index --name=cusip_index_1 --expression=cusip --region=/Trades
>                Member                | Status | Message
> ------------------------------------ | ------ | ---------------------------------------------------------------------------
> 192.168.1.4(server1:88452)<v1>:41001 | ERROR  | Index "cusip_index_1" already exists.  Create failed due to duplicate name.
> 192.168.1.4(server2:88465)<v2>:41002 | OK     | Index successfully created
> 192.168.1.4(server3:88473)<v3>:41003 | ERROR  | Index "cusip_index_1" already exists.  Create failed due to duplicate name.
> 192.168.1.4(server4:88480)<v4>:41004 | ERROR  | Index "cusip_index_1" already exists.  Create failed due to duplicate name.
> {noformat}
> Here is some logging that shows the behavior:
> server2 executes the CreateIndexFunction and creates the index locally:
> {noformat}
> [warn 2020/03/12 16:18:11.273 PDT <Function Execution Processor2> tid=0x54] XXX CreateIndexFunction.execute indexName=cusip_index_1
> [info 2020/03/12 16:18:11.297 PDT <Function Execution Processor2> tid=0x54] Created index locally, sending index creation message to all members, and will be waiting for response Index [ Name=cusip_index_1 Type =FUNCTIONAL IdxExp=cusip From=/Trades Proj=*]imports : null.
> {noformat}
> It sends the IndexCreationMsg to servers 1, 3 and 4 and processes the response:
> {noformat}
> [warn 2020/03/12 16:18:11.297 PDT <Function Execution Processor2> tid=0x54] XXX IndexCreationMsg.send indMsg=cusip_index_1 
> [warn 2020/03/12 16:18:11.298 PDT <Function Execution Processor2> tid=0x54] XXX PartitionedRegion.createIndex response=<IndexCreationMsg$IndexCreationResponse 52 waiting for 3 replies from [192.168.1.4(server1:88452)<v1>:41001, 192.168.1.4(server3:88473)<v3>:41003, 192.168.1.4(server4:88480)<v4>:41004]>
> {noformat}
> servers 1, 3 and 4 receive the IndexCreationMsg, creates the index and respond:
> {noformat}
> [warn 2020/03/12 16:18:11.298 PDT <PartitionedRegion Message Processor2> tid=0x4b] XXX IndexCreationMsg.operateOnPartitionedRegion about to createIndexes
> [warn 2020/03/12 16:18:11.304 PDT <PartitionedRegion Message Processor2> tid=0x4b] XXX IndexCreationMsg.operateOnPartitionedRegion done createIndexes
> {noformat}
> Then they execute the CreateIndexFunction to create the index locally which fails:
> {noformat}
> [warn 2020/03/12 16:18:11.501 PDT <Function Execution Processor2> tid=0x4e] XXX CreateIndexFunction.execute indexName=cusip_index_1
> [warn 2020/03/12 16:18:11.521 PDT <Function Execution Processor2> tid=0x4e] XXX CreateIndexFunction.execute failed due to IndexNameConflictException:
> org.apache.geode.cache.query.IndexNameConflictException: Index named ' cusip_index_1 ' already exists.
> 	at org.apache.geode.internal.cache.PartitionedRegion.createIndex(PartitionedRegion.java:8453)
> 	at org.apache.geode.internal.cache.PartitionedRegion.createIndex(PartitionedRegion.java:8403)
> 	at org.apache.geode.cache.query.internal.DefaultQueryService.createIndex(DefaultQueryService.java:245)
> 	at org.apache.geode.cache.query.internal.DefaultQueryService.createIndex(DefaultQueryService.java:203)
> 	at org.apache.geode.cache.query.internal.DefaultQueryService.createIndex(DefaultQueryService.java:274)
> 	at org.apache.geode.cache.query.internal.DefaultQueryService.createIndex(DefaultQueryService.java:177)
> 	at org.apache.geode.management.internal.cli.functions.CreateIndexFunction.execute(CreateIndexFunction.java:62)
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)