pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #6643: [PostgreSQL9.2beta1] COPY after changing fillfactor gets a PANIC.
4+ messages / 3 participants
[nested] [flat]

* BUG #6643: [PostgreSQL9.2beta1] COPY after changing fillfactor gets a PANIC.
@ 2012-05-16 10:39 katsumata.tomonari@po.ntts.co.jp
  2012-05-16 10:47 ` Re: BUG #6643: [PostgreSQL9.2beta1] COPY after changing fillfactor gets a PANIC. Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
  0 siblings, 1 reply; 4+ messages in thread

From: katsumata.tomonari@po.ntts.co.jp @ 2012-05-16 10:39 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      6643
Logged by:          Tomonari Katsumata
Email address:      katsumata.tomonari@po.ntts.co.jp
PostgreSQL version: Unsupported/Unknown
Operating system:   RHEL 6.2 x86_64
Description:        

Hi,

Now, I'm testing PostgreSQL 9.2 Beta 1.
And I have a problem.

Steps to procedure are bellow.

1. CREATE DATABASE
  export LANG=C
  initdb -D $PGDATA -E SQL_ASCII
  pg_ctl start
  createdb testdb

2. CREATE TABLE
  psql -d testdb -f ./create_table_customer.sql

3. ALTER TABLE(fillfactor)
  psql -d testdb -c "ALTER TABLE customer SET (fillfactor=90);"

4. LOAD DATA
  (please set correct path to customer.data)
  psql -d testdb -f ./customer.sql

Then, I have a PANIC error.
==============================
BEGIN
TRUNCATE TABLE
PANIC:  failed to add tuple to page
CONTEXT:  COPY customer, line 296:
"296>ALNGAT>alngat>EgBEEAyXVIAWBE>KCiDDFsqA8Kv>2586068>4067234479>ALNGAT@kuvkaEEyi>20100905>20101023>..."
STATEMENT:  COPY customer FROM
'/home/katsumata/work/2012/20120516_PG92beta1_bug1/copy_panic_dbt1/copy_panic/customer.data'
WITH DELIMITER '>';
psql:./customer.sql:3: PANIC:  failed to add tuple to page
CONTEXT:  COPY customer, line 296:
"296>ALNGAT>alngat>EgBEEAyXVIAWBE>KCiDDFsqA8Kv>2586068>4067234479>ALNGAT@kuvkaEEyi>20100905>20101023>..."
PANIC:  failed to add tuple to page
CONTEXT:  COPY customer, line 296:
"296>ALNGAT>alngat>EgBEEAyXVIAWBE>KCiDDFsqA8Kv>2586068>4067234479>ALNGAT@kuvkaEEyi>20100905>20101023>..."
psql:./customer.sql:3: connection to server was lost
==============================

If I skip the 3rd step(ALTER TABLE(fillfactor)),
I don't have any ERROR.
And It's also OK on PostgreSQL 9.1.3.

Are there any changes about this behavior ?





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: BUG #6643: [PostgreSQL9.2beta1] COPY after changing fillfactor gets a PANIC.
  2012-05-16 10:39 BUG #6643: [PostgreSQL9.2beta1] COPY after changing fillfactor gets a PANIC. katsumata.tomonari@po.ntts.co.jp
@ 2012-05-16 10:47 ` Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
  2012-05-16 11:14   ` Re: BUG #6643: [PostgreSQL9.2beta1] COPY after changing fillfactor gets a PANIC. Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Heikki Linnakangas @ 2012-05-16 10:47 UTC (permalink / raw)
  To: katsumata.tomonari@po.ntts.co.jp; +Cc: pgsql-bugs

On 16.05.2012 13:39, katsumata.tomonari@po.ntts.co.jp wrote:
> Now, I'm testing PostgreSQL 9.2 Beta 1.
> And I have a problem.
>
> Steps to procedure are bellow.
>
> 1. CREATE DATABASE
>    export LANG=C
>    initdb -D $PGDATA -E SQL_ASCII
>    pg_ctl start
>    createdb testdb
>
> 2. CREATE TABLE
>    psql -d testdb -f ./create_table_customer.sql
>
> 3. ALTER TABLE(fillfactor)
>    psql -d testdb -c "ALTER TABLE customer SET (fillfactor=90);"
>
> 4. LOAD DATA
>    (please set correct path to customer.data)
>    psql -d testdb -f ./customer.sql
>
> Then, I have a PANIC error.
> ==============================
> BEGIN
> TRUNCATE TABLE
> PANIC:  failed to add tuple to page
> CONTEXT:  COPY customer, line 296:
> "296>ALNGAT>alngat>EgBEEAyXVIAWBE>KCiDDFsqA8Kv>2586068>4067234479>ALNGAT@kuvkaEEyi>20100905>20101023>..."
> STATEMENT:  COPY customer FROM
> '/home/katsumata/work/2012/20120516_PG92beta1_bug1/copy_panic_dbt1/copy_panic/customer.data'
> WITH DELIMITER '>';
> psql:./customer.sql:3: PANIC:  failed to add tuple to page
> CONTEXT:  COPY customer, line 296:
> "296>ALNGAT>alngat>EgBEEAyXVIAWBE>KCiDDFsqA8Kv>2586068>4067234479>ALNGAT@kuvkaEEyi>20100905>20101023>..."
> PANIC:  failed to add tuple to page
> CONTEXT:  COPY customer, line 296:
> "296>ALNGAT>alngat>EgBEEAyXVIAWBE>KCiDDFsqA8Kv>2586068>4067234479>ALNGAT@kuvkaEEyi>20100905>20101023>..."
> psql:./customer.sql:3: connection to server was lost
> ==============================
>
> If I skip the 3rd step(ALTER TABLE(fillfactor)),
> I don't have any ERROR.
> And It's also OK on PostgreSQL 9.1.3.
>
> Are there any changes about this behavior ?

This sounds like a bug in the new page-at-a-time behavior in COPY. Can 
you send me a self-contained test, including the test data?

-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: BUG #6643: [PostgreSQL9.2beta1] COPY after changing fillfactor gets a PANIC.
  2012-05-16 10:39 BUG #6643: [PostgreSQL9.2beta1] COPY after changing fillfactor gets a PANIC. katsumata.tomonari@po.ntts.co.jp
  2012-05-16 10:47 ` Re: BUG #6643: [PostgreSQL9.2beta1] COPY after changing fillfactor gets a PANIC. Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
@ 2012-05-16 11:14   ` Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
  2012-05-16 11:35     ` Re: BUG #6643: [PostgreSQL9.2beta1] COPY after changing fillfactor gets a PANIC. Tomonari Katsumata <katsumata.tomonari@po.ntts.co.jp>
  0 siblings, 1 reply; 4+ messages in thread

From: Heikki Linnakangas @ 2012-05-16 11:14 UTC (permalink / raw)
  To: katsumata.tomonari@po.ntts.co.jp; +Cc: pgsql-bugs

On 16.05.2012 13:47, Heikki Linnakangas wrote:
> This sounds like a bug in the new page-at-a-time behavior in COPY. Can
> you send me a self-contained test, including the test data?

Never mind. After staring at the code for a while, I spotted the bug, 
and was able to reproduce with a simpler case. It's quite easy to 
reproduce when you set fillfactor even lower, like 10.

The problem is with this line in heap_multi_insert function:

	if (PageGetHeapFreeSpace(page) - saveFreeSpace < MAXALIGN(heaptup->t_len))

That doesn't work as intended, because the return value of 
PageGetHeapFreeSpace and saveFreeSpace are unsigned. When saveFreeSpace 
is larger than the amount of free space on the page, the left hand side 
of that comparison is supposed to go negative, but it wraps around to a 
highly positive number because it's unsigned.

Fixed, thanks for the report!

-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: BUG #6643: [PostgreSQL9.2beta1] COPY after changing fillfactor gets a PANIC.
  2012-05-16 10:39 BUG #6643: [PostgreSQL9.2beta1] COPY after changing fillfactor gets a PANIC. katsumata.tomonari@po.ntts.co.jp
  2012-05-16 10:47 ` Re: BUG #6643: [PostgreSQL9.2beta1] COPY after changing fillfactor gets a PANIC. Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
  2012-05-16 11:14   ` Re: BUG #6643: [PostgreSQL9.2beta1] COPY after changing fillfactor gets a PANIC. Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
@ 2012-05-16 11:35     ` Tomonari Katsumata <katsumata.tomonari@po.ntts.co.jp>
  0 siblings, 0 replies; 4+ messages in thread

From: Tomonari Katsumata @ 2012-05-16 11:35 UTC (permalink / raw)
  To: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>; +Cc: pgsql-bugs

Hi, Heikki

I'm sorry, forgotten attach files.

I've tryed to send mail with files,
but I could not...
(I think this is my mail server problem.)


Thank you very much for fixing it!

(2012/05/16 20:14), Heikki Linnakangas wrote:
> On 16.05.2012 13:47, Heikki Linnakangas wrote:
>> This sounds like a bug in the new page-at-a-time behavior in COPY. Can
>> you send me a self-contained test, including the test data?
>
> Never mind. After staring at the code for a while, I spotted the bug, 
> and was able to reproduce with a simpler case. It's quite easy to 
> reproduce when you set fillfactor even lower, like 10.
>
> The problem is with this line in heap_multi_insert function:
>
>     if (PageGetHeapFreeSpace(page) - saveFreeSpace < 
> MAXALIGN(heaptup->t_len))
>
> That doesn't work as intended, because the return value of 
> PageGetHeapFreeSpace and saveFreeSpace are unsigned. When 
> saveFreeSpace is larger than the amount of free space on the page, the 
> left hand side of that comparison is supposed to go negative, but it 
> wraps around to a highly positive number because it's unsigned.
>
> Fixed, thanks for the report!




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2012-05-16 11:35 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-05-16 10:39 BUG #6643: [PostgreSQL9.2beta1] COPY after changing fillfactor gets a PANIC. katsumata.tomonari@po.ntts.co.jp
2012-05-16 10:47 ` Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
2012-05-16 11:14   ` Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
2012-05-16 11:35     ` Tomonari Katsumata <katsumata.tomonari@po.ntts.co.jp>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox