From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Leonardo Francalanci <m_lists(at)yahoo(dot)it> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: use less space in xl_xact_commit patch |
Date: | 2011-05-17 18:02:07 |
Message-ID: | BANLkTikbMKB7FQse5AZ5uxv-qhyFmKaxig@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, May 16, 2011 at 11:20 AM, Leonardo Francalanci <m_lists(at)yahoo(dot)it> wrote:
>
> following the conversation at
>
> http://postgresql.1045698.n5.nabble.com/switch-UNLOGGED-to-LOGGED-tp4290461p4382333.html
>
>
> I tried to remove some bytes from xl_xact_commit.
>
> The way I did it needs palloc+memcpy. I guess it could be done
> reusing the memory for smgrGetPendingDeletes. But I don't
> think it's that important.
>
> I guess there are other ways of doing it; let me know what
> you think.
I don't think there's much point to the xl_xact_commit_opt structure;
it doesn't really do anything. What I would do is end the
xl_xact_commit structure with something like:
int counts[1]; /* variable-length array of counts, xinfo flags define
length of array and meaning of counts */
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...
...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)
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.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2011-05-17 18:43:49 | Re: Review: psql include file using relative path |
Previous Message | Robert Haas | 2011-05-17 17:19:17 | Re: DOMAINs and CASTs |