Open
Conversation
Contributor
Result of foundationdb-pr-clang on Linux RHEL 9
|
Contributor
Result of foundationdb-pr on Linux RHEL 9
|
Contributor
Result of foundationdb-pr-clang-arm on Linux CentOS 7
|
Contributor
Result of foundationdb-pr-clang-ide on Linux RHEL 9
|
Contributor
Result of foundationdb-pr-cluster-tests on Linux RHEL 9
|
Contributor
Result of foundationdb-pr-clang-ide on Linux RHEL 9
|
Contributor
Result of foundationdb-pr-clang-arm on Linux CentOS 7
|
Contributor
Result of foundationdb-pr on Linux RHEL 9
|
Contributor
Result of foundationdb-pr-clang on Linux RHEL 9
|
Contributor
Result of foundationdb-pr-cluster-tests on Linux RHEL 9
|
Contributor
|
(Review in progress) |
gxglass
reviewed
Mar 19, 2026
Contributor
gxglass
left a comment
There was a problem hiding this comment.
At best a partial review (limited template metaprogramming knowledge, limited knowledge of the code being modified), but doing what I can here.
| AsyncResult() noexcept : state(nullptr) {} | ||
| AsyncResult(AsyncResult const&) = delete; | ||
| AsyncResult& operator=(AsyncResult const&) = delete; | ||
| AsyncResult(AsyncResult&& rhs) noexcept : state(rhs.state) { rhs.state = nullptr; } |
Contributor
There was a problem hiding this comment.
I might be missing something but this doesn't call release() while operator= below does. Is the difference intentional?
| } | ||
| }; | ||
|
|
||
| template <class F, class U> |
Contributor
There was a problem hiding this comment.
would readers of this code generally know what F and U refer to here? If not put comments
| void addRef() { ++refs; } | ||
| void delRef() { | ||
| if (!--refs) { | ||
| delete this; |
Contributor
There was a problem hiding this comment.
If there's a bug in this logic, or let's say this line got deleted by merge damage (unlikely, but possible), would that fail any tests?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Because
Future<T>usesSAV<T>under the hood, if a coroutine returns aFuture<T>the only way to take ownership of the result of the coroutine is to copy aTobject, which may be expensive. In many cases, this is unnecessary, and should be avoided. For example, the following code requires an expensive copy:The new
AsyncResultclass is not copyable and doesn't rely onSAV, so results are moved out of the coroutine. If thecorocoroutine above returnedAsyncResult<std::vector<int>>, an expensive copy could be avoided. A microbenchmark is added in this PR to demonstrate this.fdbcli/ExcludeCommand.cppis also updated to avoid some expensive copies using this optimization. Lastly,raceis updated to supportAsyncResultarguments as well asFutureorFutureStreamarguments.Code-Reviewer Section
The general pull request guidelines can be found here.
Please check each of the following things and check all boxes before accepting a PR.
For Release-Branches
If this PR is made against a release-branch, please also check the following:
release-branchormainif this is the youngest branch)