PetaByet / cdp

Simple & Open Source Server Backups
https://cdp.me
GNU General Public License v2.0
122 stars 39 forks source link

Incremental backup would auto-delete full version backup #34

Open hiphiphip opened 9 years ago

hiphiphip commented 9 years ago

I setted a backup job to backup a folder about 3.4G, auto-delete was set to 30 days. But it didn't do a full backup every 30 days, all files under /var/www/files are small than 60M. There is no full version backup. I don't know how restore works but 30*60M < 3.4G I think it need to keep two full version backup to make it possible to restore to any given day within 30 days.

PetaByet commented 9 years ago

Could you provide the backup logs if you have them?

hiphiphip commented 9 years ago

I tried to reproduce this problem, need to wait a few days to know the results. May be caused by my deletion. After delete backups

                    foreach ($backups as $key => $backup) {
                        if ($backup['file'] == $_REQUEST['id']) {
                            unset($backups[$key]);
                        }
                    }
                    file_put_contents($config['path'] . '/db/db-backups.json', json_encode($backups));

This would turn

[{"id":"26dd99457553d087d4330a1a931ce694","file":"cdpme-2015-10-28-18-26-21-26dd99457553d087d4330a1a931ce694.tar.gz","size":29761524,"time":1446056781},{"id":"7c27e3a5d70f3f39793eb005deb1615b","file":"cdpme-2015-10-28-18-26-39-7c27e3a5d70f3f39793eb005deb1615b.tar.gz","size":123400,"time":1446056798}]

into

{"0":{"id":"26dd99457553d087d4330a1a931ce694","file":"cdpme-2015-10-28-18-26-21-26dd99457553d087d4330a1a931ce694.tar.gz","size":29761524,"time":1446056781}}

keys was added to jason files. That's why some records are missing, and some reasons are not in order. Add

$backups = array_values($backups);

before

file_put_contents($config['path'] . '/db/db-backups.json', json_encode($backups));

could solve this issue. The same situation may also occur when dbbackupjob/acl/user was deleted.

Another two issues:

hiphiphip commented 9 years ago

I setted a increamental backup keep for 3 days, still no full version archive. There is nothing in particular in /var/log/syslog. I could set a demo server for testing.