use of org.apache.jackrabbit.oak.plugins.index.lucene.directory.IndexConsistencyChecker.Result in project jackrabbit-oak by apache.
the class IndexConsistencyCheckerTest method blobsWithError.
@Test
public void blobsWithError() throws Exception {
FailingBlob failingBlob = new FailingBlob("foo");
idx.setProperty("foo", failingBlob);
idx.child(":index").setProperty("foo", failingBlob);
idx.child("b").setProperty("foo", Lists.newArrayList(failingBlob, failingBlob), Type.BINARIES);
NodeBuilder builder = EMPTY_NODE.builder();
builder.setChildNode("a", idx.getNodeState());
IndexConsistencyChecker checker = new IndexConsistencyChecker(builder.getNodeState(), "/a", temporaryFolder.getRoot());
Result result = checker.check(Level.BLOBS_ONLY);
assertFalse(result.clean);
assertTrue(result.missingBlobs);
assertFalse(result.blobSizeMismatch);
assertEquals(4, result.missingBlobIds.size());
dumpResult(result);
}
use of org.apache.jackrabbit.oak.plugins.index.lucene.directory.IndexConsistencyChecker.Result in project jackrabbit-oak by apache.
the class LuceneIndexMBeanImpl method checkConsistencyOfAllIndexes.
@Override
public boolean checkConsistencyOfAllIndexes(boolean fullCheck) throws IOException {
Stopwatch watch = Stopwatch.createStarted();
NodeState root = nodeStore.getRoot();
boolean clean = true;
for (String indexPath : indexPathService.getIndexPaths()) {
NodeState idxState = NodeStateUtils.getNode(root, indexPath);
if (LuceneIndexConstants.TYPE_LUCENE.equals(idxState.getString(IndexConstants.TYPE_PROPERTY_NAME))) {
Result result = getConsistencyCheckResult(indexPath, fullCheck);
if (!result.clean) {
clean = false;
break;
}
}
}
log.info("Checked index consistency in {}. Check result {}", watch, clean);
return clean;
}
use of org.apache.jackrabbit.oak.plugins.index.lucene.directory.IndexConsistencyChecker.Result in project jackrabbit-oak by apache.
the class IndexConsistencyCheckerTest method validIndexTest.
@Test
public void validIndexTest() throws Exception {
IndexDefinition defn = IndexDefinition.newBuilder(rootState, idx.getNodeState(), "/fooIndex").build();
Directory dir = new OakDirectory(idx, ":data", defn, false);
createIndex(dir, 10);
dir = new OakDirectory(idx, ":data2" + MultiplexersLucene.INDEX_DIR_SUFFIX, defn, false);
createIndex(dir, 10);
NodeBuilder builder = rootState.builder();
builder.setChildNode("fooIndex", idx.getNodeState());
NodeState indexState = builder.getNodeState();
IndexConsistencyChecker checker = new IndexConsistencyChecker(indexState, "/fooIndex", temporaryFolder.getRoot());
Result result = checker.check(Level.BLOBS_ONLY);
assertTrue(result.clean);
checker = new IndexConsistencyChecker(indexState, "/fooIndex", temporaryFolder.getRoot());
result = checker.check(Level.FULL);
assertTrue(result.clean);
assertEquals(2, result.dirStatus.size());
dumpResult(result);
}
Aggregations