myreplicator 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -30,7 +30,7 @@ module Myreplicator
|
|
30
30
|
elsif @export_obj.export_type? == :incremental or load_to == "vertica"
|
31
31
|
on_failure_state_trans(metadata, "failed") # Set state trans on failure
|
32
32
|
on_export_success(metadata)
|
33
|
-
|
33
|
+
incremental_export_into_outfile metadata
|
34
34
|
end
|
35
35
|
|
36
36
|
end # metadata
|
@@ -146,10 +146,13 @@ module Myreplicator
|
|
146
146
|
|
147
147
|
def incremental_export_into_outfile metadata
|
148
148
|
unless @export_obj.is_running?
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
149
|
+
|
150
|
+
if @export_obj.export_type == "incremental"
|
151
|
+
max_value = @export_obj.max_value
|
152
|
+
metadata.export_type = "incremental_outfile"
|
153
|
+
@export_obj.update_max_val if @export_obj.max_incremental_value.blank?
|
154
|
+
end
|
155
|
+
|
153
156
|
options = {
|
154
157
|
:db => @export_obj.source_schema,
|
155
158
|
:table => @export_obj.table_name,
|
@@ -167,25 +170,30 @@ module Myreplicator
|
|
167
170
|
puts "Exporting..."
|
168
171
|
result = execute_export(cmd, metadata)
|
169
172
|
check_result(result, 0)
|
170
|
-
|
171
|
-
@export_obj.
|
173
|
+
|
174
|
+
if @export_obj.export_type == "incremental"
|
175
|
+
metadata.incremental_val = max_value # store max val in metadata
|
176
|
+
@export_obj.update_max_val(max_value) # update max value if export was successful
|
177
|
+
end
|
172
178
|
end
|
179
|
+
|
173
180
|
return false
|
174
181
|
end
|
175
182
|
|
176
183
|
def self.compare_schemas vertica_schema, mysql_schema
|
177
184
|
if vertica_schema.size != mysql_schema.size
|
178
|
-
return {:changed => true,
|
185
|
+
return {:changed => true,
|
186
|
+
:mysql_schema => mysql_schema,
|
187
|
+
:vertica_schema => vertica_schema,
|
188
|
+
:new => false}
|
179
189
|
else
|
180
190
|
index = 0
|
181
191
|
while index < vertica_schema.size
|
182
|
-
# puts vertica_schema.rows[index][:column_name] + " " + mysql_schema[index]["column_name"]
|
183
192
|
# check for column name
|
184
193
|
if vertica_schema.rows[index][:column_name] != mysql_schema[index]["column_name"]
|
185
194
|
return true
|
186
195
|
end
|
187
196
|
|
188
|
-
# puts vertica_schema.rows[index][:data_type] + " " + VerticaTypes.convert(mysql_schema[index]["data_type"],mysql_schema[index]["column_type"])
|
189
197
|
# check for column's data type
|
190
198
|
if (vertica_schema.rows[index][:data_type] != VerticaTypes.convert(mysql_schema[index]["data_type"],mysql_schema[index]["column_type"]) and vertica_schema.rows[index][:data_type] != "timestamp")
|
191
199
|
return true
|
data/lib/myreplicator/version.rb
CHANGED
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.
|
4
|
+
version: 1.1.3
|
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-03-
|
12
|
+
date: 2013-03-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -370,7 +370,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
370
370
|
version: '0'
|
371
371
|
segments:
|
372
372
|
- 0
|
373
|
-
hash:
|
373
|
+
hash: 899144579806510491
|
374
374
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
375
375
|
none: false
|
376
376
|
requirements:
|
@@ -379,7 +379,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
379
379
|
version: '0'
|
380
380
|
segments:
|
381
381
|
- 0
|
382
|
-
hash:
|
382
|
+
hash: 899144579806510491
|
383
383
|
requirements: []
|
384
384
|
rubyforge_project:
|
385
385
|
rubygems_version: 1.8.23
|