[SERVER-36568] Avoid unique index format update via an empty collMod on secondary with FCV=4.0 Created: 10/Aug/18  Updated: 29/Oct/23  Resolved: 23/Aug/18

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: 4.1.1
Fix Version/s: 4.1.3

Type: Bug Priority: Major - P3
Reporter: Neha Khatri Assignee: Neha Khatri
Resolution: Fixed Votes: 0
Labels: storage-engines
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Storage Engines 2018-08-27
Participants:
Linked BF Score: 15

 Description   

We are seeing multiple evergreen failures with following assertion failure during a collection Validate on a secondary in a replica set.

[ReplicaSetFixture:job0:secondary] 2018-08-06T18:09:24.083+0000 D -        [conn283] User Assertion: Overflow: Invalid advance (1) past end of buffer[0] at offset: 0 src/mongo/util/bufreader.h 109
[ValidateCollections:job0:jstestfuzz-3c61-ent_94e1-qa_a6ce-1533653374890-044:ValidateCollections] 2018-08-07T15:06:59.231+0000 	"errors" : [
[ValidateCollections:job0:jstestfuzz-3c61-ent_94e1-qa_a6ce-1533653374890-044:ValidateCollections] 2018-08-07T15:06:59.231+0000 		"exception during index validation: Overflow: Invalid advance (1) past end of buffer[0] at offset: 0"

This failure looks related to recent changes in the unique index format.



 Comments   
Comment by Githook User [ 23/Aug/18 ]

Author:

{'name': 'nehakhatri5', 'email': 'neha.khatri@mongodb.com', 'username': 'nehakhatri5'}

Message: SERVER-36568 Avoid unique index upgrade at secondary on an empty collMod with FCV=4.0.

An empty collMod is used to upgrade unique index during FCV upgrade. If an application
issues an empty collMod when FCV is not upgrading or upgraded to 4.2 then the unique
index should not be upgraded due to this collMod on the secondary.
Branch: master
https://github.com/mongodb/mongo/commit/e6d0f838165a464926768bf9c39ce058ecc29a03

Comment by Neha Khatri [ 17/Aug/18 ]

Thanks for the repro script benety.goh. It was very useful. I see what's happening here.

An empty collMod is assumed to be a collMod for unique index upgrade here. When an empty collMod command is executed on primary,  the oplog apply on secondary would invoke collModWithUpgrade in response. This would trigger the unique index upgrade logic on secondary. Since FCV is 4.0, unique index metadata update will change the index formatVersion back to old formatVersion i.e. 8. This formatVersion change(downgrade) is undesired and it interferes with the index validation logic resulting in the user assertion failure on secondary only.

Note the same thing does not happen on the primary because it takes a different path of invoking non-upgrade collMod.

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