mysql_manager 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/mysql_manager/command_line.rb +2 -1
- data/lib/mysql_manager/utilities.rb +9 -4
- data/lib/mysql_manager/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53a27ba7825f89239352f0fe6e2abcfae91f0e08
|
4
|
+
data.tar.gz: 19512d7cd7494684d3625a181df610df15437246
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fbca20aa0f85a19beea1e114e8f2afb40d40ca1f897b51cc7e943e4155c2d631c89001655373b09e33bc44e6ebe01f483540d447e1a70d7a24b4814c9a4c06c
|
7
|
+
data.tar.gz: 210ea7bb118d109e2df0d097c6f7ab6fc1931662324565151b14275339e6c9f44e66eb6f7c98844c822e6bf51714734fdc2a03bf130b5911c0df664227f4e173
|
@@ -234,6 +234,10 @@ module MysqlManager
|
|
234
234
|
raise FileNotFoundException.new("Unable to open mysql data dir #{options[:data_dir]}")
|
235
235
|
end
|
236
236
|
|
237
|
+
# test connection
|
238
|
+
@log.info("Testing connection...")
|
239
|
+
@dbh.do("SELECT 1") unless @dry_run
|
240
|
+
|
237
241
|
rsync = []
|
238
242
|
rsync << options[:rsync_bin]
|
239
243
|
rsync << options[:rsync_args]
|
@@ -243,7 +247,7 @@ module MysqlManager
|
|
243
247
|
# create target directory if it does not already exist
|
244
248
|
unless File.directory?(options[:backup_dir])
|
245
249
|
@log.info("Creating #{options[:backup_dir]}")
|
246
|
-
run ['mkdir', '-p', options[:backup_dir]]
|
250
|
+
run ['mkdir', '-p', options[:backup_dir]] unless @dry_run
|
247
251
|
end
|
248
252
|
|
249
253
|
rsync.flatten!
|
@@ -253,7 +257,7 @@ module MysqlManager
|
|
253
257
|
while t_rsync_elapsed > options[:rsync_ttl]
|
254
258
|
# first do a raw rsync without table locks
|
255
259
|
@log.info("Performing first-pass rsync without table locks")
|
256
|
-
run rsync
|
260
|
+
run rsync unless @dry_run
|
257
261
|
t_rsync_elapsed = Time.now.to_f - t_rsync
|
258
262
|
@log.info("Rsync took #{t_rsync_elapsed} seconds")
|
259
263
|
sleep 1
|
@@ -267,17 +271,18 @@ module MysqlManager
|
|
267
271
|
|
268
272
|
# re-sync the delats
|
269
273
|
@log.info("Performing second-pass rsync with table locks")
|
270
|
-
run rsync
|
274
|
+
run rsync unless @dry_run
|
271
275
|
|
272
276
|
# release locks
|
273
277
|
@log.info("Unlocking tables")
|
274
|
-
@dbh.do('UNLOCK TABLES')
|
278
|
+
@dbh.do('UNLOCK TABLES') unless @dry_run
|
275
279
|
@log.info("Total lock time #{Time.now.to_f - t_lock} seconds")
|
276
280
|
@log.info("Total elapsed time #{Time.now.to_f - t_start} seconds")
|
277
281
|
|
278
282
|
rescue DBI::DatabaseError => e
|
279
283
|
@log.debug(@dbh.last_statement)
|
280
284
|
@log.warn(e.message)
|
285
|
+
exit(1)
|
281
286
|
end
|
282
287
|
end
|
283
288
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mysql_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erik Osterman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parseconfig
|