{"action":"created","issue":{"url":"https://api.github.com/repos/syncthing/syncthing/issues/2165","labels_url":"https://api.github.com/repos/syncthing/syncthing/issues/2165/labels{/name}","comments_url":"https://api.github.com/repos/syncthing/syncthing/issues/2165/comments","events_url":"https://api.github.com/repos/syncthing/syncthing/issues/2165/events","html_url":"https://github.com/syncthing/syncthing/issues/2165","id":101505219,"number":2165,"title":"Unit test staggered versioning","user":{"login":"Zillode","id":14169,"avatar_url":"https://avatars.githubusercontent.com/u/14169?v=3","gravatar_id":"","url":"https://api.github.com/users/Zillode","html_url":"https://github.com/Zillode","followers_url":"https://api.github.com/users/Zillode/followers","following_url":"https://api.github.com/users/Zillode/following{/other_user}","gists_url":"https://api.github.com/users/Zillode/gists{/gist_id}","starred_url":"https://api.github.com/users/Zillode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zillode/subscriptions","organizations_url":"https://api.github.com/users/Zillode/orgs","repos_url":"https://api.github.com/users/Zillode/repos","events_url":"https://api.github.com/users/Zillode/events{/privacy}","received_events_url":"https://api.github.com/users/Zillode/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-17T20:37:18Z","updated_at":"2015-08-18T19:41:08Z","closed_at":null,"body":"Implement unit test for staggered versioning, based on conversation on IRC:\r\n```\r\n22:25  emko> DEBUG: too many files in step -> delete /syncfolders/eewwe/.stversions/333~20150812-141528.txt\r\n22:25  emko> what does that mean?\r\n22:40  edrex> [0]Jmr: thanks for pointing me to openssl s_client -connect, just what I was looking for!\r\n22:41  edrex> I'm not having any trouble with local discovery, not sure what you meant there.\r\n22:47 @Zillode> emko: it means you ran out of the nr of 'used' files for staggered versioning\r\n23:17  emko> Zillode, how does that work?\r\n23:17  emko> i want to have versions of my edited files\r\n23:17  emko> and a version of a deleted file\r\n23:19  emko> so the number of used files is 1? it will only keep 1 inital version? whats the point of that\r\n23:20  emko> for example i created a file, then edited now i have 1 version plus the latest\r\n23:20  emko> i deleted this file\r\n23:21  emko> i end up with a the inital unedited file as a version\r\n23:51 @Zillode> emko: http://docs.syncthing.net/users/versioning.html#staggered-file-versioning\r\n23:51  emko> yes i read that\r\n23:51  emko> it does not do what it says\r\n23:52 @Zillode> what's your value?\r\n23:52  emko> 365\r\n23:52  emko> max age\r\n23:55 @Zillode> The following intervals are used: for the first hour a version is kept every 30 seconds, for the first day a version is kept every hour, for the\r\n                first 30 days a version is kept every day, until the maximum age a version is kept every week.\r\n23:55  emko> i only get 1 inital version and it does not change\r\n23:55 @Zillode> so that means i'll store at least one version per week if your changes happen after 30 days\r\n23:56 @Zillode> that could be a bug, although we have a unit test for that\r\n23:56 @Zillode> could you specify the sequence of actions to reproduce it?\r\n23:58  emko> for example  1. i create a txt file, i wait for it to sync over 2. i add some text, wait for the to sync 3. i see the OLD version is in the folder now\r\n             4. i update the text file again it gets synced but not versioned 5. i delete the file it gets synced and the version thats in the folder is still the\r\n             inital version\r\n23:59  emko> http://pastebin.com/raw.php?i=UWS3Np0k\r\n---\r\n2015-08-12 14:13:19,882 INFO success: syncthing entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2015-08-12 14:14:12,718 DEBG 'syncthing' stdout output: [YNQIN] 2015/08/12 14:14:12.717794 staggered.go:240: DEBUG: Waiting for lock on /syncfolders/eewwe/.stversions\r\n2015-08-12 14:14:12,718 DEBG 'syncthing' stdout output: [YNQIN] 2015/08/12 14:14:12.717920 staggered.go:248: DEBUG: not archiving nonexistent file /syncfolders/eewwe/333.txt\r\n2015-08-12 14:14:54,422 DEBG 'syncthing' stdout output: [YNQIN] 2015/08/12 14:14:54.422151 staggered.go:240: DEBUG: Waiting for lock on /syncfolders/eewwe/.stversions\r\n2015-08-12 14:14:54,422 DEBG 'syncthing' stdout output: [YNQIN] 2015/08/12 14:14:54.422293 staggered.go:268: DEBUG: archiving /syncfolders/eewwe/333.txt [YNQIN] 2015/08/12 14:14:54.422316 staggered.go:286: DEBUG: moving to /syncfolders/eewwe/.stversions/333~20150812-141454.txt\r\n2015-08-12 14:14:54,423 DEBG 'syncthing' stdout output: [YNQIN] 2015/08/12 14:14:54.423692 staggered.go:169: DEBUG: Versioner: Expiring versions [/syncfolders/eewwe/.stversions/333~20150812-141454.txt]\r\n2015-08-12 14:15:28,334 DEBG 'syncthing' stdout output: [YNQIN] 2015/08/12 14:15:28.334382 staggered.go:240: DEBUG: Waiting for lock on /syncfolders/eewwe/.stversions\r\n2015-08-12 14:15:28,335 DEBG 'syncthing' stdout output: [YNQIN] 2015/08/12 14:15:28.334547 staggered.go:268: DEBUG: archiving /syncfolders/eewwe/333.txt [YNQIN] 2015/08/12 14:15:28.334597 staggered.go:286: DEBUG: moving to /syncfolders/eewwe/.stversions/333~20150812-141528.txt\r\n2015-08-12 14:15:28,335 DEBG 'syncthing' stdout output: [YNQIN] 2015/08/12 14:15:28.335680 staggered.go:169: DEBUG: Versioner: Expiring versions [/syncfolders/eewwe/.stversions/333~20150812-141454.txt /syncfolders/eewwe/.stversions/333~20150812-141528.txt]\r\n2015-08-12 14:15:28,336 DEBG 'syncthing' stdout output: [YNQIN] 2015/08/12 14:15:28.335929 staggered.go:223: DEBUG: too many files in step -> delete /syncfolders/eewwe/.stversions/333~20150812-141528.txt\r\n2015-08-12 14:16:43,927 DEBG 'syncthing' stdout output: [YNQIN] 2015/08/12 14:16:43.927619 staggered.go:240: DEBUG: Waiting for lock on /syncfolders/eewwe/.stversions\r\n2015-08-12 14:16:43,928 DEBG 'syncthing' stdout output: [YNQIN] 2015/08/12 14:16:43.927784 staggered.go:268: DEBUG: archiving /syncfolders/eewwe/333.txt [YNQIN] 2015/08/12 14:16:43.927802 staggered.go:286: DEBUG: moving to /syncfolders/eewwe/.stversions/333~20150812-141643.txt\r\n2015-08-12 14:16:43,929 DEBG 'syncthing' stdout output: [YNQIN] 2015/08/12 14:16:43.929086 staggered.go:169: DEBUG: Versioner: Expiring versions [/syncfolders/eewwe/.stversions/333~20150812-141454.txt /syncfolders/eewwe/.stversions/333~20150812-141643.txt]\r\n2015-08-12 14:16:43,929 DEBG 'syncthing' stdout output: [YNQIN] 2015/08/12 14:16:43.929338 staggered.go:223: DEBUG: too many files in step -> delete /syncfolders/eewwe/.stversions/333~20150812-141643.txt\r\n---\r\n23:59  emko> thats what syncthing is doing\r\n23:59 @[0]Jmr> so its\r\n23:59 @[0]Jmr> once every 30 seconds\r\n23:59 @[0]Jmr> and in your case its 25 seconds\r\n23:59 @Zillode> thanks, will have a look at it tomorrow\r\n23:59 @[0]Jmr> hence only one version is kept\r\nDay changed to 13 Aug 2015\r\n00:00 @[0]Jmr> ah no\r\n00:00 @[0]Jmr> its over 30 seconds sorry\r\n00:00  emko> i waited as long as i want still same\r\n00:00  emko> i delted still no deleted version\r\n00:00 @Zillode> night\r\n00:00  emko> thanks\r\n00:00  emko> night\r\n00:06 @[0]Jmr> we don't have tests for stagerred versioner\r\n00:07 @[0]Jmr> I've read the code and it's not obvious\r\n00:07 @[0]Jmr> you should probably compile your own version with the logs printing a bit more info\r\n00:13  emko> sorry i have no clue how to do that\r\n``"},"comment":{"url":"https://api.github.com/repos/syncthing/syncthing/issues/comments/132329045","html_url":"https://github.com/syncthing/syncthing/issues/2165#issuecomment-132329045","issue_url":"https://api.github.com/repos/syncthing/syncthing/issues/2165","id":132329045,"user":{"login":"AudriusButkevicius","id":1144861,"avatar_url":"https://avatars.githubusercontent.com/u/1144861?v=3","gravatar_id":"","url":"https://api.github.com/users/AudriusButkevicius","html_url":"https://github.com/AudriusButkevicius","followers_url":"https://api.github.com/users/AudriusButkevicius/followers","following_url":"https://api.github.com/users/AudriusButkevicius/following{/other_user}","gists_url":"https://api.github.com/users/AudriusButkevicius/gists{/gist_id}","starred_url":"https://api.github.com/users/AudriusButkevicius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AudriusButkevicius/subscriptions","organizations_url":"https://api.github.com/users/AudriusButkevicius/orgs","repos_url":"https://api.github.com/users/AudriusButkevicius/repos","events_url":"https://api.github.com/users/AudriusButkevicius/events{/privacy}","received_events_url":"https://api.github.com/users/AudriusButkevicius/received_events","type":"User","site_admin":false},"created_at":"2015-08-18T19:41:08Z","updated_at":"2015-08-18T19:41:08Z","body":"So I ran tests with the exact values the guy had at the time (from the debug output), and could not repro it."}}