You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EmailUtil.sendMail("Unable to copy data with the following error: "+ e.getStackTrace(), "Unable to copy data from table in monetdb", config.getDatabaseProperties());
196
-
}
197
-
198
-
LOG.info("PHASE 1 FINISHED: all data copied from MS SQL source databases to local disk");
199
-
200
-
LOG.info("STARTING PHASE 2: loading data into target MonetDB database");
201
-
202
-
// get a SQL-friendly representation of the current date/time of the load
EmailUtil.sendMail("Unable to load data with the following error: "+ e.getStackTrace(), "Unable to load data table into monetdb", config.getDatabaseProperties());
222
-
}
223
-
224
-
LOG.info("PAHSE 2 FINISHED: all data loaded into target MonetDB database");
225
-
226
-
LOG.info("STARTING PHASE 3: switching all view-based tables to new data");
227
-
228
-
// we need another loop through the tables for temp table copying and view
229
-
// switching. We do this after the copy actions to reduce down-time
230
-
231
-
// phase 3: switch views (for view-based tables)
232
-
for (CopyTablecopyTable : tablesToCopy.values())
233
-
{
234
-
// if there are any temp table copies configured, then copy the
235
-
// temp tables to result tables. We do this after the rest is done to
236
-
// reduce down-time
237
-
if (copyTable.isCopyViaTempTable())
238
-
{
239
-
copyTempTableToCurrentTable(copyTable);
179
+
180
+
// verify MonetDB database is working by opening connection
EmailUtil.sendMail("Unable to copy data with the following error: "+ e.getStackTrace(), "Unable to copy data from table in monetdb", config.getDatabaseProperties());
250
201
}
251
-
catch (SQLExceptione)
252
-
{
202
+
203
+
LOG.info("PHASE 1 FINISHED: all data copied from MS SQL source databases to local disk");
204
+
205
+
LOG.info("STARTING PHASE 2: loading data into target MonetDB database");
206
+
207
+
// get a SQL-friendly representation of the current date/time of the load
LOG.error("Unable to create view '" + copyTable.getToViewSql() + "'", e);
255
-
EmailUtil.sendMail("Unable to create view" + copyTable.getToViewSql() + " with the following error: "+ e.toString(), "Unable to create view in monetdb", config.getDatabaseProperties());
225
+
LOG.error("Unable to load data into MonetDB", e);
226
+
EmailUtil.sendMail("Unable to load data with the following error: "+ e.getStackTrace(), "Unable to load data table into monetdb", config.getDatabaseProperties());
256
227
}
228
+
229
+
LOG.info("PHASE 2 FINISHED: all data loaded into target MonetDB database");
230
+
}
231
+
else {
232
+
LOG.info("Switch-Only requested with flag. Therefore, PHASE 1 and 2 skipped");
257
233
}
258
234
259
-
LOG.info("PHASE 3 FINISHED: all views have been switched");
235
+
//if switch-ONly flag set or when the no-switch-Flag is NOT set, than switching
236
+
if(switchOnly || !noSwitch){
237
+
238
+
LOG.info("STARTING PHASE 3: switching all view-based tables to new data");
239
+
240
+
// we need another loop through the tables for temp table copying and view
241
+
// switching. We do this after the copy actions to reduce down-time
242
+
243
+
// phase 3: switch views (for view-based tables)
244
+
for (CopyTablecopyTable : tablesToCopy.values())
245
+
{
246
+
// if there are any temp table copies configured, then copy the
247
+
// temp tables to result tables. We do this after the rest is done to
248
+
// reduce down-time
249
+
if (copyTable.isCopyViaTempTable())
250
+
{
251
+
copyTempTableToCurrentTable(copyTable);
252
+
}
253
+
254
+
try
255
+
{
256
+
// set view to current table because it contains the new data now
LOG.error("Unable to create view '" + copyTable.getToViewSql() + "'", e);
267
+
EmailUtil.sendMail("Unable to create view" + copyTable.getToViewSql() + " with the following error: "+ e.toString(), "Unable to create view in monetdb", config.getDatabaseProperties());
268
+
}
269
+
}
270
+
271
+
LOG.info("PHASE 3 FINISHED: all views have been switched");
260
272
261
-
LOG.info("STARTING PHASE 4: cleanup of data from disk and database");
262
273
263
-
// phase 4: remove temp data from disk and target database
264
-
for (CopyTablecopyTable : tablesToCopy.values())
265
-
{
266
-
// remove temp data from disk
267
-
removeTempData(copyTable);
274
+
LOG.info("STARTING PHASE 4: cleanup of data from disk and database");
268
275
269
-
// remove old versions of view-based tables
270
-
// that are no longer needed
271
-
try {
272
-
dropOldTables(copyTable);
273
-
} catch (SQLExceptione) {
274
-
LOG.warn("Got SQLException when trying to drop older versions of table '" + copyTable.getToName() + "': " + e.getMessage(), e);
276
+
// phase 4: remove temp data from disk and target database
277
+
for (CopyTablecopyTable : tablesToCopy.values())
278
+
{
279
+
// remove temp data from disk
280
+
removeTempData(copyTable);
281
+
282
+
// remove old versions of view-based tables
283
+
// that are no longer needed
284
+
try {
285
+
dropOldTables(copyTable);
286
+
} catch (SQLExceptione) {
287
+
LOG.warn("Got SQLException when trying to drop older versions of table '" + copyTable.getToName() + "': " + e.getMessage(), e);
288
+
}
275
289
}
276
-
}
277
-
278
-
LOG.info("PHASE 4 FINISHED: all data removed from disk and database");
290
+
291
+
LOG.info("PHASE 4 FINISHED: all data removed from disk and database");
279
292
293
+
}
294
+
else{
295
+
LOG.info("PHASE 3 (switching) and PHASE 4 (cleanup) skipped because no-switch-flag setting");
0 commit comments