TransactionCoordinator _targetHostAsync may not run continuation on intended thread

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Won't Fix
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Cluster Scalability
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      I was investigating uses of unsafeToInlineFuture in the code, and found that in AsyncWorkScheduler::_targetHostAsync, it looks like the intention is to run the continuation on an executor thread:

                  return targeter->findHost(readPref, CancellationToken::uncancelable())
                      .thenRunOn(_executor)
                      .unsafeToInlineFuture()
                      .then([shard = std::move(shard)](HostAndPort host) mutable -> HostAndShard {
                          return {std::move(host), std::move(shard)};
                      });

      However, based on recent discussion (linked in comments), .thenRunOn(...).unsafeToInlineFuture(...) will actually just run the continuation inline, not on the executor provided in thenRunOn.

      This might not be a big deal in this function (if so, feel free to close as Won't Fix), but I wanted to raise it as it looks like the intended behavior doesn't match the actual behavior here.

              Assignee:
              Unassigned
              Reporter:
              Erin McNulty
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: