Re: use less space in xl_xact_commit patch

From: Leonardo Francalanci <m_lists(at)yahoo(dot)it>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: use less space in xl_xact_commit patch
Date: 2011-05-18 07:34:35
Message-ID: 65723.49167.qm@web29005.mail.ird.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Leonardo Francalanci 2011-05-18 13:11:52 Re: use less space in xl_xact_commit patch
Previous Message Max Bourinov 2011-05-18 05:40:29 Passing an array or record to a stored procedure in PostgreSQL