[SERVER-15596] Renaming system.indexes collection should not be allowed Created: 10/Oct/14  Updated: 08/Dec/17  Resolved: 13/Oct/14

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: 2.4.11, 2.6.5
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Duncan Phillips Assignee: Thomas Rueckstiess
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-15616 Attempt to rename system.indexes coll... Closed
Participants:

 Description   

We inadvertently dropped the system index table. It seems that the collections are still working with indexes though, but we're unable to restore the collection from a backup since the table is recreated as soon as mongo is started. Could someone advise on a recommended approach to restore this table from backup (none of our indexes have changed since the error)?



 Comments   
Comment by J Rassi [ 13/Oct/14 ]

I'm resolving this ticket as a dup of SERVER-5955. Please feel free to reply over on that ticket if you have further questions/comments.

Comment by Thomas Rueckstiess [ 13/Oct/14 ]

Hi Duncan,

As per our email conversation, the best way forward is to restore a backup of your data. While dropping the system.indexes collection is not possible in current versions, a rename (that's what happened in your case) is still possible in the 2.4 and 2.6 branch.

I'll convert this ticket into an Improvement Request to prevent renaming of the system.indexes collection to prevent accidental removal.

Regards,
Thomas

Comment by Duncan Phillips [ 10/Oct/14 ]

hi, thanks for getting back. We actually renamed the index in preparation for the dropping. the collection was included with a lot of others by mistake.

Comment by Thomas Rueckstiess [ 10/Oct/14 ]

Hi Duncan,

Dropping the system.indexes table shouldn't be possible. I tried on 2.4.8 and get:

MongoDB shell version: 2.4.8
connecting to: test
> db.system.indexes.drop()
Fri Oct 10 15:31:45.701 drop failed: {
	"ns" : "test.system.indexes",
	"errmsg" : "exception: can't drop system ns",
	"code" : 12502,
	"ok" : 0
} at src/mongo/shell/collection.js:383
>

Can you recall the steps you took that dropped the collection? Did you use the shell or a driver to drop the collection? If you have a log file covering this time, that would be helpful, too.

Can you also provide the following:

  • output of db.system.indexes.find()
  • output of .getIndexes() for any collection in the database

I'll confirm with a developer what the best course of action is in such a case and get back to you.

Thomas

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