Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-41811

Deduplicate CollectionValidation::_genericRecordStoreValidate and ValidateAdaptor::traverseRecordStore

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.3.1
    • Affects Version/s: None
    • Component/s: Storage
    • Labels:
    • Fully Compatible
    • Execution Team 2019-08-26

      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);
      

            Assignee:
            gregory.wlodarek@mongodb.com Gregory Wlodarek
            Reporter:
            louis.williams@mongodb.com Louis Williams
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: