[SERVER-85200] Fix hashing batch bounds for extra index keys check Created: 12/Jan/24  Updated: 05/Feb/24

Status: In Code Review
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Huayu Ouyang Assignee: Xuerui Fa
Resolution: Unresolved Votes: 0
Labels: pm-855-milestone-2
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Replication
Operating System: ALL
Sprint: Repl 2024-02-05, Repl 2024-02-19
Participants:

 Description   

I noticed this bug out of a separate issue in BF-31124. In this patch, the batch sizes logged are all 4, when they should be 99. From code inspection I think the error is from herehttps://github.com/10gen/mongo/blob/37501b2150baea9d055f1ab8477e06352eb12a85/src/mongo/db/commands/dbcheck_command.cpp#L1161 when we update batchStats.firstIndexKey = firstKeyString. However if there are multiple snapshots within a batch we end up doing this for each snapshot, so the firstIndexKey ends up getting updated to be the first index key of the last snapshot in the batch. This is a problem because when we hash the keys we'll then only hash the last snapshot. We should fix this by updating the first of the batch vs the first of the snapshot separately.

We should also change this log line to instead say "started extra index keys snapshot"

To catch this bug we should add a complete coverage test similar to the one that exists for collection check here for extra index keys as well


Generated at Thu Feb 08 06:57:06 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.