vacuumlo patch - Mailing list pgsql-hackers

From Tim
Subject vacuumlo patch
Date
Msg-id CA+3zgmtrZW2tabW9V9Tynj8Oc9V_EnLQNpKp-zY6oHRf+pO59A@mail.gmail.com
Whole thread Raw
Responses Re: vacuumlo patch
List pgsql-hackers
Please consider adding this minor patch, or offering improvements.<br /><br /><b>Problem</b>: vacuumlo required
PostgreSQLto use more locks per transaction than possible resulting in an error and a log file full of "ignored until
endof transaction" warnings. <br /> (max_locks_per_transaction is limited by shmmax which is limited by RAM)<br /><br
/><b>Solution</b>:ask vacuumlo to complete after N lo_unlink(OID)s.<br /><b><br />Alternate Solution</b>: ask vacuumlo
tostart a new transaction after N lo_unlink(OID)s.<br /> (more complex and can be implemented with the other solution
inthe shell)<br /><br /><b>Design Decisions</b>: Add a flag so the new behavior is optional and it defaults to the old
behavior.<br/><br /><b>Implementation</b>: Followed code formatting style.<br /> It's likely pointless to check if an
intis > 2147483647 but maybe it clarifies the code.<br />Added a friendly error message and the a line in the
help.<br/><br /><span style="font-family: courier new,monospace;">git diff -U0 HEAD --
contrib/vacuumlo/vacuumlo.c</span><brstyle="font-family: courier new,monospace;" /><span style="font-family: courier
new,monospace;">diff--git a/contrib/vacuumlo/vacuumlo.c b/contrib/vacuumlo/vacuumlo.c</span><br style="font-family:
couriernew,monospace;" /><span style="font-family: courier new,monospace;">index f6e2a28..b7c7d64 100644</span><br
style="font-family:courier new,monospace;" /><span style="font-family: courier new,monospace;">---
a/contrib/vacuumlo/vacuumlo.c</span><brstyle="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;">@@ -50,0 +51 @@ struct _param</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;">@@ -284,0 +286 @@
vacuumlo(char*database, struct _param * param)</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;">@@ -285,0 +288,5 @@ vacuumlo(char *database, struct _param *
param)</span><brstyle="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;">+               
{</span><brstyle="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:
couriernew,monospace;">+            }</span><br style="font-family: courier new,monospace;" /><span style="font-family:
couriernew,monospace;">@@ -315,0 +323 @@ usage(const char *progname)</span><br style="font-family: courier
new,monospace;"/><span style="font-family: courier new,monospace;">+    printf("  -l LIMIT     stop after removing
LIMITLOs\n");</span><br style="font-family: courier new,monospace;" /><span style="font-family: courier
new,monospace;">@@-344,0 +353 @@ main(int argc, char **argv)</span><br style="font-family: courier new,monospace;"
/><spanstyle="font-family: courier new,monospace;">+    param.transaction_limit = 0;</span><br style="font-family:
couriernew,monospace;" /><span style="font-family: courier new,monospace;">@@ -362 +371 @@ main(int argc, char
**argv)</span><brstyle="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: courier new,monospace;" /><span
style="font-family:courier new,monospace;">+        c = getopt(argc, argv, "h:U:p:l:vnwW");</span><br
style="font-family:courier new,monospace;" /><span style="font-family: courier new,monospace;">@@ -397,0 +407,8 @@
main(intargc, char **argv)</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;" /><span style="font-family:
couriernew,monospace;">+                param.transaction_limit = strtol(optarg, NULL, 10);</span><br
style="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: courier
new,monospace;"/><span style="font-family: courier new,monospace;">+                {</span><br style="font-family:
couriernew,monospace;" /><span style="font-family: courier new,monospace;">+                    fprintf(stderr, "%s:
invalidtransaction limit number: %s, valid range is form 0(disabled) to 2147483647.\n", progname, optarg);</span><br
style="font-family:courier new,monospace;" /><span style="font-family: courier new,monospace;">+                   
exit(1);</span><brstyle="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;">+               break;</span><br style="font-family: courier new,monospace;" /><br /> 

pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Problem with pg_upgrade's directory write check on Windows
Next
From: Tom Lane
Date:
Subject: SSL-mode error reporting in libpq