Uploaded image for project: 'Apache Lens (Retired)'
  1. Apache Lens (Retired)
  2. LENS-1282

getUpdatedQueryContext() call is missing from QueryExecutionServiceImpl#executeTimeoutInternal

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.6
    • 2.6, 2.7
    • None
    • None

    Description

      We should call getUpdatedQueryContext() in while loop to make sure latest status is available after each "listener.wait(waitMillisPerCheck)"

       if (totalWaitTime > 0 && !queryCtx.getStatus().executed() && !queryCtx.getStatus().finished()) {
            log.info("Registering for query {} completion notification", ctx.getQueryHandleString());
            queryCtx.getSelectedDriver().registerForCompletionNotification(handle, totalWaitTime, listener);
            try {
              // We will wait for a few millis at a time until we reach max required wait time and also check the state
              // each time we come out of the wait.
              // This is done because the registerForCompletionNotification and query execution completion can happen
              // parallely especailly in case of drivers like JDBC and in that case completion notification may not be
              //  received by this listener. So its better to break the wait into smaller ones.
              long waitMillisPerCheck = totalWaitTime/10;
              waitMillisPerCheck = (waitMillisPerCheck > 500) ? 500 : waitMillisPerCheck; // Lets keep max as 500
              long totalWaitMillisSoFar = 0;
              synchronized (listener) {
                while (totalWaitMillisSoFar < totalWaitTime
                  && !queryCtx.getStatus().executed() && !queryCtx.getStatus().finished()) {
                  listener.wait(waitMillisPerCheck);
                  totalWaitMillisSoFar += waitMillisPerCheck;
                }
              }
            } catch (InterruptedException e) {
              log.info("{} query completion notification wait interrupted", queryCtx.getQueryHandleString());
            }
          }
      

      Attachments

        1. lens-1282.patch
          1 kB
          Puneet Gupta

        Activity

          People

            puneet884 Puneet Gupta
            puneet884 Puneet Gupta
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: