Skip to content

Commit

Permalink
better logging. don't continue to log about missing tables. log once.…
Browse files Browse the repository at this point in the history
… better log message in router service for missing trigger history id.
  • Loading branch information
chenson42 committed May 9, 2012
1 parent a5a24af commit 039ce3d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Expand Up @@ -482,8 +482,8 @@ protected int routeData(Data data, ChannelRouterContext context) throws SQLExcep

} else {
log.warn(
"Could not find trigger for trigger id of {}. Not processing data with the id of {}",
data.getTriggerHistory().getTriggerId(), data.getDataId());
"Could not find triggers for history id of {}. Not processing data with the id of {}",
data.getTriggerHistory().getTriggerHistoryId(), data.getDataId());
}

context.incrementStat(numberOfDataEventsInserted,
Expand Down
Expand Up @@ -6,8 +6,10 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
Expand Down Expand Up @@ -67,6 +69,8 @@ public static enum LoadStatus {

protected IDatabaseWriterConflictResolver conflictResolver;

protected Set<String> missingTables = new HashSet<String>();

public DatabaseWriter(IDatabasePlatform platform) {
this(platform, null, null);
}
Expand Down Expand Up @@ -102,8 +106,11 @@ public boolean start(Table table) {
this.transaction.allowInsertIntoAutoIncrementColumns(true, this.targetTable);
return true;
} else {
log.warn("Did not find the {} table in the target database",
sourceTable.getFullyQualifiedTableName());
String qualifiedName = sourceTable.getFullyQualifiedTableName();
if (!missingTables.contains(qualifiedName)) {
log.warn("Did not find the {} table in the target database", qualifiedName);
missingTables.add(qualifiedName);
}
return false;
}
}
Expand Down Expand Up @@ -549,7 +556,7 @@ protected void logFailure(SqlException e, CsvData data) {
protected boolean script(CsvData data) {
try {
statistics.get(batch).startTimer(DataWriterStatisticConstants.DATABASEMILLIS);
String script = data.getParsedData(CsvData.ROW_DATA)[0];
String script = data.getParsedData(CsvData.ROW_DATA)[0];
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("SOURCE_NODE_ID", batch.getNodeId());
ISqlTemplate template = platform.getSqlTemplate();
Expand Down Expand Up @@ -583,7 +590,7 @@ protected boolean create(CsvData data) {
String xml = null;
try {
statistics.get(batch).startTimer(DataWriterStatisticConstants.DATABASEMILLIS);
xml = data.getParsedData(CsvData.ROW_DATA)[0];
xml = data.getParsedData(CsvData.ROW_DATA)[0];
log.info("About to create table using the following definition: ", xml);
StringReader reader = new StringReader(xml);
Database db = (Database) new DatabaseIO().read(reader, false);
Expand Down

0 comments on commit 039ce3d

Please sign in to comment.