copy_file_range is now a Linux kernel call

Started by Tom Laneover 8 years ago6 messageshackers
Jump to latest
#1Tom Lane
tgl@sss.pgh.pa.us

Buildfarm member caiman just came back online after some time AWOL, and
it's not happy. The problem evidently is that pg_rewind's copy_file_range
function conflicts with a recently added Linux system call:

http://man7.org/linux/man-pages/man2/copy_file_range.2.html

Looks like we'd better rename our function. Anybody have an idea
more creative than "pg_copy_file_range"?

(At some point somebody might want to think about fixing this function
so it can make use of the kernel call when available. But that's more
work than I care to do right now, and certainly more change than I'd want
to back-patch.)

regards, tom lane

#2Andres Freund
andres@anarazel.de
In reply to: Tom Lane (#1)
Re: copy_file_range is now a Linux kernel call

Hi,

On 2018-01-02 22:44:04 -0500, Tom Lane wrote:

Buildfarm member caiman just came back online after some time AWOL, and
it's not happy. The problem evidently is that pg_rewind's copy_file_range
function conflicts with a recently added Linux system call:

http://man7.org/linux/man-pages/man2/copy_file_range.2.html

Heh, just observed the same:
http://archives.postgresql.org/message-id/20180103033425.w7jkljth3e26sduc%40alap3.anarazel.de

Looks like we'd better rename our function. Anybody have an idea
more creative than "pg_copy_file_range"?

I'd rather name it pg_rewind specific, something like
rwnd_copy_file_range or such. It's not a generic range copying facility,
given the way it computes source/target file names.

(At some point somebody might want to think about fixing this function
so it can make use of the kernel call when available. But that's more
work than I care to do right now, and certainly more change than I'd want
to back-patch.)

If so we'd probably want to do so in a more generic facility than what
pg_rewind uses. But for now it indeed seems like a bad idea to do
so. Besides the backpatch concern you mention, the functionality is also
just present in an unreleased glibc version...

Greetings,

Andres Freund

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andres Freund (#2)
Re: copy_file_range is now a Linux kernel call

Andres Freund <andres@anarazel.de> writes:

On 2018-01-02 22:44:04 -0500, Tom Lane wrote:

Looks like we'd better rename our function. Anybody have an idea
more creative than "pg_copy_file_range"?

I'd rather name it pg_rewind specific,

OK ...

something like
rwnd_copy_file_range or such.

Bleah --- "rwnd" is unpronounceable and not an abbreviation we're
currently using anywhere. If we go that way, let's brave carpal tunnel
syndrome by calling it "rewind_copy_file_range". But I'm not that
happy with any of these.

Filipe Rosset pointed out to me off-list that we're not the only
ones feeling the pain:

https://sourceforge.net/p/e2fsprogs/code/ci/01551bdba16ab16512a01affe02ade32c41ede8a

Maybe go with copy_file_chunk like e2fsprogs did?

regards, tom lane

#4Andres Freund
andres@anarazel.de
In reply to: Tom Lane (#3)
Re: copy_file_range is now a Linux kernel call

Hi,

On 2018-01-02 23:08:05 -0500, Tom Lane wrote:

Andres Freund <andres@anarazel.de> writes:

On 2018-01-02 22:44:04 -0500, Tom Lane wrote:
something like rwnd_copy_file_range or such.

Bleah --- "rwnd" is unpronounceable and not an abbreviation we're
currently using anywhere. If we go that way, let's brave carpal tunnel
syndrome by calling it "rewind_copy_file_range". But I'm not that
happy with any of these.

rewind_copy_file_range works for me.

Filipe Rosset pointed out to me off-list that we're not the only
ones feeling the pain:

https://sourceforge.net/p/e2fsprogs/code/ci/01551bdba16ab16512a01affe02ade32c41ede8a

Maybe go with copy_file_chunk like e2fsprogs did?

-0.2 - don't think it hurts to signal this isn't a general function.

Greetings,

Andres Freund

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andres Freund (#4)
Re: copy_file_range is now a Linux kernel call

Andres Freund <andres@anarazel.de> writes:

On 2018-01-02 23:08:05 -0500, Tom Lane wrote:

Bleah --- "rwnd" is unpronounceable and not an abbreviation we're
currently using anywhere. If we go that way, let's brave carpal tunnel
syndrome by calling it "rewind_copy_file_range". But I'm not that
happy with any of these.

rewind_copy_file_range works for me.

Maybe go with copy_file_chunk like e2fsprogs did?

-0.2 - don't think it hurts to signal this isn't a general function.

Fair enough. You want to do the honors, or shall I?

regards, tom lane

#6Andres Freund
andres@anarazel.de
In reply to: Tom Lane (#5)
Re: copy_file_range is now a Linux kernel call

On 2018-01-02 23:34:47 -0500, Tom Lane wrote:

Andres Freund <andres@anarazel.de> writes:

On 2018-01-02 23:08:05 -0500, Tom Lane wrote:

Bleah --- "rwnd" is unpronounceable and not an abbreviation we're
currently using anywhere. If we go that way, let's brave carpal tunnel
syndrome by calling it "rewind_copy_file_range". But I'm not that
happy with any of these.

rewind_copy_file_range works for me.

Maybe go with copy_file_chunk like e2fsprogs did?

-0.2 - don't think it hurts to signal this isn't a general function.

Fair enough. You want to do the honors, or shall I?

Will do tomorrow morning, unless you beat me to it over there on the
cold coast.

Greetings,

Andres Freund