pg_restore is broken on 9.2 version.

Started by Rushabh Lathiaalmost 9 years ago3 messages
#1Rushabh Lathia
rushabh.lathia@gmail.com
1 attachment(s)

Hi All,

Commit c59a1a89035674c6efacc596d652528cebba37ec don't allow non-positive
number
of jobs. Now on 9.2 number of jobs get assigned to opts->number_of_jobs. If
user don't specify any value -j then default value will be always 0. Which
will
lead to the "invalid number of parallel jobs" error.

if (opts->number_of_jobs <= 0)
{
fprintf(stderr, _("%s: invalid number of parallel jobs\n"),
progname);
exit(1);
}

Please find attach patch to initialize default value for number of jobs to
1.

Thanks,
Rushabh Lathia
www.EnterpriseDB.com

Attachments:

pg_restore_fix.patchbinary/octet-stream; name=pg_restore_fix.patchDownload
diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c
index 98f4be6..15824bd 100644
--- a/src/bin/pg_dump/pg_restore.c
+++ b/src/bin/pg_dump/pg_restore.c
@@ -130,6 +130,8 @@ main(int argc, char **argv)
 	init_parallel_dump_utils();
 
 	opts = NewRestoreOptions();
+	/* initialize default number of jobs */
+	opts->number_of_jobs = 1;
 
 	progname = get_progname(argv[0]);
 
#2Stephen Frost
sfrost@snowman.net
In reply to: Rushabh Lathia (#1)
Re: pg_restore is broken on 9.2 version.

Greetings,

* Rushabh Lathia (rushabh.lathia@gmail.com) wrote:

Commit c59a1a89035674c6efacc596d652528cebba37ec don't allow non-positive
number
of jobs. Now on 9.2 number of jobs get assigned to opts->number_of_jobs. If
user don't specify any value -j then default value will be always 0. Which
will
lead to the "invalid number of parallel jobs" error.

if (opts->number_of_jobs <= 0)
{
fprintf(stderr, _("%s: invalid number of parallel jobs\n"),
progname);
exit(1);
}

Please find attach patch to initialize default value for number of jobs to
1.

Ugh. This is what I get for thinking that our regression tests actually
test even the basic things.

That fix should go into NewRestoreOptions() where the other not-zero
settings go.

I'll fix it here in a few.

Thanks!

Stephen

#3Stephen Frost
sfrost@snowman.net
In reply to: Stephen Frost (#2)
Re: pg_restore is broken on 9.2 version.

* Stephen Frost (sfrost@snowman.net) wrote:

Greetings,

* Rushabh Lathia (rushabh.lathia@gmail.com) wrote:

Commit c59a1a89035674c6efacc596d652528cebba37ec don't allow non-positive
number
of jobs. Now on 9.2 number of jobs get assigned to opts->number_of_jobs. If
user don't specify any value -j then default value will be always 0. Which
will
lead to the "invalid number of parallel jobs" error.

if (opts->number_of_jobs <= 0)
{
fprintf(stderr, _("%s: invalid number of parallel jobs\n"),
progname);
exit(1);
}

Please find attach patch to initialize default value for number of jobs to
1.

Ugh. This is what I get for thinking that our regression tests actually
test even the basic things.

That fix should go into NewRestoreOptions() where the other not-zero
settings go.

I'll fix it here in a few.

Fix pushed.

Thanks!

Stephen