Skip to content

Commit be8092d

Browse files
committed
Merging with v2 of DataStax Python Driver
Conflicts: cassandra/cluster.py
2 parents 223b297 + 58b3c71 commit be8092d

File tree

96 files changed

+7588
-2378
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+7588
-2378
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
*.swp
33
*.swo
44
*.so
5+
*.egg
56
*.egg-info
67
.tox
78
.idea/
@@ -15,3 +16,4 @@ cover/
1516
docs/_build/
1617
tests/integration/ccm
1718
setuptools*.tar.gz
19+
setuptools*.egg

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ env:
44
- TOX_ENV=py26
55
- TOX_ENV=py27
66
- TOX_ENV=pypy
7+
- TOX_ENV=py33
8+
- TOX_ENV=py34
79

810
before_install:
911
- sudo apt-get update -y
1012
- sudo apt-get install -y build-essential python-dev
1113
- sudo apt-get install -y libev4 libev-dev
14+
1215
install:
1316
- pip install tox
1417

CHANGELOG.rst

Lines changed: 196 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,199 @@
1+
2.0.2
2+
=====
3+
4+
Bug Fixes
5+
---------
6+
* Add six to requirements.txt
7+
* Avoid KeyError during schema refresh when a keyspace is dropped
8+
and TokenAwarePolicy is not in use
9+
* Avoid registering multiple atexit() cleanup functions will the
10+
asyncore event loop is restarted multiple times
11+
* Delay initialization of reactors in order to avoid problems
12+
with shared state when using multiprocessing (PYTHON-60)
13+
* Add python-six to debian dependencies, move python-blist to
14+
recommends
15+
16+
2.0.1
17+
=====
18+
May 28, 2014
19+
20+
Bug Fixes
21+
---------
22+
* Fix check for Cluster.is_shutdown in in @run_in_executor
23+
decorator
24+
25+
2.0.0
26+
=====
27+
May 28, 2014
28+
29+
Features
30+
--------
31+
* Make libev C extension Python3-compatible (PYTHON-70)
32+
* Support v2 protocol authentication (PYTHON-73, github #125)
33+
34+
Bug Fixes
35+
---------
36+
* Fix murmur3 C extension compilation under Python3.4 (github #124)
37+
38+
Merged From 1.x
39+
---------------
40+
41+
Features
42+
^^^^^^^^
43+
* Add Session.default_consistency_level (PYTHON-14)
44+
45+
Bug Fixes
46+
^^^^^^^^^
47+
* Don't strip trailing underscores from column names when using the
48+
named_tuple_factory (PYTHON-56)
49+
* Ensure replication factors are ints for NetworkTopologyStrategy
50+
to avoid TypeErrors (github #120)
51+
* Pass WriteType instance to RetryPolicy.on_write_timeout() instead
52+
of the string name of the write type. This caused write timeout
53+
errors to always be rethrown instead of retrying. (github #123)
54+
* Avoid submitting tasks to the ThreadPoolExecutor after shutdown. With
55+
retries enabled, this could cause Cluster.shutdown() to hang under
56+
some circumstances.
57+
* Fix unintended rebuild of token replica map when keyspaces are
58+
discovered (on startup), added, or updated and TokenAwarePolicy is not
59+
in use.
60+
* Avoid rebuilding token metadata when cluster topology has not
61+
actually changed
62+
* Avoid preparing queries for hosts that should be ignored (such as
63+
remote hosts when using the DCAwareRoundRobinPolicy) (PYTHON-75)
64+
65+
Other
66+
^^^^^
67+
* Add 1 second timeout to join() call on event loop thread during
68+
interpreter shutdown. This can help to prevent the process from
69+
hanging during shutdown.
70+
71+
2.0.0b1
72+
=======
73+
May 6, 2014
74+
75+
Upgrading from 1.x
76+
------------------
77+
Cluster.shutdown() should always be called when you are done with a
78+
Cluster instance. If it is not called, there are no guarantees that the
79+
driver will not hang. However, if you *do* have a reproduceable case
80+
where Cluster.shutdown() is not called and the driver hangs, please
81+
report it so that we can attempt to fix it.
82+
83+
If you're using the 2.0 driver against Cassandra 1.2, you will need
84+
to set your protocol version to 1. For example:
85+
86+
cluster = Cluster(..., protocol_version=1)
87+
88+
Features
89+
--------
90+
* Support v2 of Cassandra's native protocol, which includes the following
91+
new features: automatic query paging support, protocol-level batch statements,
92+
and lightweight transactions
93+
* Support for Python 3.3 and 3.4
94+
* Allow a default query timeout to be set per-Session
95+
96+
Bug Fixes
97+
---------
98+
* Avoid errors during interpreter shutdown (the driver attempts to cleanup
99+
daemonized worker threads before interpreter shutdown)
100+
101+
Deprecations
102+
------------
103+
The following functions have moved from cassandra.decoder to cassandra.query.
104+
The original functions have been left in place with a DeprecationWarning for
105+
now:
106+
107+
* cassandra.decoder.tuple_factory has moved to cassandra.query.tuple_factory
108+
* cassandra.decoder.named_tuple_factory has moved to cassandra.query.named_tuple_factory
109+
* cassandra.decoder.dict_factory has moved to cassandra.query.dict_factory
110+
* cassandra.decoder.ordered_dict_factory has moved to cassandra.query.ordered_dict_factory
111+
112+
1.1.2
113+
=====
114+
May 8, 2014
115+
116+
Features
117+
--------
118+
* Allow a specific compression type to be requested for communications with
119+
Cassandra and prefer lz4 if available
120+
121+
Bug Fixes
122+
---------
123+
* Update token metadata (for TokenAware calculations) when a node is removed
124+
from the ring
125+
* Fix file handle leak with gevent reactor due to blocking Greenlet kills when
126+
closing excess connections
127+
* Avoid handling a node coming up multiple times due to a reconnection attempt
128+
succeeding close to the same time that an UP notification is pushed
129+
* Fix duplicate node-up handling, which could result in multiple reconnectors
130+
being started as well as the executor threads becoming deadlocked, preventing
131+
future node up or node down handling from being executed.
132+
* Handle exhausted ReconnectionPolicy schedule correctly
133+
134+
Other
135+
-----
136+
* Don't log at ERROR when a connection is closed during the startup
137+
communications
138+
* Mke scales, blist optional dependencies
139+
140+
1.1.1
141+
=====
142+
April 16, 2014
143+
144+
Bug Fixes
145+
---------
146+
* Fix unconditional import of nose in setup.py (github #111)
147+
148+
1.1.0
149+
=====
150+
April 16, 2014
151+
152+
Features
153+
--------
154+
* Gevent is now supported through monkey-patching the stdlib (PYTHON-7,
155+
github issue #46)
156+
* Support static columns in schemas, which are available starting in
157+
Cassandra 2.1. (github issue #91)
158+
* Add debian packaging (github issue #101)
159+
* Add utility methods for easy concurrent execution of statements. See
160+
the new cassandra.concurrent module. (github issue #7)
161+
162+
Bug Fixes
163+
---------
164+
* Correctly supply compaction and compression parameters in CREATE statements
165+
for tables when working with Cassandra 2.0+
166+
* Lowercase boolean literals when generating schemas
167+
* Ignore SSL_ERROR_WANT_READ and SSL_ERROR_WANT_WRITE socket errors. Previously,
168+
these resulted in the connection being defuncted, but they can safely be
169+
ignored by the driver.
170+
* Don't reconnect the control connection every time Cluster.connect() is
171+
called
172+
* Avoid race condition that could leave ResponseFuture callbacks uncalled
173+
if the callback was added outside of the event loop thread (github issue #95)
174+
* Properly escape keyspace name in Session.set_keyspace(). Previously, the
175+
keyspace name was quoted, but any quotes in the string were not escaped.
176+
* Avoid adding hosts to the load balancing policy before their datacenter
177+
and rack information has been set, if possible.
178+
* Avoid KeyError when updating metadata after droping a table (github issues
179+
#97, #98)
180+
* Use tuples instead of sets for DCAwareLoadBalancingPolicy to ensure equal
181+
distribution of requests
182+
183+
Other
184+
-----
185+
* Don't ignore column names when parsing typestrings. This is needed for
186+
user-defined type support. (github issue #90)
187+
* Better error message when libevwrapper is not found
188+
* Only try to import scales when metrics are enabled (github issue #92)
189+
* Cut down on the number of queries executing when a new Cluster
190+
connects and when the control connection has to reconnect (github issue #104,
191+
PYTHON-59)
192+
* Issue warning log when schema versions do not match
193+
1194
1.0.2
2195
=====
3-
In Progress
196+
March 4, 2014
4197

5198
Bug Fixes
6199
---------
@@ -15,6 +208,8 @@ Bug Fixes
15208
TimestampType to fix sorting of pre-unix epoch dates in CASSANDRA-5723.)
16209
* Handle latest table options when parsing the schema and generating
17210
CREATE statements.
211+
* Avoid 'Set changed size during iteration' during query plan generation
212+
when hosts go up or down
18213

19214
Other
20215
-----

README-dev.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Releasing
22
=========
33
* Run the tests and ensure they all pass
4+
* If dependencies have changed, make sure ``debian/control``
5+
is up to date
46
* Update CHANGELOG.rst
57
* Update the version in ``cassandra/__init__.py``
68
* Commit the changelog and version changes
@@ -41,6 +43,8 @@ For example::
4143
python setup.py doc
4244
cp -R docs/_build/1.0.0-beta1/* ~/python-driver-docs/
4345
cd ~/python-driver-docs
46+
git add --all
47+
git commit -m 'Update docs'
4448
git push origin gh-pages
4549

4650
Running the Tests

README.rst

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ DataStax Python Driver for Apache Cassandra
66

77
A Python client driver for Apache Cassandra. This driver works exclusively
88
with the Cassandra Query Language v3 (CQL3) and Cassandra's native
9-
protocol. As such, only Cassandra 1.2+ is supported.
9+
protocol.
10+
11+
The driver supports Python 2.6, 2.7, 3.3, and 3.4.
1012

1113
Installation
1214
------------
@@ -19,16 +21,14 @@ For more complete installation instructions, see the
1921

2022
Documentation
2123
-------------
24+
The documentation can be found online `here <http://datastax.github.io/python-driver/index.html>`_.
2225

2326
A couple of links for getting up to speed:
2427

2528
* `Installation <http://datastax.github.io/python-driver/installation.html>`_
2629
* `Getting started guide <http://datastax.github.io/python-driver/getting_started.html>`_
2730
* `API docs <http://datastax.github.io/python-driver/api/index.html>`_
28-
29-
You can also find some
30-
`notes about the performance <http://datastax.github.io/python-driver/performance.html>`_
31-
on the `documentation page <http://datastax.github.io/python-driver/index.html>`_.
31+
* `Performance tips <http://datastax.github.io/python-driver/performance.html>`_
3232

3333
Reporting Problems
3434
------------------
@@ -49,13 +49,12 @@ you can use `freenode's web-based client <http://webchat.freenode.net/?channels=
4949
Features to be Added
5050
--------------------
5151
* C extension for encoding/decoding messages
52-
* Twisted, gevent support
53-
* Python 3 support
52+
* Twisted support
5453
* IPv6 Support
5554

5655
License
5756
-------
58-
Copyright 2013, DataStax
57+
Copyright 2013, 2014 DataStax
5958

6059
Licensed under the Apache License, Version 2.0 (the "License");
6160
you may not use this file except in compliance with the License.

benchmarks/base.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# Copyright 2013-2014 DataStax, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
from cProfile import Profile
216
import logging
317
import os.path
@@ -15,7 +29,6 @@
1529
from cassandra.cluster import Cluster
1630
from cassandra.io.asyncorereactor import AsyncoreConnection
1731
from cassandra.policies import HostDistance
18-
from cassandra.query import SimpleStatement
1932

2033
log = logging.getLogger()
2134
handler = logging.StreamHandler()
@@ -28,7 +41,7 @@
2841
from cassandra.io.libevreactor import LibevConnection
2942
have_libev = True
3043
supported_reactors.append(LibevConnection)
31-
except ImportError, exc:
44+
except ImportError as exc:
3245
pass
3346

3447
KEYSPACE = "testkeyspace"
@@ -86,13 +99,12 @@ def benchmark(thread_class):
8699
log.debug("Sleeping for two seconds...")
87100
time.sleep(2.0)
88101

89-
query = SimpleStatement("""
90-
INSERT INTO {table} (thekey, col1, col2)
91-
VALUES (%(key)s, %(a)s, %(b)s)
102+
query = session.prepare("""
103+
INSERT INTO {table} (thekey, col1, col2) VALUES (?, ?, ?)
92104
""".format(table=TABLE))
93-
values = {'key': 'key', 'a': 'a', 'b': 'b'}
105+
values = ('key', 'a', 'b')
94106

95-
per_thread = options.num_ops / options.threads
107+
per_thread = options.num_ops // options.threads
96108
threads = []
97109

98110
log.debug("Beginning inserts...")

0 commit comments

Comments
 (0)