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

Indexes reported as valid when unable to return inconsistencies due to memory limit

    • Storage Execution
    • Fully Compatible
    • ALL
    • v6.2, v6.0, v5.0, v4.4, v4.2
    • Hide

      Apply the patch

      diff --git a/src/mongo/db/catalog/index_consistency.cpp b/src/mongo/db/catalog/index_consistency.cpp
      index 40dec646b08..910619634bc 100644
      --- a/src/mongo/db/catalog/index_consistency.cpp
      +++ b/src/mongo/db/catalog/index_consistency.cpp
      @@ -445,7 +445,7 @@ void IndexConsistency::addIndexKey(OperationContext* opCtx,
       bool IndexConsistency::limitMemoryUsageForSecondPhase(ValidateResults* result) {
           invariant(!_firstPhase);
       
      -    const uint32_t maxMemoryUsageBytes = maxValidateMemoryUsageMB.load() * 1024 * 1024;
      +    const uint32_t maxMemoryUsageBytes = 0;
           const uint64_t totalMemoryNeededBytes =
               std::accumulate(_indexKeyBuckets.begin(),
                               _indexKeyBuckets.end(), 

      And then run 

      buildscripts/resmoke.py run --suite=core repro.js 

      with 

      (function() {
      "use strict";
      
      load('jstests/libs/fail_point_util.js');
      
      let testColl = db.getCollection("test");
      assert.commandWorked(testColl.createIndex({a: 1}));
      
      assert.commandWorked(
          db.adminCommand({configureFailPoint: "skipIndexNewRecords", mode: "alwaysOn"}));
      
      assert.commandWorked(testColl.insert({a: 100}));
      
      assert.commandWorked(db.adminCommand({configureFailPoint: "skipIndexNewRecords", mode: "off"}));
      })(); 
      Show
      Apply the patch diff --git a/src/mongo/db/catalog/index_consistency.cpp b/src/mongo/db/catalog/index_consistency.cpp index 40dec646b08..910619634bc 100644 --- a/src/mongo/db/catalog/index_consistency.cpp +++ b/src/mongo/db/catalog/index_consistency.cpp @@ -445,7 +445,7 @@ void IndexConsistency::addIndexKey(OperationContext* opCtx,  bool IndexConsistency::limitMemoryUsageForSecondPhase(ValidateResults* result) {      invariant(!_firstPhase);   -     const uint32_t maxMemoryUsageBytes = maxValidateMemoryUsageMB.load() * 1024 * 1024; +     const uint32_t maxMemoryUsageBytes = 0;       const uint64_t totalMemoryNeededBytes =          std::accumulate(_indexKeyBuckets.begin(),                          _indexKeyBuckets.end(), And then run  buildscripts/resmoke.py run --suite=core repro.js with  (function() { "use strict" ; load( 'jstests/libs/fail_point_util.js' ); let testColl = db.getCollection( "test" ); assert .commandWorked(testColl.createIndex({a: 1})); assert .commandWorked( db.adminCommand({configureFailPoint: "skipIndexNewRecords" , mode: "alwaysOn" })); assert .commandWorked(testColl.insert({a: 100})); assert .commandWorked(db.adminCommand({configureFailPoint: "skipIndexNewRecords" , mode: "off" })); })();
    • Execution Team 2023-02-20, Execution Team 2023-02-06

      We zero out the inconsistencies during validation if it takes more than the memory limit to report them. However, if all inconsistencies are zeroed out, we would return the indexes as valid: true in the indexDetails section, which is confusing.

      We should at least still flag the index as invalid even if we can't report any of the inconsistencies. Or we should always report at least one inconsistency as the size of one keystring shouldn't cause OOM.

            Assignee:
            dan.larkin-york@mongodb.com Dan Larkin-York
            Reporter:
            yuhong.zhang@mongodb.com Yuhong Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: