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

Support for DB Restore from Object Stores #17791

Merged
merged 4 commits into from
Aug 2, 2018
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/evm_database_ops.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ def self.restore(db_opts, connect_opts = {})
# :username => 'samba_one',
# :password => 'Zug-drep5s',

uri = with_mount_session(:restore, db_opts, connect_opts) do |database_opts, _session, _remote_file_uri|
uri = with_mount_session(:restore, db_opts, connect_opts) do |database_opts, session, _remote_file_uri|
database_opts[:local_file] = session.download(database_opts[:local_file], connect_opts[:remote_file_name]) if session
Copy link
Member

Choose a reason for hiding this comment

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

I think connect_opts[:remote_file_name] here can just be the yielded remote_file_uri

prepare_for_restore(database_opts[:local_file])

# remove all the connections before we restore; AR will reconnect on the next query
Expand All @@ -110,6 +111,7 @@ def self.restore(db_opts, connect_opts = {})
if db_opts[:local_file].nil?
if action == :restore
uri = connect_opts[:uri]
connect_opts[:remote_file_name] ||= connect_opts[:uri]
Copy link
Member

Choose a reason for hiding this comment

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

I think we can remove this and use uri (remote_file_uri) in the block, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes! I knew there was something we changed that could handle that. Thanks. Changing now.

connect_opts[:uri] = File.dirname(connect_opts[:uri])
else
connect_opts[:remote_file_name] ||= File.basename(backup_file_name(action))
Expand Down