kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | f0e51e4b50e6d20ac5538276af30fb431c37bda009717c1798e0ab42f93a6980 |
|---|---|
| Author | olim7t <omichallat+github@gmail.com> · 2014-10-09 15:52 +02:00 |
| Committer | olim7t <omichallat+github@gmail.com> · 2014-10-09 15:52 +02:00 |
| Parents | da8137a35958 |
1 file changed
modified driver-core/Upgrade_guide_to_2.1.rst +77 −9
| @@ -1,13 +1,14 @@ | ||
| 1 | -Upgrade Guide to 2.1.0 | |
| 2 | -====================== | |
| 1 | +Upgrade Guide to 2.1 | |
| 2 | +==================== | |
| 3 | 3 | |
| 4 | 4 | The purpose of this guide is to detail the changes made by version 2.1 of |
| 5 | -the Java Driver that are relevant to an upgrade from version 2.0. This guide | |
| 6 | -only describes breaking changes of the API, added features are not covered. | |
| 5 | +the Java Driver. | |
| 7 | 6 | |
| 7 | +2.1.0 | |
| 8 | +----- | |
| 8 | 9 | |
| 9 | 10 | User API Changes |
| 10 | ----------------- | |
| 11 | +~~~~~~~~~~~~~~~~ | |
| 11 | 12 | |
| 12 | 13 | 1. The ``getCaching`` method of ``TableMetadata#Options`` now returns a |
| 13 | 14 | ``Map`` to account for changes to Cassandra 2.1. Also, the |
| @@ -25,22 +26,89 @@ | ||
| 25 | 26 | |
| 26 | 27 | |
| 27 | 28 | Internal API Changes |
| 28 | --------------------- | |
| 29 | +~~~~~~~~~~~~~~~~~~~~ | |
| 29 | 30 | |
| 30 | 31 | The changes listed in this section should normally not impact end users of the |
| 31 | 32 | driver, but rather third-party frameworks and tools. |
| 32 | 33 | |
| 33 | -3. The ``serialize`` and ``deserialize`` methods in ``DataType`` now take an | |
| 34 | +1. The ``serialize`` and ``deserialize`` methods in ``DataType`` now take an | |
| 34 | 35 | additional parameter: the protocol version. As explained in the javadoc, |
| 35 | 36 | if unsure, the proper value to use for this parameter is the protocol version |
| 36 | 37 | in use by the driver, i.e. the value returned by |
| 37 | 38 | ``cluster.getConfiguration().getProtocolOptions().getProtocolVersion()``. |
| 38 | 39 | |
| 39 | -4. The ``parse`` method in ``DataType`` now returns a Java object, not a | |
| 40 | +2. The ``parse`` method in ``DataType`` now returns a Java object, not a | |
| 40 | 41 | ``ByteBuffer``. The previous behavior can be obtained by calling the |
| 41 | 42 | ``serialize`` method on the returned object. |
| 42 | 43 | |
| 43 | -5. The ``getValues`` method of ``RegularStatement`` now takes the protocol | |
| 44 | +3. The ``getValues`` method of ``RegularStatement`` now takes the protocol | |
| 44 | 45 | version as a parameter. As above, the proper value if unsure is almost surely |
| 45 | 46 | the protocol version in use |
| 46 | 47 | (``cluster.getConfiguration().getProtocolOptions().getProtocolVersion()``). |
| 48 | + | |
| 49 | + | |
| 50 | +2.1.1 | |
| 51 | +----- | |
| 52 | + | |
| 53 | +Internal API Changes | |
| 54 | +~~~~~~~~~~~~~~~~~~~~ | |
| 55 | + | |
| 56 | +1. The ``ResultSet`` interface has a new ``wasApplied()`` method. This will | |
| 57 | + only affect clients that provide their own implementation of this interface. | |
| 58 | + | |
| 59 | + | |
| 60 | +2.1.2 | |
| 61 | +----- | |
| 62 | + | |
| 63 | +2.1.2 brings important internal changes with native protocol v3 support, but | |
| 64 | +the impact on the public API has been kept as low as possible. | |
| 65 | + | |
| 66 | +User API Changes | |
| 67 | +~~~~~~~~~~~~~~~~ | |
| 68 | + | |
| 69 | +1. The native protocol version is now modelled as an enum: ``ProtocolVersion``. | |
| 70 | + Most public methods that take it as an argument have a backward-compatible | |
| 71 | + version that takes an ``int`` (the exception being ``RegularStatement``, | |
| 72 | + described below). For new code, prefer the enum version. | |
| 73 | + | |
| 74 | +Internal API Changes | |
| 75 | +~~~~~~~~~~~~~~~~~~~~ | |
| 76 | + | |
| 77 | +1. ``RegularStatement.getValues`` now takes the protocol version as a | |
| 78 | + ``ProtocolVersion`` instead of an ``int``. This is transparent for callers | |
| 79 | + since there is a backward-compatible alternative, but if you happened to | |
| 80 | + extend the class you'll need to update your implementation. | |
| 81 | + | |
| 82 | +2. ``BatchStatement.setSerialConsistencyLevel`` now returns ``BatchStatement`` | |
| 83 | + instead of ``Statement``. Again, this only matters if you extended this | |
| 84 | + class (if so, it might be a good idea to also have a covariant return in | |
| 85 | + your child class). | |
| 86 | + | |
| 87 | +3. The constructor of ``UnsupportedFeatureException`` now takes a | |
| 88 | + ``ProtocolVersion`` as a parameter. This should impact few users, as there's | |
| 89 | + hardly any reason to build instances of that class from client code. | |
| 90 | + | |
| 91 | +New features | |
| 92 | +~~~~~~~~~~~~ | |
| 93 | + | |
| 94 | +These features are only active when the native protocol v3 is in use. | |
| 95 | + | |
| 96 | +1. The driver now uses a single connection per host (as opposed to a pool in | |
| 97 | + 2.1.1). Most options in ``PoolingOptions`` are ignored, except for a new one | |
| 98 | + called ``maxSimultaneousRequestsPerHostThreshold``. See the class's Javadocs | |
| 99 | + for detailed explanations. | |
| 100 | + | |
| 101 | +2. You can now provide a default timestamp with each query (but it will be | |
| 102 | + ignored if the CQL query string already contains a ``USING TIMESTAMP`` | |
| 103 | + clause). This can be done on a per-statement basis with | |
| 104 | + ``Statement.setDefaultTimestamp``, or automatically with a | |
| 105 | + ``TimestampGenerator`` specified with | |
| 106 | + ``Cluster.Builder.withTimestampGenerator`` (two implementations are | |
| 107 | + provided: ``ThreadLocalMonotonicTimestampGenerator`` and | |
| 108 | + ``AtomicMonotonicTimestampGenerator``). If you specify both, the statement's | |
| 109 | + timestamp takes precedence over the generator. By default, the driver has | |
| 110 | + the same behavior as 2.1.1 (no generator, timestamps are assigned by | |
| 111 | + Cassandra unless ``USING TIMESTAMP`` was specified). | |
| 112 | + | |
| 113 | +3. ``BatchStatement.setSerialConsistencyLevel`` no longer throws an exception, | |
| 114 | + it will honor the serial consistency level for the batch. |