Restore is not loading complete cdr

I am migrating an existing install to new hardware for better performance. I backed up on the old server and restored on the new one. Everything went well, no errors while restoring. But when I try to get a CDR report I did not see any recent calls. I went into the database and can only see about half of the 11 million records that are in the original database. I uncompressed the backup file and the cdr.sql file does have all records, it simply only imported half of them into the database. The cdr.sql file is about 3.8GB

Both servers are running Freepbx 16 with all the latest updates. The new server has 32GB of ram and an SSD so performance should not be a problem.

How can I make sure these big SQL files get imported completely? What do I need to modify in the configuration? Is this a Mariadb issue or an issue with the Restore module in Freepbx?

Upgrade from FreePBX 13 to 17. CDR db size - 7,4 GB.

/usr/sbin/fwconsole backup --restore=‘/var/spool/asterisk/backup/uploads/20-xxx.tgz’

Determining backup file type...type is legacy
Legacy CDR Restore Option: 0 
Starting restore job with file: /var/spool/asterisk/backup/uploads/20-xxx.tgz
Extracting backup...
Loading manifest to memory
Parsing out SQL tables. This may take a moment depending on backup size.
Found 1 database files in the backup.
File named: /tmp/backup/11e6d8b0-59e9-4899-a585-e5326685dc5d/mysql-4.sql.gz
Restore completed successfully

/tmp/backup# gunzip < /tmp/backup/11e6d8b0-59e9-4899-a585-e5326685dc5d/mysql-4.sql.gz | pv --bytes --eta --progress | mysql -u UserName -pPassword asteriskcdrdb

Result: The database has been copied. But maybe additional processing should have been performed there?

Hi @sppFP

Determining backup file type...type is legacy
Legacy CDR Restore Option: 0 

Looks like you have not added the “–restorelegacycdr” option while restoring.

Give a try with “–restorelegacycdr” option like below .

fwconsole backup --restore [/path/to/restore-xxxxxx.tar.gz] --restorelegacycdr
1 Like

Maybe we can make an automatic determination of the need for such a parameter?

Determining backup file type...type is **legacy**

Ok. Set legacy mode

Legacy CDR Restore Option: 1

For what reason should this be done forcibly?

You should always tell it if you have legacy cdrs that need to be restored. There are changes to the table that the module will make during the process with that option enabled.