diff options
author | Justin Seyster <justin.seyster@mongodb.com> | 2019-10-15 21:45:03 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-10-15 21:45:03 +0000 |
commit | 0b80f48b436a14cdfc6d05eb4108aa4e796565ce (patch) | |
tree | d224921c1aa53af05aa87d89bfda1d429373aae5 /src/mongo/db/exec | |
parent | b612950c46b24aa2977cb45a96def717af1210bc (diff) | |
download | mongo-0b80f48b436a14cdfc6d05eb4108aa4e796565ce.tar.gz |
SERVER-42836 Fast path for sort key generation of WorkingSetMembers
Includes a small change to external_sort_find.js, which was failing
when this change was initially submitted.
This reverts commit 72d8bff5f619ebdcb9904f5978ac14b2f53ea686.
Diffstat (limited to 'src/mongo/db/exec')
-rw-r--r-- | src/mongo/db/exec/sort_key_generator.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mongo/db/exec/sort_key_generator.cpp b/src/mongo/db/exec/sort_key_generator.cpp index f8c81395b8a..0d18dc37d7b 100644 --- a/src/mongo/db/exec/sort_key_generator.cpp +++ b/src/mongo/db/exec/sort_key_generator.cpp @@ -68,16 +68,16 @@ PlanStage::StageState SortKeyGeneratorStage::doWork(WorkingSetID* out) { if (stageState == PlanStage::ADVANCED) { WorkingSetMember* member = _ws->get(*out); - auto sortKey = _sortKeyGen.computeSortKey(*member); - if (!sortKey.isOK()) { - *out = WorkingSetCommon::allocateStatusMember(_ws, sortKey.getStatus()); + try { + auto sortKey = _sortKeyGen.computeSortKey(*member); + + // Add the sort key to the WSM as metadata. + member->metadata().setSortKey(std::move(sortKey), _sortKeyGen.isSingleElementKey()); + } catch (const DBException& computeSortKeyException) { + *out = WorkingSetCommon::allocateStatusMember(_ws, computeSortKeyException.toStatus()); return PlanStage::FAILURE; } - // Add the sort key to the WSM as metadata. - member->metadata().setSortKey(std::move(sortKey.getValue()), - _sortKeyGen.isSingleElementKey()); - return PlanStage::ADVANCED; } |