format print log
@@ -53,6 +53,10 @@ public class RetractJDBCOutputFormat extends MetricOutputFormat {
private static final Logger LOG = LoggerFactory.getLogger(RetractJDBCOutputFormat.class);
+ private static int dirtyDataPrintFrequency = 1000;
+
+ private static int receiveDataPrintFrequency = 1000;
+
private String username;
private String password;
private String drivername;
@@ -167,8 +171,11 @@ public class RetractJDBCOutputFormat extends MetricOutputFormat {
}
if (retract) {
- insertWrite(row);
outRecords.inc();
+ if (outRecords.getCount() % receiveDataPrintFrequency == 0) {
+ LOG.info("Receive data : {}", row);
+ }
+ insertWrite(row);
} else {
//do nothing
}
@@ -200,10 +207,12 @@ public class RetractJDBCOutputFormat extends MetricOutputFormat {
upload.execute();
} catch (SQLException e) {
outDirtyRecords.inc();
+ if (outDirtyRecords.getCount() % dirtyDataPrintFrequency == 0) {
LOG.error("record insert failed ..", row.toString());
LOG.error("", e);
}
}
+ }
private void updatePreparedStmt(Row row, PreparedStatement pstmt) throws SQLException {
if (typesArray == null) {
@@ -297,7 +306,6 @@ public class RetractJDBCOutputFormat extends MetricOutputFormat {
private synchronized void submitExecuteBatch() {
try {
- LOG.info("submitExecuteBatch start......");
this.upload.executeBatch();
dbConn.commit();
} catch (SQLException e) {
