inconvenient compression options in pg_basebackup

Started by Peter Eisentrautalmost 15 years ago10 messageshackers
Jump to latest
#1Peter Eisentraut
peter_e@gmx.net

There is no way to tell pg_basebackup to "just compress the thing in a
default way". You have to pick some number and then write -Z8 or
something. I suppose that interface was copied from pg_dump, but there
it's not that commonly used because the right formats are compressed by
default.

I suggest we add an argument-less option -z that means "compress", and
then -Z can be relegated to choosing the compression level.

#2Magnus Hagander
magnus@hagander.net
In reply to: Peter Eisentraut (#1)
Re: inconvenient compression options in pg_basebackup

On Thu, May 19, 2011 at 17:56, Peter Eisentraut <peter_e@gmx.net> wrote:

There is no way to tell pg_basebackup to "just compress the thing in a
default way".  You have to pick some number and then write -Z8 or
something.  I suppose that interface was copied from pg_dump, but there
it's not that commonly used because the right formats are compressed by
default.

It was copied from pg_dump, yes.

I suggest we add an argument-less option -z that means "compress", and
then -Z can be relegated to choosing the compression level.

We can't just use -Z without a parameter for that?

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

#3Peter Eisentraut
peter_e@gmx.net
In reply to: Magnus Hagander (#2)
Re: inconvenient compression options in pg_basebackup

On fre, 2011-05-20 at 14:19 -0400, Magnus Hagander wrote:

I suggest we add an argument-less option -z that means "compress",

and

then -Z can be relegated to choosing the compression level.

We can't just use -Z without a parameter for that?

You can't portably have a command-line option with an optional argument.

#4Magnus Hagander
magnus@hagander.net
In reply to: Peter Eisentraut (#3)
Re: inconvenient compression options in pg_basebackup

On Fri, May 20, 2011 at 17:45, Peter Eisentraut <peter_e@gmx.net> wrote:

On fre, 2011-05-20 at 14:19 -0400, Magnus Hagander wrote:

I suggest we add an argument-less option -z that means "compress",

and

then -Z can be relegated to choosing the compression level.

We can't just use -Z without a parameter for that?

You can't portably have a command-line option with an optional argument.

Ugh.

In that case, I'm fine with your suggestion.

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

#5Peter Eisentraut
peter_e@gmx.net
In reply to: Magnus Hagander (#4)
Re: inconvenient compression options in pg_basebackup

On sön, 2011-05-22 at 16:43 -0400, Magnus Hagander wrote:

On Fri, May 20, 2011 at 17:45, Peter Eisentraut <peter_e@gmx.net> wrote:

On fre, 2011-05-20 at 14:19 -0400, Magnus Hagander wrote:

I suggest we add an argument-less option -z that means "compress",

and

then -Z can be relegated to choosing the compression level.

We can't just use -Z without a parameter for that?

You can't portably have a command-line option with an optional argument.

Ugh.

In that case, I'm fine with your suggestion.

Quick patch for verification. I chose the naming -z/--gzip to mirror
GNU tar.

Attachments:

pg_basebackup-compress.patchtext/x-patch; charset=UTF-8; name=pg_basebackup-compress.patchDownload+34-14
#6Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#5)
Re: inconvenient compression options in pg_basebackup

Peter Eisentraut <peter_e@gmx.net> writes:

Quick patch for verification. I chose the naming -z/--gzip to mirror
GNU tar.

I would argue that -Z ought to turn on "gzip" without my having to write
-z as well (at least when the argument is greater than zero; possibly
-Z0 should be allowed as meaning "no compression").

Other than that (and the ensuing docs and help changes), looks fine.

regards, tom lane

#7Peter Eisentraut
peter_e@gmx.net
In reply to: Tom Lane (#6)
Re: inconvenient compression options in pg_basebackup

On tis, 2011-05-24 at 15:34 -0400, Tom Lane wrote:

I would argue that -Z ought to turn on "gzip" without my having to
write
-z as well (at least when the argument is greater than zero; possibly
-Z0 should be allowed as meaning "no compression").

My concern with that is that if we ever add another compression method,
would we then add another option to control the compression level of
that method?

#8Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#7)
Re: inconvenient compression options in pg_basebackup

Peter Eisentraut <peter_e@gmx.net> writes:

On tis, 2011-05-24 at 15:34 -0400, Tom Lane wrote:

I would argue that -Z ought to turn on "gzip" without my having to write
-z as well (at least when the argument is greater than zero; possibly
-Z0 should be allowed as meaning "no compression").

My concern with that is that if we ever add another compression method,
would we then add another option to control the compression level of
that method?

Um ... what's your point? Forcing the user to type two switches instead
of one isn't going to make that hypothetical future extension any
easier, AFAICS.

But if you want to take such an extension into account right now, maybe
we ought to design that feature now. What are you seeing it as looking
like?

My thought is that "-z" should just mean "give me compression; a good
default compression setting is fine". "-Zn" could mean "I want gzip
with exactly this compression level" (thus making the presence or
absence of -z moot). If you want to specify some other compression
method altogether, use something like --lzma=N. It seems unlikely to me
that somebody who wants to override the default compression method
wouldn't want to pick the settings for it too.

regards, tom lane

#9Peter Eisentraut
peter_e@gmx.net
In reply to: Tom Lane (#8)
Re: inconvenient compression options in pg_basebackup

On tor, 2011-05-26 at 16:54 -0400, Tom Lane wrote:

But if you want to take such an extension into account right now,
maybe we ought to design that feature now. What are you seeing it as
looking like?

My thought is that "-z" should just mean "give me compression; a good
default compression setting is fine". "-Zn" could mean "I want gzip
with exactly this compression level" (thus making the presence or
absence of -z moot). If you want to specify some other compression
method altogether, use something like --lzma=N. It seems unlikely to
me that somebody who wants to override the default compression method
wouldn't want to pick the settings for it too.

I think of pg_basebackup as analogous to tar. tar has a bunch of
options to set a compression method (-Z, -z, -j, -J), but no support for
setting compression specific options. So in that sense that contradicts
your suspicion.

#10Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#9)
Re: inconvenient compression options in pg_basebackup

Peter Eisentraut <peter_e@gmx.net> writes:

On tor, 2011-05-26 at 16:54 -0400, Tom Lane wrote:

But if you want to take such an extension into account right now,
maybe we ought to design that feature now. What are you seeing it as
looking like?

My thought is that "-z" should just mean "give me compression; a good
default compression setting is fine". "-Zn" could mean "I want gzip
with exactly this compression level" (thus making the presence or
absence of -z moot). If you want to specify some other compression
method altogether, use something like --lzma=N. It seems unlikely to
me that somebody who wants to override the default compression method
wouldn't want to pick the settings for it too.

I think of pg_basebackup as analogous to tar. tar has a bunch of
options to set a compression method (-Z, -z, -j, -J), but no support for
setting compression specific options. So in that sense that contradicts
your suspicion.

I would think we'd be more concerned about preserving an analogy to
pg_dump, which most certainly does expose compression-quality options.

regards, tom lane