diff options
author | Jason Carey <jcarey@argv.me> | 2018-04-30 15:21:45 -0400 |
---|---|---|
committer | Jason Carey <jcarey@argv.me> | 2018-05-04 12:18:23 -0400 |
commit | 236bf5f077eb16f7bf8f0f7c5f103240bd061f12 (patch) | |
tree | bbf85db3916634483f8123fe60c2ccc1ab3eed63 /src/mongo/util | |
parent | 3539922e751fc79f536a43aae6da422e5a4a03d0 (diff) | |
download | mongo-236bf5f077eb16f7bf8f0f7c5f103240bd061f12.tar.gz |
SERVER-34506 TLASIO test for isJustForContinuation
Adding an integration test for transport layer asio which uses a fail
point to induce single byte at a time reads and writes. We use this,
along with a debug block in the future header, to ensure that the
continuation folding in futures is working properly with
opportunisticRead/Write chaining.
To test the other side of this, adding a new test command called "echo"
which returns the command object passed to it (to allow for a large
message body on the read and write path more easily).
Diffstat (limited to 'src/mongo/util')
-rw-r--r-- | src/mongo/util/future.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mongo/util/future.h b/src/mongo/util/future.h index 2b4d2c9c4f4..7a8fece88ab 100644 --- a/src/mongo/util/future.h +++ b/src/mongo/util/future.h @@ -41,6 +41,7 @@ #include "mongo/stdx/mutex.h" #include "mongo/stdx/utility.h" #include "mongo/util/assert_util.h" +#include "mongo/util/debug_util.h" #include "mongo/util/intrusive_counter.h" #include "mongo/util/scopeguard.h" @@ -356,6 +357,27 @@ public: dassert(oldState == SSBState::kWaiting); + DEV { + // If you hit this limit one of two things has probably happened + // + // 1. The justForContinuation optimization isn't working. + // 2. You may be creating a variable length chain. + // + // If those statements don't mean anything to you, please ask an editor of this file. + // If they don't work here anymore, I'm sorry. + const size_t kMaxDepth = 32; + + size_t depth = 0; + for (auto ssb = continuation.get(); ssb; + ssb = ssb->state.load(std::memory_order_acquire) == SSBState::kWaiting + ? ssb->continuation.get() + : nullptr) { + depth++; + + invariant(depth < kMaxDepth); + } + } + if (callback) { callback(this); } |