Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-7875

The gfsh create index command sometimes fails with 'Index already exists. Create failed due to duplicate name.' message

    XMLWordPrintableJSON

Details

    Description

      Here is output from the connect, list indexes, create index commands:

      (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.
      

      Here is some logging that shows the behavior:

      server2 executes the CreateIndexFunction and creates the index locally:

      [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.
      

      It sends the IndexCreationMsg to servers 1, 3 and 4 and processes the response:

      [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]>
      

      servers 1, 3 and 4 receive the IndexCreationMsg, creates the index and respond:

      [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
      

      Then they execute the CreateIndexFunction to create the index locally which fails:

      [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)
      

      Attachments

        Activity

          People

            mkevo Mario Kevo
            boglesby Barrett Oglesby
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: