Re: vacuumlo patch - Mailing list pgsql-hackers

From Tim
Subject Re: vacuumlo patch
Date
Msg-id CA+3zgmvzuT5DmS35tp2rT_CaWhS9QoQ=mqnXgaKH5bjOZ5ypSQ@mail.gmail.com
Whole thread Raw
In response to Re: vacuumlo patch  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: vacuumlo patch
List pgsql-hackers
Hi Álvaro, thanks for the response.<br /><br />Here is the requested "diff with 3 lines of context":<font
color="#888888"><br/><br /></font>git diff HEAD -- contrib/vacuumlo/vacuumlo.c<br />diff --git
a/contrib/vacuumlo/vacuumlo.cb/contrib/vacuumlo/vacuumlo.c<br /> index f6e2a28..b7c7d64 100644<br />---
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 />@@ -282,7 +283,13 @@
vacuumlo(char*database, struct _param * param)<br />                 fprintf(stderr, "%s", PQerrorMessage(conn));<br />
            }<br />             else<br />+            {<br />                 deleted++;<br />+               
if(param->transaction_limit!=0&& deleted>=param->transaction_limit)<br />+                {<br />+   
               break;<br /> +                }<br />+            }<br />         }<br />         else<br />            
deleted++;<br/>@@ -313,6 +320,7 @@ usage(const char *progname)<br />     printf("  -h HOSTNAME  database server host or
socketdirectory\n");<br />      printf("  -n           don't remove large objects, just show what would be done\n");<br
/>    printf("  -p PORT      database server port\n");<br />+    printf("  -l LIMIT     stop after removing LIMIT
LOs\n");<br/>      printf("  -U USERNAME  user name to connect as\n");<br />     printf("  -w           never prompt
forpassword\n");<br />     printf("  -W           force password prompt\n");<br />@@ -342,6 +350,7 @@ main(int argc,
char**argv)<br />      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 />@@ -359,7 +368,7 @@ main(int argc, char
**argv)<br/> <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 />@@ -395,6 +404,14 @@
main(intargc, char **argv)<br />                  }<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 > 2147483647))<br /> +           
   {<br />+                    fprintf(stderr, "%s: invalid transaction limit number: %s, valid range is form
0(disabled)to 2147483647.\n", progname, optarg);<br />+                    exit(1);<br />+                }<br /> +   
           break;<br />             case 'h':<br />                 param.pg_host = strdup(optarg);<br />            
   break;<br /> 

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: python cleanup
Next
From: Harshitha S
Date:
Subject: Re: Tracing in Postgres