ExportXMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major - P3
    • 9.1.0-rc0, 9.1.0-rc1025
    • Affects Version/s: None
    • Component/s: None
    • None
    • Cluster Scalability
    • Fully Compatible
    • ClusterScalability 26Oct-9Nov
    • 0
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      ReshardingOpObserver calls LocalReshardingOperationsRegistry::registerOperation()/unregisterOperation()/clearOperationsForRole() directly, inline, from its onInserts/onUpdate/onDelete/onDropCollection hooks. These hooks run before the enclosing WriteUnitOfWork commits, but the registry mutation itself is a plain in-memory update with no ties to whether that WriteUnitOfWork actually commits or rolls back.

      So the registry's view of "is this namespace currently undergoing resharding, and under what role" can drift out of sync with the durable state documents it mirrors, any time the write it's reacting to doesn't commit, e.g. a later op observer hook throwing, a retry after WriteConflictException, or any other path that aborts the WriteUnitOfWork after the registry call already ran.

      This was observed as part of SERVER-134132: onDelete unregistered a donor operation from the registry before running the pin lock-mode check in _doPin()/_calculatePin(). If that check throws (a tassert as of that fix, previously a crashing invariant), the delete's WriteUnitOfWork rolls back but the registry mutation had already taken effect, leaving it stale. That instance was fixed narrowly by reordering the two calls. The same class of bug exists at every other registry call site in this file, since none of them are actually transactional with the write.

      The proposed fix is to register a RecoveryUnit::onCommit() handler that performs the registry mutation only once the write has actually committed in WiredTiger, instead of mutating inline. This mirrors the pattern already used elsewhere in the same file  eg the onCommit handler in onUpdate that defers notifying ReshardingCoordinatorObserver until after commit.

      Note this is not urgent on its own because the registry is rebuilt from durable state on stepup/restart via resyncFromDisk, so a mismatch self-heals eventually. But ShardingWriteRouter and ready_range_deletions_processor read it in between, so a stale entry can cause incorrect write routing or an incorrect range-deletion decision until the next step-up.

            Assignee:
            Jordan Glassley
            Reporter:
            Nandini Bhartiya
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: