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

getUpdatedQueryContext() call is missing from QueryExecutionServiceImpl#executeTimeoutInternal

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.6
    • Fix Version/s: 2.6, 2.7
    • Component/s: None
    • Labels:
      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

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: