Skip site navigation (1) Skip section navigation (2)

Re: Large C files

From: Peter Geoghegan <peter(at)2ndquadrant(dot)com>
To: Greg Stark <stark(at)mit(dot)edu>
Cc: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Jan Urbański <wulczer(at)wulczer(dot)org>
Subject: Re: Large C files
Date: 2011-09-10 03:28:16
Message-ID: CAEYLb_UfPj4945zKks=D-sErz3-R8XCq+CmisFBQsA5ooAajcQ@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
I've produced the refinement of my little shell script anticipated by
my last e-mail (using sed to remove irrelevant variations in
__func__.12345 type symbol names). I decided to test it for:

1. Detecting behavioural changes when removing existing "pgrminclude
ignore" files (Basically headers that won't break the build if
removed, but will break Postgres). I stuck with .c files here for the
sake of convenience.

2. False positives by including a bunch of random headers.

Fist file tested was pl_comp.c. The script detected the change in
behaviour due to the omission of that header (incidentally, the way
the header is used there strikes me as a bit ugly). The script did not
produce false positives with the addition of these headers:

#include "commands/portalcmds.h"
#include "commands/conversioncmds.h"
#include "commands/defrem.h"
#include "commands/proclang.h"
#include "commands/tablecmds.h"
#include "commands/tablespace.h"
#include "commands/typecmds.h"
#include "commands/collationcmds.h"
#include "commands/prepare.h"
#include "commands/explain.h"
#include "commands/comment.h"
#include "commands/cluster.h"
#include "commands/discard.h"
#include "commands/trigger.h"
#include "commands/user.h"
#include "commands/view.h"
#include "commands/sequence.h"
#include "commands/dbcommands.h"
#include "commands/async.h"
#include "commands/lockcmds.h"
#include "commands/vacuum.h"

The second file tested was regerror.c . Similarly, the omission was
detected, and the addition of the same headers did not produce a false
positive.

It's very difficult or impossible to anticipate how effective the tool
will be in practice, but when you consider that it works and does not
produce false positives for the first 3 real-world cases tested, it
seems reasonable to assume that it's at least worth having around. Tom
recently said of a previous pgrminclude campaign in July 2006 that "It
took us two weeks to mostly recover, but we were still dealing with
some fallout in December". I think that makes the case for adding this
tool or some refinement as a complement to pgrminclude in src/tools
fairly compelling.

-- 
Peter Geoghegan       http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training and Services

Attachment: nm-diff.sh
Description: application/x-sh (1.6 KB)

In response to

Responses

pgsql-hackers by date

Next:From: Bruce MomjianDate: 2011-09-10 03:34:45
Subject: Re: superusers are members of all roles?
Previous:From: Tom LaneDate: 2011-09-10 02:42:10
Subject: Re: nonempty default log_line_prefix (was [COMMITTERS] pgsql: Simplify handling of the timezone GUC)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group