From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <5536975a.l8Wm63exg0ejuKfK%hruodr@gmail.com> References: <5536975a.l8Wm63exg0ejuKfK%hruodr@gmail.com> Date: Tue, 21 Apr 2015 15:46:35 -0400 Message-ID: Subject: Re: [9fans] thoughs about venti+fossil From: Russ Cox To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=14dae94edf5ddb6b910514414d5e Topicbox-Message-UUID: 4e2b2b4c-ead9-11e9-9d60-3106f5b1d025 --14dae94edf5ddb6b910514414d5e Content-Type: text/plain; charset=UTF-8 On Tue, Apr 21, 2015 at 2:30 PM, wrote: > Does this mean, that Plan9 by default supposes that A=B if hash(A)=hash(B)? > Yes. > That this was not the default before, but it is now? > Yes. > That I still have the possibility of a "full check" of A=B (and not > supposing > it after checking hash(A)=hash(B)) by changing "int verifywrites = 1;" in > "lump.c"? > Yes. > I just want to know why the > default was changed, I believe I changed it, because I was working on performance, and reading data from disk to run a memcmp whose answer is already known is an obvious operation to cut to make a disk-bound server faster. Since you (quite reasonably) don't want to reopen the debate over whether that's a reasonable optimization, I won't justify it further. My paper with Sean Rhea and Alex Pesterev documents the performance effect of double-checking the equality in some detail. https://www.usenix.org/legacy/event/usenix08/tech/full_papers/rhea/rhea.pdf. (Caveat: in the usual academic tradition, the paper uses "Venti" to mean the system described in the original paper, not the system in Plan 9 today. The current Plan 9 implementation is much closer to what the paper calls "Foundation: Compare by Hash".) > why originaly A=B was checked even if one was sure > that the probability of error by only checking hash(A)=hash(B) is > negligible, why the possibility of changing this default exists. > I didn't write the original code, so I can't answer that definitively. That said, it seems to me quite reasonable to check A=B in the initial version of a server, since you might have bugs in your implementation such that (for example) hash(x) = 0 for all x. Once the system is more stable it also seems to me reasonable to remove those checks if they incur significant cost, much as one turns off costly asserts or other debugging code. Hope this helps. Russ --14dae94edf5ddb6b910514414d5e Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On T= ue, Apr 21, 2015 at 2:30 PM, <hruodr@gmail.com> wrote:
Does this mean, that Plan9 by default supposes that A=3DB if= hash(A)=3Dhash(B)?

Yes.
=C2=A0
That this was not the default before, but it is now?

Yes.
=C2=A0
That I still have the possibility of a "full check" of A=3DB (an= d not supposing
it after checking hash(A)=3Dhash(B)) by changing "int verifywrites =3D= 1;" in
"lump.c"?

Yes.
=C2= =A0
I just want to know why the
default was changed,

I believe I changed i= t, because I was working on performance, and reading data from disk to run = a memcmp whose answer is already known is an obvious operation to cut to ma= ke a disk-bound server faster. Since you (quite reasonably) don't want = to reopen the debate over whether that's a reasonable optimization, I w= on't justify it further.

My paper with Se= an Rhea and Alex Pesterev documents the performance effect of double-checki= ng the equality in some detail. https://www.usenix.org/legacy/= event/usenix08/tech/full_papers/rhea/rhea.pdf. (Caveat: in the usual ac= ademic tradition, the paper uses "Venti" to mean the system descr= ibed in the original paper, not the system in Plan 9 today. The current Pla= n 9 implementation is much closer to what the paper calls "Foundation:= Compare by Hash".)
=C2=A0
why originaly A=3DB was checked even if one was sure
that the probability of error by only checking hash(A)=3Dhash(B) is
negligible, why the possibility of changing this default exists.

I didn't write the original code, so I can= 9;t answer that definitively. That said, it seems to me quite reasonable to= check A=3DB in the initial version of a server, since you might have bugs = in your implementation such that (for example) hash(x) =3D 0 for all x. Onc= e the system is more stable it also seems to me reasonable to remove those = checks if they incur significant cost, much as one turns off costly asserts= or other debugging code.

Hope this helps.
Russ
--14dae94edf5ddb6b910514414d5e--