-
Notifications
You must be signed in to change notification settings - Fork 116
Fixed LOAD DATA LOCAL INFILE
commands
#30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* Fixes for both "buffered" & "unbuffered" cursor types * Registered `test_load_local` to run with tests * Refactored `test_load_local` tests to work with the tornado framework More information here: PyMySQL#29
In LoadLocal.send_data:
This line will block entire your ioloop. |
In same function:
This only append packet into write buffer. |
As you can see, writing proper async code is hard job. |
af71cc7
to
4dfd091
Compare
Fair enough. My initial goal was just to get it functional, not necessarily to vet all the "async" portions of it. But I've taken your suggestions & revised. You can obviously take it or leave it. Thanks |
FYI, current chunk_size is too large. 2**24 may be larger than OS readahead size. |
True... but in reality the stream is going to be doing nonblocking reads against the file descriptor (PipeIOStream sets O_NONBLOCK)... and no OS is going to give back that much data in a single nonblocking read, which governs the chunk size that gets handled. That said, it probably would be better to take control of that more tightly. |
I can't understand what stream you mean. |
See also: go-sql-driver/mysql#424 |
After you made the comment about the blocking file read, I changed to use tornado.iostream.PipeIOStream: |
If you want to use PipeIOStream, you should use pipe. Maybe, "/usr/bin/cat /path/to/file" (This is not works on Windows, off course). File I/O can't be non blocking. That's why libuv uses threadpool for file I/O. |
Yes, my mistake. The truth is that for my application it doesn't matter much, since the portions that use |
FYI, aio-libs/aiomysql is actively maintained. Tornado can be used with asyncio now. |
That's the eventual plan, actually... but for now we have to support py2.7 & py3.4. |
test_load_local
to run with teststest_load_local
tests to work with the tornado frameworkMore information here:
#29