Skip to content
This repository was archived by the owner on Dec 22, 2021. It is now read-only.

Conversation

@TBSliver
Copy link
Contributor

Updated retryable-writes spec tests as the appeared at mongodb/specifications@b7c53fc

Copy link
Contributor

@xdg xdg left a comment

Choose a reason for hiding this comment

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

MongoDB::NetworkError should also default to being retryable. Otherwise, looks good.

my $err = length($@) ? $@ : "caught error, but it was lost in eval unwind";
my $retry_link = $self->{_topology}->get_writable_link;

# Rare chance that the new link is not retryable
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment is now mildly confusing given extra error check.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh oops I did have a comment there about the extra check, must have got caught with a debugging cleanup...

# errors in a retryable write. This has to be seperate to the other functions
# due to not all result objects having the base response inside, so cannot be
# used to parse operationTime or $clusterTime
sub _assert_session_errors {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a little nervous about this, but if all existing tests pass (particularly for bulk operations) then I'm okay with it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea this was the least complicated place to add this assertion - I couldn't see any information about the comment in MongoDB::Op::_BulkWrite->execute of write concern errors are thrown only for the entire batch in the specs for bulk operations, and as retryable writes can happen on certain write concern errors it must be done inside the retry loop.

The other single ops do throw WriteConcernErrors further down the stack, but only on the return value of the send_*write_op which is outside the retryable writes block - could maybe move that assertion up the call stack slightly to be inside the execute block? If commandResult is also modified to check for write concern errors in the assert step, that would get rid of this extra assertion? Would mean that bulk writes would throw write concern errors earlier, and as I said I couldnt find if that is a spec decision or not...

@TBSliver
Copy link
Contributor Author

As far as I can tell, MongoDB::NetworkError should have __is_retryable_error be true, as it extends MongoDB::ConnectionError - unless I've missed something in the inheritance? Have updated the comment to be a bit clearer in the retry logic and re-arranged it slightly, as I noticed a possible issue...

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 76.619% when pulling 9ba406d on shadow-dot-cat:TBSliver/PERL-918 into 6f41220 on mongodb:master.

Copy link
Contributor

@xdg xdg left a comment

Choose a reason for hiding this comment

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

LGTM. Please work on integrating with PERL-875 and giving me a single branch to merge.

@xdg
Copy link
Contributor

xdg commented Jun 22, 2018

Closing this PR as the #163 includes it.

@xdg xdg closed this Jun 22, 2018
@TBSliver TBSliver deleted the TBSliver/PERL-918 branch September 14, 2018 14:58
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.

3 participants