-
Notifications
You must be signed in to change notification settings - Fork 101
test case for https://rt.cpan.org/Ticket/Display.html?id=63955 #13
Conversation
… might not find the master and thus udpates to be a slave, which will bomb out on the next test which tries to insert
… after reconnect whereas find works without problem
perl_mongo_master takes a flag to reconnect, but this was never being set so the auto_reconnect flag was useless. fix this and add tests (+ reorder tests slightly). there is a (perhaps low level) bug somewhere, as can be seen in the strace.out file included in this commit. when calling perl_mongo_master we check if connected by first inspecting link->master->connected, and then calling getpeername to check the socket. in the strace.out we can see the following, which ties up to the failing test in auto_reconnect.t: getpeername(4, {sa_family=AF_INET, sin_port=htons(27272), sin_addr=inet_addr("127.0.0.1")}, [16]) = 0 sendto(4, "D\0\0\0\345\321\t\0\0\0\0\0\324\7\0\0\0\0\0\0test_database.foo\0\0\0\0\0\0\0\0\0\26\0\0\0\7_id\0M\216M\272\316\203xt'\0\0\2\0", 68, 0, NULL, 0) = 68 getpeername(4, 0x7fff47164990, [16]) = -1 ENOTCONN (Transport endpoint is not connected)
Nice work. Hope I can write a test that's even half as useful for https://jira.mongodb.org/browse/PERL-149 :) |
On 5 Oct 2011, at 02:11, Paul.W Harvey wrote:
I'd forgotten about this! Don't think it has been pulled so it will Lee. |
Hey @leejo! Currently we can't use your changes due to changes in some of the modules in the last 2 or so years. The auto_reconnect issue will be solved down the road but you are welcome to still get this fix in earlier than that. If you are still willing to modify your code to fit with the newer code, you are more than welcome to :). I've created a test in devel/t-dynamic called PERL-234-auto-reconnect.t that you can use to test whether or not this bug is fixed. It might need to be changed depending on the implementation of the fix. |
Hi! Well it's been a while since i made this PR and i am no longer actively using mongodb. I can look at this if necessary, but will need to refresh my memory (and dev environment). It's been so long that if the issue is going to be resolved soon enough then it may be easier to just close this PR without merging. I notice that this PR isn't very clean anyway, i could do with squashing it a bit and also removing some unnecessary files (don't know why i committed that strace output!) |
Going to close this for now then. Thank you so much for the tests though. I didn't have to do much work to get them working with our current orchestration framework. |
appears to be a bug when calling find_one after an auto_reconnect has taken place. added a test case to catch this. cheers, lee.