On 3/2/2015 11:39 AM, spillane wrote:
> and then starting up host2, host3 and host4 in order I am expecting to see a
> cloud graph like this
>                     
>                       shard1 - host1  ip
> rockbands -->  shard2 - host2 ip
>                       shard3  - host3 ip
>                       shard4  - host4 ip
>
> But the cloud graph shows this order after the first host is started
>
>                       shard1 - host1 ip
> rockbands -->  shard4
>                       shard2
>                       shard3

I have not looked at the code, so I could be completely wrong about
this, but I am guessing that the results you see are because of the code
being implemented in a specific way for performance reasons.

It's very likely that these pieces of information are stored in a Map
structure in the java code, and it is most likely a HashMap, because
that is a very fast Map implementation.  When it is time to return that
information to the admin UI cloud graph, it probably uses the "keySet()"
method on the Map object.  HashMap makes no guarantees about the order
of the elements in the map, and adding more entries very likely will
change the order:

http://docs.oracle.com/javase/7/docs/api/java/util/HashMap.html

There should probably be one or more options available for the API calls
that the admin UI uses, which can specify that the list should be
sorted, and possibly how to sort it.  Our UI expert will tell us whether
the UI should have options to specify sort parameters, or whether it
will simply sort by default.  The UI work may require a separate issue
in Jira.

Thanks,
Shawn

Reply via email to