<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 05/13/2014 03:58 PM, Dan Berindei
      wrote:<br>
    </div>
    <blockquote
cite="mid:CA+nfvwQDkzbZ7fuoLX80xtx0KgspGZVWoqD+vo=W5iFRSCcKEg@mail.gmail.com"
      type="cite">
      <div dir="ltr"><br>
        <div class="gmail_extra"><br>
          <div class="gmail_quote">On Mon, May 12, 2014 at 1:54 PM,
            Radim Vansa <span dir="ltr">&lt;<a moz-do-not-send="true"
                href="mailto:rvansa@redhat.com" target="_blank">rvansa@redhat.com</a>&gt;</span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">@Dan:
              It's absolutely correct to do the further writes in order
              to make<br>
              the cache consistent, I am not arguing against that.
              You've fixed the<br>
              outcome (state of cache) well. My point was that we should
              let the user<br>
              know that the value he gets is not 100% correct when we
              already know<br>
              that - and given the API, the only option to do that seems
              to me as<br>
              throwing an exception.<br>
            </blockquote>
            <div><br>
            </div>
            <div>The problem, as I see it, is that users also expect
              methods that throw an exception to *not* modify the cache.</div>
            <div>So we would break some of the users' expectations
              anyway.</div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    When the response from primary owner does not arrive soon, we throw
    timeout exception and the cache is modified anyway, isn't it?<br>
    If we throw ~ReturnValueUnreliableException, the user has at least
    some chance to react. Currently, for code requiring 100% reliable
    value, you can't do anything but ignore the return value, even for
    CAS operations.<br>
    <br>
    <blockquote
cite="mid:CA+nfvwQDkzbZ7fuoLX80xtx0KgspGZVWoqD+vo=W5iFRSCcKEg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div>&nbsp;</div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br>
              @Sanne: I was not suggesting that for now - sure, value
              versioning is (I<br>
              hope) on the roadmap. But that's more complicated, I
              though just about<br>
              making an adjustment to the current implementation.<br>
            </blockquote>
            <div><br>
            </div>
            <div><br class="">
              Actually, just keeping a history of values would not fix
              the the return value in all cases.</div>
            <div><br>
            </div>
            <div>When retrying a put on the new primary owner, the
              primary owner would still have to compare our value with
              the latest value, and return the previous value if they
              are equal. So we could have something like this:</div>
            <div><br>
            </div>
            <div>A is the originator, B is the primary owner, k = v0</div>
            <div>A -&gt; B: put(k, v1)</div>
            <div>B dies before writing v, C is now primary owner</div>
            <div>D -&gt; C: put(k, v1) // another put operation from D,
              with the same value</div>
            <div>C -&gt; D: null</div>
            <div>A -&gt; C: retry_put(k, v1)</div>
            <div>C -&gt; A: v0 // C assumes A is overwriting its own
              value, so it's returning the previous one</div>
            <div><br>
            </div>
            <div>To fix that, we'd need a unique version generated by
              the originator - kind of like a transaction id ;)</div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    Is it such a problem to associate unique ID with each write? History
    implementation seems to me like the more complicated part.<br>
    <br>
    <blockquote
cite="mid:CA+nfvwQDkzbZ7fuoLX80xtx0KgspGZVWoqD+vo=W5iFRSCcKEg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div>And to fix the HotRod use case, the HotRod client would
              have to be the one generating the version.</div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    I agree.<br>
    <br>
    Radim<br>
    <br>
    <blockquote
cite="mid:CA+nfvwQDkzbZ7fuoLX80xtx0KgspGZVWoqD+vo=W5iFRSCcKEg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div><br>
            </div>
            <div>Cheers</div>
            <div>Dan</div>
            <div>&nbsp;</div>
            <div><br>
            </div>
            <div>&nbsp;</div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span
                class=""><font color="#888888">
                  Radim<br>
                </font></span>
              <div class="">
                <div class="h5"><br>
                  On 05/12/2014 12:02 PM, Sanne Grinovero wrote:<br>
                  &gt; I don't think we are in a position to decide what
                  is a reasonable<br>
                  &gt; compromise; we can do better.<br>
                  &gt; For example - as Radim suggested - it might seem
                  reasonable to have<br>
                  &gt; the older value around for a little while. We'll
                  need a little bit of<br>
                  &gt; history of values and tombstones anyway for many
                  other reasons.<br>
                  &gt;<br>
                  &gt;<br>
                  &gt; Sanne<br>
                  &gt;<br>
                  &gt; On 12 May 2014 09:37, Dan Berindei &lt;<a
                    moz-do-not-send="true"
                    href="mailto:dan.berindei@gmail.com">dan.berindei@gmail.com</a>&gt;
                  wrote:<br>
                  &gt;&gt; Radim, I would contend that the first and
                  foremost guarantee that put()<br>
                  &gt;&gt; makes is to leave the cache in a consistent
                  state. So we can't just throw an<br>
                  &gt;&gt; exception and give up, leaving k=v on one
                  owner and k=null on another.<br>
                  &gt;&gt;<br>
                  &gt;&gt; Secondly, put(k, v) being atomic means that
                  it either succeeds, it writes<br>
                  &gt;&gt; k=v in the cache, and it returns the previous
                  value, or it doesn't succeed,<br>
                  &gt;&gt; and it doesn't write k=v in the cache.
                  Returning the wrong previous value is<br>
                  &gt;&gt; bad, but leaving k=v in the cache is just as
                  bad, even if the all the owners<br>
                  &gt;&gt; have the same value.<br>
                  &gt;&gt;<br>
                  &gt;&gt; And last, we can't have one node seeing
                  k=null, then k=v, then k=null again,<br>
                  &gt;&gt; when the only write we did on the cache was a
                  put(k, v). So trying to undo<br>
                  &gt;&gt; the write would not help.<br>
                  &gt;&gt;<br>
                  &gt;&gt; In the end, we have to make a compromise, and
                  I think returning the wrong<br>
                  &gt;&gt; value in some of the cases is a reasonable
                  compromise. Of course, we should<br>
                  &gt;&gt; document that :)<br>
                  &gt;&gt;<br>
                  &gt;&gt; I also believe ISPN-2956 could be fixed so
                  that HotRod behaves just like<br>
                  &gt;&gt; embedded mode after the ISPN-3422 fix, by
                  adding a RETRY flag to the HotRod<br>
                  &gt;&gt; protocol and to the cache itself.<br>
                  &gt;&gt;<br>
                  &gt;&gt; Incidentally, transactional caches have a
                  similar problem when the<br>
                  &gt;&gt; originator leaves the cluster: ISPN-3421 [1]<br>
                  &gt;&gt; And we can't handle transactional caches any
                  better than non-transactional<br>
                  &gt;&gt; caches until we expose transactions to the
                  HotRod client.<br>
                  &gt;&gt;<br>
                  &gt;&gt; [1] <a moz-do-not-send="true"
                    href="https://issues.jboss.org/browse/ISPN-2956"
                    target="_blank">https://issues.jboss.org/browse/ISPN-2956</a><br>
                  &gt;&gt;<br>
                  &gt;&gt; Cheers<br>
                  &gt;&gt; Dan<br>
                  &gt;&gt;<br>
                  &gt;&gt;<br>
                  &gt;&gt;<br>
                  &gt;&gt;<br>
                  &gt;&gt; On Mon, May 12, 2014 at 10:21 AM, Radim Vansa
                  &lt;<a moz-do-not-send="true"
                    href="mailto:rvansa@redhat.com">rvansa@redhat.com</a>&gt;
                  wrote:<br>
                  &gt;&gt;&gt; Hi,<br>
                  &gt;&gt;&gt;<br>
                  &gt;&gt;&gt; recently I've stumbled upon one already
                  expected behaviour (one instance<br>
                  &gt;&gt;&gt; is [1]), but which did not got much
                  attention.<br>
                  &gt;&gt;&gt;<br>
                  &gt;&gt;&gt; In non-tx cache, when the primary owner
                  fails after the request has been<br>
                  &gt;&gt;&gt; replicated to backup owner, the request
                  is retried in the new topology.<br>
                  &gt;&gt;&gt; Then, the operation is executed on the
                  new primary (the previous<br>
                  &gt;&gt;&gt; backup). The outcome has been already
                  fixed in [2], but the return value<br>
                  &gt;&gt;&gt; may be wrong. For example, when we do a
                  put, the return value for the<br>
                  &gt;&gt;&gt; second attempt will be the currently
                  inserted value (although the entry<br>
                  &gt;&gt;&gt; was just created). Same situation may
                  happen for other operations.<br>
                  &gt;&gt;&gt;<br>
                  &gt;&gt;&gt; Currently, it's not possible to return
                  the correct value (because it has<br>
                  &gt;&gt;&gt; already been overwritten and we don't
                  keep a history of values), but<br>
                  &gt;&gt;&gt; shouldn't we rather throw an exception if
                  we were not able to fulfil the<br>
                  &gt;&gt;&gt; API contract?<br>
                  &gt;&gt;&gt;<br>
                  &gt;&gt;&gt; Radim<br>
                  &gt;&gt;&gt;<br>
                  &gt;&gt;&gt; [1] <a moz-do-not-send="true"
                    href="https://issues.jboss.org/browse/ISPN-2956"
                    target="_blank">https://issues.jboss.org/browse/ISPN-2956</a><br>
                  &gt;&gt;&gt; [2] <a moz-do-not-send="true"
                    href="https://issues.jboss.org/browse/ISPN-3422"
                    target="_blank">https://issues.jboss.org/browse/ISPN-3422</a><br>
                  &gt;&gt;&gt;<br>
                  &gt;&gt;&gt; --<br>
                  &gt;&gt;&gt; Radim Vansa &lt;<a moz-do-not-send="true"
                    href="mailto:rvansa@redhat.com">rvansa@redhat.com</a>&gt;<br>
                  &gt;&gt;&gt; JBoss DataGrid QA<br>
                  &gt;&gt;&gt;<br>
                  &gt;&gt;&gt;
                  _______________________________________________<br>
                  &gt;&gt;&gt; infinispan-dev mailing list<br>
                  &gt;&gt;&gt; <a moz-do-not-send="true"
                    href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br>
                  &gt;&gt;&gt; <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>
                  &gt;&gt;<br>
                  &gt;&gt;<br>
                  &gt;&gt;
                  _______________________________________________<br>
                  &gt;&gt; infinispan-dev mailing list<br>
                  &gt;&gt; <a moz-do-not-send="true"
                    href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br>
                  &gt;&gt; <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>
                  &gt; _______________________________________________<br>
                  &gt; infinispan-dev mailing list<br>
                  &gt; <a moz-do-not-send="true"
                    href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br>
                  &gt; <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>
                  <br>
                  <br>
                  --<br>
                  Radim Vansa &lt;<a moz-do-not-send="true"
                    href="mailto:rvansa@redhat.com">rvansa@redhat.com</a>&gt;<br>
                  JBoss DataGrid QA<br>
                  <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>
                </div>
              </div>
            </blockquote>
          </div>
          <br>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
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>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Radim Vansa <a class="moz-txt-link-rfc2396E" href="mailto:rvansa@redhat.com">&lt;rvansa@redhat.com&gt;</a>
JBoss DataGrid QA
</pre>
  </body>
</html>