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

Deleting non-existent indexes on a collection drops active (basic) cursors on that collection

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Index Maintenance
    • None
    • Environment:
      RH6.3, mongod, 2.2.3, java driver 2.7/2.10 going through mongos
    • ALL
    • Hide

      Note that this does not occur if you use the console version of dropIndex(), only if you use the Java driver version. The difference can be seen in the log:

      Cursor version:
      eg mongo doc_metadata --eval 'printjson(db.metadata.dropIndex(

      {sourceUrl:1}

      ))'
      Wed Mar 13 21:14:59 [conn13] CMD: dropIndexes doc_metadata.metadata
      Wed Mar 13 21:14:59 [conn13] CMD: dropIndexes doc_metadata.metadata
      Wed Mar 13 21:14:59 [conn13] CMD: dropIndexes doc_metadata.metadata
      Wed Mar 13 21:14:59 [conn13] CMD: dropIndexes doc_metadata.metadata

      Java driver version:
      eg dbcollection.coll.dropIndex(new BasicDBObject("sourceUrl", 1));
      Wed Mar 13 15:57:23 [conn10] CMD: dropIndexes doc_metadata.metadata
      Wed Mar 13 15:57:23 [conn10] dropIndexes: sourceUrl_1 not found
      Wed Mar 13 15:57:23 [conn10] CMD: dropIndexes doc_metadata.metadata
      Wed Mar 13 15:57:23 [conn10] dropIndexes: sourceKey_1 not found
      Wed Mar 13 15:57:23 [conn10] CMD: dropIndexes doc_metadata.metadata
      Wed Mar 13 15:57:23 [conn10] dropIndexes: title_1 not found
      Wed Mar 13 15:57:23 [conn10] CMD: dropIndexes doc_metadata.metadata
      Wed Mar 13 15:57:23 [conn10] dropIndexes: updateId_1 not found

      Presumably this is significant

      Show
      Note that this does not occur if you use the console version of dropIndex(), only if you use the Java driver version. The difference can be seen in the log: Cursor version: eg mongo doc_metadata --eval 'printjson(db.metadata.dropIndex( {sourceUrl:1} ))' Wed Mar 13 21:14:59 [conn13] CMD: dropIndexes doc_metadata.metadata Wed Mar 13 21:14:59 [conn13] CMD: dropIndexes doc_metadata.metadata Wed Mar 13 21:14:59 [conn13] CMD: dropIndexes doc_metadata.metadata Wed Mar 13 21:14:59 [conn13] CMD: dropIndexes doc_metadata.metadata Java driver version: eg dbcollection.coll.dropIndex(new BasicDBObject("sourceUrl", 1)); Wed Mar 13 15:57:23 [conn10] CMD: dropIndexes doc_metadata.metadata Wed Mar 13 15:57:23 [conn10] dropIndexes: sourceUrl_1 not found Wed Mar 13 15:57:23 [conn10] CMD: dropIndexes doc_metadata.metadata Wed Mar 13 15:57:23 [conn10] dropIndexes: sourceKey_1 not found Wed Mar 13 15:57:23 [conn10] CMD: dropIndexes doc_metadata.metadata Wed Mar 13 15:57:23 [conn10] dropIndexes: title_1 not found Wed Mar 13 15:57:23 [conn10] CMD: dropIndexes doc_metadata.metadata Wed Mar 13 15:57:23 [conn10] dropIndexes: updateId_1 not found Presumably this is significant

      See https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/7lydgWPRmcI

      If when I have an active basic cursor, I delete an index on the same collection, then the cursor is dropped.

      (in my case it's a non-existent index, I don't know if dropping a real one would also fail)

      Furthermore, the DBCursor.hasNext()/DBCursor.next() from the java driver, instead of returning an error, returns what it claims is a valid DBObject but in fact is just

      { "$err" : "getMore: cursor didn't exist on server, possible restart or timeout?" , "code" : 13127}

      which imo is terrible error handling (I've seen similar issues with the Java driver before, eg DBCursor.count() returned 100 after timing out due to DB load on a much larger query)

      (If you want me to create a separate Java driver issue for the error handling then let me know)

      If it's intended behavior that index operations interfere with cursors (which it shouldn't be I think?) then at least you should update the documentation eg http://docs.mongodb.org/manual/core/read-operations/

            Assignee:
            Unassigned Unassigned
            Reporter:
            apiggott@ikanow.com Alex Piggott
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: