Skip to content

Commit 638cf09

Browse files
committed
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 0ac5ad5 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.
1 parent a50d976 commit 638cf09

File tree

1 file changed

+6
-2
lines changed
  • src/backend/access/transam

1 file changed

+6
-2
lines changed

src/backend/access/transam/slru.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,8 +1293,12 @@ SlruScanDirectory(SlruCtl ctl, SlruScanCallback callback, void *data)
12931293
cldir = AllocateDir(ctl->Dir);
12941294
while ((clde = ReadDir(cldir, ctl->Dir)) != NULL)
12951295
{
1296-
if (strlen(clde->d_name) == 4 &&
1297-
strspn(clde->d_name, "0123456789ABCDEF") == 4)
1296+
size_t len;
1297+
1298+
len = strlen(clde->d_name);
1299+
1300+
if ((len == 4 || len == 5) &&
1301+
strspn(clde->d_name, "0123456789ABCDEF") == len)
12981302
{
12991303
segno = (int) strtol(clde->d_name, NULL, 16);
13001304
segpage = segno * SLRU_PAGES_PER_SEGMENT;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy