[ClusterLabs] Unbounded master scoring
Andrei Borzenkov
arvidjaar at gmail.com
Fri Apr 10 16:49:26 UTC 2015
В Fri, 10 Apr 2015 10:29:45 +0200
Alexander T <mittspamkonto at gmail.com> пишет:
> Hello!
>
> I have a situation where I would like to set master preferences based on
> practically unbounded measurements, for instance age or connection count. I
> am trying to figure out how this can be done safely with the current
> scoring model.
>
> If I for instance choose to set the score directly based on age in minutes,
> I will be limited to something like 100000 minutes - 70 days. If I want
> second resolution, I will only get 100000 seconds ~ 27 hours.
>
> The problem gets even worse if I want to select primarily on age but
> secondly on for instance active connection count. That is to make sure that
> connection count only matters if age is equal. How can I locally compute a
> single score which reflects this logic? Tricky to say the least, especially
> if the measurements are non-bounded.
>
> I am imagining a situation where a node can set local attributes, like {
> lastModificationTime: X, activeConnections: Y }, and I can provide a score
> or "master preference" function. I am here illustrating the concept with a
> simplified function which would only work in a two-node situation:
>
> compute_scores(node0_lastModificationTime,
> node0_activeConnections,
> node1_lastModificationTime,
> node1_activeConnections) {
> winner = compare(node0_lastModificationTime,
> node1_lastModificationTime);
> if (winner == None) {
> winner = compare(node0_activeConnections, node1_activeConnections);
>
> }
> if (winner == None) {
> //tie
> return { node0: 0, node1: 0 }
> } else if (winner == node0) {
> return { node0: 1, node1: 0 }
> } else {
> return { node0: 0, node1: 1 }
> }
> }
>
> Is something like this possible today? Has anyone done this already?
>
> If I am to implement this myself I suppose I could store per-node
> attributes in the CIB and aggregate them on each node, compare and compute
> each local score on 'monitor' or 'notify'. I am unsure whether this will
> give me the result which I need, though. I am primarily concerned that the
> CIB attributes and/or my score won't be updated by the time that scores are
> evaluated. I am relying on age today to choose the right master after
> partitioning and split brain. For a transition to this new model, I would
> need pacemaker to call my function before making any decision. And I'm not
> sure it would.
>
> Any advice/ideas?
>
In your monitor function set scoring attribute(s) for current node and
then compute current node master score based on attributes of all
nodes.
More information about the Users
mailing list