myreplicator 1.1.7 → 1.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/myreplicator/exports_controller.rb +1 -4
- data/app/models/myreplicator/log.rb +1 -1
- data/lib/exporter/export_metadata.rb +10 -0
- data/lib/exporter/mysql_exporter.rb +44 -53
- data/lib/exporter/sql_commands.rb +8 -2
- data/lib/loader/loader.rb +55 -18
- data/lib/loader/vertica/vertica_loader.rb +242 -102
- data/lib/myreplicator/version.rb +1 -1
- data/test/dummy/log/development.log +272 -0
- metadata +4 -4
@@ -45,8 +45,6 @@ module Myreplicator
|
|
45
45
|
@dbs = get_dbs
|
46
46
|
@tables = db_metadata
|
47
47
|
@edit = true
|
48
|
-
|
49
|
-
Myreplicator::Export.schedule_in_resque # schedule in resque
|
50
48
|
end
|
51
49
|
|
52
50
|
# POST /exports
|
@@ -70,14 +68,13 @@ module Myreplicator
|
|
70
68
|
# PUT /exports/1.json
|
71
69
|
def update
|
72
70
|
@export = Export.find(params[:id])
|
73
|
-
Myreplicator::Export.schedule_in_resque # schedule in resque
|
74
|
-
|
75
71
|
@dbs = get_dbs
|
76
72
|
|
77
73
|
respond_to do |format|
|
78
74
|
if @export.update_attributes(params[:export])
|
79
75
|
format.html { redirect_to @export, notice: 'Export was successfully updated.' }
|
80
76
|
format.json { head :no_content }
|
77
|
+
Myreplicator::Export.schedule_in_resque # schedule in resque
|
81
78
|
else
|
82
79
|
format.html { render action: "edit" }
|
83
80
|
format.json { render json: @export.errors, status: :unprocessable_entity }
|
@@ -39,6 +39,16 @@ module Myreplicator
|
|
39
39
|
name = zipped ? "#{name}.gz" : name
|
40
40
|
return name
|
41
41
|
end
|
42
|
+
|
43
|
+
def metadata_filename
|
44
|
+
name = filepath.split("/").last
|
45
|
+
name += ".json"
|
46
|
+
return name
|
47
|
+
end
|
48
|
+
|
49
|
+
def metadata_filepath tmp_dir
|
50
|
+
File.join(tmp_dir, metadata_filename)
|
51
|
+
end
|
42
52
|
|
43
53
|
def destination_filepath tmp_dir
|
44
54
|
File.join(tmp_dir, filename)
|
@@ -27,7 +27,7 @@ module Myreplicator
|
|
27
27
|
on_failure_state_trans(metadata, "new") # If failed, go back to new
|
28
28
|
on_export_success(metadata)
|
29
29
|
initial_export metadata
|
30
|
-
elsif @export_obj.export_type? == :incremental
|
30
|
+
elsif @export_obj.export_type? == :incremental || 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
|
@@ -100,43 +100,6 @@ module Myreplicator
|
|
100
100
|
return cmd
|
101
101
|
end
|
102
102
|
|
103
|
-
##
|
104
|
-
# Exports table incrementally, using the incremental column specified
|
105
|
-
# If column is not specified, it will export the entire table
|
106
|
-
# Maximum value of the incremental column is recorded BEFORE export starts
|
107
|
-
##
|
108
|
-
|
109
|
-
def incremental_export metadata
|
110
|
-
unless @export_obj.is_running?
|
111
|
-
max_value = @export_obj.max_value
|
112
|
-
metadata.export_type = "incremental"
|
113
|
-
@export_obj.update_max_val if @export_obj.max_incremental_value.blank?
|
114
|
-
|
115
|
-
cmd = incremental_export_cmd
|
116
|
-
exporting_state_trans # mark exporting
|
117
|
-
puts "Exporting..."
|
118
|
-
result = execute_export(cmd, metadata)
|
119
|
-
check_result(result, 0)
|
120
|
-
metadata.incremental_val = max_value # store max val in metadata
|
121
|
-
@export_obj.update_max_val(max_value) # update max value if export was successful
|
122
|
-
end
|
123
|
-
return false
|
124
|
-
end
|
125
|
-
|
126
|
-
def incremental_export_cmd
|
127
|
-
sql = SqlCommands.export_sql(:db => @export_obj.source_schema,
|
128
|
-
:table => @export_obj.table_name,
|
129
|
-
:incremental_col => @export_obj.incremental_column,
|
130
|
-
:incremental_col_type => @export_obj.incremental_column_type,
|
131
|
-
:incremental_val => @export_obj.max_incremental_value)
|
132
|
-
|
133
|
-
cmd = SqlCommands.mysql_export(:db => @export_obj.source_schema,
|
134
|
-
:filepath => filepath,
|
135
|
-
:sql => sql)
|
136
|
-
|
137
|
-
return cmd
|
138
|
-
end
|
139
|
-
|
140
103
|
##
|
141
104
|
# Exports table incrementally, similar to incremental_export method
|
142
105
|
# Dumps file in tmp directory specified in myreplicator.yml
|
@@ -146,25 +109,33 @@ module Myreplicator
|
|
146
109
|
|
147
110
|
def incremental_export_into_outfile metadata
|
148
111
|
unless @export_obj.is_running?
|
149
|
-
|
112
|
+
|
150
113
|
if @export_obj.export_type == "incremental"
|
151
114
|
max_value = @export_obj.max_value
|
152
|
-
metadata.export_type = "
|
115
|
+
metadata.export_type = "incremental"
|
153
116
|
@export_obj.update_max_val if @export_obj.max_incremental_value.blank?
|
154
117
|
end
|
155
118
|
|
156
119
|
options = {
|
157
120
|
:db => @export_obj.source_schema,
|
121
|
+
:source_schema => @export_obj.source_schema,
|
158
122
|
:table => @export_obj.table_name,
|
159
123
|
:filepath => filepath,
|
160
124
|
:destination_schema => @export_obj.destination_schema}
|
161
125
|
|
162
|
-
|
126
|
+
schema_status = MysqlExporter.schema_changed?(options)
|
127
|
+
Kernel.p "===== schema_status ====="
|
128
|
+
Kernel.p schema_status
|
129
|
+
if schema_status[:changed] # && new?
|
130
|
+
metadata.export_type = "initial"
|
131
|
+
else
|
163
132
|
options[:incremental_col] = @export_obj.incremental_column
|
164
133
|
options[:incremental_col_type] = @export_obj.incremental_column_type
|
165
134
|
options[:incremental_val] = @export_obj.max_incremental_value
|
166
135
|
end
|
167
136
|
|
137
|
+
Kernel.p "===== incremental_export_into_outfile OPTIONS ====="
|
138
|
+
Kernel.p options
|
168
139
|
cmd = SqlCommands.mysql_export_outfile(options)
|
169
140
|
exporting_state_trans
|
170
141
|
puts "Exporting..."
|
@@ -181,11 +152,10 @@ module Myreplicator
|
|
181
152
|
end
|
182
153
|
|
183
154
|
def self.compare_schemas vertica_schema, mysql_schema
|
155
|
+
Kernel.p vertica_schema
|
156
|
+
Kernel.p mysql_schema
|
184
157
|
if vertica_schema.size != mysql_schema.size
|
185
|
-
return
|
186
|
-
:mysql_schema => mysql_schema,
|
187
|
-
:vertica_schema => vertica_schema,
|
188
|
-
:new => false}
|
158
|
+
return true
|
189
159
|
else
|
190
160
|
index = 0
|
191
161
|
while index < vertica_schema.size
|
@@ -195,7 +165,7 @@ module Myreplicator
|
|
195
165
|
end
|
196
166
|
|
197
167
|
# check for column's data type
|
198
|
-
if
|
168
|
+
if compare_datatypes index, vertica_schema, mysql_schema
|
199
169
|
return true
|
200
170
|
end
|
201
171
|
# and others ?? (PRIMARY, DEFAULT NULL, etc.)
|
@@ -205,7 +175,28 @@ module Myreplicator
|
|
205
175
|
return false
|
206
176
|
end
|
207
177
|
|
178
|
+
def self.compare_datatypes index, vertica_schema, mysql_schema
|
179
|
+
type = VerticaTypes.convert mysql_schema[index]["data_type"], mysql_schema[index]["column_type"]
|
180
|
+
if vertica_schema.rows[index][:data_type] != type
|
181
|
+
if vertica_schema.rows[index][:data_type] != "timestamp"
|
182
|
+
return true
|
183
|
+
end
|
184
|
+
return false
|
185
|
+
end
|
186
|
+
return false
|
187
|
+
end
|
188
|
+
|
189
|
+
def self.get_mysql_schema_rows mysql_schema
|
190
|
+
mysql_schema_simple_form = []
|
191
|
+
mysql_schema.each(:as => :hash) do |row|
|
192
|
+
puts row
|
193
|
+
mysql_schema_simple_form << row
|
194
|
+
end
|
195
|
+
return mysql_schema_simple_form
|
196
|
+
end
|
197
|
+
|
208
198
|
def self.schema_changed? options
|
199
|
+
Kernel.p "===== schema_changed? ====="
|
209
200
|
puts options
|
210
201
|
mysql_schema = Loader.mysql_table_definition(options)
|
211
202
|
vertica_schema = VerticaLoader.destination_table_vertica(options)
|
@@ -214,19 +205,19 @@ module Myreplicator
|
|
214
205
|
unless vertica_schema.size > 0
|
215
206
|
return {:changed => true, :mysql_schema => mysql_schema, :new => true}
|
216
207
|
end
|
217
|
-
|
208
|
+
Kernel.p "***** 1 *****"
|
218
209
|
# compare two schemas
|
219
|
-
mysql_schema_simple_form = []
|
220
|
-
mysql_schema.each(:as => :hash) do |row|
|
221
|
-
mysql_schema_simple_form << row
|
222
|
-
end
|
223
210
|
|
224
|
-
|
211
|
+
|
212
|
+
mysql_schema_2 = get_mysql_schema_rows mysql_schema
|
225
213
|
if compare_schemas(vertica_schema, mysql_schema_2)
|
214
|
+
Kernel.p "***** 2 *****"
|
226
215
|
result = {:changed => true, :mysql_schema => mysql_schema, :vertica_schema => vertica_schema,:new => false}
|
227
216
|
else
|
228
|
-
|
217
|
+
Kernel.p "***** 3 *****"
|
218
|
+
result = {:changed => false, :mysql_schema => mysql_schema}
|
229
219
|
end
|
220
|
+
Kernel.p result
|
230
221
|
return result
|
231
222
|
end
|
232
223
|
|
@@ -119,6 +119,8 @@ module Myreplicator
|
|
119
119
|
##
|
120
120
|
|
121
121
|
def self.get_outfile_sql options
|
122
|
+
Kernel.p "===== SELECT * INTO OUTFILE OPTIONS====="
|
123
|
+
Kernel.p options
|
122
124
|
sql = "SELECT * INTO OUTFILE '#{options[:filepath]}' "
|
123
125
|
|
124
126
|
sql += " FIELDS TERMINATED BY '\\0' ESCAPED BY '' OPTIONALLY ENCLOSED BY '\\\"' LINES TERMINATED BY '\\n'"
|
@@ -143,13 +145,17 @@ module Myreplicator
|
|
143
145
|
# Location of the output file needs to have 777 perms
|
144
146
|
##
|
145
147
|
def self.mysql_export_outfile *args
|
148
|
+
Kernel.p "===== mysql_export_outfile OPTIONS ====="
|
149
|
+
|
146
150
|
options = args.extract_options!
|
151
|
+
Kernel.p options
|
147
152
|
options.reverse_merge! :flags => []
|
148
|
-
db = options[:
|
153
|
+
db = options[:source_schema]
|
149
154
|
|
150
155
|
# Database host when ssh'ed into the db server
|
151
156
|
db_host = "127.0.0.1"
|
152
|
-
|
157
|
+
Kernel.p "===== mysql_export_outfile ssh_configs ====="
|
158
|
+
Kernel.p ssh_configs(db)
|
153
159
|
if !ssh_configs(db)["ssh_db_host"].blank?
|
154
160
|
db_host = ssh_configs(db)["ssh_db_host"]
|
155
161
|
elsif !db_configs(db)["host"].blank?
|
data/lib/loader/loader.rb
CHANGED
@@ -31,7 +31,7 @@ module Myreplicator
|
|
31
31
|
def self.load
|
32
32
|
initials = []
|
33
33
|
incrementals = []
|
34
|
-
all_files = Loader.metadata_files
|
34
|
+
all_files = Myreplicator::Loader.metadata_files
|
35
35
|
|
36
36
|
all_files.each do |m|
|
37
37
|
if m.export_type == "initial"
|
@@ -80,7 +80,11 @@ module Myreplicator
|
|
80
80
|
:export_id => metadata.export_id) do |log|
|
81
81
|
|
82
82
|
if Loader.transfer_completed? metadata
|
83
|
-
|
83
|
+
if metadata.export_to == "vertica"
|
84
|
+
Loader.incremental_load metadata
|
85
|
+
else
|
86
|
+
Loader.initial_load metadata
|
87
|
+
end
|
84
88
|
Loader.cleanup metadata
|
85
89
|
end
|
86
90
|
|
@@ -107,7 +111,7 @@ module Myreplicator
|
|
107
111
|
:file => metadata.filename,
|
108
112
|
:export_id => metadata.export_id) do |log|
|
109
113
|
|
110
|
-
if Loader.transfer_completed? metadata
|
114
|
+
if Loader.transfer_completed? metadata
|
111
115
|
Loader.incremental_load metadata
|
112
116
|
Loader.cleanup metadata
|
113
117
|
end
|
@@ -152,6 +156,7 @@ module Myreplicator
|
|
152
156
|
##
|
153
157
|
def self.initial_load metadata
|
154
158
|
exp = Export.find(metadata.export_id)
|
159
|
+
Kernel.p "===== unzip ====="
|
155
160
|
Loader.unzip(metadata.filename)
|
156
161
|
metadata.zipped = false
|
157
162
|
|
@@ -176,22 +181,16 @@ module Myreplicator
|
|
176
181
|
Loader.unzip(metadata.filename)
|
177
182
|
metadata.zipped = false
|
178
183
|
|
179
|
-
options = {:table_name => exp.table_name,
|
180
|
-
:
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
end
|
184
|
+
options = {:table_name => exp.table_name,
|
185
|
+
:db => exp.destination_schema,
|
186
|
+
:filepath => metadata.destination_filepath(tmp_dir),
|
187
|
+
:source_schema => exp.source_schema,
|
188
|
+
:fields_terminated_by => "\\0",
|
189
|
+
:lines_terminated_by => "\\n"}
|
186
190
|
|
187
191
|
case metadata.export_to
|
188
192
|
when "vertica"
|
189
|
-
options
|
190
|
-
:filepath => metadata.destination_filepath(tmp_dir), :source_schema => exp.source_schema, :export_id => metadata.export_id}
|
191
|
-
options[:destination_schema] = exp.destination_schema
|
192
|
-
Kernel.p "===== LOAD TO VERTICA ====="
|
193
|
-
Kernel.p options
|
194
|
-
Myreplicator::VerticaLoader.load options
|
193
|
+
Loader.load_to_vertica options, metadata, exp
|
195
194
|
when "mysql"
|
196
195
|
cmd = ImportSql.load_data_infile(options)
|
197
196
|
puts cmd
|
@@ -204,6 +203,25 @@ module Myreplicator
|
|
204
203
|
end #case
|
205
204
|
end
|
206
205
|
|
206
|
+
##
|
207
|
+
# Load to Vertica
|
208
|
+
##
|
209
|
+
def self.load_to_vertica options, metadata, exp
|
210
|
+
options = {:table_name => exp.table_name,
|
211
|
+
:db => ActiveRecord::Base.configurations["vertica"]["database"],
|
212
|
+
:filepath => metadata.destination_filepath(tmp_dir),
|
213
|
+
:source_schema => exp.source_schema, :export_id => metadata.export_id,
|
214
|
+
:metadata => metadata
|
215
|
+
}
|
216
|
+
|
217
|
+
options[:destination_schema] = exp.destination_schema
|
218
|
+
|
219
|
+
result = Myreplicator::VerticaLoader.load options
|
220
|
+
|
221
|
+
##TO DO: Handle unsuccessful vertica loads here
|
222
|
+
|
223
|
+
end
|
224
|
+
|
207
225
|
##
|
208
226
|
# Returns true if the transfer of the file
|
209
227
|
# being loaded is completed
|
@@ -222,7 +240,7 @@ module Myreplicator
|
|
222
240
|
##
|
223
241
|
def self.cleanup metadata
|
224
242
|
puts "Cleaning up..."
|
225
|
-
FileUtils.rm
|
243
|
+
FileUtils.rm metadata.metadata_filepath(tmp_dir) # json file
|
226
244
|
FileUtils.rm metadata.destination_filepath(tmp_dir) # dump file
|
227
245
|
end
|
228
246
|
|
@@ -259,8 +277,27 @@ module Myreplicator
|
|
259
277
|
return files
|
260
278
|
end
|
261
279
|
|
280
|
+
##
|
281
|
+
# Clears files that are older than the passed metadata file.
|
282
|
+
# Note: This methoded is provided to ensure no old incremental files
|
283
|
+
# ever get loaded after the schema change algorithm has been applied
|
284
|
+
##
|
285
|
+
def self.clear_older_files metadata
|
286
|
+
files = Loader.metadata_files
|
287
|
+
Kernel.p "===== clear old files ====="
|
288
|
+
Kernel.p metadata
|
289
|
+
Kernel.p files
|
290
|
+
max_date = DateTime.strptime metadata.export_time
|
291
|
+
files.each do |m|
|
292
|
+
if metadata.export_id == m.export_id
|
293
|
+
if max_date > DateTime.strptime(m.export_time)
|
294
|
+
Loader.cleanup m if metadata.filepath != m.filepath
|
295
|
+
end
|
296
|
+
end
|
297
|
+
end
|
298
|
+
end
|
299
|
+
|
262
300
|
def self.mysql_table_definition options
|
263
|
-
Kernel.p options
|
264
301
|
sql = "SELECT table_schema, table_name, column_name, is_nullable, data_type, column_type, column_key "
|
265
302
|
sql += "FROM INFORMATION_SCHEMA.COLUMNS where table_name = '#{options[:table]}' "
|
266
303
|
sql += "and table_schema = '#{options[:source_schema]}';"
|
@@ -4,6 +4,8 @@ module Myreplicator
|
|
4
4
|
|
5
5
|
def create_table *args
|
6
6
|
options = args.extract_options!
|
7
|
+
Kernel.p "===== OPTION ====="
|
8
|
+
puts options
|
7
9
|
columns = []
|
8
10
|
options[:mysql_schema].each(:as => :hash) do |row|
|
9
11
|
columns << row
|
@@ -32,124 +34,124 @@ module Myreplicator
|
|
32
34
|
##
|
33
35
|
# rasing a concern: using the same schema or the tmp schema for the tmp table? Vertica doesn't lock the schema
|
34
36
|
def apply_schema_change options, temp_table
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
Kernel.p "+++++++++++++++++ options "
|
38
|
+
puts options
|
39
|
+
VerticaLoader.create_table({:mysql_schema => options[:mysql_schema],
|
40
|
+
:vertica_db => options[:vertica_db],
|
41
|
+
:vertica_schema => options[:vertica_schema],
|
42
|
+
:table => temp_table,
|
43
|
+
:mysql_table => options[:table]})
|
42
44
|
|
43
|
-
def full_load options, temp_table
|
44
45
|
export_id = options[:export_id]
|
45
46
|
new_options = prepare_options options
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
FileUtils.rm file
|
63
|
-
FileUtils.rm "#{file}.json"
|
64
|
-
sql = "DROP TABLE #{options[:vertica_db]}.#{options[:vertica_schema]}.#{options[:table]} CASCADE;"
|
65
|
-
VerticaDb::Base.connection.execute sql
|
66
|
-
#rename
|
67
|
-
sql = "ALTER TABLE #{options[:vertica_db]}.#{options[:vertica_schema]}.#{temp_table} RENAME TO #{options[:table]};"
|
68
|
-
VerticaDb::Base.connection.execute sql
|
69
|
-
rescue Exception => e
|
70
|
-
raise e.message
|
71
|
-
ensure
|
72
|
-
|
73
|
-
end
|
47
|
+
new_options[:file] = options[:filepath]
|
48
|
+
new_options[:table] = temp_table
|
49
|
+
new_options[:schema] = options[:vertica_schema]
|
50
|
+
|
51
|
+
|
52
|
+
vertica_copy new_options
|
53
|
+
Kernel.p "+++++++++++++++++ new_options "
|
54
|
+
puts new_options
|
55
|
+
puts options
|
56
|
+
|
57
|
+
sql = "DROP TABLE IF EXISTS #{options[:vertica_db]}.#{options[:vertica_schema]}.#{options[:table]} CASCADE;"
|
58
|
+
VerticaDb::Base.connection.execute sql
|
59
|
+
#rename
|
60
|
+
sql = "ALTER TABLE #{options[:vertica_db]}.#{options[:vertica_schema]}.#{temp_table} RENAME TO #{options[:table]};"
|
61
|
+
VerticaDb::Base.connection.execute sql
|
62
|
+
|
74
63
|
end
|
64
|
+
|
65
|
+
def create_temp_table *args
|
66
|
+
options = args.extract_options!
|
67
|
+
temp_table_name = "temp_" + options[:table] + DateTime.now.strftime('%Y%m%d_%H%M%S').to_s
|
75
68
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
# :vertica_table => table,
|
85
|
-
# :vertica_schema => db,
|
86
|
-
# :table => table,
|
87
|
-
# :db => db)
|
88
|
-
# sqls["#{table}"] = sql
|
89
|
-
# VerticaDb::Base.connection.execute sql
|
90
|
-
# end
|
91
|
-
# end
|
92
|
-
|
69
|
+
VerticaLoader.create_table({:mysql_schema => options[:mysql_schema],
|
70
|
+
:vertica_db => options[:vertica_db],
|
71
|
+
:vertica_schema => options[:vertica_schema],
|
72
|
+
:table => temp_table_name,
|
73
|
+
:mysql_table => options[:table]})
|
74
|
+
return temp_table_name
|
75
|
+
end
|
76
|
+
|
93
77
|
def prepare_options *args
|
94
|
-
options = args.extract_options
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
78
|
+
options = args.extract_options!.clone
|
79
|
+
Kernel.p "===== OPTION [options[:db]] ====="
|
80
|
+
puts options
|
81
|
+
# How not to hard code the vertica connection config ?
|
82
|
+
vertica_options = ActiveRecord::Base.configurations["vertica"]
|
83
|
+
|
84
|
+
options.reverse_merge!(:host => vertica_options["host"],
|
85
|
+
:user => vertica_options["username"],
|
86
|
+
:pass => vertica_options["password"],
|
87
|
+
:db => vertica_options["database"],
|
88
|
+
:schema => options[:destination_schema],
|
89
|
+
:table => options[:table_name],
|
90
|
+
:file => options[:filepath],
|
91
|
+
:delimiter => "\\0",
|
92
|
+
:null_value => "NULL",
|
93
|
+
:enclosed => "")
|
94
|
+
# working now but should fix this
|
110
95
|
if !vertica_options["vsql"].blank?
|
111
|
-
|
112
|
-
:vsql => vertica_options["vsql"]
|
113
|
-
)
|
96
|
+
options.reverse_merge!(:vsql => vertica_options["vsql"])
|
114
97
|
else
|
115
|
-
|
116
|
-
:vsql => "/opt/vertica/bin/vsql"
|
117
|
-
)
|
98
|
+
options.reverse_merge!(:vsql => "/opt/vertica/bin/vsql")
|
118
99
|
end
|
119
100
|
|
120
|
-
return
|
101
|
+
return options
|
121
102
|
end
|
122
103
|
|
123
104
|
# Loader::VerticaLoader.load({:schema => "king", :table => "category_overview_data", :file => "tmp/vertica/category_overview_data.tsv", :null_value => "NULL"})
|
105
|
+
# check for export_type!
|
124
106
|
def load *args
|
125
107
|
options = args.extract_options!
|
126
|
-
|
108
|
+
metadata = options[:metadata]
|
109
|
+
Kernel.p "===== metadata ====="
|
110
|
+
Kernel.p metadata
|
111
|
+
Kernel.p options
|
112
|
+
#options = {:table => "app_csvs", :destination_schema => "public", :source_schema => "okl_dev"}
|
113
|
+
#options = {:table => "actucast_appeal", :destination_schema => "public", :source_schema => "raw_sources"}
|
127
114
|
schema_check = Myreplicator::MysqlExporter.schema_changed?(:table => options[:table_name],
|
128
115
|
:destination_schema => options[:destination_schema],
|
129
116
|
:source_schema => options[:source_schema])
|
130
|
-
|
117
|
+
Kernel.p "===== schema_check ====="
|
118
|
+
Kernel.p schema_check
|
119
|
+
Kernel.p schema_check[:mysql_schema]
|
131
120
|
#create a temp table
|
132
121
|
temp_table = "temp_" + options[:table_name] + DateTime.now.strftime('%Y%m%d_%H%M%S').to_s
|
133
122
|
ops = {:mysql_schema => schema_check[:mysql_schema],
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
123
|
+
:vertica_db => options[:db],
|
124
|
+
:vertica_schema => options[:destination_schema],
|
125
|
+
:table => options[:table_name],
|
126
|
+
:export_id => options[:export_id],
|
127
|
+
:filepath => options[:filepath]
|
138
128
|
}
|
139
|
-
|
140
|
-
|
141
|
-
|
129
|
+
Kernel.p "===== schema_check[:mysql_schema] ====="
|
130
|
+
Kernel.p ops
|
131
|
+
if schema_check[:new]
|
132
|
+
create_table(ops)
|
133
|
+
#LOAD DATA IN
|
134
|
+
vertica_copy options
|
135
|
+
elsif schema_check[:changed]
|
136
|
+
if metadata.export_type == 'initial'
|
137
|
+
Loader.clear_older_files metadata # clear old incremental files
|
142
138
|
apply_schema_change(ops, temp_table)
|
143
|
-
#vertica_copy options
|
144
|
-
full_load(ops, temp_table)
|
145
|
-
elsif schema_check[:changed]
|
146
|
-
apply_schema_change(ops, temp_table)
|
147
|
-
full_load(ops, temp_table)
|
148
139
|
else
|
149
|
-
|
140
|
+
Loader.cleanup metadata #Remove incremental file
|
150
141
|
end
|
151
|
-
|
152
|
-
|
142
|
+
else
|
143
|
+
temp_table = create_temp_table ops
|
144
|
+
options[:table] = temp_table
|
145
|
+
Kernel.p "===== COPY TO TEMP TABLE #{temp_table} ====="
|
146
|
+
vertica_copy options
|
147
|
+
options.reverse_merge!(:temp_table => "#{temp_table}")
|
148
|
+
options[:table] = options[:table_name]
|
149
|
+
Kernel.p "===== MERGE ====="
|
150
|
+
vertica_merge options
|
151
|
+
#drop the temp table
|
152
|
+
Kernel.p "===== DROP TEMP TABLE ====="
|
153
|
+
sql = "DROP TABLE IF EXISTS #{options[:db]}.#{options[:destination_schema]}.#{temp_table} CASCADE;"
|
154
|
+
VerticaDb::Base.connection.execute sql
|
153
155
|
end
|
154
156
|
end
|
155
157
|
|
@@ -161,17 +163,16 @@ module Myreplicator
|
|
161
163
|
raise "No input file"
|
162
164
|
end
|
163
165
|
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
end
|
166
|
+
process_file(:file => prepared_options[:file],
|
167
|
+
:list_of_nulls => list_of_nulls,
|
168
|
+
:null_value => prepared_options[:null_value])
|
169
|
+
|
170
|
+
cmd = get_vsql_copy_command(prepared_options)
|
171
|
+
puts cmd
|
172
|
+
system(cmd)
|
172
173
|
end
|
173
174
|
|
174
|
-
def
|
175
|
+
def get_vsql_copy_command prepared_options
|
175
176
|
file_extension = prepared_options[:file].split('.').last
|
176
177
|
file_handler = ""
|
177
178
|
file_handler = "GZIP" if file_extension == "gz"
|
@@ -229,6 +230,145 @@ module Myreplicator
|
|
229
230
|
system(cmd2)
|
230
231
|
end
|
231
232
|
|
233
|
+
def get_mysql_keys mysql_schema_simple_form
|
234
|
+
result = []
|
235
|
+
mysql_schema_simple_form.each do |col|
|
236
|
+
if col["column_key"] == "PRI"
|
237
|
+
result << col["column_name"]
|
238
|
+
end
|
239
|
+
end
|
240
|
+
return result
|
241
|
+
end
|
242
|
+
|
243
|
+
def get_mysql_none_keys mysql_schema_simple_form
|
244
|
+
result = []
|
245
|
+
mysql_schema_simple_form.each do |col|
|
246
|
+
if col["column_key"].blank?
|
247
|
+
result << col["column_name"]
|
248
|
+
end
|
249
|
+
end
|
250
|
+
return result
|
251
|
+
end
|
252
|
+
|
253
|
+
def get_mysql_inserted_columns mysql_schema_simple_form
|
254
|
+
result = []
|
255
|
+
mysql_schema_simple_form.each do |col|
|
256
|
+
result << col["column_name"]
|
257
|
+
end
|
258
|
+
return result
|
259
|
+
end
|
260
|
+
|
261
|
+
def get_vsql_merge_command options, keys, none_keys, inserted_columns
|
262
|
+
Kernel.p "===== Merge Options ====="
|
263
|
+
Kernel.p options
|
264
|
+
a = prepare_options options
|
265
|
+
Kernel.p a
|
266
|
+
prepared_options = options
|
267
|
+
sql = "MERGE INTO "
|
268
|
+
sql+= "#{prepared_options[:db]}.#{prepared_options[:schema]}.#{prepared_options[:table]} target "
|
269
|
+
sql+= "USING #{prepared_options[:db]}.#{prepared_options[:schema]}.#{prepared_options[:temp_table]} source "
|
270
|
+
sql+= "ON "
|
271
|
+
count = 0
|
272
|
+
keys.each do |k|
|
273
|
+
if count < 1
|
274
|
+
sql += "source.#{k} = target.#{k} "
|
275
|
+
else
|
276
|
+
sql += "AND source.#{k} = target.#{k} "
|
277
|
+
end
|
278
|
+
count += 1
|
279
|
+
end
|
280
|
+
sql+= "WHEN MATCHED THEN "
|
281
|
+
sql+= "UPDATE SET "
|
282
|
+
count = 1
|
283
|
+
none_keys.each do |nk|
|
284
|
+
if count < none_keys.size
|
285
|
+
sql+= "#{nk} = source.#{nk}, "
|
286
|
+
else
|
287
|
+
sql+= "#{nk} = source.#{nk} "
|
288
|
+
end
|
289
|
+
count += 1
|
290
|
+
end
|
291
|
+
sql+= "WHEN NOT MATCHED THEN "
|
292
|
+
sql+= "INSERT "
|
293
|
+
#count = 1
|
294
|
+
#inserted_columns.each do |col|
|
295
|
+
# if count < inserted_columns.size
|
296
|
+
# sql+= "#{col}, "
|
297
|
+
# else
|
298
|
+
# sql+= "#{col} "
|
299
|
+
# end
|
300
|
+
# count += 1
|
301
|
+
#end
|
302
|
+
count = 1
|
303
|
+
sql+= " VALUES ("
|
304
|
+
inserted_columns.each do |col|
|
305
|
+
if count < inserted_columns.size
|
306
|
+
sql+= "source.#{col}, "
|
307
|
+
else
|
308
|
+
sql+= "source.#{col}) "
|
309
|
+
end
|
310
|
+
count += 1
|
311
|
+
end
|
312
|
+
sql+= ";"
|
313
|
+
cmd = "#{prepared_options[:vsql]} -h #{prepared_options[:host]} -U #{prepared_options[:user]} -w #{prepared_options[:pass]} -d #{prepared_options[:db]} -c \"#{sql}\""
|
314
|
+
return cmd
|
315
|
+
end
|
316
|
+
|
317
|
+
def vertica_merge *args
|
318
|
+
options = args.extract_options!
|
319
|
+
metadata = options[:metadata]
|
320
|
+
Kernel.p "===== MERGE metadata ====="
|
321
|
+
Kernel.p metadata
|
322
|
+
ops = {:table => options[:table_name],
|
323
|
+
:destination_schema => options[:destination_schema],
|
324
|
+
:source_schema => options[:source_schema]}
|
325
|
+
mysql_schema = Loader.mysql_table_definition(options)
|
326
|
+
vertica_schema = VerticaLoader.destination_table_vertica(options)
|
327
|
+
mysql_schema_simple_form = MysqlExporter.get_mysql_schema_rows mysql_schema
|
328
|
+
# get the column(s) that is(are) used as the primary key
|
329
|
+
keys = get_mysql_keys mysql_schema_simple_form
|
330
|
+
# get the non key coluns
|
331
|
+
none_keys = get_mysql_none_keys mysql_schema_simple_form
|
332
|
+
# get the column to put in the insert part
|
333
|
+
inserted_columns = get_mysql_inserted_columns mysql_schema_simple_form
|
334
|
+
#get the vsql merge command
|
335
|
+
cmd = get_vsql_merge_command options, keys, none_keys, inserted_columns
|
336
|
+
#execute
|
337
|
+
puts cmd
|
338
|
+
begin
|
339
|
+
result = `#{cmd} 2>&1`
|
340
|
+
if result[0..4] == "ERROR"
|
341
|
+
Loader.cleanup metadata
|
342
|
+
sql = "DROP TABLE IF EXISTS #{options[:db]}.#{options[:destination_schema]}.#{options[:temp_table]} CASCADE;"
|
343
|
+
Kernel.p "===== DROP CMD ====="
|
344
|
+
Kernel.p sql
|
345
|
+
VerticaDb::Base.connection.execute sql
|
346
|
+
raise result
|
347
|
+
end
|
348
|
+
rescue Exception => e
|
349
|
+
raise e.message
|
350
|
+
ensure
|
351
|
+
# place holder
|
352
|
+
end
|
353
|
+
end
|
354
|
+
|
355
|
+
# def create_all_tables db
|
356
|
+
# tables = Loader::SourceDb.get_tables(db)
|
357
|
+
# sqls = {}
|
358
|
+
# tables.each do |table|
|
359
|
+
# puts "Creating #{db}.#{table}"
|
360
|
+
# sql = "DROP TABLE IF EXISTS #{db}.#{table} CASCADE;"
|
361
|
+
# VerticaDb::Base.connection.execute sql
|
362
|
+
# sql = Loader::VerticaLoader.create_table(:vertica_db => "bidw",
|
363
|
+
# :vertica_table => table,
|
364
|
+
# :vertica_schema => db,
|
365
|
+
# :table => table,
|
366
|
+
# :db => db)
|
367
|
+
# sqls["#{table}"] = sql
|
368
|
+
# VerticaDb::Base.connection.execute sql
|
369
|
+
# end
|
370
|
+
# end
|
371
|
+
|
232
372
|
end
|
233
373
|
end
|
234
374
|
end
|
data/lib/myreplicator/version.rb
CHANGED
@@ -4086,3 +4086,275 @@ Connecting to database specified by database.yml
|
|
4086
4086
|
Connecting to database specified by database.yml
|
4087
4087
|
Connecting to database specified by database.yml
|
4088
4088
|
Connecting to database specified by database.yml
|
4089
|
+
Connecting to database specified by database.yml
|
4090
|
+
|
4091
|
+
|
4092
|
+
Started GET "/myreplicator/exports" for 127.0.0.1 at 2013-03-08 14:24:06 -0800
|
4093
|
+
Processing by Myreplicator::ExportsController#index as HTML
|
4094
|
+
[1m[36m (0.3ms)[0m [1mSELECT COUNT(*) FROM `myreplicator_exports` [0m
|
4095
|
+
[1m[35mMyreplicator::Export Load (0.5ms)[0m SELECT `myreplicator_exports`.* FROM `myreplicator_exports` ORDER BY source_schema asc LIMIT 30 OFFSET 0
|
4096
|
+
Rendered /home/sasan/workspace/myreplicator/app/views/myreplicator/exports/index.html.erb within layouts/myreplicator/application (73.0ms)
|
4097
|
+
Completed 200 OK in 361ms (Views: 356.6ms | ActiveRecord: 2.0ms)
|
4098
|
+
|
4099
|
+
|
4100
|
+
Started GET "/assets/myreplicator/application.css?body=1" for 127.0.0.1 at 2013-03-08 14:24:07 -0800
|
4101
|
+
Served asset /myreplicator/application.css - 304 Not Modified (32ms)
|
4102
|
+
|
4103
|
+
|
4104
|
+
Started GET "/assets/myreplicator/chosen.css?body=1" for 127.0.0.1 at 2013-03-08 14:24:07 -0800
|
4105
|
+
Served asset /myreplicator/chosen.css - 304 Not Modified (3ms)
|
4106
|
+
|
4107
|
+
|
4108
|
+
Started GET "/assets/myreplicator/exports.css?body=1" for 127.0.0.1 at 2013-03-08 14:24:07 -0800
|
4109
|
+
Served asset /myreplicator/exports.css - 304 Not Modified (2ms)
|
4110
|
+
|
4111
|
+
|
4112
|
+
Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2013-03-08 14:24:07 -0800
|
4113
|
+
Served asset /jquery.js - 304 Not Modified (3ms)
|
4114
|
+
|
4115
|
+
|
4116
|
+
Started GET "/assets/myreplicator/tipTip.css?body=1" for 127.0.0.1 at 2013-03-08 14:24:07 -0800
|
4117
|
+
Served asset /myreplicator/tipTip.css - 304 Not Modified (1ms)
|
4118
|
+
|
4119
|
+
|
4120
|
+
Started GET "/assets/myreplicator/select2.css?body=1" for 127.0.0.1 at 2013-03-08 14:24:07 -0800
|
4121
|
+
Served asset /myreplicator/select2.css - 304 Not Modified (2ms)
|
4122
|
+
|
4123
|
+
|
4124
|
+
Started GET "/assets/jquery-ui.js?body=1" for 127.0.0.1 at 2013-03-08 14:24:07 -0800
|
4125
|
+
Served asset /jquery-ui.js - 304 Not Modified (3ms)
|
4126
|
+
|
4127
|
+
|
4128
|
+
Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2013-03-08 14:24:07 -0800
|
4129
|
+
Served asset /jquery_ujs.js - 304 Not Modified (2ms)
|
4130
|
+
|
4131
|
+
|
4132
|
+
Started GET "/assets/myreplicator/chosen.jquery.min.js?body=1" for 127.0.0.1 at 2013-03-08 14:24:07 -0800
|
4133
|
+
Served asset /myreplicator/chosen.jquery.min.js - 304 Not Modified (1ms)
|
4134
|
+
|
4135
|
+
|
4136
|
+
Started GET "/assets/myreplicator/cronwtf.js?body=1" for 127.0.0.1 at 2013-03-08 14:24:07 -0800
|
4137
|
+
Served asset /myreplicator/cronwtf.js - 304 Not Modified (1ms)
|
4138
|
+
|
4139
|
+
|
4140
|
+
Started GET "/assets/myreplicator/exports.js?body=1" for 127.0.0.1 at 2013-03-08 14:24:07 -0800
|
4141
|
+
Served asset /myreplicator/exports.js - 304 Not Modified (1ms)
|
4142
|
+
|
4143
|
+
|
4144
|
+
Started GET "/assets/myreplicator/jquery.tipTip.minified.js?body=1" for 127.0.0.1 at 2013-03-08 14:24:07 -0800
|
4145
|
+
Served asset /myreplicator/jquery.tipTip.minified.js - 304 Not Modified (1ms)
|
4146
|
+
|
4147
|
+
|
4148
|
+
Started GET "/assets/myreplicator/select2.js?body=1" for 127.0.0.1 at 2013-03-08 14:24:07 -0800
|
4149
|
+
Served asset /myreplicator/select2.js - 304 Not Modified (29ms)
|
4150
|
+
|
4151
|
+
|
4152
|
+
Started GET "/assets/myreplicator/application.js?body=1" for 127.0.0.1 at 2013-03-08 14:24:07 -0800
|
4153
|
+
Served asset /myreplicator/application.js - 304 Not Modified (8ms)
|
4154
|
+
|
4155
|
+
|
4156
|
+
Started GET "/assets/myreplicator/plus.png" for 127.0.0.1 at 2013-03-08 14:24:07 -0800
|
4157
|
+
Served asset /myreplicator/plus.png - 304 Not Modified (31ms)
|
4158
|
+
|
4159
|
+
|
4160
|
+
Started GET "/assets/myreplicator/desc-white.gif" for 127.0.0.1 at 2013-03-08 14:24:07 -0800
|
4161
|
+
Served asset /myreplicator/desc-white.gif - 304 Not Modified (7ms)
|
4162
|
+
|
4163
|
+
|
4164
|
+
Started GET "/assets/myreplicator/bg.gif" for 127.0.0.1 at 2013-03-08 14:24:07 -0800
|
4165
|
+
Served asset /myreplicator/bg.gif - 304 Not Modified (56ms)
|
4166
|
+
|
4167
|
+
|
4168
|
+
Started GET "/assets/myreplicator/clipboard-list.png" for 127.0.0.1 at 2013-03-08 14:24:07 -0800
|
4169
|
+
Served asset /myreplicator/clipboard-list.png - 304 Not Modified (3ms)
|
4170
|
+
|
4171
|
+
|
4172
|
+
Started GET "/assets/myreplicator/gear.png" for 127.0.0.1 at 2013-03-08 14:24:07 -0800
|
4173
|
+
Served asset /myreplicator/gear.png - 304 Not Modified (7ms)
|
4174
|
+
|
4175
|
+
|
4176
|
+
Started GET "/assets/myreplicator/status.png" for 127.0.0.1 at 2013-03-08 14:24:07 -0800
|
4177
|
+
Served asset /myreplicator/status.png - 304 Not Modified (10ms)
|
4178
|
+
|
4179
|
+
|
4180
|
+
Started GET "/assets/myreplicator/FrancoisOne.ttf" for 127.0.0.1 at 2013-03-08 14:24:07 -0800
|
4181
|
+
Served asset /myreplicator/FrancoisOne.ttf - 304 Not Modified (13ms)
|
4182
|
+
|
4183
|
+
|
4184
|
+
Started GET "/assets/myreplicator/websymbols-regular-webfont.woff" for 127.0.0.1 at 2013-03-08 14:24:07 -0800
|
4185
|
+
Served asset /myreplicator/websymbols-regular-webfont.woff - 304 Not Modified (55ms)
|
4186
|
+
|
4187
|
+
|
4188
|
+
Started GET "/assets/myreplicator/cross.png" for 127.0.0.1 at 2013-03-08 14:24:07 -0800
|
4189
|
+
Served asset /myreplicator/cross.png - 304 Not Modified (11ms)
|
4190
|
+
|
4191
|
+
|
4192
|
+
Started GET "/myreplicator/exports/new" for 127.0.0.1 at 2013-03-08 14:24:09 -0800
|
4193
|
+
Processing by Myreplicator::ExportsController#new as HTML
|
4194
|
+
Rendered /home/sasan/workspace/myreplicator/app/views/myreplicator/exports/_form.html.erb (68.7ms)
|
4195
|
+
Rendered /home/sasan/workspace/myreplicator/app/views/myreplicator/exports/new.html.erb within layouts/myreplicator/application (76.6ms)
|
4196
|
+
Completed 200 OK in 553ms (Views: 102.5ms | ActiveRecord: 76.8ms)
|
4197
|
+
|
4198
|
+
|
4199
|
+
Started GET "/assets/myreplicator/application.css?body=1" for 127.0.0.1 at 2013-03-08 14:24:10 -0800
|
4200
|
+
Served asset /myreplicator/application.css - 304 Not Modified (4ms)
|
4201
|
+
|
4202
|
+
|
4203
|
+
Started GET "/assets/myreplicator/exports.css?body=1" for 127.0.0.1 at 2013-03-08 14:24:10 -0800
|
4204
|
+
Served asset /myreplicator/exports.css - 304 Not Modified (0ms)
|
4205
|
+
|
4206
|
+
|
4207
|
+
Started GET "/assets/myreplicator/chosen.css?body=1" for 127.0.0.1 at 2013-03-08 14:24:10 -0800
|
4208
|
+
Served asset /myreplicator/chosen.css - 304 Not Modified (0ms)
|
4209
|
+
|
4210
|
+
|
4211
|
+
Started GET "/assets/myreplicator/select2.css?body=1" for 127.0.0.1 at 2013-03-08 14:24:10 -0800
|
4212
|
+
Served asset /myreplicator/select2.css - 304 Not Modified (0ms)
|
4213
|
+
|
4214
|
+
|
4215
|
+
Started GET "/assets/myreplicator/tipTip.css?body=1" for 127.0.0.1 at 2013-03-08 14:24:10 -0800
|
4216
|
+
Served asset /myreplicator/tipTip.css - 304 Not Modified (0ms)
|
4217
|
+
|
4218
|
+
|
4219
|
+
Started GET "/assets/myreplicator/cronwtf.js?body=1" for 127.0.0.1 at 2013-03-08 14:24:10 -0800
|
4220
|
+
Served asset /myreplicator/cronwtf.js - 304 Not Modified (0ms)
|
4221
|
+
|
4222
|
+
|
4223
|
+
Started GET "/assets/jquery-ui.js?body=1" for 127.0.0.1 at 2013-03-08 14:24:10 -0800
|
4224
|
+
Served asset /jquery-ui.js - 304 Not Modified (2ms)
|
4225
|
+
|
4226
|
+
|
4227
|
+
Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2013-03-08 14:24:10 -0800
|
4228
|
+
Served asset /jquery_ujs.js - 304 Not Modified (0ms)
|
4229
|
+
|
4230
|
+
|
4231
|
+
Started GET "/assets/myreplicator/chosen.jquery.min.js?body=1" for 127.0.0.1 at 2013-03-08 14:24:10 -0800
|
4232
|
+
Served asset /myreplicator/chosen.jquery.min.js - 304 Not Modified (0ms)
|
4233
|
+
|
4234
|
+
|
4235
|
+
Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2013-03-08 14:24:10 -0800
|
4236
|
+
Served asset /jquery.js - 304 Not Modified (0ms)
|
4237
|
+
|
4238
|
+
|
4239
|
+
Started GET "/assets/myreplicator/exports.js?body=1" for 127.0.0.1 at 2013-03-08 14:24:10 -0800
|
4240
|
+
Served asset /myreplicator/exports.js - 304 Not Modified (0ms)
|
4241
|
+
|
4242
|
+
|
4243
|
+
Started GET "/assets/myreplicator/jquery.tipTip.minified.js?body=1" for 127.0.0.1 at 2013-03-08 14:24:10 -0800
|
4244
|
+
Served asset /myreplicator/jquery.tipTip.minified.js - 304 Not Modified (0ms)
|
4245
|
+
|
4246
|
+
|
4247
|
+
Started GET "/assets/myreplicator/select2.js?body=1" for 127.0.0.1 at 2013-03-08 14:24:10 -0800
|
4248
|
+
Served asset /myreplicator/select2.js - 304 Not Modified (0ms)
|
4249
|
+
|
4250
|
+
|
4251
|
+
Started GET "/assets/myreplicator/application.js?body=1" for 127.0.0.1 at 2013-03-08 14:24:10 -0800
|
4252
|
+
Served asset /myreplicator/application.js - 304 Not Modified (2ms)
|
4253
|
+
|
4254
|
+
|
4255
|
+
Started GET "/assets/myreplicator/cross.png" for 127.0.0.1 at 2013-03-08 14:24:10 -0800
|
4256
|
+
Served asset /myreplicator/cross.png - 304 Not Modified (0ms)
|
4257
|
+
|
4258
|
+
|
4259
|
+
Started GET "/assets/myreplicator/FrancoisOne.ttf" for 127.0.0.1 at 2013-03-08 14:24:10 -0800
|
4260
|
+
Served asset /myreplicator/FrancoisOne.ttf - 304 Not Modified (0ms)
|
4261
|
+
|
4262
|
+
|
4263
|
+
Started GET "/assets/myreplicator/websymbols-regular-webfont.woff" for 127.0.0.1 at 2013-03-08 14:24:10 -0800
|
4264
|
+
Served asset /myreplicator/websymbols-regular-webfont.woff - 304 Not Modified (0ms)
|
4265
|
+
|
4266
|
+
|
4267
|
+
Started GET "/assets/myreplicator/select2.png" for 127.0.0.1 at 2013-03-08 14:24:10 -0800
|
4268
|
+
Served asset /myreplicator/select2.png - 304 Not Modified (21ms)
|
4269
|
+
|
4270
|
+
|
4271
|
+
Started GET "/assets/myreplicator/slider_handle.png" for 127.0.0.1 at 2013-03-08 14:24:10 -0800
|
4272
|
+
Served asset /myreplicator/slider_handle.png - 304 Not Modified (11ms)
|
4273
|
+
|
4274
|
+
|
4275
|
+
Started POST "/myreplicator/exports" for 127.0.0.1 at 2013-03-08 14:24:33 -0800
|
4276
|
+
Processing by Myreplicator::ExportsController#create as HTML
|
4277
|
+
Parameters: {"utf8"=>"✓", "authenticity_token"=>"QmN8JvOm6ve0DKeySyGW8m4j4mX7L4aFx3WoUG5Iguk=", "export"=>{"export_to"=>"vertica", "export_type"=>"incremental", "source_schema"=>"okl_dev", "destination_schema"=>"public", "table_name"=>"activation_cohorts", "incremental_column"=>"modified_date", "incremental_column_type"=>"", "max_incremental_value"=>"", "s3_path"=>"", "active"=>"true", "cron"=>"*/23 * * * *"}, "commit"=>"Create Export"}
|
4278
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
4279
|
+
[1m[35mSQL (0.4ms)[0m INSERT INTO `myreplicator_exports` (`active`, `created_at`, `cron`, `destination_schema`, `error`, `export_finished_at`, `export_started_at`, `export_to`, `export_type`, `exporter_pid`, `incremental_column`, `incremental_column_type`, `max_incremental_value`, `s3_path`, `source_schema`, `state`, `table_name`, `updated_at`) VALUES (1, '2013-03-08 22:24:34', '*/23 * * * *', 'public', NULL, NULL, NULL, 'vertica', 'incremental', NULL, 'modified_date', '', '', '', 'okl_dev', 'new', 'activation_cohorts', '2013-03-08 22:24:34')
|
4280
|
+
[1m[36m (42.3ms)[0m [1mCOMMIT[0m
|
4281
|
+
[1m[35mMyreplicator::Export Load (0.3ms)[0m SELECT `myreplicator_exports`.* FROM `myreplicator_exports`
|
4282
|
+
Redirected to http://localhost:3000/myreplicator/exports/4
|
4283
|
+
Completed 302 Found in 561ms (ActiveRecord: 120.4ms)
|
4284
|
+
|
4285
|
+
|
4286
|
+
Started GET "/myreplicator/exports/4" for 127.0.0.1 at 2013-03-08 14:24:34 -0800
|
4287
|
+
Processing by Myreplicator::ExportsController#show as HTML
|
4288
|
+
Parameters: {"id"=>"4"}
|
4289
|
+
[1m[36mMyreplicator::Export Load (0.3ms)[0m [1mSELECT `myreplicator_exports`.* FROM `myreplicator_exports` WHERE `myreplicator_exports`.`id` = 4 LIMIT 1[0m
|
4290
|
+
Rendered /home/sasan/workspace/myreplicator/app/views/myreplicator/exports/show.html.erb within layouts/myreplicator/application (1.5ms)
|
4291
|
+
Completed 200 OK in 23ms (Views: 20.7ms | ActiveRecord: 0.3ms)
|
4292
|
+
|
4293
|
+
|
4294
|
+
Started GET "/assets/myreplicator/application.css?body=1" for 127.0.0.1 at 2013-03-08 14:24:34 -0800
|
4295
|
+
Served asset /myreplicator/application.css - 304 Not Modified (5ms)
|
4296
|
+
|
4297
|
+
|
4298
|
+
Started GET "/assets/myreplicator/tipTip.css?body=1" for 127.0.0.1 at 2013-03-08 14:24:34 -0800
|
4299
|
+
Served asset /myreplicator/tipTip.css - 304 Not Modified (0ms)
|
4300
|
+
|
4301
|
+
|
4302
|
+
Started GET "/assets/myreplicator/chosen.css?body=1" for 127.0.0.1 at 2013-03-08 14:24:34 -0800
|
4303
|
+
Served asset /myreplicator/chosen.css - 304 Not Modified (1ms)
|
4304
|
+
|
4305
|
+
|
4306
|
+
Started GET "/assets/myreplicator/exports.css?body=1" for 127.0.0.1 at 2013-03-08 14:24:34 -0800
|
4307
|
+
Served asset /myreplicator/exports.css - 304 Not Modified (0ms)
|
4308
|
+
|
4309
|
+
|
4310
|
+
Started GET "/assets/myreplicator/select2.css?body=1" for 127.0.0.1 at 2013-03-08 14:24:34 -0800
|
4311
|
+
Served asset /myreplicator/select2.css - 304 Not Modified (0ms)
|
4312
|
+
|
4313
|
+
|
4314
|
+
Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2013-03-08 14:24:34 -0800
|
4315
|
+
Served asset /jquery.js - 304 Not Modified (1ms)
|
4316
|
+
|
4317
|
+
|
4318
|
+
Started GET "/assets/jquery-ui.js?body=1" for 127.0.0.1 at 2013-03-08 14:24:34 -0800
|
4319
|
+
Served asset /jquery-ui.js - 304 Not Modified (1ms)
|
4320
|
+
|
4321
|
+
|
4322
|
+
Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2013-03-08 14:24:34 -0800
|
4323
|
+
Served asset /jquery_ujs.js - 304 Not Modified (0ms)
|
4324
|
+
|
4325
|
+
|
4326
|
+
Started GET "/assets/myreplicator/cronwtf.js?body=1" for 127.0.0.1 at 2013-03-08 14:24:34 -0800
|
4327
|
+
Served asset /myreplicator/cronwtf.js - 304 Not Modified (0ms)
|
4328
|
+
|
4329
|
+
|
4330
|
+
Started GET "/assets/myreplicator/chosen.jquery.min.js?body=1" for 127.0.0.1 at 2013-03-08 14:24:34 -0800
|
4331
|
+
Served asset /myreplicator/chosen.jquery.min.js - 304 Not Modified (2ms)
|
4332
|
+
|
4333
|
+
|
4334
|
+
Started GET "/assets/myreplicator/exports.js?body=1" for 127.0.0.1 at 2013-03-08 14:24:34 -0800
|
4335
|
+
Served asset /myreplicator/exports.js - 304 Not Modified (0ms)
|
4336
|
+
|
4337
|
+
|
4338
|
+
Started GET "/assets/myreplicator/jquery.tipTip.minified.js?body=1" for 127.0.0.1 at 2013-03-08 14:24:34 -0800
|
4339
|
+
Served asset /myreplicator/jquery.tipTip.minified.js - 304 Not Modified (0ms)
|
4340
|
+
|
4341
|
+
|
4342
|
+
Started GET "/assets/myreplicator/select2.js?body=1" for 127.0.0.1 at 2013-03-08 14:24:34 -0800
|
4343
|
+
Served asset /myreplicator/select2.js - 304 Not Modified (0ms)
|
4344
|
+
|
4345
|
+
|
4346
|
+
Started GET "/assets/myreplicator/application.js?body=1" for 127.0.0.1 at 2013-03-08 14:24:34 -0800
|
4347
|
+
Served asset /myreplicator/application.js - 304 Not Modified (2ms)
|
4348
|
+
|
4349
|
+
|
4350
|
+
Started GET "/assets/myreplicator/FrancoisOne.ttf" for 127.0.0.1 at 2013-03-08 14:24:34 -0800
|
4351
|
+
Served asset /myreplicator/FrancoisOne.ttf - 304 Not Modified (0ms)
|
4352
|
+
|
4353
|
+
|
4354
|
+
Started GET "/assets/myreplicator/websymbols-regular-webfont.woff" for 127.0.0.1 at 2013-03-08 14:24:34 -0800
|
4355
|
+
Served asset /myreplicator/websymbols-regular-webfont.woff - 304 Not Modified (0ms)
|
4356
|
+
|
4357
|
+
|
4358
|
+
Started GET "/assets/myreplicator/gear.png" for 127.0.0.1 at 2013-03-08 14:24:34 -0800
|
4359
|
+
Served asset /myreplicator/gear.png - 304 Not Modified (0ms)
|
4360
|
+
Connecting to database specified by database.yml
|
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.9
|
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-13 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: -3137880076696344108
|
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: -3137880076696344108
|
383
383
|
requirements: []
|
384
384
|
rubyforge_project:
|
385
385
|
rubygems_version: 1.8.23
|