Re: Prepare xlog for optional oid

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Manfred Koizar <mkoi-pg(at)aon(dot)at>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Prepare xlog for optional oid
Date: 2002-07-13 01:38:47
Message-ID: 200207130138.g6D1cle29489@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


Patch retracted by author.

---------------------------------------------------------------------------

Manfred Koizar wrote:
> Prepare xlog code for optional oid, also some tweaking in
> log_heap_update and heap_xlog_update (1 memcpy instead of 2);
> and - completely unrelated - fix a comment in ExecRemoveJunk()
>
> Servus
> Manfred
>
> diff -ru ../base/src/backend/access/heap/heapam.c src/backend/access/heap/heapam.c
> --- ../base/src/backend/access/heap/heapam.c 2002-07-04 00:26:37.000000000 +0200
> +++ src/backend/access/heap/heapam.c 2002-07-05 22:22:31.000000000 +0200
> @@ -1179,6 +1179,7 @@
> rdata[1].next = &(rdata[2]);
>
> rdata[2].buffer = buffer;
> + /* PG73FORMAT: write bitmap [+ padding] [+ oid] + data */
> rdata[2].data = (char *) tup->t_data + offsetof(HeapTupleHeaderData, t_bits);
> rdata[2].len = tup->t_len - offsetof(HeapTupleHeaderData, t_bits);
> rdata[2].next = NULL;
> @@ -1988,18 +1989,16 @@
> xlhdr.hdr.mask = newtup->t_data->t_infomask;
> if (move) /* remember xmin & xmax */
> {
> - TransactionId xmax;
> - TransactionId xmin;
> + TransactionId xid[2]; /* xmax, xmin */
>
> - if (newtup->t_data->t_infomask & HEAP_XMAX_INVALID ||
> - newtup->t_data->t_infomask & HEAP_MARKED_FOR_UPDATE)
> - xmax = InvalidTransactionId;
> + if (newtup->t_data->t_infomask & (HEAP_XMAX_INVALID |
> + HEAP_MARKED_FOR_UPDATE))
> + xid[0] = InvalidTransactionId;
> else
> - xmax = HeapTupleHeaderGetXmax(newtup->t_data);
> - xmin = HeapTupleHeaderGetXmin(newtup->t_data);
> - memcpy((char *) &xlhdr + hsize, &xmax, sizeof(TransactionId));
> - memcpy((char *) &xlhdr + hsize + sizeof(TransactionId),
> - &xmin, sizeof(TransactionId));
> + xid[0] = HeapTupleHeaderGetXmax(newtup->t_data);
> + xid[1] = HeapTupleHeaderGetXmin(newtup->t_data);
> + memcpy((char *) &xlhdr + hsize,
> + (char *) xid, 2 * sizeof(TransactionId));
> hsize += 2 * sizeof(TransactionId);
> }
> rdata[2].buffer = newbuf;
> @@ -2008,6 +2007,7 @@
> rdata[2].next = &(rdata[3]);
>
> rdata[3].buffer = newbuf;
> + /* PG73FORMAT: write bitmap [+ padding] [+ oid] + data */
> rdata[3].data = (char *) newtup->t_data + offsetof(HeapTupleHeaderData, t_bits);
> rdata[3].len = newtup->t_len - offsetof(HeapTupleHeaderData, t_bits);
> rdata[3].next = NULL;
> @@ -2203,11 +2203,13 @@
> memcpy((char *) &xlhdr,
> (char *) xlrec + SizeOfHeapInsert,
> SizeOfHeapHeader);
> + htup = &tbuf.hdr;
> + MemSet((char *) htup, 0, sizeof(HeapTupleHeaderData));
> + /* PG73FORMAT: get bitmap [+ padding] [+ oid] + data */
> memcpy((char *) &tbuf + offsetof(HeapTupleHeaderData, t_bits),
> (char *) xlrec + SizeOfHeapInsert + SizeOfHeapHeader,
> newlen);
> newlen += offsetof(HeapTupleHeaderData, t_bits);
> - htup = &tbuf.hdr;
> htup->t_natts = xlhdr.t_natts;
> htup->t_hoff = xlhdr.t_hoff;
> htup->t_infomask = HEAP_XMAX_INVALID | xlhdr.mask;
> @@ -2373,29 +2375,30 @@
> memcpy((char *) &xlhdr,
> (char *) xlrec + SizeOfHeapUpdate,
> SizeOfHeapHeader);
> + htup = &tbuf.hdr;
> + MemSet((char *) htup, 0, sizeof(HeapTupleHeaderData));
> + /* PG73FORMAT: get bitmap [+ padding] [+ oid] + data */
> memcpy((char *) &tbuf + offsetof(HeapTupleHeaderData, t_bits),
> (char *) xlrec + hsize,
> newlen);
> newlen += offsetof(HeapTupleHeaderData, t_bits);
> - htup = &tbuf.hdr;
> htup->t_natts = xlhdr.t_natts;
> htup->t_hoff = xlhdr.t_hoff;
> if (reln->rd_rel->relhasoids)
> HeapTupleHeaderSetOid(htup, xlhdr.t_oid);
> if (move)
> {
> - TransactionId xmax;
> - TransactionId xmin;
> + TransactionId xid[2]; /* xmax, xmin */
>
> hsize = SizeOfHeapUpdate + SizeOfHeapHeader;
> - memcpy(&xmax, (char *) xlrec + hsize, sizeof(TransactionId));
> - memcpy(&xmin, (char *) xlrec + hsize + sizeof(TransactionId), sizeof(TransactionId));
> + memcpy((char *) xid,
> + (char *) xlrec + hsize, 2 * sizeof(TransactionId));
> htup->t_infomask = xlhdr.mask;
> htup->t_infomask &= ~(HEAP_XMIN_COMMITTED |
> HEAP_XMIN_INVALID | HEAP_MOVED_OFF);
> htup->t_infomask |= HEAP_MOVED_IN;
> - HeapTupleHeaderSetXmin(htup, xmin);
> - HeapTupleHeaderSetXmax(htup, xmax);
> + HeapTupleHeaderSetXmin(htup, xid[1]);
> + HeapTupleHeaderSetXmax(htup, xid[0]);
> HeapTupleHeaderSetXvac(htup, record->xl_xid);
> }
> else
> diff -ru ../base/src/backend/executor/execJunk.c src/backend/executor/execJunk.c
> --- ../base/src/backend/executor/execJunk.c 2002-06-21 02:12:15.000000000 +0200
> +++ src/backend/executor/execJunk.c 2002-07-05 19:28:45.000000000 +0200
> @@ -383,8 +383,8 @@
> * information for the new "clean" tuple.
> *
> * Note: we use memory on the stack to optimize things when we are
> - * dealing with a small number of tuples. for large tuples we just use
> - * palloc.
> + * dealing with a small number of attributes. for large tuples we
> + * just use palloc.
> */
> if (cleanLength > 64)
> {
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>
>
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2002-07-13 01:47:13 Re: [BUGS] Bug #708: PgTransaction class is broken since 7.2
Previous Message Joe Conway 2002-07-12 17:47:54 Re: [GENERAL] workaround for lack of REPLACE() function