Fixes#181
Mostly a few changes in pragmas. There are also a few actual code
changes:
- remove reduntant `else return` after `if return`
- Change some `x = foo and bar or baz` into equivalent `bar if foo
else baz` forms.
Fixes#169.
We need this version for IMultiCommitStorage and the registerDB fix in
ConflictResolvingStorage. Since these versions run on Python 2.7.8,
there's no motivation for trying to go back farther.
* Clean up all violations reported by pylint in preperation for turning on landscape.io
* fix all prospector errors.
* don't run pylint on pypy/py3 because we're getting all sorts of import errors under Py3 (and it's sorta slow on pypy)
* back to editable? Somehow _cache_ring isn't always being built.
* skip bootstrap.py on landscape.
* pylint fixes for umysql
* Adapt code from NextThought to implement umysqldb support. Fixes#79.
* exclude should be a sub-key of matrix.
* Force the right driver for the umysqldb tests.
* formatting and debuging.
* Use bytes, not bytearry, to avoid a crash in umysql.
* Tweak driver selection.
* test fixes for umysqldb.
As #92 shows, this can have a profound performance impact (depending on
the hit rate, of course, and the relative speed of the
database/Memcache).
This still needs a lot of cleanup, specific testing, and documentation.
Committing as a WIP.
The major difference from psycopg2/cffi is that it doesn't have native
lobject support. This is easily worked around, but this draft is not
complete because it doesn't support chunks. Some refactoring will be
required to elegantly handle this.
Two minor differences:
- It doesn't support multiple statements in a single `cursor.execute()`
call. Apparently it turns all statements into prepared statements,
because the error is from the server. Easily worked around and
unlikely to be a perfomance difference.
- It handles transaction isolation levels like most other drivers, in
SQL. This could be handled more elegantly too.
One thing: The server spits out lots of "WARNING: not in a transaction".
If I enable statement logging, I see every `commit` immediately followed
by a `rollback`, which generates the warning. I'm not sure if that's
just us, or something the driver is doing differently (e.g, maybe
psycopg2/cffi always follows `commit` with `begin`? and then when we try
to `rollback` we're already in a transaction?). Annoying but harmless.
Still, would like to figure it out though.
Testing this pure-python driver on Python 3 also revealed a lot of
connection leaks, many of which I've fixed, but there are probably more.
This should be a win for PyPy. See also zopefoundation/ZODB#78.
The testing matrix is expanded to test the pure-python drivers on
CPython too and to test pg8000. (Travis will be the first time I run
psycopg2 tests; hope I didn't break anything!)
Fixes#85.
Locally, I'm getting a bunch of MemoryErrors with PyPy 5.0+MySQL (with
or without coverage) that I didn't get with PyPy 4.whatever I was using
before.
```
File "relstorage/tests/blob/testblob.py", line 532, in relstorage.tests.blob.testblob.savepoint_cleanup
Failed example:
db = DB(bs)
Exception raised:
Traceback (most recent call last):
File "/Users/jmadden/bin/pypy/lib-python/2.7/doctest.py", line 1315, in __run
compileflags, 1) in test.globs
File "<doctest relstorage.tests.blob.testblob.savepoint_cleanup[3]>", line 1, in <module>
db = DB(bs)
File "////relstorage/.tox/pypy-mysql/site-packages/ZODB/DB.py", line 458, in __init__
temp_storage.tpc_vote(t)
File "////relstorage/.tox/pypy-mysql/site-packages/perfmetrics/__init__.py", line 133, in call_with_metric
return f(*args, **kw)
File "relstorage/storage.py", line 841, in tpc_vote
return self._vote()
File "relstorage/storage.py", line 875, in _vote
self._prepare_tid()
File "relstorage/storage.py", line 757, in _prepare_tid
adapter.txncontrol.add_transaction(cursor, tid_int, user, desc, ext)
File "relstorage/adapters/txncontrol.py", line 140, in add_transaction
self.Binary(description), self.Binary(extension)))
File "////relstorage/.tox/pypy-mysql/site-packages/pymysql/cursors.py", line 159, in execute
query = self.mogrify(query, args)
File "////relstorage/.tox/pypy-mysql/site-packages/pymysql/cursors.py", line 138, in mogrify
query = query % self._escape_args(args, conn)
File "////relstorage/.tox/pypy-mysql/site-packages/pymysql/cursors.py", line 113, in _escape_args
return tuple(conn.escape(arg) for arg in args)
File "////relstorage/.tox/pypy-mysql/site-packages/pymysql/cursors.py", line 113, in <genexpr>
return tuple(conn.escape(arg) for arg in args)
File "////relstorage/.tox/pypy-mysql/site-packages/pymysql/connections.py", line 793, in escape
return escape_item(obj, self.charset, mapping=mapping)
File "////relstorage/.tox/pypy-mysql/site-packages/pymysql/converters.py", line 26, in escape_item
val = encoder(val, mapping)
File "////relstorage/.tox/pypy-mysql/site-packages/pymysql/converters.py", line 94, in escape_bytes
return b"_binary'%s'" % escape_string(value)
File "////relstorage/.tox/pypy-mysql/site-packages/pymysql/converters.py", line 83, in escape_string
value = value.replace('\\', '\\\\')
MemoryError
```
Adds .travis.yml and scripts for creating the DBs for those tests.
Travis is setup to send coverage reports to coveralls.io (once the tests
pass).
Also adds a tox.ini and .coveragerc for checking coverage locally.
Run the tests with '-m relstorage.tests.alltests', which now behaves
like the existing '-m relstorage.tests.testmysql' et al.
Fixes an issue running blob tests with '-m'.