Re: [PATCH] pageinspect function to decode infomasks

From: "Moon Insung" <Moon_Insung_i3(at)lab(dot)ntt(dot)co(dot)jp>
To: "'Craig Ringer'" <craig(at)2ndquadrant(dot)com>
Cc: "'PostgreSQL Hackers'" <pgsql-hackers(at)postgresql(dot)org>, "'Julien Rouhaud'" <rjuju123(at)gmail(dot)com>, "'Pavan Deolasee'" <pavan(dot)deolasee(at)2ndquadrant(dot)com>, 'Álvaro Herrera' <alvherre(at)2ndquadrant(dot)com>, "'Peter Eisentraut'" <peter(dot)eisentraut(at)2ndquadrant(dot)com>, "'Masahiko Sawada'" <sawada(dot)mshk(at)gmail(dot)com>, "'abhijit Menon-Sen'" <ams(at)2ndquadrant(dot)com>, "'Peter Geoghegan'" <pg(at)bowt(dot)ie>, "'Ashutosh Sharma'" <ashu(dot)coek88(at)gmail(dot)com>
Subject: Re: [PATCH] pageinspect function to decode infomasks
Date: 2017-08-15 01:11:42
Message-ID: 005801d31563$748c6560$5da53020$@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear Craig Ringer

Frist, thank you for implementing the necessary function.

but, i have some question.

question 1) vacuum freeze hint bits

If run a vacuum freeze, bits in the infomask will be 0x0300.

in this case, if output the value of informsk in the run to you modified,

HEAP_XMIN_COMMITTED(0x0100), HEAP_XMIN_INVALID(0x0200), HEAP_XMIN_FROZEN(0x0300)

all outputs to hint bits.

is it normal to output values?

if look at htup_details.h code,

#define HeapTupleHeaderXminInvalid(tup) \

( \

((tup)->t_infomask & (HEAP_XMIN_COMMITTED|HEAP_XMIN_INVALID)) == \

HEAP_XMIN_INVALID \

)

#define HeapTupleHeaderSetXminCommitted(tup) \

( \

AssertMacro(!HeapTupleHeaderXminInvalid(tup)), \

((tup)->t_infomask |= HEAP_XMIN_COMMITTED) \

)

HEAP_XMIN_INVALID and HEAP_XMIN_COMMITTED can not be write simultaneously.

So I think the value of 0x0300 is to HEAP_XMIN_COMMITTED, HEAP_XMIN_FROZEN

Only output needs to be values.

question 2) xmax lock hint bits

similar to the vacuum freezeze question..

Assume that the infomask has a bit of 0x0050

In this case, if run on the code that you modified,

HEAP_XMAX_KEYSHR_LOCK(0x0010), HEAP_XMAX_EXCL_LOCK(0x0040), HEAP_XMAX_IS_LOCKED_ONLY

three hint bits are the output.

if look at htup_details.h code,

#define HEAP_XMAX_IS_SHR_LOCKED(infomask) \

(((infomask) & HEAP_LOCK_MASK) == HEAP_XMAX_SHR_LOCK)

#define HEAP_XMAX_IS_EXCL_LOCKED(infomask) \

(((infomask) & HEAP_LOCK_MASK) == HEAP_XMAX_EXCL_LOCK)

#define HEAP_XMAX_IS_KEYSHR_LOCKED(infomask) \

(((infomask) & HEAP_LOCK_MASK) == HEAP_XMAX_KEYSHR_LOCK)

It is divided into to hint bits.

so I think this part needs to fix.

If my opinion may be wrong. So plz check one more time.

Regards.

Moon

From: pgsql-hackers-owner(at)postgresql(dot)org [mailto:pgsql-hackers-owner(at)postgresql(dot)org] On Behalf Of Craig Ringer
Sent: Thursday, July 20, 2017 8:53 PM
To: Ashutosh Sharma
Cc: PostgreSQL Hackers; Julien Rouhaud; Pavan Deolasee; Álvaro Herrera; Peter Eisentraut; Masahiko Sawada; abhijit Menon-Sen; Peter Geoghegan
Subject: Re: [HACKERS] [PATCH] pageinspect function to decode infomasks

On 20 Jul. 2017 19:09, "Ashutosh Sharma" <ashu(dot)coek88(at)gmail(dot)com <mailto:ashu(dot)coek88(at)gmail(dot)com> > wrote:

I had a quick look into this patch and also tested it and following
are my observations.

Thanks very much.

I'll expand the tests to cover various normal and nonsensical masks and combinations and fix the identified issues.

This was a quick morning's work in amongst other things so not surprised I missed a few details. The check is appreciated.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2017-08-15 01:13:38 Re: Block level parallel vacuum WIP
Previous Message Masahiko Sawada 2017-08-15 00:11:52 Re: Fix a typo in sequence.c