|
@@ -190,26 +190,26 @@ public class YohoIndexDataLoader implements ApplicationContextAware { |
|
@@ -190,26 +190,26 @@ public class YohoIndexDataLoader implements ApplicationContextAware { |
190
|
result = result & futureResult.get();
|
190
|
result = result & futureResult.get();
|
191
|
}
|
191
|
}
|
192
|
|
192
|
|
193
|
- List<?> dataList = indexBuilder.getUpdatedLists();
|
|
|
194
|
- int resultSize = dataList != null ? dataList.size() : 0;
|
|
|
195
|
- INDEX_REBUILD_LOG.info("loadUpdatedData [yohoIndexName=[{}]],[{resultSize={}]", yohoIndexName, resultSize);
|
|
|
196
|
- if (resultSize > 0) {
|
|
|
197
|
- performanceMonitor.addVisitCount();
|
|
|
198
|
- long begin = System.currentTimeMillis();
|
|
|
199
|
- INDEX_REBUILD_LOG.debug("[addDataToEs begin][yohoIndexName=[{}]],[selectCount={}][begin={}]", yohoIndexName, dataList.size(), begin);
|
|
|
200
|
- List<ESBluk> bluks = new ArrayList<>(dataList.size());
|
|
|
201
|
- for(Object ob: dataList){
|
|
|
202
|
- bluks.add(new ESBluk(JSONObject.toJSONString(ob),indexBuilder.getId(ob),yohoIndexName,yohoIndexName,false));
|
|
|
203
|
- }
|
|
|
204
|
- BulkResponse bulkResponse = client.bulk(bluks);
|
|
|
205
|
- if(bulkResponse.hasFailures()){
|
|
|
206
|
- INDEX_REBUILD_LOG.error("addIndexDataBean has fail,[yohoIndexName=[%s]],[failureMessage=%s]", yohoIndexName,bulkResponse.buildFailureMessage());
|
|
|
207
|
- throw new Exception(String.format("addIndexDataBean has fail,[yohoIndexName=[%s]],[failureMessage=%s]", yohoIndexName,bulkResponse.buildFailureMessage()));
|
|
|
208
|
- }
|
|
|
209
|
- long end = System.currentTimeMillis();
|
|
|
210
|
- INDEX_REBUILD_LOG.debug("[addDataToEs begin][yohoIndexName=[{}]],[selectCount={}][cost={}ms]", yohoIndexName, dataList.size(), end-begin);
|
|
|
211
|
- performanceMonitor.addCost(end-begin);
|
|
|
212
|
- }
|
193
|
+// List<?> dataList = indexBuilder.getUpdatedLists();
|
|
|
194
|
+// int resultSize = dataList != null ? dataList.size() : 0;
|
|
|
195
|
+// INDEX_REBUILD_LOG.info("loadUpdatedData [yohoIndexName=[{}]],[{resultSize={}]", yohoIndexName, resultSize);
|
|
|
196
|
+// if (resultSize > 0) {
|
|
|
197
|
+// performanceMonitor.addVisitCount();
|
|
|
198
|
+// long begin = System.currentTimeMillis();
|
|
|
199
|
+// INDEX_REBUILD_LOG.debug("[addDataToEs begin][yohoIndexName=[{}]],[selectCount={}][begin={}]", yohoIndexName, dataList.size(), begin);
|
|
|
200
|
+// List<ESBluk> bluks = new ArrayList<>(dataList.size());
|
|
|
201
|
+// for(Object ob: dataList){
|
|
|
202
|
+// bluks.add(new ESBluk(JSONObject.toJSONString(ob),indexBuilder.getId(ob),yohoIndexName,yohoIndexName,false));
|
|
|
203
|
+// }
|
|
|
204
|
+// BulkResponse bulkResponse = client.bulk(bluks);
|
|
|
205
|
+// if(bulkResponse.hasFailures()){
|
|
|
206
|
+// INDEX_REBUILD_LOG.error("addIndexDataBean has fail,[yohoIndexName=[%s]],[failureMessage=%s]", yohoIndexName,bulkResponse.buildFailureMessage());
|
|
|
207
|
+// throw new Exception(String.format("addIndexDataBean has fail,[yohoIndexName=[%s]],[failureMessage=%s]", yohoIndexName,bulkResponse.buildFailureMessage()));
|
|
|
208
|
+// }
|
|
|
209
|
+// long end = System.currentTimeMillis();
|
|
|
210
|
+// INDEX_REBUILD_LOG.debug("[addDataToEs begin][yohoIndexName=[{}]],[selectCount={}][cost={}ms]", yohoIndexName, dataList.size(), end-begin);
|
|
|
211
|
+// performanceMonitor.addCost(end-begin);
|
|
|
212
|
+// }
|
213
|
return true;
|
213
|
return true;
|
214
|
} catch (Exception e) {
|
214
|
} catch (Exception e) {
|
215
|
// 如果有异常,则处理一下,并等待30s执行下一次
|
215
|
// 如果有异常,则处理一下,并等待30s执行下一次
|