[SERVER-2019] _id index on capped collection : inconsistent between master and slave Created: 28/Oct/10  Updated: 02/Jul/21  Resolved: 07/Mar/14

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

Type: Bug Priority: Minor - P4
Reporter: Dwight Merriman Assignee: Dwight Merriman
Resolution: Done Votes: 3
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-84 when replicating capped collection, _... Closed
Related
is related to SERVER-2048 Cannot remove _id_ index from capped ... Closed
Operating System: ALL
Participants:

 Description   

there seems to be no _id index on the replication primary

but there is on the slaves

what to do - create them on the primary?



 Comments   
Comment by Githook User [ 02/Jul/21 ]

Author:

{'name': 'Brian McCarthy', 'email': 'brian.mccarthy@mongodb.com', 'username': 'briananthonymccarthy'}

Message: BUILD-13557 Windows vsCurrent should use Windows_Server-2019-English-Full-Base as source AMI
Branch: master
https://github.com/10gen/buildhost-configuration/commit/81a347052a31c9d11f38338fbdab2883879efd3c

Comment by Githook User [ 02/Jul/21 ]

Author:

{'name': 'Brian McCarthy', 'email': 'brian.mccarthy@mongodb.com', 'username': 'briananthonymccarthy'}

Message: BUILD-13557 Windows vsCurrent should use Windows_Server-2019-English-Full-Base as source AMI
Branch: BUILD-13557
https://github.com/10gen/buildhost-configuration/commit/4edda18c6eed5273c2122923dd37ee089639d75b

Comment by Eric Milkie [ 07/Mar/14 ]

As of 2.2, capped collections have _id index by default.

Comment by Hitoshi Asai [ 20/Jan/12 ]

Is this fixed by the following ticket?
https://jira.mongodb.org/browse/SERVER-4626

Comment by Hitoshi Asai [ 26/Nov/11 ]

I'm using mongod ver.2.0.1
All db and collections are created under this version.
But some of collections has index and other is not. I don't know why...

I understood the _id index is effective for the performance of replication.
But my application creates a lot of small capped collections. (max=100, size=8191)
So I think that _id index should not be created automatically. It should be selective and consistent within master and slaves.

Comment by Dwight Merriman [ 26/Nov/11 ]

generally, in the current versions, there is a need for an _id index on secondaries otherwise replication application will be very slow. perhaps if you have many collections and they are small it might be ok but generally it isn't. we are researching what is the best long term approach.

if a few have _id i wonder if old version created the index and new versions don't, that is my first thought.

unless you empirically see non-index is faster, i'd recommend having _id index on secondaries for now.

Comment by Hitoshi Asai [ 26/Nov/11 ]

I also encountered this problem.

There are 100000 or more capped collections with no index in PRIMARY.
But 4 or 5% of collections has _id index in SECONDARY.

I need no indices. I need no more disk use.

Comment by Dwight Merriman [ 28/Oct/10 ]

duplicates http://jira.mongodb.org/browse/SERVER-84

Comment by Dwight Merriman [ 28/Oct/10 ]

it would be unfortunate to lose the high speed.

maybe there is another solution, like making the slaves not be too chatty on dup keys and keep going.

Comment by Dwight Merriman [ 28/Oct/10 ]

workaround:

(1) don't insert non-unique _ids
(2) create _id index explicitly

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