Authored by all4you

update

... ... @@ -190,10 +190,10 @@ public class YohoIndexDataLoader implements ApplicationContextAware {
boolean result = false;
while (tryCount <= retryCount && !result) {
long begin = System.currentTimeMillis();
INDEX_REBUILD_LOG.info("[yohoIndexName=[{}]],[pageNo={}],[tryCount={}],[begin={}]", yohoIndexName, pageNo, tryCount, begin);
INDEX_REBUILD_LOG.debug("[yohoIndexName=[{}]],[pageNo={}],[tryCount={}],[begin={}]", yohoIndexName, pageNo, tryCount, begin);
result = this.doLoadData(yohoIndexName, tempIndexRealName, indexBuilder, client, pageNo, limit, true);
long cost = System.currentTimeMillis() - begin;
INDEX_REBUILD_LOG.info("[yohoIndexName=[{}]],[pageNo={}],[tryCount={}],[begin={}],[cost={}ms],[{result={}]", yohoIndexName, pageNo, tryCount, begin, cost, result);
INDEX_REBUILD_LOG.debug("[yohoIndexName=[{}]],[pageNo={}],[tryCount={}],[begin={}],[cost={}ms],[{result={}]", yohoIndexName, pageNo, tryCount, begin, cost, result);
tryCount++;
}
return result;
... ... @@ -210,11 +210,12 @@ public class YohoIndexDataLoader implements ApplicationContextAware {
long begin = System.currentTimeMillis();
INDEX_REBUILD_LOG.info("[addDataToEs begin][yohoIndexName=[{}]],[pageNo={}],[selectCount={}][begin={}]", yohoIndexName, pageNo,dataList.size(), begin);
List<ESBluk> bluks = new ArrayList<>(dataList.size());
for(Object ob: dataList){
for(Object ob: dataList){
bluks.add(new ESBluk(JSONObject.toJSONString(ob),indexBuilder.getId(ob),tempIndexRealName,yohoIndexName,false));
}
BulkResponse bulkResponse = client.bulk(bluks);
if(bulkResponse.hasFailures()){
INDEX_REBUILD_LOG.error("addIndexDataBean has fail,[yohoIndexName=[%s]],[pageNo=%s],[failureMessage=%s]", yohoIndexName,pageNo,bulkResponse.buildFailureMessage());
throw new Exception(String.format("addIndexDataBean has fail,[yohoIndexName=[%s]],[pageNo=%s],[failureMessage=%s]", yohoIndexName,pageNo,bulkResponse.buildFailureMessage()));
}
long end = System.currentTimeMillis();
... ...
... ... @@ -24,9 +24,9 @@ public class IndexRebuildJob {
/**
* 定时任务重建所有索引(每天凌晨0点执行一次)
* 定时任务重建所有索引(每天凌晨1点执行一次)
*/
@Scheduled(cron = "0 0 0 * * ?")
@Scheduled(cron = "0 0 1 * * ?")
public void rebuildIndexJob() {
this.rebuildIndex(Index.social_user.getIndexName());
}
... ...