@Override public void reportIndexingFinished(SpaceIndexingInfo indexingInfo) { lastSpaceIndexingInfo.put(indexingInfo.spaceKey, indexingInfo); if (coordinatorInstance != null) { try { coordinatorInstance.reportIndexingFinished( indexingInfo.spaceKey, indexingInfo.finishedOK, indexingInfo.fullUpdate); } catch (Exception e) { logger.warn("Indexing finished reporting to coordinator failed due {}", e.getMessage()); } } writeActivityLogRecord(indexingInfo); }
@Override public String forceIncrementalReindex(String spaceKey) throws Exception { if (coordinatorInstance == null) return null; List<String> pkeys = getAllIndexedSpaceKeys(); if (Utils.isEmpty(spaceKey)) { if (pkeys != null) { for (String k : pkeys) { coordinatorInstance.forceIncrementalReindex(k); } return Utils.createCsvString(pkeys); } else { return ""; } } else { if (pkeys != null && pkeys.contains(spaceKey)) { coordinatorInstance.forceIncrementalReindex(spaceKey); return spaceKey; } else { return null; } } }
/** * Get info about current operation of this river. Used for REST management operations handling. * * @return String with JSON formatted info. * @throws Exception */ @Override public String getRiverOperationInfo(DiscoveryNode esNode, Date currentDate) throws Exception { XContentBuilder builder = jsonBuilder().prettyPrint(); builder.startObject(); builder.field("river_name", riverName().getName()); builder.field("info_date", currentDate); builder.startObject("indexing"); builder.field("state", closed ? "stopped" : "running"); if (!closed) builder.field("last_restart", lastRestartDate); else if (permanentStopDate != null) builder.field("stopped_permanently", permanentStopDate); builder.endObject(); if (esNode != null) { builder.startObject("node"); builder.field("id", esNode.getId()); builder.field("name", esNode.getName()); builder.endObject(); } if (coordinatorInstance != null) { List<SpaceIndexingInfo> currProjectIndexingInfo = coordinatorInstance.getCurrentSpaceIndexingInfo(); if (currProjectIndexingInfo != null) { builder.startArray("current_indexing"); for (SpaceIndexingInfo pi : currProjectIndexingInfo) { pi.buildDocument(builder, null, true, false); } builder.endArray(); } } List<String> pkeys = getAllIndexedSpaceKeys(); if (pkeys != null) { builder.startArray("indexed_spaces"); for (String spaceKey : pkeys) { builder.startObject(); builder.field(SpaceIndexingInfo.DOCFIELD_SPACE_KEY, spaceKey); SpaceIndexingInfo lastIndexing = getLastSpaceIndexingInfo(spaceKey); if (lastIndexing != null) { builder.field("last_indexing"); lastIndexing.buildDocument(builder, null, false, true); } builder.endObject(); } builder.endArray(); } builder.endObject(); return builder.string(); }