@Nullable public static String getAsyncLaneName(NodeState idxState, String indexPath) { return getAsyncLaneName(idxState, indexPath, idxState.getProperty(IndexConstants.ASYNC_PROPERTY_NAME)); }
@CheckForNull public static String getAsyncLaneName(NodeState idxState, String indexPath) { return getAsyncLaneName(idxState, indexPath, idxState.getProperty(IndexConstants.ASYNC_PROPERTY_NAME)); }
@Nullable public static String getAsyncLaneName(NodeState idxState, String indexPath) { return getAsyncLaneName(idxState, indexPath, idxState.getProperty(IndexConstants.ASYNC_PROPERTY_NAME)); }
private void computeAsyncIndexInfo(NodeState idxState, String indexPath, LuceneIndexInfo info) { String asyncName = IndexUtils.getAsyncLaneName(idxState, indexPath); if (asyncName == null) { log.warn("No 'async' value for index definition at [{}]. Definition {}", indexPath, idxState); return; } AsyncIndexInfo asyncInfo = asyncInfoService.getInfo(asyncName); checkNotNull(asyncInfo, "No async info found for name [%s] " + "for index at [%s]", asyncName, indexPath); info.indexedUptoTime = asyncInfo.getLastIndexedTo(); info.asyncName = asyncName; }
/** * Determines the async lane name. This method also check if lane was previously switched * then it uses the actual lane name prior to switch was done * * @param indexPath path of index. Mostly used in reporting exception * @param indexState nodeState for index at given path * * @return async lane name or null which would be the case for sync indexes */ static String getAsyncLaneName(String indexPath, NodeState indexState) { PropertyState asyncPrevious = indexState.getProperty(AsyncLaneSwitcher.ASYNC_PREVIOUS); if (asyncPrevious != null && !AsyncLaneSwitcher.isNone(asyncPrevious)){ return IndexUtils.getAsyncLaneName(indexState, indexPath, asyncPrevious); } return IndexUtils.getAsyncLaneName(indexState, indexPath); }
/** * Determines the async lane name. This method also check if lane was previously switched * then it uses the actual lane name prior to switch was done * * @param indexPath path of index. Mostly used in reporting exception * @param indexState nodeState for index at given path * * @return async lane name or null which would be the case for sync indexes */ static String getAsyncLaneName(String indexPath, NodeState indexState) { PropertyState asyncPrevious = indexState.getProperty(AsyncLaneSwitcher.ASYNC_PREVIOUS); if (asyncPrevious != null && !AsyncLaneSwitcher.isNone(asyncPrevious)){ return IndexUtils.getAsyncLaneName(indexState, indexPath, asyncPrevious); } return IndexUtils.getAsyncLaneName(indexState, indexPath); }
/** * Determines the async lane name. This method also check if lane was previously switched * then it uses the actual lane name prior to switch was done * * @param indexPath path of index. Mostly used in reporting exception * @param indexState nodeState for index at given path * * @return async lane name or null which would be the case for sync indexes */ static String getAsyncLaneName(String indexPath, NodeState indexState) { PropertyState asyncPrevious = indexState.getProperty(AsyncLaneSwitcher.ASYNC_PREVIOUS); if (asyncPrevious != null && !AsyncLaneSwitcher.isNone(asyncPrevious)){ return IndexUtils.getAsyncLaneName(indexState, indexPath, asyncPrevious); } return IndexUtils.getAsyncLaneName(indexState, indexPath); }
private void computeAsyncIndexInfo(NodeState idxState, String indexPath, LuceneIndexInfo info) { String asyncName = IndexUtils.getAsyncLaneName(idxState, indexPath); if (asyncName == null) { log.warn("No 'async' value for index definition at [{}]. Definition {}", indexPath, idxState); return; } AsyncIndexInfo asyncInfo = asyncInfoService.getInfo(asyncName); checkNotNull(asyncInfo, "No async info found for name [%s] " + "for index at [%s]", asyncName, indexPath); info.indexedUptoTime = asyncInfo.getLastIndexedTo(); info.asyncName = asyncName; }
static boolean hasAsyncIndexerRun(NodeState root, String indexPath, NodeState defnNodeState) { boolean hasAsyncNode = root.hasChildNode(ASYNC); String asyncLaneName = getAsyncLaneName(defnNodeState, indexPath, defnNodeState.getProperty(ASYNC_PROPERTY_NAME)); if (asyncLaneName != null) { return hasAsyncNode && root.getChildNode(ASYNC).hasProperty(asyncLaneName); } else { // useful only for tests - basically non-async index defs which don't rely on /:async // hence either readers are there (and this method doesn't come into play during open) // OR there is no cycle (where we return false correctly) return false; } }
static boolean hasAsyncIndexerRun(NodeState root, String indexPath, NodeState defnNodeState) { boolean hasAsyncNode = root.hasChildNode(ASYNC); String asyncLaneName = getAsyncLaneName(defnNodeState, indexPath, defnNodeState.getProperty(ASYNC_PROPERTY_NAME)); if (asyncLaneName != null) { return hasAsyncNode && root.getChildNode(ASYNC).hasProperty(asyncLaneName); } else { // useful only for tests - basically non-async index defs which don't rely on /:async // hence either readers are there (and this method doesn't come into play during open) // OR there is no cycle (where we return false correctly) return false; } }
static boolean hasAsyncIndexerRun(NodeState root, String indexPath, NodeState defnNodeState) { boolean hasAsyncNode = root.hasChildNode(ASYNC); String asyncLaneName = getAsyncLaneName(defnNodeState, indexPath, defnNodeState.getProperty(ASYNC_PROPERTY_NAME)); if (asyncLaneName != null) { return hasAsyncNode && root.getChildNode(ASYNC).hasProperty(asyncLaneName); } else { // useful only for tests - basically non-async index defs which don't rely on /:async // hence either readers are there (and this method doesn't come into play during open) // OR there is no cycle (where we return false correctly) return false; } }
@Test public void asyncName() throws Exception { assertNull(IndexUtils.getAsyncLaneName(EMPTY_NODE, "/fooIndex")); NodeBuilder builder = EMPTY_NODE.builder(); builder.setProperty("async", newArrayList("async2", "sync"), Type.STRINGS); assertEquals("async2", IndexUtils.getAsyncLaneName(builder.getNodeState(), "/fooIndex")); builder.setProperty("async", newArrayList("async3"), Type.STRINGS); assertEquals("async3", IndexUtils.getAsyncLaneName(builder.getNodeState(), "/fooIndex")); }
NodeState idx = getNode(root, indexPath); NodeBuilder idxb = child(builder, indexPath); String laneName = IndexUtils.getAsyncLaneName(idx, indexPath); Long lastIndexedTo = asyncInfo.get(laneName);
NodeState idx = getNode(root, indexPath); NodeBuilder idxb = child(builder, indexPath); String laneName = IndexUtils.getAsyncLaneName(idx, indexPath); Long lastIndexedTo = asyncInfo.get(laneName);
} else { if (getAsyncLaneName(definition.getNodeState(), indexPath) == null || rootState.async != null) { rootState.indexDisabler.disableOldIndexes(indexPath, definition);
} else { if (getAsyncLaneName(definition.getNodeState(), indexPath) == null || rootState.async != null) { rootState.indexDisabler.disableOldIndexes(indexPath, definition);
} else { if (getAsyncLaneName(definition.getNodeState(), indexPath) == null || rootState.async != null) { rootState.indexDisabler.disableOldIndexes(indexPath, definition);