Re: dtrace probes

From: Jesper Pedersen <jesper(dot)pedersen(at)redhat(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: dtrace probes
Date: 2017-04-20 14:30:55
Message-ID: 19cb453b-6004-5006-1dbc-fc4fdafca7db@redhat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 04/20/2017 09:24 AM, Amit Kapila wrote:
>> The lwlock dtrace probes define LWLockMode as int, and the
>> TRACE_POSTGRESQL_LWLOCK methods are called using both a variable and
>> constant definition.
>>
>> This leads to a mix of argument definitions depending on the call site, as
>> seen in probes.txt file.
>>
>> A fix is to explicit cast 'mode' to int such that all call sites will use
>> the
>>
>> argument #2 4 signed bytes
>>
>> definition. Attached patch does this.
>>
>
> I think this fix is harmless and has some value in terms of
> consistency. One minor suggestion is that you should leave a space
> after typecasting.
>
> - TRACE_POSTGRESQL_LWLOCK_WAIT_DONE(T_NAME(lock), mode);
> + TRACE_POSTGRESQL_LWLOCK_WAIT_DONE(T_NAME(lock), (int)mode);
>
> There should be a space like "(int) mode".
>
>

v2 attached.

>> I have verified all dtraces probes for their type, and only the lock__
>> methods doesn't aligned with its actual types.
>>
>
> Do you see any problem with that?
>

Not really, but it would be more clear what the value space of each of
the parameters were.

>>
>> Depending on the feedback I can add this patch to the open item list in
>> order to fix it for PostgreSQL 10.
>>
>
> Is there any commit in PG-10 which has caused this behavior? If not,
> then I don't think it should be added to open items of PG-10.
>
>

It is really a bug fix, so it could even be back patched.

Thanks for the feedback !

Best regards,
Jesper

Attachment Content-Type Size
0001-Explicit-cast-LWLockMode-which-an-enum-to-int-in-ord_v2.patch text/x-patch 3.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2017-04-20 15:25:58 Re: Use sync commit for logical replication apply in TAP tests
Previous Message Ashutosh Bapat 2017-04-20 14:29:42 Re: Optimization for updating foreign tables in Postgres FDW