Re: vacuumlo patch - Mailing list pgsql-hackers
From | Tim Lewis |
---|---|
Subject | Re: vacuumlo patch |
Date | |
Msg-id | CA+3zgmti_ooeVFHZO-bJoqEpbeYot3G9wxavwH2=YaNDDxVVqQ@mail.gmail.com Whole thread Raw |
In response to | Re: vacuumlo patch (Aron <me@eunice.de>) |
List | pgsql-hackers |
Hi Aron,<br /><br />Thanks for the input. The "small change" you suggest would change the behavior of the patch which I wouldprefer not to do as I have reasons for the previous behavior.<br />Because you gave no reasons and "stop after removingLIMIT LOs" was not changed to "stop after attempting to remove LIMIT LOs" I suspect you were just trying to keepthe code clean.<br /><br />The difference:<br />In your version of the patch vacuumlo will stop after N lo_unlink(OID)attempts.<br />The previous behavior of the patch is that vacuumlo will stop after N successful lo_unlink(OID)s.<br/><br />If you have good reason for your behavior please add another flag so that it is optional.<br />There should be a clear distinction between "counting vs not", and "aborting vs continuing" when a lo_unlink(OID) is unsuccessful.<br/><br /><br /><div class="gmail_quote">On Tue, Jul 26, 2011 at 4:18 AM, Aron <span dir="ltr"><<a href="mailto:me@eunice.de">me@eunice.de</a>></span>wrote:<br /><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px#ccc solid;padding-left:1ex;">Here's another small change to the patch, it works fine for me and it quite<br/> saved my day.<br /><br /> I try to submit the patch by email.<br /><div class="im"><br /><br /> diff --git a/contrib/vacuumlo/vacuumlo.cb/contrib/vacuumlo/vacuumlo.c<br /></div>index f6e2a28..1f88d72 100644<br /><div class="im">---a/contrib/vacuumlo/vacuumlo.c<br /> +++ b/contrib/vacuumlo/vacuumlo.c<br /> @@ -48,6 +48,7 @@ struct _param<br/> char *pg_host;<br /> int verbose;<br /> int dry_run;<br /> + int transaction_limit;<br /> };<br /><br /> int vacuumlo(char*, struct _param *);<br /></div>@@ -286,6 +287,8 @@ vacuumlo(char *database, struct _param * param)<br /><divclass="im"> }<br /> else<br /> deleted++;<br /> + if(param->transaction_limit!=0 &&<br /> deleted>=param->transaction_limit)<br /> + break;<br /> }<br /> PQclear(res);<br /><br /></div>@@ -313,6 +316,7 @@ usage(const char *progname)<br /><divclass="im"> printf(" -h HOSTNAME database server host or socket directory\n");<br /> printf(" -n don't remove large objects, just show what would be<br /> done\n");<br /> printf(" -p PORT databaseserver port\n");<br /> + printf(" -l LIMIT stop after removing LIMIT LOs\n");<br /> printf(" -UUSERNAME user name to connect as\n");<br /> printf(" -w never prompt for password\n");<br /> printf(" -W force password prompt\n");<br /></div>@@ -342,6 +346,7 @@ main(int argc, char **argv)<br /><divclass="im"> param.pg_port = NULL;<br /> param.verbose = 0;<br /> param.dry_run = 0;<br /> + param.transaction_limit = 0;<br /><br /> if (argc > 1)<br /> {<br /></div>@@ -359,7 +364,7 @@ main(intargc, char **argv)<br /><div class="im"><br /> while (1)<br /> {<br /> - c = getopt(argc,argv, "h:U:p:vnwW");<br /> + c = getopt(argc, argv, "h:U:p:l:vnwW");<br /> if (c== -1)<br /> break;<br /><br /></div>@@ -395,6 +400,14 @@ main(int argc, char **argv)<br /><divclass="im"> }<br /> param.pg_port = strdup(optarg);<br/> break;<br /> + case 'l':<br /> + param.transaction_limit = strtol(optarg, NULL, 10);<br /> + if ((param.transaction_limit< 0) || (param.transaction_limit ><br /><a href="tel:2147483647" value="+12147483647">2147483647</a>))<br/> + {<br /> + fprintf(stderr,"%s: invalid transaction limit number: %s, valid<br /> range is form 0(disabled) to <a href="tel:2147483647"value="+12147483647">2147483647</a>.\n", progname, optarg);<br /> + exit(1);<br /> + }<br /> + break;<br /> case 'h':<br /> param.pg_host = strdup(optarg);<br /> break;<br /><br /><br /></div>--<br /> View this message in context: <a href="http://postgresql.1045698.n5.nabble.com/vacuumlo-patch-tp4628522p4634026.html" target="_blank">http://postgresql.1045698.n5.nabble.com/vacuumlo-patch-tp4628522p4634026.html</a><br/> Sent from the PostgreSQL- hackers mailing list archive at Nabble.com.<br /><font color="#888888"><br /> --<br /> Sent via pgsql-hackersmailing list (<a href="mailto:pgsql-hackers@postgresql.org">pgsql-hackers@postgresql.org</a>)<br /> To makechanges to your subscription:<br /><a href="http://www.postgresql.org/mailpref/pgsql-hackers" target="_blank">http://www.postgresql.org/mailpref/pgsql-hackers</a><br/></font></blockquote></div><br /><br clear="all"/><br />-- <br /><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse"><div style="font-family:'ArialRounded MT Bold';color:rgb(11, 119, 176);font-size:26px;font-weight:bold"><br />Noodle</div><divstyle="font-family:Helvetica;font-size:12px"><div style="font-style:italic;color:rgb(0, 3, 5)">Connecting <spanstyle="font-weight:bold">People, Content & Capabilities</span> within the <span style="font-weight:bold">Enterprise</span><br/><br /></div><br />Toll Free: 866-258-6951 x 701<br /><a href="mailto:Tim.Lewis@vialect.com"style="color:rgb(17, 65, 112)" target="_blank">Tim.Lewis@vialect.com</a><br /><a href="http://www.vialect.com"style="color:rgb(17, 65, 112)" target="_blank">http://www.vialect.com</a><br /><br />Noodleis a product of Vialect Inc<br /><br />Follow Noodle on Twitter<br /><a href="http://www.twitter.com/noodle_news"style="color:rgb(17, 65, 112)" target="_blank">http://www.twitter.com/noodle_news</a></div></span><br/>
pgsql-hackers by date: