Page 1 of 1

Backup does not complete

Posted: Sun Dec 06, 2020 3:47 am
by captquirk
If your website has abnormally large pages, it is possible that a database backup may not complete. There will be an entry in your error log mentioning running out of memory.
Because the backup groups several table rows for efficiency, large pages can cause a transaction to be too big to handle.
This can be fixed.
In admin/db_backup.php, about lines 230-240 (depending on version), you will find:

Code: Select all

                    // HERE WE CONTROL THE SIZE OF $vals --- LIMIT INSERTS TO
                    // 15000 ROWS, 1500 ROWS FOR THE `links` TABLE
                    if ($z == 15000 || (substr($table, strlen($table)-5) == "links"
                        && $z == 1500)

Where you see "&& $z == 1500)", reduce the "1500" to a smaller number. Keep reducing the number until a backup completes. I've seen it necessary to go to as low as 15 for some very large pages. It is theoretically possible to have pages so large that even that won't work. Then the only solution would be to reduce page size.