PHPLIB-463: Implement spec test runner for retryable reads#671
PHPLIB-463: Implement spec test runner for retryable reads#671alcaeus wants to merge 0 commit intomongodb:masterfrom
Conversation
7492be4 to
191681f
Compare
| $cursor = $hasOutputCollection | ||
| ? $server->executeReadWriteCommand($this->databaseName, $command, $options) | ||
| : $server->executeReadCommand($this->databaseName, $command, $options); | ||
| : $server->executeCommand($this->databaseName, $command, $options); |
There was a problem hiding this comment.
I understand why this was necessary, as libmongoc does not prohibit retrying mapReduce if executed via read_command_with_opts(). We'd be in a pickle of mapReduce supported a readConcern option, as this would prohibit inheritance of any URI-level read concern; however, it does not and I don't imagine that will change anytime soon.
I do think we'd do well to add a command above this line explaining why we use executeCommand() here, though. Feel free to note that this isn't a problem since MR doesn't take a read concern.
There was a problem hiding this comment.
Please correct me if I'm wrong, but Server::executeCommand uses PHONGO_COMMAND_RAW (0x07). The way I read the readConcern check in phongo_execute_command, it will parse the read concern when using PHONGO_COMMAND_RAW.
However, when looking at mongoc-client-c, it only applies a readConcern option for MONGOC_CMD_READ and MONGOC_CMD_RW.
Looking at the enum we declare in phongo.h, I believe the declaration for PHONGO_COMMAND_RAW should change from 0x07 to 0x06 to not support the readConcern option, just the way libmongoc does.
In summary, your point is absolutely correct, as libmongoc does not parse a readConcern option when running the command through executeCommand vs. executeReadCommand. Given the history of mapReduce, I'd also be surprised if it started supporting a readConcern option. If that were the case however, there would be more changes necessary in both libmongoc and the driver here, so I think we should be safe ignoring this for now. Regardless of the above, I've added a comment to explain why we use executeCommand instead of executeReadCommand.
There was a problem hiding this comment.
I think we talked through the first question earlier today, but in case not: Server::executeCommand() takes RC, RP, and WC options, just as mongoc_client_command_with_opts() does. What those functions don't do is inherit client-level options from the URI.
That aside, the new comment LGTM.
56754c8 to
4be88b0
Compare
tests/SpecTests/Operation.php
Outdated
| case 'runCommand': | ||
| return ResultExpectation::ASSERT_MATCHES_DOCUMENT; | ||
| case 'watch': | ||
| return ResultExpectation::ASSERT_NOTHING; |
There was a problem hiding this comment.
Did I suggest using ASSERT_SAME_DOCUMENTS in my previous review here? This would ensure that we start failing if/when the tests ever introduce result assertions for watch(). As-is, this will cause us to ignore newly introduced result assertions.
There was a problem hiding this comment.
I missed that the original comment referred to match as well. It's updated now.
| */ | ||
| private function executeForGridFSBucket(Bucket $bucket, Context $context) | ||
| { | ||
| switch ($this->name) { |
There was a problem hiding this comment.
The other execute methods in this file start with:
$args = $context->prepareOptions($this->arguments);
$context->replaceArgumentSessionPlaceholder($args);
I suppose there's no reason to do this because we reference exact options in the cases below and aren't passing the full array to anything. I suppose it's something to keep in mind if/when GridFS gets session support, although who knows what that API may look like.
There was a problem hiding this comment.
I suppose there's no reason to do this because we reference exact options in the cases below and aren't passing the full array to anything. I suppose it's something to keep in mind if/when GridFS gets session support, although who knows what that API may look like.
That is correct. We only use the filename option for the download_by_name operation and leave all other options unused. We could pass in options on the off-chance that a test specifies the revision option (which currently is the only option taken by these GridFS operations).
There was a problem hiding this comment.
I think it's worth doing array_diff_key() just to populate general options to each method that takes them.
a5bfc34 to
d90b890
Compare
|
Merged in 2789277. |
https://jira.mongodb.org/browse/PHPLIB-463