<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body 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>&nbsp; ClusterCacheStatus status = //get status for cache name</tt><br>
    <tt>&nbsp; status.setNewMappings(...) //synchronized of course</tt><br>
    <tt>&nbsp; rebalancePolicy.updateCacheStatus(...);</tt><br>
    <tt>}<br>
      <br>
      DefaultRebalancePolicy.updateCacheStatus(...) { //modified<br>
      &nbsp; ...<br>
      &nbsp; if (!status.hasJoiners() &amp;&amp; isBalanced(...) &amp;&amp;
      !status.hasNewMappings()) { //added last condition<br>
      &nbsp;&nbsp;&nbsp; return;<br>
      &nbsp; }<br>
      &nbsp; ...<br>
      }<br>
      <br>
      ClusterTopologyManagerImpl.startRebalance(...) { //modifed<br>
      &nbsp; ...<br>
      &nbsp; chFactory.rebalance(ch);<br>
      &nbsp; chFactory.applyMappings(ch, status.getNewMappings()); //added.<br>
      &nbsp; ... //if it is the same ch, no state transfer is triggered<br>
      }</tt><br>
    <br>
    What do you think?<br>
    <br>
    Thanks,<br>
    Pedro<br>
    <br>
    On 2/12/13 3:39 PM, Dan Berindei wrote:
    <blockquote
cite="mid:CA+nfvwTg8q7UHqhK4a0NTUcvqNYxRbVSASeDqs1+x8gWyRUOyA@mail.gmail.com"
      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">&lt;<a moz-do-not-send="true"
              href="mailto:pruivo@gsd.inesc-id.pt" target="_blank">pruivo@gsd.inesc-id.pt</a>&gt;</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 class="im"><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 moz-do-not-send="true"
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 class="h5"><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
                          moz-do-not-send="true"
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">&lt;<a
                            moz-do-not-send="true"
                            href="mailto:pruivo@gsd.inesc-id.pt"
                            target="_blank">pruivo@gsd.inesc-id.pt</a>&gt;</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 moz-do-not-send="true"
                            href="mailto:infinispan-dev@lists.jboss.org"
                            target="_blank">infinispan-dev@lists.jboss.org</a><br>
                          <a moz-do-not-send="true"
                            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 moz-do-not-send="true" href="mailto:infinispan-dev@lists.jboss.org" target="_blank">infinispan-dev@lists.jboss.org</a>
<a moz-do-not-send="true" 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 moz-do-not-send="true"
              href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br>
            <a moz-do-not-send="true"
              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 wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
infinispan-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/infinispan-dev">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a></pre>
    </blockquote>
  </body>
</html>