PR#1148: Backup files policy

Post here if you have re-based and finalised code to integrate into master, which was discussed, agreed to and tested in other forums. You can also submit your PR directly on github.
plgarcia
Posts: 281
Joined: Wed Jun 17, 2015 9:47 pm
Location: Near Paris (France)

PR#1148: Backup files policy

Postby plgarcia » Sat Feb 17, 2018 9:51 pm

This PR has been discussed in thread 25601.
https://forum.freecadweb.org/viewtopic.php?f=8&t=25601


This PR first solves the little problem around the number of saves kept when changed in configuration. The number can be increased but not reduced.
It proposes that the name of the archives have the date in their names instead of numbers, what help sorting the archives.
When a errors occurs while saving a windows pops up to the user warning him.

Finally as there is no reuse of the name of the archive just deleted, hopefully, the problem introduced by Google Drive introducing a delay between the request of the deletion and the effective deletion, and making the save incomplete on windows is solved.

Regards
triplus
Posts: 8802
Joined: Mon Dec 12, 2011 4:45 pm

Re: PR#1148: Backup files policy

Postby triplus » Sat Feb 17, 2018 10:21 pm

I am guessing this should be discussed after FreeCAD 0.17 is released. As maybe some users won't like the change (backup file names used). And best to figure such things out through the FreeCAD 0.18 development cycle. Where things can still change or to be reverted with ease. Unless others feel it makes sense to have it in FreeCAD 0.17. Then it is fine with me.
plgarcia wrote:
Sat Feb 17, 2018 9:51 pm
Finally as there is no reuse of the name of the archive just deleted, hopefully, the problem introduced by Google Drive introducing a delay between the request of the deletion and the effective deletion, and making the save incomplete on windows is solved.

Regards
Hopefully or you actually tested it and the problem was gone? That is at least the problem wasn't detected anymore on your side?
plgarcia
Posts: 281
Joined: Wed Jun 17, 2015 9:47 pm
Location: Near Paris (France)

Re: PR#1148: Backup files policy

Postby plgarcia » Sat Feb 17, 2018 10:36 pm

I clearly identify the reason of this bug. But I have not been conducted he process to generate on windows until the end.
The change has been tested with Linux and works fine, but I did not test if the problem does no longer exist under windows on a drive synchronized with google drive, and with “show warning when an element is deleted” option activated., although I am quite confident.

Google simply closed the bug report. These people may think there are clever enough not to create undesired behaviors!
This PR is available since the 6th of December. But I do not care when it will be incorporated and the discussion is still open to decide if this change is valuable or should be implemented differently.

The change handles the transition with the actual way.
triplus
Posts: 8802
Joined: Mon Dec 12, 2011 4:45 pm

Re: PR#1148: Backup files policy

Postby triplus » Sat Feb 17, 2018 10:59 pm

plgarcia wrote:
Sat Feb 17, 2018 10:36 pm
The change has been tested with Linux and works fine, but I did not test if the problem does no longer exist under windows on a drive synchronized with google drive, and with “show warning when an element is deleted” option activated.
I see. And if i remember correctly the main problem on why it wasn't tested. To confirm if the issue is resolved. Is related to the difficulties compiling FreeCAD on Windows?
sgrogan wrote:
Any chance you could help out? By providing a Windows build including the PR for testing purposes?
plgarcia
Posts: 281
Joined: Wed Jun 17, 2015 9:47 pm
Location: Near Paris (France)

Re: PR#1148: Backup files policy

Postby plgarcia » Sat Feb 17, 2018 11:12 pm

Yes I have not been able to compile on windows and postponed this battle until I have some time to spend. In secret I have hope somebody would provide an easy compiling procedure!

To my mind it is a Google Drive issue and this change just tries not to fail in the trap open by Goggle Drive.
But I believe the management of the archives is better, and the user will be warned if the problem occurs. Two sufficient reasons to take the PR even if the initial problem has not been tested!

If sombody is able to provide me a Windows version I can test it. It is very easy to test, just open a document and save it many times. The problem occurs every very few saves.

The PR is murged to the last version.
User avatar
sgrogan
Posts: 5475
Joined: Wed Oct 22, 2014 5:02 pm

Re: PR#1148: Backup files policy

Postby sgrogan » Tue Feb 20, 2018 9:22 pm

plgarcia wrote:
Sat Feb 17, 2018 11:12 pm
If sombody is able to provide me a Windows version I can test it.
I can provide a build.
plgarcia
Posts: 281
Joined: Wed Jun 17, 2015 9:47 pm
Location: Near Paris (France)

Re: PR#1148: Backup files policy

Postby plgarcia » Wed Feb 21, 2018 12:04 am

Fine thank you.
Where and when can I download it ?
User avatar
sgrogan
Posts: 5475
Joined: Wed Oct 22, 2014 5:02 pm

Re: PR#1148: Backup files policy

Postby sgrogan » Wed Feb 21, 2018 1:21 am

plgarcia wrote:
Wed Feb 21, 2018 12:04 am
Where and when can I download it ?
https://github.com/sgrogan/FreeCAD/rele ... 0.17-SAVES
I have some problems.
"About FreeCAD" reports
OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13171 +133 (Git)
Build type: Release
Branch:
Hash: 86ed1a93a25cbe88d9e87ac93e081daee932f9eb
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: English/UnitedStates (en_US)

The missing branch name maybe due to my git skills, but I haven't experienced this before. All self tests pass BTW.
plgarcia
Posts: 281
Joined: Wed Jun 17, 2015 9:47 pm
Location: Near Paris (France)

Re: PR#1148: Backup files policy

Postby plgarcia » Wed Feb 21, 2018 6:18 am

Thanks,
Reactivation google option etc. The poblem seems to be solved.
Regards
plgarcia
Posts: 281
Joined: Wed Jun 17, 2015 9:47 pm
Location: Near Paris (France)

Re: PR#1148: Backup files policy

Postby plgarcia » Wed Feb 21, 2018 9:30 am

Even over the 4G connection it is working. 30 archives configured.
Capture6.PNG
Capture6.PNG (63.59 KiB) Viewed 2935 times
the -1 -2 ... are added if the backup already exists, what means there have been many saves within the same second as windows does not record the milliseconds.
Rotation of the archives works also well, and the number is kept to 30.
If the number of archives configured is reduced, ne number of archived is also reduced next time a saves occurs.

May be should we change to remove the milliseconds in the name of the archive as they are of no use and always 000.