Re: WIP patch for Oid formatting in printf/elog strings

From: Mark Dilger <hornschnorter(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIP patch for Oid formatting in printf/elog strings
Date: 2014-12-11 18:27:34
Message-ID: CAE-h2Tqb2UDr052x7COnvtMzo_ujeV66x9HLwpwx=xBSh-vsvA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thank you Alvaro,

The attached patch changes the type of chunk_seq to int32,
rather than changing the %d formatting. The other changes
are the same as in the previous patch.

Mark Dilger

On Thu, Dec 11, 2014 at 9:39 AM, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
wrote:

> Mark Dilger wrote:
> > I found a few places in the code where a variable of
> > type Oid is printed using "%d" rather than "%u" and
> > changed them in the attached patch.
> >
> > In src/backend/replication/logical/reorderbuffer.c,
> > circa line 2494, chunk_seq is of type Oid, but
> > ent->last_chunk_seq is of type int32, leading me
> > to question if perhaps the use of %d for chunk_seq
> > is correct, but the use of Oid for the type of chunk_seq
> > is in error. If neither is in error, perhaps someone
> > can provide a short code comment explaining the
> > logic of the signed/unsigned discrepancy.
>
> tuptoaster defines chunk_seq as signed int32; ReorderBufferToastAppendChunk
> is wrong in declaring it Oid, and so this part of your patch is bogus.
> The others seem correct.
>
> > diff --git a/src/backend/replication/logical/reorderbuffer.c
> b/src/backend/replication/logical/reorderbuffer.c
> > index 6e75398..41a4896 100644
> > --- a/src/backend/replication/logical/reorderbuffer.c
> > +++ b/src/backend/replication/logical/reorderbuffer.c
> > @@ -2487,11 +2487,11 @@ ReorderBufferToastAppendChunk(ReorderBuffer *rb,
> ReorderBufferTXN *txn,
> > dlist_init(&ent->chunks);
> >
> > if (chunk_seq != 0)
> > - elog(ERROR, "got sequence entry %d for toast chunk
> %u instead of seq 0",
> > + elog(ERROR, "got sequence entry %u for toast chunk
> %u instead of seq 0",
> > chunk_seq, chunk_id);
> > }
> > else if (found && chunk_seq != ent->last_chunk_seq + 1)
> > - elog(ERROR, "got sequence entry %d for toast chunk %u
> instead of seq %d",
> > + elog(ERROR, "got sequence entry %u for toast chunk %u
> instead of seq %d",
> > chunk_seq, chunk_id, ent->last_chunk_seq + 1);
> >
> > chunk = DatumGetPointer(fastgetattr(&newtup->tuple, 3, desc,
> &isnull));
>
> --
> Álvaro Herrera http://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
>

Attachment Content-Type Size
oidformat.diff text/plain 2.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2014-12-11 18:43:31 Re: 9.5 release scheduling (was Re: logical column ordering)
Previous Message Josh Berkus 2014-12-11 18:26:53 Re: Commitfest problems