Re: DTrace build dependency rules

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Mark Johnston <markj(at)freebsd(dot)org>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: DTrace build dependency rules
Date: 2015-08-18 16:08:16
Message-ID: 20150818160816.GF5232@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas wrote:
> On Sat, Aug 15, 2015 at 6:45 PM, Mark Johnston <markj(at)freebsd(dot)org> wrote:

> > The bug is in src/backend/Makefile. probes.o, the dtrace(1)-generated
> > object file, depends on the objfiles.txt for each of the backend
> > subdirs. These files depend in turn on the object files themselves; if
> > objfiles.txt is out of date with respect to one of its object files, the
> > mtime of objfiles.txt is updated with "touch" (see backend/common.mk).
> > The problem is that dtrace -G, which runs at the end of the build,
> > modifies a number of object files (it overwrites their probe sites with
> > NOPs), thus making their corresponding objfiles.txt out of date. Then,
> > when "make install" traverses the backend subdirs, it updates
> > objfiles.txt, which causes probes.o to be rebuilt, resulting in an error
> > from dtrace(1).
>
> Gosh, that's pretty ugly. I would have thought it would be a real
> no-no to update the .o file once it got generated. If nothing else, a
> modification to the .c file concurrent with a make invocation might
> lead to the .o not getting rebuilt the next time make is run.

I had the same thought, and wondered for a bit whether we should instead
have the compilation rules produce some intermediate file (prior to
dtrace fumbling), then emit the .o from dtrace -G. OTOH this might be
more trouble than is worth for a feature that doesn't see a lot of use.

> > The attached patch fixes the problem by having probes.o depend on object
> > files directly, rather than on objfiles.txt. I've tested it with
> > PostgreSQL 9.0-9.4 on FreeBSD CURRENT.
>
> I don't see a particular reason not to make this change, though.

I wanted to test it on Linux yesterday but didn't get any further than
installing a couple of packages.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2015-08-18 16:27:41 Re: allowing wal_level change at run time
Previous Message Robert Haas 2015-08-18 16:00:57 Re: missing documentation for partial WAL files