Re: BUG #15010: Sequence ID is getting skipped

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "anilkumar(dot)gv(at)gmail(dot)com" <anilkumar(dot)gv(at)gmail(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #15010: Sequence ID is getting skipped
Date: 2018-01-15 08:45:37
Message-ID: 91542DCB-90A4-48B2-B989-D879D0C7835C@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> On 15 Jan 2018, at 08:36, David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>
> On Sunday, January 14, 2018, PG Bug reporting form <noreply(at)postgresql(dot)org <mailto:noreply(at)postgresql(dot)org>> wrote:
> The following bug has been logged on the website:
>
> Bug reference: 15010
> Logged by: Anil Kumar G V
> Email address: anilkumar(dot)gv(at)gmail(dot)com <mailto:anilkumar(dot)gv(at)gmail(dot)com>
> PostgreSQL version: 9.3.0
> Operating system: Ubuntu
> Description:
>
> Sometime sequence ID is getting skipped by 32 numbers. Here is some sample
> sequence definition.
>
> I don't think the exact cause of this particular skipping is documented (it's database startup, maybe crash, related I think) but sequences are not promised to be gap-less.

Sequences are indeed not guaranteed to be gapless, and given that the report is
for 32 numbers it sounds like the SEQ_LOG_VALS skipping. From sequence.c:

/*
* We don't want to log each fetching of a value from a sequence,
* so we pre-log a few fetches in advance. In the event of
* crash we can lose (skip over) as many values as we pre-logged.
*/
#define SEQ_LOG_VALS 32

cheers ./daniel

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2018-01-15 12:56:20 BUG #15011: pgAdmin doesn't connect local server
Previous Message David G. Johnston 2018-01-15 07:36:40 BUG #15010: Sequence ID is getting skipped