You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "nabarun (JIRA)" <ji...@apache.org> on 2018/04/12 20:35:00 UTC
[jira] [Created] (GEODE-5061) Lucene queries cannot be executed on
an accessor
nabarun created GEODE-5061:
------------------------------
Summary: Lucene queries cannot be executed on an accessor
Key: GEODE-5061
URL: https://issues.apache.org/jira/browse/GEODE-5061
Project: Geode
Issue Type: Bug
Components: lucene
Reporter: nabarun
h2. Current:
An Apache Geode user can execute a Lucene query on an accessor without ever creating a Lucene index. This should not be allowed but it is and it causes a stack overflow when we execute a Lucene query from the accessor. This can be observed in the below test case.
{code:java}
public void asynchronousLuceneIndexCreationWithDifferentFieldsMustFail(
RegionTestableType regionTestType) throws Exception {
SerializableRunnableIF createIndex = () -> {
LuceneService luceneService = LuceneServiceProvider.get(getCache());
luceneService.createIndexFactory().addField("text").create(INDEX_NAME, REGION_NAME);
};
dataStore1.invoke(() -> initDataStore(createIndex, regionTestType));
dataStore2.invoke(() -> initDataStore(createIndex, regionTestType));
accessor.invoke(() -> initAccessor(createIndex, regionTestType));
putDataInRegion(accessor);
assertTrue(waitForFlushBeforeExecuteTextSearch(accessor, 60000));
assertTrue(waitForFlushBeforeExecuteTextSearch(dataStore1, 60000));
executeTextSearch(accessor);
dataStore1.invoke(() -> destroyIndex());
// re-index stored data
AsyncInvocation ai1 = dataStore1.invokeAsync(() -> {
recreateIndex();
});
dataStore2.invoke(() -> closeCache());
ai1.join();
aia.join();
assertTrue(waitForFlushBeforeExecuteTextSearch(dataStore1, 60000));
ai1.checkException();
putAllDataIntoRegion(accessor);
executeTextSearch(accessor);
}{code}
However we can see that the issue is resolved when the accessor creates the Lucene Index.
This can be seen in the below test case.
{code:java}
public void asynchronousLuceneIndexCreationWithDifferentFieldsMustFail(
RegionTestableType regionTestType) throws Exception {
SerializableRunnableIF createIndex = () -> {
LuceneService luceneService = LuceneServiceProvider.get(getCache());
luceneService.createIndexFactory().addField("text").create(INDEX_NAME, REGION_NAME);
};
dataStore1.invoke(() -> initDataStore(createIndex, regionTestType));
dataStore2.invoke(() -> initDataStore(createIndex, regionTestType));
accessor.invoke(() -> initAccessor(createIndex, regionTestType));
putDataInRegion(accessor);
assertTrue(waitForFlushBeforeExecuteTextSearch(accessor, 60000));
assertTrue(waitForFlushBeforeExecuteTextSearch(dataStore1, 60000));
executeTextSearch(accessor);
dataStore1.invoke(() -> destroyIndex());
// re-index stored data
AsyncInvocation ai1 = dataStore1.invokeAsync(() -> {
recreateIndex();
});
AsyncInvocation aia = accessor.invokeAsync(() -> {
recreateIndex();
});
dataStore2.invoke(() -> closeCache());
ai1.join();
aia.join();
assertTrue(waitForFlushBeforeExecuteTextSearch(dataStore1, 60000));
ai1.checkException();
putAllDataIntoRegion(accessor);
executeTextSearch(accessor);
}{code}
h2. Solution:
Make sure that Lucene queries cannot be executed in the accessor if the accessor has not created the Lucene index used in the query.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)