Re: vacuumlo patch - Mailing list pgsql-hackers

From Tim
Subject Re: vacuumlo patch
Date
Msg-id CA+3zgmsBdZqXjRWNgZikbz-oObG_RhqGG2nRQ2hUBRwivgVd7A@mail.gmail.com
Whole thread Raw
In response to Re: vacuumlo patch  (Tim <elatllat@gmail.com>)
Responses Re: vacuumlo patch
List pgsql-hackers
Updated the patch to also apply when the no-action flag is enabled.<br /><br /><span style="font-family: courier
new,monospace;">gitdiff HEAD -- contrib/vacuumlo/vacuumlo.c</span><br style="font-family: courier new,monospace;"
/><spanstyle="font-family: courier new,monospace;">diff --git a/contrib/vacuumlo/vacuumlo.c
b/contrib/vacuumlo/vacuumlo.c</span><brstyle="font-family: courier new,monospace;" /><span style="font-family: courier
new,monospace;">indexf6e2a28..8e9c342 100644</span><br style="font-family: courier new,monospace;" /><span
style="font-family:courier new,monospace;">--- a/contrib/vacuumlo/vacuumlo.c</span><br style="font-family: courier
new,monospace;"/><span style="font-family: courier new,monospace;">+++ b/contrib/vacuumlo/vacuumlo.c</span><br
style="font-family:courier new,monospace;" /><span style="font-family: courier new,monospace;">@@ -48,6 +48,7 @@ struct
_param</span><brstyle="font-family: courier new,monospace;" /><span style="font-family: courier new,monospace;">    
char      *pg_host;</span><br style="font-family: courier new,monospace;" /><span style="font-family: courier
new,monospace;">    int            verbose;</span><br style="font-family: courier new,monospace;" /><span
style="font-family:courier new,monospace;">     int            dry_run;</span><br style="font-family: courier
new,monospace;"/><span style="font-family: courier new,monospace;">+    int            transaction_limit;</span><br
style="font-family:courier new,monospace;" /><span style="font-family: courier new,monospace;"> };</span><br
style="font-family:courier new,monospace;" /><span style="font-family: courier new,monospace;"> </span><br
style="font-family:courier new,monospace;" /><span style="font-family: courier new,monospace;"> int           
vacuumlo(char*, struct _param *);</span><br style="font-family: courier new,monospace;" /><span style="font-family:
couriernew,monospace;">@@ -282,10 +283,18 @@ vacuumlo(char *database, struct _param * param)</span><br
style="font-family:courier new,monospace;" /><span style="font-family: courier new,monospace;">                
fprintf(stderr,"%s", PQerrorMessage(conn));</span><br style="font-family: courier new,monospace;" /><span
style="font-family:courier new,monospace;">             }</span><br style="font-family: courier new,monospace;" /><span
style="font-family:courier new,monospace;">             else</span><br style="font-family: courier new,monospace;"
/><spanstyle="font-family: courier new,monospace;">+            {</span><br style="font-family: courier new,monospace;"
/><spanstyle="font-family: courier new,monospace;">                 deleted++;</span><br style="font-family: courier
new,monospace;"/><span style="font-family: courier new,monospace;">+                if(param->transaction_limit!=0
&&deleted>=param->transaction_limit)</span><br style="font-family: courier new,monospace;" /><span
style="font-family:courier new,monospace;">+                    break;</span><br style="font-family: courier
new,monospace;"/><span style="font-family: courier new,monospace;">+            }</span><br style="font-family: courier
new,monospace;"/><span style="font-family: courier new,monospace;">         }</span><br style="font-family: courier
new,monospace;"/><span style="font-family: courier new,monospace;">         else</span><br style="font-family: courier
new,monospace;"/><span style="font-family: courier new,monospace;">+        {</span><br style="font-family: courier
new,monospace;"/><span style="font-family: courier new,monospace;">             deleted++;</span><br
style="font-family:courier new,monospace;" /><span style="font-family: courier new,monospace;">+           
if(param->transaction_limit!=0&& deleted>=param->transaction_limit)</span><br style="font-family:
couriernew,monospace;" /><span style="font-family: courier new,monospace;">+                break;</span><br
style="font-family:courier new,monospace;" /><span style="font-family: courier new,monospace;">+        }</span><br
style="font-family:courier new,monospace;" /><span style="font-family: courier new,monospace;">     }</span><br
style="font-family:courier new,monospace;" /><span style="font-family: courier new,monospace;">    
PQclear(res);</span><brstyle="font-family: courier new,monospace;" /><span style="font-family: courier
new,monospace;"> </span><brstyle="font-family: courier new,monospace;" /><span style="font-family: courier
new,monospace;">@@-313,6 +322,7 @@ usage(const char *progname)</span><br style="font-family: courier new,monospace;"
/><spanstyle="font-family: courier new,monospace;">     printf("  -h HOSTNAME  database server host or socket
directory\n");</span><brstyle="font-family: courier new,monospace;" /><span style="font-family: courier
new,monospace;">    printf("  -n           don't remove large objects, just show what would be done\n");</span><br
style="font-family:courier new,monospace;" /><span style="font-family: courier new,monospace;">     printf("  -p
PORT     database server port\n");</span><br style="font-family: courier new,monospace;" /><span style="font-family:
couriernew,monospace;">+    printf("  -l LIMIT     stop after removing LIMIT LOs\n");</span><br style="font-family:
couriernew,monospace;" /><span style="font-family: courier new,monospace;">     printf("  -U USERNAME  user name to
connectas\n");</span><br style="font-family: courier new,monospace;" /><span style="font-family: courier
new,monospace;">    printf("  -w           never prompt for password\n");</span><br style="font-family: courier
new,monospace;"/><span style="font-family: courier new,monospace;">     printf("  -W           force password
prompt\n");</span><brstyle="font-family: courier new,monospace;" /><span style="font-family: courier new,monospace;">@@
-342,6+352,7 @@ main(int argc, char **argv)</span><br style="font-family: courier new,monospace;" /><span
style="font-family:courier new,monospace;">     param.pg_port = NULL;</span><br style="font-family: courier
new,monospace;"/><span style="font-family: courier new,monospace;">     param.verbose = 0;</span><br
style="font-family:courier new,monospace;" /><span style="font-family: courier new,monospace;">     param.dry_run =
0;</span><brstyle="font-family: courier new,monospace;" /><span style="font-family: courier new,monospace;">+   
param.transaction_limit= 0;</span><br style="font-family: courier new,monospace;" /><span style="font-family: courier
new,monospace;"> </span><brstyle="font-family: courier new,monospace;" /><span style="font-family: courier
new,monospace;">    if (argc > 1)</span><br style="font-family: courier new,monospace;" /><span style="font-family:
couriernew,monospace;">     {</span><br style="font-family: courier new,monospace;" /><span style="font-family: courier
new,monospace;">@@-359,7 +370,7 @@ main(int argc, char **argv)</span><br style="font-family: courier new,monospace;"
/><spanstyle="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;" /><span
style="font-family:courier new,monospace;">     while (1)</span><br style="font-family: courier new,monospace;" /><span
style="font-family:courier new,monospace;">     {</span><br style="font-family: courier new,monospace;" /><span
style="font-family:courier new,monospace;">-        c = getopt(argc, argv, "h:U:p:vnwW");</span><br style="font-family:
couriernew,monospace;" /><span style="font-family: courier new,monospace;">+        c = getopt(argc, argv,
"h:U:p:l:vnwW");</span><brstyle="font-family: courier new,monospace;" /><span style="font-family: courier
new,monospace;">        if (c == -1)</span><br style="font-family: courier new,monospace;" /><span style="font-family:
couriernew,monospace;">             break;</span><br style="font-family: courier new,monospace;" /><span
style="font-family:courier new,monospace;"> </span><br style="font-family: courier new,monospace;" /><span
style="font-family:courier new,monospace;">@@ -395,6 +406,14 @@ main(int argc, char **argv)</span><br
style="font-family:courier new,monospace;" /><span style="font-family: courier new,monospace;">                
}</span><brstyle="font-family: courier new,monospace;" /><span style="font-family: courier new,monospace;">            
   param.pg_port = strdup(optarg);</span><br style="font-family: courier new,monospace;" /><span style="font-family:
couriernew,monospace;">                 break;</span><br style="font-family: courier new,monospace;" /><span
style="font-family:courier new,monospace;">+            case 'l':</span><br style="font-family: courier new,monospace;"
/><spanstyle="font-family: courier new,monospace;">+                param.transaction_limit = strtol(optarg, NULL,
10);</span><brstyle="font-family: courier new,monospace;" /><span style="font-family: courier new,monospace;">+       
       if ((param.transaction_limit < 0) || (param.transaction_limit > 2147483647))</span><br style="font-family:
couriernew,monospace;" /><span style="font-family: courier new,monospace;">+                {</span><br
style="font-family:courier new,monospace;" /><span style="font-family: courier new,monospace;">+                   
fprintf(stderr,"%s: invalid transaction limit number: %s, valid range is form 0(disabled) to 2147483647.\n", progname,
optarg);</span><brstyle="font-family: courier new,monospace;" /><span style="font-family: courier new,monospace;">+   
               exit(1);</span><br style="font-family: courier new,monospace;" /><span style="font-family: courier
new,monospace;">+               }</span><br style="font-family: courier new,monospace;" /><span style="font-family:
couriernew,monospace;">+                break;</span><br style="font-family: courier new,monospace;" /><span
style="font-family:courier new,monospace;">             case 'h':</span><br style="font-family: courier new,monospace;"
/><spanstyle="font-family: courier new,monospace;">                 param.pg_host = strdup(optarg);</span><br
style="font-family:courier new,monospace;" /><span style="font-family: courier new,monospace;">                
break;</span><brstyle="font-family: courier new,monospace;" /><br /><br /> 

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: pgbench --unlogged-tables
Next
From: Robert Haas
Date:
Subject: Re: Questions and experiences writing a Foreign Data Wrapper