|
77 | 77 | *
|
78 | 78 | * "path" should point to a buffer at least MAXPGPATH characters long.
|
79 | 79 | *
|
80 |
| - * If ctl->long_segment_names is true, segno can be in the range [0, 2^60-1]. |
81 |
| - * The resulting file name is made of 15 characters, e.g. dir/123456789ABCDEF. |
82 |
| - * |
83 |
| - * If ctl->long_segment_names is false, segno can be in the range [0, 2^24-1]. |
84 |
| - * The resulting file name is made of 4 to 6 characters, as of: |
85 |
| - * |
86 |
| - * dir/1234 for [0, 2^16-1] |
87 |
| - * dir/12345 for [2^16, 2^20-1] |
88 |
| - * dir/123456 for [2^20, 2^24-1] |
| 80 | + * segno can be in the range [0, 2^60-1]. The resulting file name is made |
| 81 | + * of 15 characters, e.g. dir/123456789ABCDEF. |
89 | 82 | */
|
90 | 83 | static inline int
|
91 | 84 | SlruFileName(SlruCtl ctl, char *path, int64 segno)
|
92 | 85 | {
|
93 |
| - if (ctl->long_segment_names) |
94 |
| - { |
95 |
| - /* |
96 |
| - * We could use 16 characters here but the disadvantage would be that |
97 |
| - * the SLRU segments will be hard to distinguish from WAL segments. |
98 |
| - * |
99 |
| - * For this reason we use 15 characters. It is enough but also means |
100 |
| - * that in the future we can't decrease SLRU_PAGES_PER_SEGMENT easily. |
101 |
| - */ |
102 |
| - Assert(segno >= 0 && segno <= INT64CONST(0xFFFFFFFFFFFFFFF)); |
103 |
| - return snprintf(path, MAXPGPATH, "%s/%015" PRIX64, ctl->Dir, segno); |
104 |
| - } |
105 |
| - else |
106 |
| - { |
107 |
| - /* |
108 |
| - * Despite the fact that %04X format string is used up to 24 bit |
109 |
| - * integers are allowed. See SlruCorrectSegmentFilenameLength() |
110 |
| - */ |
111 |
| - Assert(segno >= 0 && segno <= INT64CONST(0xFFFFFF)); |
112 |
| - return snprintf(path, MAXPGPATH, "%s/%04X", (ctl)->Dir, |
113 |
| - (unsigned int) segno); |
114 |
| - } |
| 86 | + /* |
| 87 | + * We could use 16 characters here but the disadvantage would be that |
| 88 | + * the SLRU segments will be hard to distinguish from WAL segments. |
| 89 | + * |
| 90 | + * For this reason we use 15 characters. It is enough but also means |
| 91 | + * that in the future we can't decrease SLRU_PAGES_PER_SEGMENT easily. |
| 92 | + */ |
| 93 | + Assert(segno >= 0 && segno <= INT64CONST(0xFFFFFFFFFFFFFFF)); |
| 94 | + return snprintf(path, MAXPGPATH, "%s/%015" PRIX64, ctl->Dir, segno); |
115 | 95 | }
|
116 | 96 |
|
117 | 97 | /*
|
@@ -250,7 +230,7 @@ SimpleLruAutotuneBuffers(int divisor, int max)
|
250 | 230 | void
|
251 | 231 | SimpleLruInit(SlruCtl ctl, const char *name, int nslots, int nlsns,
|
252 | 232 | const char *subdir, int buffer_tranche_id, int bank_tranche_id,
|
253 |
| - SyncRequestHandler sync_handler, bool long_segment_names) |
| 233 | + SyncRequestHandler sync_handler) |
254 | 234 | {
|
255 | 235 | SlruShared shared;
|
256 | 236 | bool found;
|
@@ -341,7 +321,6 @@ SimpleLruInit(SlruCtl ctl, const char *name, int nslots, int nlsns,
|
341 | 321 | */
|
342 | 322 | ctl->shared = shared;
|
343 | 323 | ctl->sync_handler = sync_handler;
|
344 |
| - ctl->long_segment_names = long_segment_names; |
345 | 324 | ctl->nbanks = nbanks;
|
346 | 325 | strlcpy(ctl->Dir, subdir, sizeof(ctl->Dir));
|
347 | 326 | }
|
@@ -1747,30 +1726,6 @@ SlruScanDirCbDeleteAll(SlruCtl ctl, char *filename, int64 segpage, void *data)
|
1747 | 1726 | return false; /* keep going */
|
1748 | 1727 | }
|
1749 | 1728 |
|
1750 |
| -/* |
1751 |
| - * An internal function used by SlruScanDirectory(). |
1752 |
| - * |
1753 |
| - * Returns true if a file with a name of a given length may be a correct |
1754 |
| - * SLRU segment. |
1755 |
| - */ |
1756 |
| -static inline bool |
1757 |
| -SlruCorrectSegmentFilenameLength(SlruCtl ctl, size_t len) |
1758 |
| -{ |
1759 |
| - if (ctl->long_segment_names) |
1760 |
| - return (len == 15); /* see SlruFileName() */ |
1761 |
| - else |
1762 |
| - |
1763 |
| - /* |
1764 |
| - * Commit 638cf09e76d allowed 5-character lengths. Later commit |
1765 |
| - * 73c986adde5 allowed 6-character length. |
1766 |
| - * |
1767 |
| - * Note: There is an ongoing plan to migrate all SLRUs to 64-bit page |
1768 |
| - * numbers, and the corresponding 15-character file names, which may |
1769 |
| - * eventually deprecate the support for 4, 5, and 6-character names. |
1770 |
| - */ |
1771 |
| - return (len == 4 || len == 5 || len == 6); |
1772 |
| -} |
1773 |
| - |
1774 | 1729 | /*
|
1775 | 1730 | * Scan the SimpleLru directory and apply a callback to each file found in it.
|
1776 | 1731 | *
|
@@ -1802,7 +1757,7 @@ SlruScanDirectory(SlruCtl ctl, SlruScanCallback callback, void *data)
|
1802 | 1757 |
|
1803 | 1758 | len = strlen(clde->d_name);
|
1804 | 1759 |
|
1805 |
| - if (SlruCorrectSegmentFilenameLength(ctl, len) && |
| 1760 | + if ((len == 15) && |
1806 | 1761 | strspn(clde->d_name, "0123456789ABCDEF") == len)
|
1807 | 1762 | {
|
1808 | 1763 | segno = strtoi64(clde->d_name, NULL, 16);
|
|
0 commit comments