Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements for full backup and incremental backups #154

Open
MoonInsung opened this issue Apr 22, 2021 · 1 comment
Open

Improvements for full backup and incremental backups #154

MoonInsung opened this issue Apr 22, 2021 · 1 comment

Comments

@MoonInsung
Copy link
Contributor

What are the problems?

pg_rman follows the backup process when acquiring an incremental backup.

1. Find the last full backup.
2. Find the last incremental backup.

It finds the last full backup and incremental backup and checks if it is possible to acquire the current incremental backups.
However, if a physical backup file is deleted(rm command, etc.) other than the pg_rman delete command of pg_rman, It cannot find the correct status of a full backup and incremental backup.
An example is below.

currently backup status

12:03 INCREMENT BACKUP
12:02 FULL BACKUP
12:01 INCREMENTAL BACKUP
12:00 FULL BACKUP

If we delete 12:02 FULL BACKUP using the rm command, the following backup list is displayed.

12:03 INCREMENT BACKUP
12:01 INCREMENTAL BACKUP
12:00 FULL BACKUP

In this situation, if you try to acquire an incremental backup, it finds full backup at 12:00 and performs an incremental backup based on the backup at the last incremental backup 12:03.
However, the new incremental backup obtained is an abnormal backup file and becomes an unusable backup file.

Cause of the problem

pg_rman doesn't have any elements to show the chaining? between a full backup and incremental backup.
It is just a written timeline, lsn, and backup time at pgBackup structure.
Therefore, it is impossible to check whether the incremental and full backups are the correct set.

Solutions

So far, NO ideas are being considered.
I think it will improve it by adding something that can give the chaining? of each backup(full and incremental) to the structure of pgBackup.
However, if the solution is solved in this way, a problem may occur in which so cannot use the backup file obtained before the improvement.

Note

If the problem is improved by changing the structure, it would be good to add an option to check the crc for each backup file automatically.
In other words, when It is cannot use the backup file due to a physical issue of the hardware(disk err, etc.), it seems to be very convenient in terms of usability if an error of something is displayed.

any good ideas?

Best regards.
Moon.

@mikecaat
Copy link
Contributor

@MoonInsung

Thanks! I understood there are two problems.

(1) Some files are removed or corrupted in one backup generation after the generation is validated

Now, pg_rman has validation features, which are pg_rman's validate command and validation when restoring.
But, there is no feature detecting the deficits when taking a new incremental backup.
So, the incremental backup may be taken based on unusable backup, which was already validated once,
but some files are corrupted after that. This is the problem you point to.

One just idea is to add a new option to pg_rman's validate command.

Although now, validate command's target is unvalidated backup only,
the option changes the validation targets. For example,

$ pg_rman show
=====================================================================
 StartTime           EndTime              Mode    Size   TLI  Status
=====================================================================
2021-05-27 14:25:57  2021-05-27 14:25:59  INCR   33MB     1  OK
2021-05-27 11:18:13  2021-05-27 11:18:16  INCR   23MB     1 OK
2021-05-27 10:18:11  2021-05-27 10:18:16  INCR   113MB     1  OK
2021-05-27 10:17:58  2021-05-27 10:18:00  FULL   519MB     1  OK
2021-05-27 10:01:18  2021-05-27 10:01:50  FULL   29MB     1  OK

# specify the validate backup version
$ pg_rman validate '2021-05-27 14:25:57'

# pg_rman validates all files of '2021-05-27 14:25:57' again.
# pg_rman validates all files of '2021-05-27 11:18:13' again.
# pg_rman validates all files of '2021-05-27 10:18:11' again.
# pg_rman validates all files of '2021-05-27 10:17:58' again.

# If backup data of '2021-05-27 10:18:11' was corrupted, users can see error messages like the following

The data of '2021-05-27 10:18:11'  is corrupted. Some backup generations are meaningless.
You must take a new full backup as soon as possible.

It's simpler and the performance impact to take the backup is less.
Users just execute validate command with the option after taking each incremental backup.

(2) Some backup generations are removed (due to an operation mistake).

Your example is easy to understand for this problem.

One just idea is adding a tracing backup chain feature.
But, It seems that pg_rman's data structure needs to be changed... So, before adding this feature,
do we need to add pg_rman's format versioning feature(#102) first?

Regards,

MoonInsung pushed a commit that referenced this issue May 28, 2021
* get the correct increment backup

Before, we actually got the  difference backup, not the incremental backup.
TO solve this probem ,revert #125.

However, if a physical backup file is deleted(rm command, etc.) other than the pg_rman delete command of pg_rman,
It cannot find the correct status of a full backup and incremental backup.(please refer to #154 to details)
WE will solve this problem, at the next major upgarde.

* Revert "get the correct increment backup"

* get the correct increment backup

Before, we actually got the  difference backup, not the incremental backup.
TO solve this probem ,revert #125.

However, if a physical backup file is deleted(rm command, etc.) other than the pg_rman delete command of pg_rman,
It cannot find the correct status of a full backup and incremental backup.(please refer to #154 to details)
WE will solve this problem, at the next major upgarde.

* add the regression test of increment backup

* add the regression test of increment backup

* add the comment

add the comment about the increment backup's problem

* Add a comment

Add a comment

* add the regression test of increment backup

* add the regression test of increment backup

add the regression test of increment backup

* add the comment

* add the regression test

* delete file

becaust upload the wrong place,delete it

* add the regression test

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Regression test command was  modified

* Regression test command was  modified

* Regression test command was modified
MoonInsung pushed a commit that referenced this issue May 28, 2021
* get the correct increment backup

Before, we actually got the  difference backup, not the incremental backup.
TO solve this probem ,revert #125.

However, if a physical backup file is deleted(rm command, etc.) other than the pg_rman delete command of pg_rman,
It cannot find the correct status of a full backup and incremental backup.(please refer to #154 to details)
WE will solve this problem, at the next major upgarde.

* Revert "get the correct increment backup"

* get the correct increment backup

Before, we actually got the  difference backup, not the incremental backup.
TO solve this probem ,revert #125.

However, if a physical backup file is deleted(rm command, etc.) other than the pg_rman delete command of pg_rman,
It cannot find the correct status of a full backup and incremental backup.(please refer to #154 to details)
WE will solve this problem, at the next major upgarde.

* add the regression test of increment backup

* add the regression test of increment backup

* add the comment

add the comment about the increment backup's problem

* Add a comment

Add a comment

* add the regression test of increment backup

* add the regression test of increment backup

add the regression test of increment backup

* add the comment

* add the regression test

* delete file

becaust upload the wrong place,delete it

* add the regression test

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Regression test command was  modified

* Regression test command was  modified

* Regression test command was modified
MoonInsung pushed a commit that referenced this issue May 28, 2021
* get the correct increment backup

Before, we actually got the  difference backup, not the incremental backup.
TO solve this probem ,revert #125.

However, if a physical backup file is deleted(rm command, etc.) other than the pg_rman delete command of pg_rman,
It cannot find the correct status of a full backup and incremental backup.(please refer to #154 to details)
WE will solve this problem, at the next major upgarde.

* Revert "get the correct increment backup"

* get the correct increment backup

Before, we actually got the  difference backup, not the incremental backup.
TO solve this probem ,revert #125.

However, if a physical backup file is deleted(rm command, etc.) other than the pg_rman delete command of pg_rman,
It cannot find the correct status of a full backup and incremental backup.(please refer to #154 to details)
WE will solve this problem, at the next major upgarde.

* add the regression test of increment backup

* add the regression test of increment backup

* add the comment

add the comment about the increment backup's problem

* Add a comment

Add a comment

* add the regression test of increment backup

* add the regression test of increment backup

add the regression test of increment backup

* add the comment

* add the regression test

* delete file

becaust upload the wrong place,delete it

* add the regression test

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Regression test command was  modified

* Regression test command was  modified

* Regression test command was modified
MoonInsung pushed a commit that referenced this issue May 28, 2021
* get the correct increment backup

Before, we actually got the  difference backup, not the incremental backup.
TO solve this probem ,revert #125.

However, if a physical backup file is deleted(rm command, etc.) other than the pg_rman delete command of pg_rman,
It cannot find the correct status of a full backup and incremental backup.(please refer to #154 to details)
WE will solve this problem, at the next major upgarde.

* Revert "get the correct increment backup"

* get the correct increment backup

Before, we actually got the  difference backup, not the incremental backup.
TO solve this probem ,revert #125.

However, if a physical backup file is deleted(rm command, etc.) other than the pg_rman delete command of pg_rman,
It cannot find the correct status of a full backup and incremental backup.(please refer to #154 to details)
WE will solve this problem, at the next major upgarde.

* add the regression test of increment backup

* add the regression test of increment backup

* add the comment

add the comment about the increment backup's problem

* Add a comment

Add a comment

* add the regression test of increment backup

* add the regression test of increment backup

add the regression test of increment backup

* add the comment

* add the regression test

* delete file

becaust upload the wrong place,delete it

* add the regression test

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Regression test command was  modified

* Regression test command was  modified

* Regression test command was modified
MoonInsung pushed a commit that referenced this issue May 28, 2021
* get the correct increment backup

Before, we actually got the  difference backup, not the incremental backup.
TO solve this probem ,revert #125.

However, if a physical backup file is deleted(rm command, etc.) other than the pg_rman delete command of pg_rman,
It cannot find the correct status of a full backup and incremental backup.(please refer to #154 to details)
WE will solve this problem, at the next major upgarde.

* Revert "get the correct increment backup"

* get the correct increment backup

Before, we actually got the  difference backup, not the incremental backup.
TO solve this probem ,revert #125.

However, if a physical backup file is deleted(rm command, etc.) other than the pg_rman delete command of pg_rman,
It cannot find the correct status of a full backup and incremental backup.(please refer to #154 to details)
WE will solve this problem, at the next major upgarde.

* add the regression test of increment backup

* add the regression test of increment backup

* add the comment

add the comment about the increment backup's problem

* Add a comment

Add a comment

* add the regression test of increment backup

* add the regression test of increment backup

add the regression test of increment backup

* add the comment

* add the regression test

* delete file

becaust upload the wrong place,delete it

* add the regression test

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Regression test command was  modified

* Regression test command was  modified

* Regression test command was modified
MoonInsung pushed a commit that referenced this issue May 28, 2021
* get the correct increment backup

Before, we actually got the  difference backup, not the incremental backup.
TO solve this probem ,revert #125.

However, if a physical backup file is deleted(rm command, etc.) other than the pg_rman delete command of pg_rman,
It cannot find the correct status of a full backup and incremental backup.(please refer to #154 to details)
WE will solve this problem, at the next major upgarde.

* Revert "get the correct increment backup"

* get the correct increment backup

Before, we actually got the  difference backup, not the incremental backup.
TO solve this probem ,revert #125.

However, if a physical backup file is deleted(rm command, etc.) other than the pg_rman delete command of pg_rman,
It cannot find the correct status of a full backup and incremental backup.(please refer to #154 to details)
WE will solve this problem, at the next major upgarde.

* add the regression test of increment backup

* add the regression test of increment backup

* add the comment

add the comment about the increment backup's problem

* Add a comment

Add a comment

* add the regression test of increment backup

* add the regression test of increment backup

add the regression test of increment backup

* add the comment

* add the regression test

* delete file

becaust upload the wrong place,delete it

* add the regression test

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Regression test command was  modified

* Regression test command was  modified

* Regression test command was modified
MoonInsung pushed a commit that referenced this issue May 28, 2021
* get the correct increment backup

Before, we actually got the  difference backup, not the incremental backup.
TO solve this probem ,revert #125.

However, if a physical backup file is deleted(rm command, etc.) other than the pg_rman delete command of pg_rman,
It cannot find the correct status of a full backup and incremental backup.(please refer to #154 to details)
WE will solve this problem, at the next major upgarde.

* Revert "get the correct increment backup"

* get the correct increment backup

Before, we actually got the  difference backup, not the incremental backup.
TO solve this probem ,revert #125.

However, if a physical backup file is deleted(rm command, etc.) other than the pg_rman delete command of pg_rman,
It cannot find the correct status of a full backup and incremental backup.(please refer to #154 to details)
WE will solve this problem, at the next major upgarde.

* add the regression test of increment backup

* add the regression test of increment backup

* add the comment

add the comment about the increment backup's problem

* Add a comment

Add a comment

* add the regression test of increment backup

* add the regression test of increment backup

add the regression test of increment backup

* add the comment

* add the regression test

* delete file

becaust upload the wrong place,delete it

* add the regression test

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Reflected the comment

* Regression test command was  modified

* Regression test command was  modified

* Regression test command was modified
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants