Re: use less space in xl_xact_commit patch - Mailing list pgsql-hackers

From Leonardo Francalanci
Subject Re: use less space in xl_xact_commit patch
Date
Msg-id 65723.49167.qm@web29005.mail.ird.yahoo.com
Whole thread Raw
In response to Re: use less space in xl_xact_commit patch  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: use less space in xl_xact_commit patch  (Leonardo Francalanci <m_lists@yahoo.it>)
List pgsql-hackers
> int  counts[1];  /* variable-length array of counts, xinfo flags  define
> length of array and meaning of counts */



Damn, that's much cleaner than what I did. I don't know why
I stuck with the idea that it had to be:

int
array
int
array
...

instead of:
int
int
...
array
array
...

which makes much more sense.


> Then, I'd make macros  like this:
>
> #define XactCommitNumberOfDroppedRelFileNodes(xlrec)  \
>    ((xlref->xinfo & XACT_COMMIT_DROPPED_RELFILENODES) ?  xlrec->counts[0] : 0)
> #define XactCommitNumberOfCommittedSubXids(xlrec)  \
>    ((xlref->xinfo & XACT_COMMITED_SUBXDIDS)  ?
> xlrec->counts[(xlrec->xinfo & XACT_COMMIT_DROPPED_RELFILENODES) ?  1 :
> 0] : 0)
> ...etc...


ehm I don't know if macros would be enough; that's ok
for the first 2, then I think it would become a mess...
Maybe I'll use a simple function that gets all "ints" at once.


> ...and a similar set of macros that will  return a pointer to the
> beginning of the corresponding array, if it's  present.  I'd lay out
> the record like this:
>
> - main record
> -  array of counts (might be zero-length)
> - array of dropped relfilnodes (if  any)
> - array of committed subxids (if any)
> - array of sinval messages (if  any)


ok

> Also, it's important not to confuse xact completion with xact  commit,
> as I think some of your naming does.  Completion could perhaps  be
> thought to include abort.


mmh... I don't know if I got it... but I'll give a look, and ask questions...



Thank you very much for the help


Leonardo



pgsql-hackers by date:

Previous
From: Max Bourinov
Date:
Subject: Passing an array or record to a stored procedure in PostgreSQL
Next
From: Leonardo Francalanci
Date:
Subject: Re: use less space in xl_xact_commit patch