Authored by all4you

update

... ... @@ -78,7 +78,7 @@ public class YohoIndexDataLoader implements ApplicationContextAware {
// 5、判断执行结果和任务执行状态
if (result) {
INDEX_REBUILD_LOG.info("[{}:mysql-->ES]finished,cost={}ms", tempIndexRealName, System.currentTimeMillis() - begin);
INDEX_REBUILD_LOG.info("[{}:mysql-->ES]finished,cost=[{}]s", tempIndexRealName, (System.currentTimeMillis()-begin)/1000);
} else {
INDEX_REBUILD_LOG.error("[{}:mysql-->ES]failed", tempIndexRealName);
client.deleteIndex(tempIndexRealName);
... ... @@ -162,17 +162,18 @@ public class YohoIndexDataLoader implements ApplicationContextAware {
if (resultSize > 0) {
performanceMonitor.addVisitCount();
long begin = System.currentTimeMillis();
INDEX_REBUILD_LOG.info("[addDataToEs begin][yohoIndexName=[{}]],[selectCount={}][begin={}]", yohoIndexName, dataList.size(), begin);
INDEX_REBUILD_LOG.debug("[addDataToEs begin][yohoIndexName=[{}]],[selectCount={}][begin={}]", yohoIndexName, dataList.size(), begin);
List<ESBluk> bluks = new ArrayList<>(dataList.size());
for(Object ob: dataList){
bluks.add(new ESBluk(JSONObject.toJSONString(ob),indexBuilder.getId(ob),yohoIndexName,yohoIndexName,false));
}
BulkResponse bulkResponse = client.bulk(bluks);
if(bulkResponse.hasFailures()){
INDEX_REBUILD_LOG.error("addIndexDataBean has fail,[yohoIndexName=[%s]],[failureMessage=%s]", yohoIndexName,bulkResponse.buildFailureMessage());
throw new Exception(String.format("addIndexDataBean has fail,[yohoIndexName=[%s]],[failureMessage=%s]", yohoIndexName,bulkResponse.buildFailureMessage()));
}
long end = System.currentTimeMillis();
INDEX_REBUILD_LOG.info("[addDataToEs begin][yohoIndexName=[{}]],[selectCount={}][cost={}ms]", yohoIndexName, dataList.size(), end-begin);
INDEX_REBUILD_LOG.debug("[addDataToEs begin][yohoIndexName=[{}]],[selectCount={}][cost={}ms]", yohoIndexName, dataList.size(), end-begin);
performanceMonitor.addCost(end-begin);
}
return true;
... ...