pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedpostgresql 9.0.3: parallel restore fails with comments on indices
2+ messages / 2 participants
[nested] [flat]
* postgresql 9.0.3: parallel restore fails with comments on indices
@ 2011-02-18 08:48 Arnd Hannemann <arnd.hannemann@credativ.de>
2011-02-18 17:35 ` Re: postgresql 9.0.3: parallel restore fails with comments on indices Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Hannemann @ 2011-02-18 08:48 UTC (permalink / raw)
To: pgsql-bugs
Hi,
postgres version: 9.0.3
OS: debian squeeze 64bit
if pg_restore is used with -jN it fails if the dump has comments on indices.
Steps to reproduce (db testdb):
CREATE DATABASE testdb;
\c testdb
CREATE TABLE tab (id INT);
INSERT INTO tab VALUES (1);
CREATE INDEX idx ON tab USING btree (id);
COMMENT ON INDEX idx IS 'first index';
(pgsql-pg_9.0.3)aha@abt:~/bin$ pg_restore --version
pg_restore (PostgreSQL) 9.0.3
(pgsql-pg_9.0.3)aha@abt:~/bin$ pg_dump -F c testdb > testdb.pg_dump
(pgsql-pg_9.0.3)aha@abt:~/bin$ pg_restore -j2 -c -d testdb testdb.pg_dump
ERROR: relation "idx" does not exist
STATEMENT: COMMENT ON INDEX idx IS 'first index';
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 1784; 0 0 COMMENT INDEX idx aha
pg_restore: [archiver (db)] could not execute query: ERROR: relation "idx" does not exist
Command was: COMMENT ON INDEX idx IS 'first index';
WARNING: errors ignored on restore: 1
(pgsql-pg_9.0.3)aha@abt:~/bin$ pg_restore -c -d testdb testdb.pg_dump
(pgsql-pg_9.0.3)aha@abt:~/bin$ echo $?
0
The problem seems to be a false assumption in pg_backup_archiver.c:
3200 for (next_work_item = AH->toc->next; next_work_item != AH->toc; next_work_item = next_work_item->next)
3201 {
3202 /* Non-PRE_DATA items are just ignored for now */
3203 if (next_work_item->section == SECTION_DATA ||
3204 next_work_item->section == SECTION_POST_DATA)
3205 continue;
3206
3207 ahlog(AH, 1, "processing item %d %s %s\n",
3208 next_work_item->dumpId,
3209 next_work_item->desc, next_work_item->tag);
3210
3211 (void) restore_toc_entry(AH, next_work_item, ropt, false);
3212
3213 /* there should be no touch of ready_list here, so pass NULL */
3214 reduce_dependencies(AH, next_work_item, NULL);
3215 }
Comments are in SECTION_NONE so they get restored here regardless of dependencies, which is obviously wrong
because the comment on an INDEX depends on the INDEX itself and the INDEX is in SECTION_POST_DATA
Best regards
Arnd
--
Arnd Hannemann
credativ GmbH, HRB Mönchengladbach 12080
Hohenzollernstr. 133, 41061 Mönchengladbach
Geschäftsführung: Dr. Michael Meskes, Jörg Folz
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: postgresql 9.0.3: parallel restore fails with comments on indices
2011-02-18 08:48 postgresql 9.0.3: parallel restore fails with comments on indices Arnd Hannemann <arnd.hannemann@credativ.de>
@ 2011-02-18 17:35 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2011-02-18 17:35 UTC (permalink / raw)
To: Arnd Hannemann <arnd.hannemann@credativ.de>; +Cc: pgsql-bugs
Arnd Hannemann <arnd.hannemann@credativ.de> writes:
> if pg_restore is used with -jN it fails if the dump has comments on indices.
Reproduced here, thanks for the report!
> The problem seems to be a false assumption in pg_backup_archiver.c:
> ...
> Comments are in SECTION_NONE so they get restored here regardless of dependencies, which is obviously wrong
Yeah, that seems to need a bit more thought. It's intentional that
comments that are in the PRE_DATA area get restored immediately, so as
not to eat all the overhead of a worker subprocess for them. But we
can't do it that way for comments intermixed with POST_DATA items.
I think the simplest fix is to allow this loop to process SECTION_NONE
items only as long as it hasn't skipped any prior items.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2011-02-18 17:35 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-02-18 08:48 postgresql 9.0.3: parallel restore fails with comments on indices Arnd Hannemann <arnd.hannemann@credativ.de>
2011-02-18 17:35 ` Tom Lane <tgl@sss.pgh.pa.us>
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