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

MigrationChunkClonerSourceOpObserver::onInserts() written to look like it skips checking some documents for whether their chunk has moved

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor - P4 Minor - P4
    • 7.1.0-rc0, 7.0.2
    • None
    • Sharding
    • None
    • Fully Compatible
    • ALL
    • v7.0
    • Sharding NYC 2023-09-04

    Description

      The changes from 0323cbd as part of SERVER-70437 changed the interface of shardObserveInsertOp() to become the plural shardObserveInsertsOp(). However the changes mistakenly copied over the early return inside the for-loop. This turns out not to be a transaction consistency problem in practice because in every version where cross-shard transactions are supported (since MongoDB 4.2), the changes from SERVER-38583 had already made it so onInserts() is only called with a single element at a time.

      We should change the early return to a continue statement to reflect the intended control flow though.

      134
      for (auto it = first; it != last; it++, index++) {
      135
          auto opTime = opTimeList.empty() ? repl::OpTime() : opTimeList[index];
      136
       
      137
          if (inMultiDocumentTransaction) {
      138
              const auto atClusterTime = repl::ReadConcernArgs::get(opCtx).getArgsAtClusterTime();
      139
       
      140
              if (atClusterTime) {
      141
                  const auto shardKey =
      142
                      metadata->getShardKeyPattern().extractShardKeyFromDocThrows(it->doc);
      143
                  assertIntersectingChunkHasNotMoved(opCtx, *metadata, shardKey, *atClusterTime);
      144
              }
      145
       
      146
              return;
      147
          }
      148
       
      149
          auto cloner = MigrationSourceManager::getCurrentCloner(*csr);
      150
          if (cloner) {
      151
              cloner->onInsertOp(opCtx, it->doc, opTime);
      152
          }
      153
      }
      

      Attachments

        Activity

          People

            max.hirschhorn@mongodb.com Max Hirschhorn
            max.hirschhorn@mongodb.com Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: