Repository navigation
Twisted backend for Python driver (#3785) - #4096
Conversation
|
Added tests in RaitoBezarius@2a8bac5 |
|
Cool, thanks a lot @RaitoBezarius ! @Tryneus can you check the code please? |
|
Yes, I've signed it ! Le jeu. 23 avr. 2015 21:19, Daniel Mewes [email protected] a
|
|
What's up about this pull request, it has been nearly 2 months on hold? |
|
Sorry for the delay @RaitoBezarius. We really appreciate your contribution and patience. We've had a very busy time working on a complete rewrite of RethinkDB's clustering internals (which includes auto failover, better availability, improved cluster management among others). We'll try to get to your pull request asap. |
There was a problem hiding this comment.
I don't think this will work if the driver receives two responses in a single dataReceived callback. It should save the remainder of the buffer (same goes for _handleHandshake, though it's not likely someone will be sending queries before the handshake response is received).
There was a problem hiding this comment.
You're right, I'll do it as soon as possible!
|
Ok, @RaitoBezarius, I've taken a look and commented on a few things that looked off. Primarily, though, the tests won't run, so I can't do any manual verification (especially useful because I'm new to Twisted). Sorry about the delay in getting to this, but please take a look and let me know your thoughts. |
|
Thanks, @Tryneus! I'll take the time to look about it and make the modifications. |
|
@RaitoBezarius: first you need to build the server (see instructions here. Once that is done, you should go to the |
|
@Tryneus : [FIXED EDIT] I have a strange permission error when running tests: When I printed the command, I got Here is a full Gist of what the runner printed: https://gist.github.com/RaitoBezarius/22b876a95ad90e9c1e37 I've run tests manually with EDIT: Nevermind, I had to set executable bit on twisted_connection.py* |
|
@RaitoBezarius, glad you got the permissions working, I noticed they were wrong when I was trying to get the tests running, but didn't think to mention it. |
|
@Tryneus I've finally succeeded to make tests works, and then, I've discovered that a lot of the Cursor API is broken and does not work as expected. @asyncio.coroutine
def test_cursor_after_cursor_close(self):
cursor = yield from r.range().run(self.conn)
cursor.close()
count = 0
while (yield from cursor.fetch_next()):
yield from cursor.next()
count += 1
self.assertNotEqual(count, 0, "Did not get any cursor results")If I understand correctly, it means that a cursor fetch immediately when it is instantiated some data. EDIT: I've answered many of your line notes, please take a look and let me know if I've forgotten something! |
|
@RaitoBezarius, when a query response arrives, it can indicate that it is just the first batch of a larger result - this is when we create a Cursor object. The Cursor is instantiated with the original batch of data, but will request more immediately (pre-fetching) to reduce latency. Since the first batch of a normal cursor contains data (changefeeds are different - they may or may not have data in the first batch) - this test makes sure that the cursor will return the data it has already received from the server before stopping due to the |
|
@Tryneus: If it can help you with Twisted, you can play around with the driver. It can help you to test the driver in a REPL (which is quite cool). |
|
@Tryneus: Finished! As you can see, I've made all the modifications in order to make tests pass. |
There was a problem hiding this comment.
This shouldn't fail until all successful rows have been read out from the cursor - that is, when len(self.items) == 0. Only once all the items have been read should we throw the error.
There was a problem hiding this comment.
Okay, it is fixed in the last commit !
|
@RaitoBezarius, thanks for taking a look at it - I ran into several things when testing it on my local machine, so I opened a pull request on your fork with my fixes/suggestions. Please take a look and we can combine it into this PR later. |
Fix for Twisted driver Python 3 compatibility and some corner cases
|
Finally got back to this, ran some tests and everything seems to be working fine. Merged to |
|
Thanks to you too @Tryneus ! :) |
|
👏 another backend :-) |
As discussed in #3785, here is my PR for the Twisted backend.
It has been tested (on a small part). Tests have been added (RaitoBezarius@2a8bac5), but I can't test yet (don't have the environnement for).
Keep the great work going, guys!