Re: Binary difference in pg_internal.init after running pg_initdb multiple times

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "samuel(dot)coulee" <313914592(at)qq(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Binary difference in pg_internal.init after running pg_initdb multiple times
Date: 2018-07-12 13:24:44
Message-ID: 19138.1531401884@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"samuel.coulee" <313914592(at)qq(dot)com> writes:
> In the PG source code function "write_relcache_init_file()", I found that
> the whole 'Relation' structs were directly written into the file
> 'pg_internal.init'. This brings some binary differences of that file, if we
> run pg_initdb multiple times, because the struct 'Relation' contains some
> pointer fields.

There's never been any expectation that that file is bitwise-reproducible.
The order of entries is arbitrary, there are probably alignment padding
bytes that contain garbage, etc etc. So I'm not buying into your apparent
goal here.

> And my question is : Could we clear the pointer values in 'Relation' before
> calling write_item(...)?

No; that's live data with no backup copy. Conceivably we could copy the
structure and zero out useless fields before writing from the copy, but
that adds code, cycles, maintenance effort, and risk of bugs.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2018-07-12 13:31:57 Re: buildfarm vs code
Previous Message Michael Paquier 2018-07-12 13:18:53 Re: pg_create_logical_replication_slot returns text instead of name