Bug in archive file type handling

ServerAutomaticArchive::getNonArchivedFileBackup in urbackupserver\server_archive.cpp has its ‘incremental’ test backwards, I think:

if(backup_types & backup_type_full_file && backup_types & backup_type_incr_file)
    incremental="";
else if( backup_types & backup_type_full_file )
    incremental=" AND incremental<>0";
else if( backup_types & backup_type_incr_file)
    incremental=" AND incremental=0";

IQuery *q_get_backups=db->Prepare("SELECT id FROM backups WHERE complete=1 AND archived=0 AND clientid=?"+incremental+" ORDER BY backuptime DESC LIMIT 1");

Those last two assignments to incremental should be swapped. As it is, if I specify an archive type of incr_file, then only the full file backups get archived, and vice versa.

I noticed this trying to set up an archive scheme where I keep a couple weeks of daily incr file backups, then weekly incr backups for a couple months, then monthly full file backups for 6 months. I’m doing that by keeping a max of 6 full file backups, taken every 30 days and not archived, and keeping a max of only 3 incr file backups, taken every 24 hours, but adding 2 archive rules, “Archive every 1 day, archive for 2 weeks, archive window = ;;;” and “Archive every 6 days, archive for 1 month, archive window = ;;*;0”. I want those rules to apply to just the incremental file backups, but I currently have to set Backup Type to “Full file backup” to get what I want.

Thanks! You’ll have to switch it around again with the next version. So that was the reason for Archiving - optron do not work