<div dir="ltr">Actually I'd like regular users to be able to define their own RebalancePolicies and ConsistentHashFactories, without modifying ClusterTopologyManagerImpl/ClusterCacheStatus, so I see this as a good opportunity to modify our implementation to allow it.<br>
<div><div class="gmail_extra"></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 12, 2013 at 6:04 PM, Pedro Ruivo <span dir="ltr"><<a href="mailto:pruivo@gsd.inesc-id.pt" target="_blank">pruivo@gsd.inesc-id.pt</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>
<div text="#000000" bgcolor="#ffffff">
Can I modify the existing one?<br>
<br>
I'm thinking in the following:<br>
<br>
<tt>ClusterTopologyManagerImpl.handleNewMappings(...) { //new method</tt><br>
<tt> ClusterCacheStatus status = //get status for cache name</tt><br>
<tt> status.setNewMappings(...) //synchronized of course</tt><br>
<tt> rebalancePolicy.updateCacheStatus(...);</tt><br>
<tt>}<br>
<br></tt></div></blockquote><div><br></div><div>Like I said, I'd like to keep ClusterTopologyManager as generic as possible wrt rebalance strategies, so I think your DataPlacementManager should call your custom RebalancePolicy directly.<br>
<br></div><div>The rebalance policy could keep the new mappings in a map on its own, although maybe it would be a nice touch to allow storing custom state in ClusterCacheStatus.<br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#ffffff"><tt>
DefaultRebalancePolicy.updateCacheStatus(...) { //modified<br>
...<br>
if (!status.hasJoiners() && isBalanced(...) &&
!status.hasNewMappings()) { //added last condition<br>
return;<br>
}<br>
...<br>
}<br></tt></div></blockquote><div><br></div>I guess you'd also need to clean up the old "new mappings" here after the rebalance is done.<br><br></div><div class="gmail_quote"><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#ffffff"><tt>
<br>
ClusterTopologyManagerImpl.startRebalance(...) { //modifed<br>
...<br>
chFactory.rebalance(ch);<br>
chFactory.applyMappings(ch, status.getNewMappings()); //added.<br>
... //if it is the same ch, no state transfer is triggered<br>
}</tt><br>
<br></div></blockquote><div><br></div><div>This would require ClusterTopologyManagerImpl to know about your custom ConsistentHashFactory, and it wouldn't work with another ConsistentHashFactory that requires different custom data. So I'd rather we add a generic parameter to ConsistentHashFactory.rebalance.<br>
</div><div><br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#ffffff">
What do you think?<br>
<br>
Thanks,<br>
Pedro<div><div class="h5"><br>
<br>
On 2/12/13 3:39 PM, Dan Berindei wrote:
<blockquote type="cite">
<div dir="ltr">
<div>Sorry, I didn't read your code so I just assumed you're
writing your own RebalancePolicy.<br>
<br>
</div>
I think you need to implement your own RebalancePolicy, because
ClusterTopologyManagerImpl by itself doesn't remember that a
rebalance was triggerred. So if you call startRebalance, but
there is already a rebalance in progress, it is just ignored.
When the in-progress rebalance finishes, it calls
RebalancePolicy.updateCacheStatus, and it's the RebalancePolicy
implementation's job to start a new rebalance if needed.<br>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Tue, Feb 12, 2013 at 5:28 PM, Pedro
Ruivo <span dir="ltr"><<a href="mailto:pruivo@gsd.inesc-id.pt" target="_blank">pruivo@gsd.inesc-id.pt</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div text="#000000" bgcolor="#ffffff"> Hi Dan,
<div><br>
<br>
On 2/12/13 3:12 PM, Dan Berindei wrote:
<blockquote type="cite">
<div dir="ltr">
<div>Hi Pedro<br>
<br>
</div>
<div>When I split off the RebalancePolicy I was
thinking that when a RebalancePolicy needs to
collaborate with a ConsistentHashFactory, they
should do so via another cache manager-scoped
component. But that doesn't really work (yet?),
because ConsistentHashFactory can't access any
components.<br>
</div>
</div>
</blockquote>
</div>
I didn't understand the previous sentence... Do I need to
invoke anything in the RebalancePolicy? <br>
<br>
So far, I'm invoking directly in the
ClusterTopologyManager:
<a href="https://github.com/pruivo/infinispan/blob/cloudtm_v2/core/src/main/java/org/infinispan/dataplacement/DataPlacementManager.java#L246" target="_blank">https://github.com/pruivo/infinispan/blob/cloudtm_v2/core/src/main/java/org/infinispan/dataplacement/DataPlacementManager.java#L246</a><br>
<br>
Thanks!<br>
<br>
Cheers,<br>
Pedro
<div>
<div><br>
<blockquote type="cite">
<div dir="ltr">
<div> </div>
<div><br>
</div>
<div>I think it would be better to extend
ClusterTopologyManager.triggerRebalance (and
ConsistentHashFactory.rebalance) to accept an
arbitrary Object parameter. Then RebalancePolicy
could use this parameter to pass extra
information to the CHF, like your Mappings
object, and then when ClusterTopologyManagerImpl
asks for a balanced CH, the CHF will include the
Mappings in the result CH. What do you think?<br>
<br>
</div>
<div>In order to trigger the rebalance you have to
call startRebalance, and the new ("balanced")
consistent hash must not be equal to the
existing consistent hash. See <a href="https://github.com/infinispan/infinispan/blob/master/core/src/main/java/org/infinispan/topology/ClusterTopologyManagerImpl.java#L389" target="_blank">https://github.com/infinispan/infinispan/blob/master/core/src/main/java/org/infinispan/topology/ClusterTopologyManagerImpl.java#L389</a><br>
<br>
</div>
<div>Cheers<br>
</div>
<div>Dan<br>
<br>
</div>
<br>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Thu, Feb 7, 2013 at
10:05 PM, Pedro Ruivo <span dir="ltr"><<a href="mailto:pruivo@gsd.inesc-id.pt" target="_blank">pruivo@gsd.inesc-id.pt</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
I'm working in a way to rebase auto-placer on
top of NBST and I have one<br>
question...<br>
If you have already forgot, auto-placer
analyzes the workload and tries<br>
to move the most remote accessed keys to the
corresponding requester.<br>
<br>
After calculating the new mappings, I want to
trigger the NBST with this<br>
mapping. I'm thinking to add a new method in
the ClusterTopologyManager,<br>
something like:<br>
<br>
triggerAutoPlacer(String cacheName, Mappings
newMappings);<br>
<br>
and this method it will be a duplicate of
triggerRebalance but instead<br>
of doing chFactory.rebalance(CH) (in the
startRebalance() method) I'm<br>
thinking to do chFactory.autoPlacer(CH,
Mappings). The last method will<br>
override the defautl CH location.<br>
<br>
Question: will this solution trigger the NBST
or do I have to create the<br>
triggerAutoPlacer() method in another class?<br>
<br>
ps. forget the methods names... I will think
in better names later<br>
<br>
Thanks!!<br>
<br>
Cheers,<br>
Pedro<br>
_______________________________________________<br>
infinispan-dev mailing list<br>
<a href="mailto:infinispan-dev@lists.jboss.org" target="_blank">infinispan-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br>
</blockquote>
</div>
<br>
</div>
<pre><fieldset></fieldset>
_______________________________________________
infinispan-dev mailing list
<a href="mailto:infinispan-dev@lists.jboss.org" target="_blank">infinispan-dev@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a></pre>
</blockquote>
</div>
</div>
</div>
<br>
_______________________________________________<br>
infinispan-dev mailing list<br>
<a href="mailto:infinispan-dev@lists.jboss.org" target="_blank">infinispan-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br>
</blockquote>
</div>
<br>
</div>
<pre><fieldset></fieldset>
_______________________________________________
infinispan-dev mailing list
<a href="mailto:infinispan-dev@lists.jboss.org" target="_blank">infinispan-dev@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a></pre>
</blockquote>
</div></div></div>
<br>_______________________________________________<br>
infinispan-dev mailing list<br>
<a href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br></blockquote></div><br></div></div></div>