Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-1317

background index creation blocks "creation" of existing indexes

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 1.4.2
    • Fix Version/s: 1.7.1
    • Component/s: None
    • Labels:
      None
    • Environment:
      linux, 64-bit
    • Operating System:
      ALL

      Description

      When background creating an index, creation of other indexes is blocked, as described in the docs: "Only one index build at a time is permitted per collection.". However, this has the side effect that index creation of other indexes fails even if the index already exists. This is a specific problem when called indirectly from an ORM such as mongoid which tries to create indexes for its models on initialization. As a result, a server (e.g.: a rails instance) that uses that ORM cannot be restarted while a background index build is in progress because the attempted index creation (even though the index already exists) fails.

      The error message from the mongo driver:

      /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/mongo-1.0.1/lib/../lib/mongo/collection.rb:406:in `create_index':Mongo::OperationFailure: Failed to create index {:key=>

      {"status"=>1}

      , :unique=>false, :name=>"status_1", :ns=>"thatdb.messages"}

      This error went away as soon as the background index creation was done.

      The ideal fix would be to allow multiple indexes to be created at once. A short term fix would be to have ensureIndex return success if the index already exists, regardless of what else might be happening.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              eliot Eliot Horowitz (Inactive)
              Reporter:
              fields Adam Fields
              Participants:
              Votes:
              4 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: