aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2014-01-02 18:17:29 -0300
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2014-01-02 18:17:29 -0300
commit948a3dfbb79a7e63e3bf31253837fa723f36d8c0 (patch)
tree95793ab6bd6c227a2d4058b50950443065d1c292
parent03db7945961c449ddd42be883e226bb889270161 (diff)
downloadpostgresql-948a3dfbb79a7e63e3bf31253837fa723f36d8c0.tar.gz
postgresql-948a3dfbb79a7e63e3bf31253837fa723f36d8c0.zip
Handle 5-char filenames in SlruScanDirectory
Original users of slru.c were all producing 4-digit filenames, so that was all that that code was prepared to handle. Changes to multixact.c in the course of commit 0ac5ad5134f made pg_multixact/members create 5-digit filenames once a certain threshold was reached, which SlruScanDirectory wasn't prepared to deal with; in particular, 5-digit-name files were not removed during truncation. Change that routine to make it aware of those files, and have it process them just like any others. Right now, some pg_multixact/members directories will contain a mixture of 4-char and 5-char filenames. A future commit is expected fix things so that each slru.c user declares the correct maximum width for the files it produces, to avoid such unsightly mixtures. Noticed while investigating bug #8673 reported by Serge Negodyuck.
-rw-r--r--src/backend/access/transam/slru.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/backend/access/transam/slru.c b/src/backend/access/transam/slru.c
index 9dc566e1622..af249022476 100644
--- a/src/backend/access/transam/slru.c
+++ b/src/backend/access/transam/slru.c
@@ -1293,8 +1293,12 @@ SlruScanDirectory(SlruCtl ctl, SlruScanCallback callback, void *data)
cldir = AllocateDir(ctl->Dir);
while ((clde = ReadDir(cldir, ctl->Dir)) != NULL)
{
- if (strlen(clde->d_name) == 4 &&
- strspn(clde->d_name, "0123456789ABCDEF") == 4)
+ size_t len;
+
+ len = strlen(clde->d_name);
+
+ if ((len == 4 || len == 5) &&
+ strspn(clde->d_name, "0123456789ABCDEF") == len)
{
segno = (int) strtol(clde->d_name, NULL, 16);
segpage = segno * SLRU_PAGES_PER_SEGMENT;