Skip to content
This repository was archived by the owner on Feb 1, 2022. It is now read-only.

PHP-1510: Fix tests for legacy opcode rerouting #877

Merged
merged 4 commits into from
Apr 25, 2016

Conversation

jmikola
Copy link
Member

@jmikola jmikola commented Apr 21, 2016

My mistake for not catching these test failures in #876. Please see full commit messages for an explanation of changes.

While sorting these out, I also noticed an irregularity with append_getlasterror() and opened PHPC-1511. I don't believe this affects anything, since the function would not have been called if is_gle_op() returned false, but the previous logic looked incorrect nevertheless.

Note: This was opened against the wrong branch. Will be merged to v1.6.

@@ -34,7 +34,7 @@ for ($i = 0; $i < 10; ++$i) {
array('x' => $i, 'y' => str_repeat('a', 4*1024*1024)),
array('w' => 0)
);
assertFalse($retval);
assertTrue($retval);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the commit message:

Now that unacknowledged writes are routed through legacy opcodes, these write methods return true (as documented).

It appears that the false assertion was due to mongo_convert_write_api_return_to_legacy_retval() converting the response from an unacknowledged write command (likely an empty array) to a boolean.

@derickr
Copy link
Contributor

derickr commented Apr 25, 2016

LGTM, when "silent" is changed to something akin to "show_warnings"

jmikola added 4 commits April 25, 2016 10:57
The extra is_gle_op() call was causing duplicate "safe" deprecation notices and MongoLog output in some tests. Existing code paths for write commands and legacy ops already include necessary output, so allow is_gle_op() to be silent when invoked for the purpose of routing unacknowledged writes to legacy opcodes.
Now that unacknowledged writes are routed through legacy opcodes, these write methods return true (as documented).

It appears that the false assertion was due to mongo_convert_write_api_return_to_legacy_retval() converting the response from an unacknowledged write command (likely an empty array) to a boolean.
Stream notifications cannot be used to assert the write concern of unacknowledged writes, since they are routed through legacy opcodes instead of write commands. Use MongoLog to assert that no GLE is issued for these writes.
@jmikola jmikola force-pushed the 1.6-legacy-opcodes branch from 7b84658 to 16c9a1e Compare April 25, 2016 14:57
@jmikola
Copy link
Member Author

jmikola commented Apr 25, 2016

when "silent" is changed to something akin to "show_warnings"

Removed the negation in the if statements and employed the NOISY and QUIET constants for readability.

@jmikola jmikola merged commit 16c9a1e into mongodb:master Apr 25, 2016
jmikola added a commit that referenced this pull request Apr 25, 2016
@jmikola jmikola deleted the 1.6-legacy-opcodes branch April 25, 2016 15:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants