Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-4561

CachedSqlEntityProcessor with parametarized query is broken

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 4.1
    • None
    • None

    Description

      When child entities are created and the child entity is provided with a parametrized query as below,

       
      <entity name="x" query="select * from x">
          <entity name="y" query="select * from y where xid=${x.id}" processor="CachedSqlEntityProcessor">
          </entity>
      <entity>
      

      the Entity Processor always return the result from the fist query even though the parameter is changed, It is happening because, EntityProcessorBase.getNext() method doesn't reset the query and rowIterator after calling DIHCacheSupport.getCacheData() method.

      This can be fixed by changing the else block in getNext() method of EntityProcessorBase from

       
      else  {
            return cacheSupport.getCacheData(context, query, rowIterator);
            
      }
      

      to the code mentioned below:

       
      else  {
            Map<String,Object> cacheData = cacheSupport.getCacheData(context, query, rowIterator);
            query = null;
            rowIterator = null;
            return cacheData;
          }
      

      Update: But then, the caching doesn't seem to be working...

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              sudheerprem Sudheer Prem
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 1m
                  1m
                  Remaining:
                  Remaining Estimate - 1m
                  1m
                  Logged:
                  Time Spent - Not Specified
                  Not Specified