myreplicator 1.1.23 → 1.1.24

Sign up to get free protection for your applications and to get access to all the features.
data/lib/loader/loader.rb CHANGED
@@ -317,24 +317,11 @@ module Myreplicator
317
317
  result = []
318
318
  #Kernel.p files
319
319
  files.each do |file|
320
- #puts "<<<<<<<<<<<<<<<<"
321
320
  job = Export.where("id = #{file.export_id}").first
322
- #puts "<<<<<<<<<<<<<<<<"
323
- #Kernel.p job
324
- #puts "<<<<<<<<<<<<<<<<"
325
- #puts "&&&&&&&&&&&&&&&&&&&&&&&&&&"
326
- #Kernel.p file
327
- #puts "&&&&&&&&&&&&&&&&&&&&&&&&&&"
328
321
  #if job.state == "transport_completed"
329
322
  result << file
330
323
  #end
331
- #puts "^^^^^^^^^^^^^^^^^^^^^^^^^^"
332
- #Kernel.p result
333
- #puts "^^^^^^^^^^^^^^^^^^^^^^^^^^"
334
324
  end
335
- #puts "<<<<<<<<<<<<<<<<"
336
-
337
- #puts "<<<<<<<<<<<<<<<<"
338
325
  return result
339
326
  end
340
327
 
@@ -359,13 +359,24 @@ module Myreplicator
359
359
  begin
360
360
  result = `#{cmd} 2>&1`
361
361
  if result[0..4] == "ERROR"
362
- Loader.cleanup metadata
363
- sql = "DROP TABLE IF EXISTS #{options[:db]}.#{options[:destination_schema]}.#{options[:temp_table]} CASCADE;"
364
- Kernel.p "===== DROP CMD ====="
365
- Kernel.p sql
366
- #VerticaDb::Base.connection.execute sql
367
- Myreplicator::DB.exec_sql("vertica",sql)
368
- raise result
362
+ if result[0..9] == "ERROR 4115"
363
+ # drop the current table. In the next run the table will be re-created and COPY is used to load data into it
364
+ sql = "DROP TABLE IF EXISTS #{options[:db]}.#{options[:destination_schema]}.#{options[:table]} CASCADE;"
365
+ Kernel.p "===== DROP CMD ====="
366
+ Kernel.p sql
367
+ Myreplicator::DB.exec_sql("vertica",sql)
368
+ sql = "ALTER TABLE #{options[:db]}.#{options[:destination_schema]}.#{options[:temp_table]} RENAME TO #{options[:table]};"
369
+ Kernel.p sql
370
+ Myreplicator::DB.exec_sql("vertica",sql)
371
+ else
372
+ Loader.cleanup metadata
373
+ sql = "DROP TABLE IF EXISTS #{options[:db]}.#{options[:destination_schema]}.#{options[:temp_table]} CASCADE;"
374
+ Kernel.p "===== DROP CMD ====="
375
+ Kernel.p sql
376
+ #VerticaDb::Base.connection.execute sql
377
+ Myreplicator::DB.exec_sql("vertica",sql)
378
+ raise result
379
+ end
369
380
  end
370
381
  rescue Exception => e
371
382
  raise e.message
@@ -1,3 +1,3 @@
1
1
  module Myreplicator
2
- VERSION = "1.1.23"
2
+ VERSION = "1.1.24"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myreplicator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.23
4
+ version: 1.1.24
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-04 00:00:00.000000000 Z
12
+ date: 2013-04-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -358,7 +358,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
358
358
  version: '0'
359
359
  segments:
360
360
  - 0
361
- hash: 1068280680922519880
361
+ hash: 2030272711464716021
362
362
  required_rubygems_version: !ruby/object:Gem::Requirement
363
363
  none: false
364
364
  requirements:
@@ -367,7 +367,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
367
367
  version: '0'
368
368
  segments:
369
369
  - 0
370
- hash: 1068280680922519880
370
+ hash: 2030272711464716021
371
371
  requirements: []
372
372
  rubyforge_project:
373
373
  rubygems_version: 1.8.24