[SERVER-41811] Deduplicate CollectionValidation::_genericRecordStoreValidate and ValidateAdaptor::traverseRecordStore Created: 18/Jun/19  Updated: 29/Oct/23  Resolved: 22/Aug/19

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

Type: Improvement Priority: Major - P3
Reporter: Louis Williams Assignee: Gregory Wlodarek
Resolution: Fixed Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-42357 Periodically release locks during col... Closed
Backwards Compatibility: Fully Compatible
Sprint: Execution Team 2019-08-26
Participants:

 Description   

CollecitonImpl::_genericRecordStoreValidate and RecordStoreValidateAdaptor::validate are nearly identical.

Here's a diff:

< void RecordStoreValidateAdaptor::traverseRecordStore(RecordStore* recordStore,
<                                                      ValidateCmdLevel level,
<                                                      ValidateResults* results,
<                                                      BSONObjBuilder* output) {
---
> void _genericRecordStoreValidate(OperationContext* opCtx,
>                                  RecordStore* recordStore,
>                                  RecordStoreValidateAdaptor* indexValidator,
>                                  ValidateResults* results,
>                                  BSONObjBuilder* output) {
10c11
<     std::unique_ptr<SeekableRecordCursor> cursor = recordStore->getCursor(_opCtx, true);
---
>     std::unique_ptr<SeekableRecordCursor> cursor = recordStore->getCursor(opCtx, true);
15,16d15
<         ++nrecords;
<
18c17
<             _opCtx->checkForInterrupt();
---
>             opCtx->checkForInterrupt();
20c19
<
---
>         ++nrecords;
24c23
<         Status status = validate(record->id, record->data, &validatedSize);
---
>         Status status = indexValidator->validate(record->id, record->data, &validatedSize);
26c25
<         // Checks to ensure isInRecordIdOrder() is being used properly.
---
>         // Check to ensure isInRecordIdOrder() is being used properly.
30a30,31
>         // ValidatedSize = dataSize is not a general requirement as some storage engines may use
>         // padding, but we still require that they return the unpadded record data.
41,42d41
<         // While some storage engines may use padding, we still require that they return the
<         // unpadded record data.
56c55
<         recordStore->updateStatsAfterRepair(_opCtx, nrecords, dataSizeTotal);
---
>         recordStore->updateStatsAfterRepair(opCtx, nrecords, dataSizeTotal);



 Comments   
Comment by Githook User [ 22/Aug/19 ]

Author:

{'name': 'Gregory Wlodarek', 'email': 'gregory.wlodarek@mongodb.com', 'username': 'GWlodarek'}

Message: SERVER-41811 Deduplicate CollectionValidation::_genericRecordStoreValidate and ValidateAdaptor::traverseRecordStore
Branch: master
https://github.com/mongodb/mongo/commit/4db2f7c5f0fa6a19be5cb5f36ad29b670f162813

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