public boolean isFailing(String asyncName) { return !getFailingIndexData(asyncName).isEmpty(); }
public boolean isFailing(String asyncName) { return !getFailingIndexData(asyncName).isEmpty(); }
public boolean isFailing(String asyncName) { return !getFailingIndexData(asyncName).isEmpty(); }
public TabularData getFailingIndexStats(String asyncName) { TabularDataSupport tds; try { TabularType tt = new TabularType(TrackingCorruptIndexHandler.class.getName(), "Failing Index Stats", FailingIndexStats.TYPE, new String[]{"path"}); tds = new TabularDataSupport(tt); Map<String, CorruptIndexInfo> infos = getFailingIndexData(asyncName); for (Map.Entry<String, CorruptIndexInfo> e : infos.entrySet()) { FailingIndexStats stats = new FailingIndexStats(e.getValue()); tds.put(stats.toCompositeData()); } } catch (OpenDataException e) { throw new IllegalStateException(e); } return tds; }
public TabularData getFailingIndexStats(String asyncName) { TabularDataSupport tds; try { TabularType tt = new TabularType(TrackingCorruptIndexHandler.class.getName(), "Failing Index Stats", FailingIndexStats.TYPE, new String[]{"path"}); tds = new TabularDataSupport(tt); Map<String, CorruptIndexInfo> infos = getFailingIndexData(asyncName); for (Map.Entry<String, CorruptIndexInfo> e : infos.entrySet()) { FailingIndexStats stats = new FailingIndexStats(e.getValue()); tds.put(stats.toCompositeData()); } } catch (OpenDataException e) { throw new IllegalStateException(e); } return tds; }
public TabularData getFailingIndexStats(String asyncName) { TabularDataSupport tds; try { TabularType tt = new TabularType(TrackingCorruptIndexHandler.class.getName(), "Failing Index Stats", FailingIndexStats.TYPE, new String[]{"path"}); tds = new TabularDataSupport(tt); Map<String, CorruptIndexInfo> infos = getFailingIndexData(asyncName); for (Map.Entry<String, CorruptIndexInfo> e : infos.entrySet()) { FailingIndexStats stats = new FailingIndexStats(e.getValue()); tds.put(stats.toCompositeData()); } } catch (OpenDataException e) { throw new IllegalStateException(e); } return tds; }
@Test public void notifyFailedIndexing() throws Exception{ createIndex("foo"); //1. Create and populate index NodeState before = builder.getNodeState(); builder.setProperty("foo", "bar"); NodeState after = builder.getNodeState(); NodeState indexed = hook.processCommit(before, after, CommitInfo.EMPTY); tracker.update(indexed); builder = indexed.builder(); indexed = corruptIndex("/oak:index/foo"); builder = indexed.builder(); builder.setProperty("foo", "bar2"); after = builder.getNodeState(); try { hook.processCommit(before, after, CommitInfo.EMPTY); fail("Indexing should have failed"); } catch (CommitFailedException ignore){ } assertTrue(corruptIndexHandler.getFailingIndexData("async").containsKey("/oak:index/foo")); }
assertTrue(async.getIndexStats().isFailing()); assertTrue(async.getCorruptIndexHandler().getFailingIndexData("async").containsKey("/oak:index/barIndex")); assertFalse(async.getCorruptIndexHandler().getCorruptIndexData("async").containsKey("/oak:index/barIndex")); CorruptIndexInfo barIndexInfo = async.getCorruptIndexHandler().getFailingIndexData("async").get("/oak:index/barIndex"); assertFalse(async.getCorruptIndexHandler().getFailingIndexData("async").containsKey("/oak:index/fooIndex")); assertFalse(async.getCorruptIndexHandler().getFailingIndexData("async").containsKey("/oak:index/barIndex"));