mysql_manager 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ddfdf7999bd970395137f8b591a7cc3da9e162a9
4
- data.tar.gz: 71d0566dd19f738740d337f1238245af0e3bfc6c
3
+ metadata.gz: 53a27ba7825f89239352f0fe6e2abcfae91f0e08
4
+ data.tar.gz: 19512d7cd7494684d3625a181df610df15437246
5
5
  SHA512:
6
- metadata.gz: b04e263394cbf87ed55bf4315f5a3817a2fe4ce17bb21744eb77f3fae0d25e7c331f073b874a64940687e7db1d728ea048999978782d818532c17ef915939e67
7
- data.tar.gz: 1e658cdfc31d688b6c06e8d63b73102c1f0ff9345a9abd365fd6552784d93e905715f44e194241c172d02ed788c96de453980db969b11227461d6b27d479f7ef
6
+ metadata.gz: 5fbca20aa0f85a19beea1e114e8f2afb40d40ca1f897b51cc7e943e4155c2d631c89001655373b09e33bc44e6ebe01f483540d447e1a70d7a24b4814c9a4c06c
7
+ data.tar.gz: 210ea7bb118d109e2df0d097c6f7ab6fc1931662324565151b14275339e6c9f44e66eb6f7c98844c822e6bf51714734fdc2a03bf130b5911c0df664227f4e173
@@ -283,7 +283,8 @@ module MysqlManager
283
283
  @log.info("Exiting")
284
284
  exit
285
285
  rescue Exception => e
286
- @log.fatal(e.message + e.backtrace.join("\n"))
286
+ #@log.fatal(e.message + "\n" + e.backtrace.join("\n"))
287
+ @log.fatal(e.message)
287
288
  exit(1)
288
289
  end
289
290
  end
@@ -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
 
@@ -18,5 +18,5 @@
18
18
  # along with MySQL Manager. If not, see <http://www.gnu.org/licenses/>.
19
19
  #
20
20
  module MysqlManager
21
- VERSION = "1.0.5"
21
+ VERSION = "1.0.6"
22
22
  end
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.5
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-25 00:00:00.000000000 Z
11
+ date: 2015-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parseconfig