Skip to content

Commit

Permalink
0004493: better debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed Aug 7, 2020
1 parent faf8d16 commit 8ec6615
Showing 1 changed file with 6 additions and 2 deletions.
Expand Up @@ -75,6 +75,8 @@ public MsSqlBulkDatabaseWriter(IDatabasePlatform symmetricPlatform,
this.rowTerminator = rowTerminator;
}
this.uncPath = uncPath;
log.debug("Initialized with maxRowsBeforeFlush={}, fireTriggers={}, fieldTerminator={}, rowTerminator={}, uncPath={}",
maxRowsBeforeFlush, fireTriggers, fieldTerminator, rowTerminator, uncPath);
}

public boolean start(Table table) {
Expand Down Expand Up @@ -204,7 +206,7 @@ protected void bulkWrite(CsvData data) {

protected void flush() {
if (loadedRows > 0) {
this.stagedInputFile.close();
this.stagedInputFile.close();

statistics.get(batch).startTimer(DataWriterStatisticConstants.LOADMILLIS);
String filename;
Expand Down Expand Up @@ -236,7 +238,8 @@ protected void flush() {
" WITH (DATAFILETYPE='widechar', FIELDTERMINATOR='"+StringEscapeUtils.escapeJava(fieldTerminator)+"', KEEPIDENTITY" +
(fireTriggers ? ", FIRE_TRIGGERS" : "") + rowTerminatorString +");";
Statement stmt = c.createStatement();

log.debug("Running {}", sql);

//TODO: clean this up, deal with errors, etc.?
stmt.execute(sql);
stmt.close();
Expand All @@ -255,5 +258,6 @@ protected void createStagingFile() {
// but we don't want to depend on symmetric core.
this.stagedInputFile = stagingManager.create("bulkloaddir",
table.getName() + this.getBatch().getBatchId() + ".csv");
log.debug("Using staging file {}", stagedInputFile.getFile().getPath());
}
}

0 comments on commit 8ec6615

Please sign in to comment.