kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | a3447a72a046975758e1f27434efa8175115af242aa7fc271515d10e18ef0432 |
|---|---|
| Author | Sylvain Lebresne <sylvain@datastax.com> · 2014-08-11 17:16 +02:00 |
| Committer | Sylvain Lebresne <sylvain@datastax.com> · 2014-08-11 17:16 +02:00 |
| Parents | c650795a337f, c994d7eb1103 |
3 files changed
modified driver-core/CHANGELOG.rst +1 −0
| @@ -8,6 +8,7 @@ | ||
| 8 | 8 | - [bug] Fix handling of SimpleStatement with values in query builder |
| 9 | 9 | batches (JAVA-393) |
| 10 | 10 | - [bug] Ensure pool is properly closed in onDown (JAVA-417) |
| 11 | +- [bug] Fix tokenMap initialization at startup (JAVA-415) | |
| 11 | 12 | |
| 12 | 13 | |
| 13 | 14 | 2.0.4: |
modified driver-core/src/main/java/com/datastax/driver/core/Cluster.java +1 −1
| @@ -1772,7 +1772,7 @@ | ||
| 1772 | 1772 | // that querying a table just after having created it don't fail. |
| 1773 | 1773 | if (!ControlConnection.waitForSchemaAgreement(connection, Cluster.Manager.this)) |
| 1774 | 1774 | logger.warn("No schema agreement from live replicas after {} ms. The schema may not be up to date on some nodes.", ControlConnection.MAX_SCHEMA_AGREEMENT_WAIT_MS); |
| 1775 | - ControlConnection.refreshSchema(connection, keyspace, table, Cluster.Manager.this, false, false); | |
| 1775 | + ControlConnection.refreshSchema(connection, keyspace, table, Cluster.Manager.this, false); | |
| 1776 | 1776 | } catch (Exception e) { |
| 1777 | 1777 | logger.error("Error during schema refresh ({}). The schema from Cluster.getMetadata() might appear stale. Asynchronously submitting job to fix.", e.getMessage()); |
| 1778 | 1778 | submitSchemaRefresh(keyspace, table); |
modified driver-core/src/main/java/com/datastax/driver/core/ControlConnection.java +6 −4
| @@ -228,8 +228,10 @@ | ||
| 228 | 228 | refreshNodeListAndTokenMap(connection, cluster, isInitialConnection); |
| 229 | 229 | |
| 230 | 230 | // Note that refreshing the schema will trigger refreshNodeListAndTokenMap since table == null |
| 231 | + // We want that because the token map was not properly initialized by the first call above, since it requires the list of keyspaces | |
| 232 | + // to be loaded. | |
| 231 | 233 | logger.debug("[Control connection] Refreshing schema"); |
| 232 | - refreshSchema(connection, null, null, cluster, isInitialConnection, true); | |
| 234 | + refreshSchema(connection, null, null, cluster, isInitialConnection); | |
| 233 | 235 | return connection; |
| 234 | 236 | } catch (BusyConnectionException e) { |
| 235 | 237 | connection.closeAsync().get(); |
| @@ -247,7 +249,7 @@ | ||
| 247 | 249 | // At startup, when we add the initial nodes, this will be null, which is ok |
| 248 | 250 | if (c == null) |
| 249 | 251 | return; |
| 250 | - refreshSchema(c, keyspace, table, cluster, false, false); | |
| 252 | + refreshSchema(c, keyspace, table, cluster, false); | |
| 251 | 253 | } catch (ConnectionException e) { |
| 252 | 254 | logger.debug("[Control connection] Connection error while refreshing schema ({})", e.getMessage()); |
| 253 | 255 | signalError(); |
| @@ -262,7 +264,7 @@ | ||
| 262 | 264 | } |
| 263 | 265 | } |
| 264 | 266 | |
| 265 | - static void refreshSchema(Connection connection, String keyspace, String table, Cluster.Manager cluster, boolean isInitialConnection, boolean dontReloadNodeInfo) throws ConnectionException, BusyConnectionException, ExecutionException, InterruptedException { | |
| 267 | + static void refreshSchema(Connection connection, String keyspace, String table, Cluster.Manager cluster, boolean isInitialConnection) throws ConnectionException, BusyConnectionException, ExecutionException, InterruptedException { | |
| 266 | 268 | // Make sure we're up to date on schema |
| 267 | 269 | String whereClause = ""; |
| 268 | 270 | if (keyspace != null) { |
| @@ -306,7 +308,7 @@ | ||
| 306 | 308 | |
| 307 | 309 | // If the table is null, we either rebuild all from scratch or have an updated keyspace. In both case, rebuild the token map |
| 308 | 310 | // since some replication on some keyspace may have changed |
| 309 | - if (table == null && !dontReloadNodeInfo) | |
| 311 | + if (table == null) | |
| 310 | 312 | refreshNodeListAndTokenMap(connection, cluster, false); |
| 311 | 313 | } |
| 312 | 314 |