What happens when the file changes during file replication?
I did an experiment where if the file itself is changing during the copying process, what process should the file be in after the final copy?
Is it the state at the start of replication, the state at the end of replication, or some state of an intermediate file.
Use the script file.sh to insert lines continuously into the file.dmp file, and the file will always grow larger.
file.sh:
Click here to fold or open
#!/ bin/bashi=1while truedoi=$[i+1]echo $i >> file.dmpdone
Break script.
The last line of file.dmp is 152940.
We copy using $ cp file.dmp file.dmp.bak and immediately run the file.sh script to insert the line.
After cp command ends (file must be large enough, otherwise time is very fast, can not be effective), look at the last line of file.dmp.bak file, found that is 152940.
The conclusion is that the files generated by replication will be consistent with the state at the beginning of replication, and the source files will continue to change during the replication process.
Also verify that using rsync works the same.
I welcome your testimonies.