Re: Review: DTrace probes (merged version) ver_03 - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Review: DTrace probes (merged version) ver_03
Date
Msg-id 20080731182037.GH8497@alvh.no-ip.org
Whole thread Raw
In response to Re: Review: DTrace probes (merged version) ver_03  (Robert Lor <Robert.Lor@Sun.COM>)
Responses Re: Review: DTrace probes (merged version) ver_03  (Robert Lor <Robert.Lor@Sun.COM>)
List pgsql-hackers
Robert Lor wrote:

Hi,

>> What I suggest might be a reasonable compromise is to copy needed
>> typedefs directly into the probes.d file:

> Implemented this suggestion. There are some weirdness with the OS X  
> compiler causing some of the probe declarations not to compile (see  
> comments in probe.d).  The compiler spits out some warnings because the  
> types don't show up in the function prototype in probes.h, but the  
> probes work okay. I think we can safely ignore the warnings.

These make sense, because they are already typedef's in our code:

> +typedef unsigned int LocalTransactionId;
> +typedef int LWLockId;
> +typedef int LWLockMode;
> +typedef int LOCKMODE;
> +typedef unsigned int BlockNumber;
> +typedef unsigned int Oid;

But I don't see a reason to define the rest:

> +typedef unsigned int locktag_field2;
> +typedef const char * query_string;
> +typedef int sortType;
> +typedef int trueFalse;
> +typedef int nkeys;
> +typedef int workMem;
> +typedef int randomAccess;
> +typedef unsigned long LogicalTapeSetPtr;
> +typedef long spaceUsed;
> +typedef int isLocalBuf;
> +typedef int found;
> +typedef int flags;
> +typedef int num_to_write;
> +typedef int num_written;
> +typedef int NBuffers;
> +typedef int buf_id;

I think you should add a #define Size, perhaps #define bool, and use
those where applicable, and the plain types (int, long, etc) in the rest.

> +    /* The following probe declarations cause compilation errors
> +         * on Mac OS X but not on Solaris. Need further investigation.
> +     * probe lock__wait__start(locktag_field2, LOCKMODE);
> +     * probe lock__wait__done(locktag_field2, LOCKMODE);
> +     */
> +    probe lock__wait__start(unsigned int, int);
> +    probe lock__wait__done(unsigned int, int);

For example I think this should look like
probe lock__wait__start(unsigned int, LOCKMODE);

That Mac OS X problem merits some extra investigation, I think.

Other than this, I think this patch can be committed.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: Fixing DISTINCT ON for duplicate keys
Next
From: David Fetter
Date:
Subject: Re: window function v03 against HEAD