@@ -241,9 +241,27 @@ Changing the driver's defaults should be done with care and only in
241241specific situations; read each method's Javadoc for detailed
242242explanations.
243243
244+ ### Avoid preparing 'SELECT *' queries
245+
246+ Both the driver and Cassandra maintain a mapping of `PreparedStatement` queries to their
247+ metadata. When a change is made to a table, such as a column being added or dropped, there
248+ is currently no mechanism for Cassandra to invalidate the existing metadata. Because of this,
249+ the driver is not able to properly react to these changes and will improperly read rows after
250+ a schema change is made.
251+
252+ Therefore it is currently recommended to not create prepared statements
253+ for 'SELECT *' queries if you plan on making schema changes involving
254+ adding or dropping columns. Alternatively you should list all columns of interest
255+ in your statement, i.e.: `SELECT a, b, c FROM tbl`.
256+
257+ This will be addressed in a future release of both Cassandra and the driver. Follow
258+ [CASSANDRA-10786] and [JAVA-1196] for more information.
259+
244260[PreparedStatement]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/PreparedStatement.html
245261[BoundStatement]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/BoundStatement.html
246262[setPrepareOnAllHosts]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/QueryOptions.html#setPrepareOnAllHosts-boolean-
247263[setReprepareOnUp]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/QueryOptions.html#setReprepareOnUp-boolean-
248264[execute]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Session.html#execute-com.datastax.driver.core.Statement-
249265[executeAsync]: http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Session.html#executeAsync-com.datastax.driver.core.Statement-
266+ [CASSANDRA-10786]: https://issues.apache.org/jira/browse/CASSANDRA-10786
267+ [JAVA-1196]: https://datastax-oss.atlassian.net/browse/JAVA-1196
0 commit comments