Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1497858 - katello-restore is not properly restoring the incremental backup
katello-restore is not properly restoring the incremental backup
Status: CLOSED ERRATA
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Backup & Restore (Show other bugs)
6.2.12
All Linux
high Severity high (vote)
: 6.3.3
: Unused
Assigned To: Christine Fouant
Kedar Bidarkar
: Triaged
Depends On:
Blocks: 1316897
  Show dependency treegraph
 
Reported: 2017-10-02 17:51 EDT by Christian Marineau
Modified: 2018-08-22 16:07 EDT (History)
8 users (show)

See Also:
Fixed In Version: katello-3.4.5-19
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1596354 (view as bug list)
Environment:
Last Closed: 2018-08-22 16:07:08 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Satellite6 full and incremental restore logs (36.99 KB, text/plain)
2018-08-02 09:56 EDT, Kedar Bidarkar
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 3231031 None None None 2017-11-06 10:29 EST
Foreman Issue Tracker 23107 None None None 2018-04-03 12:15 EDT

  None (edit)
Description Christian Marineau 2017-10-02 17:51:18 EDT
Description of problem:
When restoring (using katello-restore) a full backup taken via katello-backup, the full backup is correctly restored. And according to the documentation, we should then re-run katello-restore for each incremental directory. 

Looking at the katello-restore script logic, we can see that reset_katello is run every time. This would drop the database and make them unusable after restoring an incremental.

This issue is happening with the offline backup, which is the default behavior of katello-backup.

Version-Release number of selected component (if applicable):
6.2

How reproducible:
100%

Steps to Reproduce:
1. Take a full backup
   # katello-backup /backup
  
2. Once the full backup is finished, run an incremental
   # katello-backup /backup --incremental /backup/katello-backup-2017-10-02T14\:13\:51-04\:00/

3. Restore the full backup
   # katello-restore /backup/katello-backup-2017-10-02T14\:13\:51-04\:00/

4. Restore the incremental backup
   # katello-restore /backup/katello-backup-2017-10-02T14\:40\:29-04\:00/

Actual results:
Broken postgresql database.

FATAL:  database "foreman" does not exist
DETAIL:  The database subdirectory "base/41146" is missing.
Run `$ bin/rake db:create db:migrate` to create your database (ActiveRecord::NoDatabaseError)

Expected results:
Have the full backup and incremental to get restored correctly in a consistent state.

Additional info:
When decompressing the database archive manually (pgsql_data.tar.gz) one after the other, the postgresql database is restored to a working state.
Comment 3 Christian Marineau 2017-11-03 07:59:15 EDT
Some additional information:
1. When the backup where created with the "--online-backup", as it takes database dumps, the restoration of incremental will be, in face, restoring a full database and thus the databases will be in a working state. However, the pulp filesystem will be inconsistent and broken.

2. In addition the the database, the pulp file system /var/lib/pulp is also suffering from being reset. Some directories are delete when the Satellite is reset, so the incremental will only restore some pieces and bits.
Comment 5 Christine Fouant 2018-04-03 12:15:51 EDT
Created redmine issue http://projects.theforeman.org/issues/23107 from this bug
Comment 17 Kedar Bidarkar 2018-08-02 09:54:08 EDT
Followed the below procedure to test and it works fine now.

1) satellite-backup -y /var/tmp/sat-content >> /var/log/satellite/backups.log 2>&1

2) satellite-backup -y /var/tmp/sat-content --incremental /var/tmp/sat-content/satellite-backup-20180801092000 >> /var/log/satellite/backups.log 2>&1

3) satellite-restore /var/tmp/sat-content/satellite-backup-20180801092000/

4) satellite-restore -i /var/tmp/sat-content/satellite-backup-20180801093900

Restored successfully and "hammer ping" working.

VERIFIED with Sat6.3.3 snap2.

Will attach some logs shortly.
Comment 18 Kedar Bidarkar 2018-08-02 09:56 EDT
Created attachment 1472709 [details]
Satellite6 full and incremental restore logs
Comment 20 errata-xmlrpc 2018-08-22 16:07:08 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:2550

Note You need to log in before you can comment on or make changes to this bug.