diff options
author | Randolph Tan <randolph@10gen.com> | 2019-02-27 14:02:22 -0500 |
---|---|---|
committer | Randolph Tan <randolph@10gen.com> | 2019-02-28 10:35:42 -0500 |
commit | 8187116fe23a02f60bc2ed6dcdfa32d91b6e2c43 (patch) | |
tree | 9f1da9dfa6836a0647c12256534aeb1de9b4ba9e /src/mongo/db/session.cpp | |
parent | 5a12a71b2fe461200960e42c037053940c211453 (diff) | |
download | mongo-8187116fe23a02f60bc2ed6dcdfa32d91b6e2c43.tar.gz |
SERVER-39847 Migrating session info can trigger fassert when destination shard has transaction history truncated by oplog
(cherry picked from commit 1466c2b24eef41805dfac73e2fb43256d6d8fae7)
Diffstat (limited to 'src/mongo/db/session.cpp')
-rw-r--r-- | src/mongo/db/session.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/mongo/db/session.cpp b/src/mongo/db/session.cpp index a6ceba98b45..659ca1c3cc4 100644 --- a/src/mongo/db/session.cpp +++ b/src/mongo/db/session.cpp @@ -445,18 +445,17 @@ bool Session::onMigrateBeginOnPrimary(OperationContext* opCtx, TxnNumber txnNumb return false; } } catch (const DBException& ex) { - // If the transaction chain was truncated on the recipient shard, then we are most likely - // copying from a session that hasn't been touched on the recipient shard for a very long - // time but could be recent on the donor. - // - // We continue copying regardless to get the entire transaction from the donor. - if (ex.code() != ErrorCodes::IncompleteTransactionHistory) { - throw; + // If the transaction chain is incomplete because oplog was truncated, just ignore the + // incoming oplog and don't attempt to 'patch up' the missing pieces. + if (ex.code() == ErrorCodes::IncompleteTransactionHistory) { + return false; } if (stmtId == kIncompleteHistoryStmtId) { return false; } + + throw; } return true; |