Start a Conversation

This post is more than 5 years old

Solved!

Go to Solution

4451

January 12th, 2009 10:00

FPPoolQuery.fetchResult returns FP_QUERY_RESULT_CODE_ABORT

Hi, I want to query my clips using FPPoolQuery.fetchResult(60000) and get back a result code of FPLibraryConstants.FP_QUERY_RESULT_CODE_ABORT with the first call to fetchResult. I am using the profile emea1_profile1_rdqeDcw.pea

Do I query the wrong server or are my input parameters wrong?

My parameters are as following (human readable)

DEBUG: compiling patterns ...

DEBUG: [query] date from is 12.01.2009 00:00:00

DEBUG: [query] date to is 30.01.2009 00:00:00

DEBUG: [query] including existing clips

DEBUG: [query] including deleted clips

DEBUG: [query] selected fields are creation-date name type 

DEBUG: creating pool query ...

TRACE: [000] fetching result

TRACE: [000] result is 4

  The query has been aborted because of a problem at the server side. The application may want to resubmit the query



regards, Chris

P.S. here is also my source code

publicorg.jdom.Document query( Calendar from

  , Calendar to

  , booleanincludeExistingClips

  , booleanincludeDeletedClips

  , booleanincludeClipDetails

  , Set selectedFields

    , Map fieldRegExps

    , Long queryTimeout

    , Integer maxRetries

  ) throwsCenteraException{

 

    try{

      /*

       * compile patterns

       */

      logger.debug("compiling patterns ...");

      Map patterns = newHashMap ();

      if(fieldRegExps != null) {

        for(Map.Entry e : fieldRegExps.entrySet()) {

          try{

            Pattern p = Pattern.compile(e.getValue());

            patterns.put(e.getKey(), p);

          } catch(Exception ex) {

            thrownewCenteraException(

              String.format("error while parsing regexp '%s' into pattern: %s", e.getValue(), ex.getMessage()), ex);

          }

        }

      }

       

      /*

       * create Centerasearch expression

       */

      FPQueryExpression exp = newFPQueryExpression();

      if(from != null) {

        logger.debug(String.format("[query] date from is %s", DF_DISPLAY.format(from.getTime())));

        exp.setStartTime(from.getTimeInMillis());

      } if(to != null) {

        logger.debug(String.format("[query] date to is %s", DF_DISPLAY.format(to.getTime())));

        exp.setEndTime(to.getTimeInMillis());

      }

     

      inttype = 0;

      if(includeExistingClips) {

        logger.debug("[query] including existing clips");

        type |= FPLibraryConstants.FP_QUERY_TYPE_EXISTING;

      }

     

      if(includeDeletedClips) {

        logger.debug("[query] including deleted clips");

        type |= FPLibraryConstants.FP_QUERY_TYPE_DELETED;

      }

     

      exp.setType(type);

     

      StringBuilder buf = newStringBuilder();

      for(String field: selectedFields) {

        buf.append(field);

        buf.append(" ");

       

        exp.selectField(field);

      }

     

      logger.debug(String.format("[query] selected fields are %s", buf.toString()));

     

      /*

       * create query and do search

       */

      logger.debug("creating pool query ...");

      FPPoolQuery query = newFPPoolQuery(this.centeraPool, exp); 

     

      longtimeout = -1;

      if(queryTimeout != null)

        timeout = queryTimeout.longValue();

     

      FPQueryResult result = null;

     

    booleanfinished = false;

    booleanincomplete = false;

    booleanprocess = false;

   

    String error = null;

   

    Set clipIds = newLinkedHashSet ();

   

    intretries = 0;

    intidx = 0;

      while(!(finished || incomplete)) {

       

        // fetch next result

       

        logger.trace(String.format("[%03d] fetching result", idx));

        result = query.FetchResult(timeout);

        process = false;

       

        logger.trace(String.format("[%03d] result is %d", idx, result.getResultCode()));

        if(result.getResultCode() != FPLibraryConstants.FP_QUERY_RESULT_CODE_PROGRESS)

          retries = 0;

               

        // check status

        switch(result.getResultCode()) {

       

          caseFPLibraryConstants.FP_QUERY_RESULT_CODE_OK:

            process = true;

            break;

           

          caseFPLibraryConstants.FP_QUERY_RESULT_CODE_INCOMPLETE:

            incomplete = true;

            break;

           

          caseFPLibraryConstants.FP_QUERY_RESULT_CODE_COMPLETE:

          caseFPLibraryConstants.FP_QUERY_RESULT_CODE_END:

            process = true;

            finished = true;

            break;


          caseFPLibraryConstants.FP_QUERY_RESULT_CODE_ABORT:

            error = "The query has been aborted because of a problem at the server side. The application may want to resubmit the query";

            incomplete = true;

            break;

           

          caseFPLibraryConstants.FP_QUERY_RESULT_CODE_ERROR:

            error = "The FetchResult call is aborted because a (platform-specific) error occurred.";

            incomplete = true;

            break;

           

          caseFPLibraryConstants.FP_QUERY_RESULT_CODE_PROGRESS:

           

            if(maxRetries == null) {

              error = "query timed out and retries are disabled, aborting search";

              incomplete = true;

              break;

            }

           

            if(retries >= maxRetries.intValue()) {

              error = String.format("query timed out maximum number of retries reached (%d), aborting search", maxRetries.intValue());

              incomplete = true;

            }

                       

            retries++;

            logger.debug(String.format("search timed out after %d, going into retry %d / %d", retries, maxRetries.intValue()));

            break;           

        }

       

        idx++;

       

        if(!process)

          continue;


        // check if all patterns apply

        booleanmatched = true;

        for(Map.Entry e : patterns.entrySet()) {

         

          String fieldName = e.getKey();

         

          String value = result.getField(fieldName);

          if((value == null) || (value.trim().length() == 0))

            continue;

         

          Matcher m = e.getValue().matcher(value);

          if(!m.matches()) {

            matched = false;

            break;

          }

        }

       

        if(!matched)

          continue;

       

        String clipId = result.getClipID();

        clipIds.add(clipId);

      }

     

      Document doc = newDocument();

     

      Element root = newElement("search");

      doc.addContent(root);


      root.setAttribute("incomplete", String.valueOf(incomplete));

      root.setAttribute("errornous", String.valueOf(error != null));

     

      if(error != null) {

        Element errorElement = newElement("error");

        errorElement.setText(error);

       

        root.addContent(errorElement);

      } else{

        Element clipElements = newElement("clips");

        root.addContent(clipElements);

       

        for(String clipId : clipIds) {

         

          Element clipElement = null;

         

          if(includeClipDetails) {

            Document tmp = this.queryByClip(clipId);

            clipElement = tmp.getRootElement().getChild("clip");

          } else{

            clipElement = newElement("clip");

            clipElement.setAttribute("name", clipId);

            clipElement.setAttribute("exists", "true");

          }

         

          clipElements.addContent(clipElement);

        }

      }

     

    returndoc;

    } catch(Exception e) {

      thrownewCenteraException(String.format("error while processing Centera search: %s", e.getMessage()), e);

    }

}



January 13th, 2009 03:00

Hi Chris,

I quote from Centera API Reference Guide as following:

FP_QUERY_RESULT_CODE_ABORT - The query has aborted due to a problem

on the cluster or because the start time for the query expression is later than the

current server time. Check the start time and retry the query.

In my test, if end time is later than the current server time, this error will come up too.

Pls make sure the range of time is not later than current server time.

ps. To get cluster time, you can call FPPool.getClusterTime().

Best regards,

Henky

January 14th, 2009 04:00

Hi Henky, you were right, the end time was greater than the current centera time. Wouldn't this be a great oppurtunity

to add a comment to the javadoc on this?

Many thanks, Chris

No Events found!

Top