Thanks Robert.

On Sunday, December 10, 2023 at 6:30:11 PM UTC Robert Engels wrote:

Not sure how you are detecting that the append it not working - 


I noticed that the binary log was not growing, and its update timestamp was 
not changing. I have an alias, lh, that is

alias lh='ls -alFtrh|tail'

that I run regularly in the course of work to see what has changed last in 
a directory. It is very useful, if you do not use something like it.

Only by luck did I happen to notice that the file was not being grown, 
which concerned me and so I investigated via
/proc/pid/fd, saw the deletion and then looked at the git log for the file. 
The updates stopped hitting the file (because the updated time on the file 
stopped changing) right after I added it to git.

On Sunday, December 10, 2023 at 6:30:11 PM UTC Robert Engels wrote:
> it usually does because a client can relink the inode to another file 
name using a syscall

Interesting. What syscalls relink it? 

Ah... https://serverfault.com/questions/168909/relinking-a-deleted-file 
seems to suggest that it used to be possible, but not after 2011 / linux 
kernel 2.6.39 because of security concerns.

> I, of course, did test this before posting my solution and at that time 
it actually worked for me. What I wasn't aware of is that it only worked on 
tmpfs filesystems but not on e.g. ext3. Furthermore this *feature* got 
completely disabled in 2.6.39, see the commit 
<http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=aae8a97d3ec30788790d1720b71d76fd8eb44b73>.
 
(https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=aae8a97d3ec30788790d1720b71d76fd8eb44b73
 
) So therefore this solution won't work with kernel 2.6.39 or newer anymore 
and in earlier versions it depends on the filesystem. 
– 
tnimeu <https://serverfault.com/users/71635/tnimeu>
 Jan 26, 2012 at 14:04 
<https://serverfault.com/questions/168909/relinking-a-deleted-file#comment354515_238431>

where the link is to a commit:  "fs: Don't allow to create hardlink for 
deleted file" from 2011.


Anyway, the Stat approach using the original filepath seems to be working: 
I can recognize the file shrinking or not growing when it should, and 
re-create it from memory.

Thanks All.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/e322acad-3070-4b51-ac23-c541b830c0aen%40googlegroups.com.

Reply via email to