Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Commit

Permalink
Fix time deviation of mysql backup
Browse files Browse the repository at this point in the history
Change-Id: I44b35a35a1adb1c7e0778766894046f3957d206b
  • Loading branch information
felixhoo committed Mar 25, 2012
1 parent a3de99a commit ae48e35
Show file tree
Hide file tree
Showing 12 changed files with 7 additions and 5 deletions.
Binary file modified atmos/vendor/cache/vcap_services_base-0.1.8.gem
Binary file not shown.
8 changes: 5 additions & 3 deletions base/lib/base/backup.rb
Expand Up @@ -110,13 +110,15 @@ def start
echo "Backup is interrupted!"
end

def get_dump_path(name,mode=0)
def get_dump_path(name, options={})
name = name.sub(/^(mongodb|redis)-/,'')
mode = options[:mode] || 0
time = options[:time] || Time.now
case mode
when 1
File.join(@config['backup_base_dir'], 'backups', @config['service_name'],name, Time.new.to_i.to_s,@config['node_id'])
File.join(@config['backup_base_dir'], 'backups', @config['service_name'],name, time.to_i.to_s,@config['node_id'])
else
File.join(@config['backup_base_dir'], 'backups', @config['service_name'], name[0,2], name[2,2], name[4,2], name, Time.new.to_i.to_s)
File.join(@config['backup_base_dir'], 'backups', @config['service_name'], name[0,2], name[2,2], name[4,2], name, time.to_i.to_s)
end
end

Expand Down
Binary file modified filesystem/vendor/cache/vcap_services_base-0.1.8.gem
Binary file not shown.
Binary file modified mongodb/vendor/cache/vcap_services_base-0.1.8.gem
Binary file not shown.
4 changes: 2 additions & 2 deletions mysql/bin/mysql_backup
Expand Up @@ -81,11 +81,11 @@ class VCAP::Services::Mysql::Backup < VCAP::Services::Base::Backup
elsif SYSTEM_DB.include?(name)
# for system database, dir structure looks like \backups\<service-name>\
# <db-name>\<seconds_since_epoc>\<node_id>\<service specific data>
full_path = get_dump_path(name,1)
full_path = get_dump_path(name, :mode => 1, :time => ts)
else
# dir structure looks like \backups\<service-name>\<aa>\<bb>\<cc>\
# <aabbcc-rest-of-instance-guid>\<seconds_since_epoc>\<service specific data>
full_path = get_dump_path(name)
full_path = get_dump_path(name, :time => ts)
end
opts.merge!({:full_path => full_path})
# options substitution
Expand Down
Binary file modified mysql/vendor/cache/vcap_services_base-0.1.8.gem
Binary file not shown.
Binary file modified neo4j/vendor/cache/vcap_services_base-0.1.8.gem
Binary file not shown.
Binary file modified postgresql/vendor/cache/vcap_services_base-0.1.8.gem
Binary file not shown.
Binary file modified rabbit/vendor/cache/vcap_services_base-0.1.8.gem
Binary file not shown.
Binary file modified redis/vendor/cache/vcap_services_base-0.1.8.gem
Binary file not shown.
Binary file modified service_broker/vendor/cache/vcap_services_base-0.1.8.gem
Binary file not shown.
Binary file modified vblob/vendor/cache/vcap_services_base-0.1.8.gem
Binary file not shown.

0 comments on commit ae48e35

Please sign in to comment.