myreplicator 1.1.49 → 1.1.50
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.
- data/app/controllers/myreplicator/exports_controller.rb +7 -0
- data/app/models/myreplicator/export.rb +23 -3
- data/app/views/myreplicator/exports/index.html.erb +4 -0
- data/config/routes.rb +6 -0
- data/lib/exporter/export_metadata.rb +1 -0
- data/lib/myreplicator/version.rb +1 -1
- data/lib/transporter/transporter.rb +2 -1
- data/test/dummy/log/development.log +20121 -0
- data/test/dummy/tmp/cache/assets/C92/350/sprockets%2F147976739b994ea0e5833048aebc5447 +0 -0
- data/test/dummy/tmp/cache/assets/CE8/5A0/sprockets%2F7367c62ac3a27578b50b924e2fe8b746 +0 -0
- data/test/dummy/tmp/pids/server.pid +1 -0
- metadata +10 -4
@@ -97,6 +97,13 @@ module Myreplicator
|
|
97
97
|
format.json { head :no_content }
|
98
98
|
end
|
99
99
|
end
|
100
|
+
|
101
|
+
def reload
|
102
|
+
@export = Export.find(params[:id])
|
103
|
+
flash[:notice] = "'#{@export.destination_schema}.#{@export.table_name}' is reloading"
|
104
|
+
@export.reload
|
105
|
+
redirect_to :action => 'show'
|
106
|
+
end
|
100
107
|
|
101
108
|
private
|
102
109
|
|
@@ -44,10 +44,30 @@ module Myreplicator
|
|
44
44
|
export_obj.export
|
45
45
|
end
|
46
46
|
|
47
|
-
|
47
|
+
end
|
48
48
|
|
49
|
-
|
50
|
-
|
49
|
+
def reload
|
50
|
+
Log.run(:job_type => "export", :name => schedule_name,
|
51
|
+
:file => filename, :export_id => id) do |log|
|
52
|
+
# TRUNCATE TABLE & Rest incremental value if there is any
|
53
|
+
sql = "TRUNCATE TABLE '#{@export.destination_schema}'.'#{@export.table_name}';"
|
54
|
+
if self.export_to == "vertica"
|
55
|
+
Myreplicator::DB.exec_sql("vertica",sql)
|
56
|
+
else
|
57
|
+
Myreplicator::DB.exec_sql("#{@export.destination_schema}",sql)
|
58
|
+
end
|
59
|
+
|
60
|
+
if self.export_type != "all"
|
61
|
+
self.max_incremental_value = nil
|
62
|
+
self.save!
|
63
|
+
end
|
64
|
+
|
65
|
+
exporter = MysqlExporter.new
|
66
|
+
exporter.export_table self # pass current object to exporter
|
67
|
+
end
|
68
|
+
end
|
69
|
+
##
|
70
|
+
# Runs the export process using the required Exporter library
|
51
71
|
##
|
52
72
|
def export
|
53
73
|
Log.run(:job_type => "export", :name => schedule_name,
|
@@ -19,6 +19,7 @@
|
|
19
19
|
<th><%= sortable "s3_path" %></th>
|
20
20
|
<th><%= sortable "cron" %></th>
|
21
21
|
<th class="center">Actions</th>
|
22
|
+
<th class="center">Utils</th>
|
22
23
|
</tr>
|
23
24
|
</thead>
|
24
25
|
<tbody>
|
@@ -40,6 +41,9 @@
|
|
40
41
|
<%= link_to 'edit', edit_export_path(export), :class => 'action edit' %>
|
41
42
|
<%= link_to 'destroy', export, method: :delete, data: { confirm: 'Are you sure?' }, :class=> 'action delete' %>
|
42
43
|
</td>
|
44
|
+
<td>
|
45
|
+
<%= link_to 'reload', reload_export_path(export), :class=> 'action edit' %>
|
46
|
+
</td>
|
43
47
|
</tr>
|
44
48
|
<% end %>
|
45
49
|
</tbody>
|
data/config/routes.rb
CHANGED
@@ -191,6 +191,7 @@ module Myreplicator
|
|
191
191
|
# Echo is used for writing the file
|
192
192
|
##
|
193
193
|
def store!
|
194
|
+
Kernel.p "$$$$$$$$$$$$$$$$$$ @ssh CHECK $$$$$$$$$$$$$$$$$$"
|
194
195
|
cmd = "echo \"#{self.to_json.gsub("\"","\\\\\"")}\" > #{@filepath}.json"
|
195
196
|
puts cmd
|
196
197
|
result = @ssh.exec!(cmd)
|
data/lib/myreplicator/version.rb
CHANGED
@@ -40,7 +40,7 @@ module Myreplicator
|
|
40
40
|
# downloads export files concurrently from multiple sources
|
41
41
|
##
|
42
42
|
def self.transfer
|
43
|
-
unique_jobs = Export.where("active = 1").group("source_schema")
|
43
|
+
unique_jobs = Myreplicator::Export.where("active = 1").group("source_schema")
|
44
44
|
Kernel.p "===== unique_jobs ====="
|
45
45
|
Kernel.p unique_jobs
|
46
46
|
unique_jobs.each do |export|
|
@@ -246,6 +246,7 @@ module Myreplicator
|
|
246
246
|
Kernel.p "===== export ====="
|
247
247
|
Kernel.p export
|
248
248
|
cmd = "cd #{Myreplicator.configs[export.source_schema]["ssh_tmp_dir"]}; grep -ls export_completed *.json"
|
249
|
+
return cmd
|
249
250
|
end
|
250
251
|
|
251
252
|
end
|