Skip to content

Commit 131afc6

Browse files
author
HappenLee
committed
Rename pg_rewind's copy_file_range() to avoid conflict with new linux syscall.
Fix issue Tencent#72
1 parent 386193b commit 131afc6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/bin/pg_rewind/copy_fetch.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ recurse_dir(const char *datadir, const char *parentpath,
156156
* If 'trunc' is true, any existing file with the same name is truncated.
157157
*/
158158
static void
159-
copy_file_range(const char *path, off_t begin, off_t end, bool trunc)
159+
rewind_copy_file_range(const char *path, off_t begin, off_t end, bool trunc)
160160
{// #lizard forgives
161161
char buf[BLCKSZ];
162162
char srcpath[MAXPGPATH];
@@ -222,15 +222,15 @@ copy_executeFileMap(filemap_t *map)
222222
break;
223223

224224
case FILE_ACTION_COPY:
225-
copy_file_range(entry->path, 0, entry->newsize, true);
225+
rewind_copy_file_range(entry->path, 0, entry->newsize, true);
226226
break;
227227

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

232232
case FILE_ACTION_COPY_TAIL:
233-
copy_file_range(entry->path, entry->oldsize, entry->newsize, false);
233+
rewind_copy_file_range(entry->path, entry->oldsize, entry->newsize, false);
234234
break;
235235

236236
case FILE_ACTION_CREATE:
@@ -257,7 +257,7 @@ execute_pagemap(datapagemap_t *pagemap, const char *path)
257257
while (datapagemap_next(iter, &blkno))
258258
{
259259
offset = blkno * BLCKSZ;
260-
copy_file_range(path, offset, offset + BLCKSZ, false);
260+
rewind_copy_file_range(path, offset, offset + BLCKSZ, false);
261261
/* Ok, this block has now been copied from new data dir to old */
262262
}
263263
pg_free(iter);

0 commit comments

Comments
 (0)