}
long currentTimeMillis = System.currentTimeMillis();
boolean isSuccessful = true;
String recordType = null;
ChukwaRecordKey key = new ChukwaRecordKey();
ChukwaRecord record = new ChukwaRecord();
String cluster = null;
int numOfRecords = 0;
try {
Pattern p = Pattern.compile("(.*)\\-(\\d+)$");
int batch = 0;
while (reader.next(key, record)) {
numOfRecords++;
if(first) {
try {
cluster = RecordUtil.getClusterName(record);
initEnv(cluster);
first=false;
} catch(Exception ex) {
log.error("Initialization failed for: "+cluster+". Please check jdbc configuration.");
return false;
}
}
String sqlTime = DatabaseWriter.formatTimeStamp(record.getTime());
log.debug("Timestamp: " + record.getTime());
log.debug("DataType: " + key.getReduceType());
String[] fields = record.getFields();
String table = null;
String[] priKeys = null;
HashMap<String, HashMap<String, String>> hashReport = new HashMap<String, HashMap<String, String>>();
StringBuilder normKey = new StringBuilder();
String node = record.getValue("csource");
recordType = key.getReduceType().toLowerCase();
String dbKey = "report.db.name." + recordType;
Matcher m = p.matcher(recordType);
if (dbTables.containsKey(dbKey)) {
String[] tmp = mdlConfig.findTableName(mdlConfig.get(dbKey), record
.getTime(), record.getTime());