[SERVER-8975] Deleting non-existent indexes on a collection drops active (basic) cursors on that collection Created: 13/Mar/13  Updated: 10/Dec/14  Resolved: 13/Mar/13

Status: Closed
Project: Core Server
Component/s: Index Maintenance
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Alex Piggott Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

RH6.3, mongod, 2.2.3, java driver 2.7/2.10 going through mongos


Issue Links:
Duplicate
duplicates SERVER-3964 Dropping an index invalidates all cur... Closed
Operating System: ALL
Steps To Reproduce:

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

Participants:

 Description   

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/



 Comments   
Comment by Aaron Staple [ 13/Mar/13 ]

Hi Alex - I filed DOCS-1236 to try and improve the relevant documentation.

Comment by Alex Piggott [ 13/Mar/13 ]

Gah I really wish I'd found that issue 3 hours of my life ago

Comment by Aaron Staple [ 13/Mar/13 ]

Hi Alex - I'm going to close this as a dup of SERVER-3964. Please feel free to comment / vote on that ticket.

Generated at Thu Feb 08 03:18:58 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.