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

Fixes #26017 - treat tar packing response code 1 as success #253

Merged

Conversation

pmoravec
Copy link
Contributor

@pmoravec pmoravec commented Apr 1, 2019

During online backup, tar packages files changing on the fly.
It returns 1 if detecting so, while this is not a fatal error
for the backup. Therefore we should treat response code 1 as
success.

Signed-off-by: Pavel Moravec pmoravec@redhat.com

@theforeman-bot
Copy link
Member

Issues: #26017

@pmoravec
Copy link
Contributor Author

pmoravec commented Apr 1, 2019

Thanks @mbacovsky for the original idea.

@@ -20,7 +20,7 @@ def run
configs = config_files.join(' ')
execute!("tar --selinux --create --gzip --file=#{tarball} " \
"--listed-incremental=#{increments} --ignore-failed-read " \
"#{configs}")
"#{configs}", :valid_exit_statuses => [0, 1])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pmoravec Is it safe? I don't care much about online backup. But it could let some inconsistency sneak in offline backup. I guess that doing config backup after we stop services (#248) might help but still there is a chance of something unexpected.
Could we make this change optional by a new parameter that is set for online backups only?
Does it make sense or I'm I too paranoid?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes sense to be tolerant to changed configs only on online backups - will update the PR.

(that's why I am not a great developer, I fix just my (broken) call flow)

@pmoravec pmoravec force-pushed the online_backup_tar_return_code_1_is_ok branch from ba99f74 to 22e1c49 Compare April 3, 2019 15:05
@pmoravec
Copy link
Contributor Author

pmoravec commented Apr 3, 2019

PR updated.

@pmoravec
Copy link
Contributor Author

Anything is pending here, @mbacovsky ?

I see similar problem (online backup fails the same way) in #248 is fixed, so let merge this one as well to have this kind of issues (and rhbz 1673908) resolved :) .

@mbacovsky
Copy link
Member

mbacovsky commented May 17, 2019

@pmoravec thanks for the update. As we discussed outside of this thread, this could be pushed a bit and have the procedure independent on the strategy parameter. With #248 merged it should be easy to do, I'll put some hints inline.

@@ -11,16 +11,18 @@ class ConfigFiles < ForemanMaintain::Procedure
param :backup_dir, 'Directory where to backup to', :required => true
param :proxy_features, 'List of proxy features to backup (default: all)',
:array => true, :default => ['all']
param :strategy, 'Backup strategy'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be renamed to :ignore_changed_files or similar with :flag => true, :default => false options

@@ -69,6 +69,8 @@ def set_context_mapping
Procedures::Backup::Metadata => :incremental_dir)
context.map(:proxy_features,
Procedures::Backup::ConfigFiles => :proxy_features)
context.map(:strategy,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The context map should be replaced by passing the :ignore_changed_files param in compose e.g.

add_step_with_context(Procedures::Backup::ConfigFiles, :ignore_changed_files => true)

in add_online_backup_steps.

@pmoravec pmoravec force-pushed the online_backup_tar_return_code_1_is_ok branch 2 times, most recently from 2f98221 to 9666c8e Compare May 17, 2019 17:26
@theforeman-bot
Copy link
Member

There were the following issues with the commit message:

  • length of the first commit message line for 9666c8e exceeds 65 characters

If you don't have a ticket number, please create an issue in Redmine.

More guidelines are available in Coding Standards or on the Foreman wiki.


This message was auto-generated by Foreman's prprocessor

@pmoravec
Copy link
Contributor Author

Thanks for feedback, PR updated (and rebased to upstream to resolve conflicts with #248).

During online backup, tar packages files changing on the fly.
It returns 1 if detecting so, while this is not a fatal error
for the backup. Therefore we should treat response code 1 as
success.

Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
@pmoravec pmoravec force-pushed the online_backup_tar_return_code_1_is_ok branch from 8a2320e to fbb41a7 Compare May 17, 2019 17:39
Copy link
Member

@mbacovsky mbacovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done. It looks good to merge now. Thanks for all your effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants