Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-5061

Lucene queries can be executed on an accessor which causes the system to go into stack overflow

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • lucene
    • None

    Description

      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.

       

      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);
      }

       

      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.

       

      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);
      }

       

       

      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.

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            nnag Nabarun Nag
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: