Re: Uh, this is *not* a 64-bit CRC ...

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Uh, this is *not* a 64-bit CRC ...
Date: 2001-03-01 02:17:19
Message-ID: 200103010217.VAA26763@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Added to TODO:

* Correct CRC WAL code to be normal CRC32 algorithm

> On Wed, Feb 28, 2001 at 04:53:09PM -0500, Tom Lane wrote:
> > I just took a close look at the COMP_CRC64 macro in xlog.c.
> >
> > This isn't a 64-bit CRC. It's two independent 32-bit CRCs, one done
> > on just the odd-numbered bytes and one on just the even-numbered bytes
> > of the datastream. That's hardly any stronger than a single 32-bit CRC;
> > it's certainly not what I thought we had agreed to implement.
> >
> > We can't change this algorithm without forcing an initdb, which would be
> > a rather unpleasant thing to do at this late stage of the release cycle.
> > But I'm not happy with it. Comments?
>
> This might be a good time to update:
>
> The CRC-64 code used in the SWISS-PROT genetic database is (now) at:
>
> ftp://ftp.ebi.ac.uk/pub/software/swissprot/Swissknife/old/SPcrc.tar.gz
>
> From the README:
>
> The code in this package has been derived from the BTLib package
> obtained from Christian Iseli <chris(at)ludwig-alpha(dot)unil(dot)ch>.
> From his mail:
>
> The reference is: W. H. Press, S. A. Teukolsky, W. T. Vetterling, and
> B. P. Flannery, "Numerical recipes in C", 2nd ed., Cambridge University
> Press. Pages 896ff.
>
> The generator polynomial is x64 + x4 + x3 + x1 + 1.
>
> I would suggest that if you don't change the algorithm, at least change
> the name in the sources. Were you to #ifdef in a real crc-64, and make
> a compile-time option to select the old one, you could allow users who
> wish to avoid the initdb a way to continue with the existing pair of
> CRC-32s.
>
> Nathan Myers
> ncm(at)zembu(dot)com
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Myers 2001-03-01 02:51:18 Re: Uh, this is *not* a 64-bit CRC ...
Previous Message Bruce Momjian 2001-03-01 02:16:33 Re: Uh, this is *not* a 64-bit CRC ...