Skip to content

Commit ea4cbf8

Browse files
committed
Rename pg_rewind's copy_file_range() to avoid conflict with new linux syscall.
Upcoming versions of glibc will contain copy_file_range(2), a wrapper around a new linux syscall for in-kernel copying of data ranges. This conflicts with pg_rewinds function of the same name. Therefore rename pg_rewinds version. As our version isn't a generic copying facility we decided to choose a rewind specific function name. Per buildfarm animal caiman and subsequent discussion with Tom Lane. Author: Andres Freund Discussion: https://postgr.es/m/20180103033425.w7jkljth3e26sduc@alap3.anarazel.de https://postgr.es/m/31122.1514951044@sss.pgh.pa.us Backpatch: 9.5-, where pg_rewind was introduced
1 parent d329d2d commit ea4cbf8

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/bin/pg_rewind/copy_fetch.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ recurse_dir(const char *datadir, const char *parentpath,
158158
* If 'trunc' is true, any existing file with the same name is truncated.
159159
*/
160160
static void
161-
copy_file_range(const char *path, off_t begin, off_t end, bool trunc)
161+
rewind_copy_file_range(const char *path, off_t begin, off_t end, bool trunc)
162162
{
163163
char buf[BLCKSZ];
164164
char srcpath[MAXPGPATH];
@@ -224,15 +224,16 @@ copy_executeFileMap(filemap_t *map)
224224
break;
225225

226226
case FILE_ACTION_COPY:
227-
copy_file_range(entry->path, 0, entry->newsize, true);
227+
rewind_copy_file_range(entry->path, 0, entry->newsize, true);
228228
break;
229229

230230
case FILE_ACTION_TRUNCATE:
231231
truncate_target_file(entry->path, entry->newsize);
232232
break;
233233

234234
case FILE_ACTION_COPY_TAIL:
235-
copy_file_range(entry->path, entry->oldsize, entry->newsize, false);
235+
rewind_copy_file_range(entry->path, entry->oldsize,
236+
entry->newsize, false);
236237
break;
237238

238239
case FILE_ACTION_CREATE:
@@ -259,7 +260,7 @@ execute_pagemap(datapagemap_t *pagemap, const char *path)
259260
while (datapagemap_next(iter, &blkno))
260261
{
261262
offset = blkno * BLCKSZ;
262-
copy_file_range(path, offset, offset + BLCKSZ, false);
263+
rewind_copy_file_range(path, offset, offset + BLCKSZ, false);
263264
/* Ok, this block has now been copied from new data dir to old */
264265
}
265266
pg_free(iter);

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