TokenAwarePolicy does not work properly (tokenMap not initializing)

Description

When you use TokenAwarePolicy it does not work as expected since Metadata.tokenMap.tokensToHosts is empty immediately after cluster connection initialized.

I found a workaround. Changed ControlConnection.refreshSchema method so that it enforces re-reading ring data, line 310:
refreshNodeListAndTokenMap(connection, cluster, true);
to
refreshNodeListAndTokenMap(connection, cluster, false);

My change leads to reading ring tokens twice during initialization. More accurate code re-factoring is required to make only one read. It seems like the problem is connected to changes in JAVA-315.

Environment

None

Pull Requests

None

Activity

Show:
Olivier Michallat
August 11, 2014, 1:16 PM
Edited

Yes, we made changes to avoid repeating the same calls at initialization time. But it appears that there is an issue: building the tokens (Metadata#rebuildTokenMap) uses the list of keyspaces (Metadata#keyspaces), but it seems like we load the keyspaces after building the tokens. That explains why it works when you force it a second time. I'm going to look at how the calls can be reordered.

Fixed

Assignee

Olivier Michallat

Reporter

Maxim Z

Labels

None

PM Priority

None

Reproduced in

None

Affects versions

Fix versions

Pull Request

None

Doc Impact

None

Size

None

External issue ID

None

External issue ID

None

Time remaining

0m

Components

Priority

Major
Configure