Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-49283

[UDF] query launched within JS UDF does not show in active_requests

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not a Bug
    • Major
    • 7.1.0
    • 7.1.0
    • query
    • 7.1.0-1613
    • Untriaged
    • 1
    • Unknown

    Description

      To repro ...

      Create sleep function

      curl -v -X POST http://localhost:8093/evaluator/v1/libraries/helper -u Administrator:password -H 'content-type: application/json' -d 'function sleep(delay) { var start = new Date().getTime(); while (new Date().getTime() < start + delay); return delay; }'
       
      /opt/couchbase/bin/cbq -u Administrator -p password -s 'CREATE OR REPLACE FUNCTION sleep(t) LANGUAGE JAVASCRIPT AS "sleep" AT "helper"'

       

      Create selectsleep function

      curl -v -X POST http://localhost:8093/evaluator/v1/libraries/n1ql -u Administrator:password -H 'content-type: application/json' -d 'function selectsleep(seconds) {var query = N1QL("SELECT sleep($seconds) as milliseconds", {"seconds": seconds}); var acc = []; for (const row of query) { acc.push(row); } return acc;}'
       
      /opt/couchbase/bin/cbq -u Administrator -p password -s 'CREATE OR REPLACE FUNCTION selectsleep(s) LANGUAGE JAVASCRIPT AS "selectsleep" AT "n1ql"'

       

      Execute function

      cbq> execute function selectsleep(60000); 

      check active requests (in diff terminal)

      only see execute function and would expect to also see n1ql query "select sleep(60000)"

      cbq> select statement, state from system:active_requests;
      {
          "requestID": "0fa56d02-f225-4fcc-b45d-dd20dde7517a",
          "signature": {
              "state": "json",
              "statement": "json"
          },
          "results": [
          {
              "state": "running",
              "statement": "select statement, state from system:active_requests;"
          },
          {
              "state": "running",
              "statement": "execute function selectsleep(60000);"
          }
          ],
          "status": "success",
          "metrics": {
              "elapsedTime": "2.84826ms",
              "executionTime": "2.595987ms",
              "resultCount": 2,
              "resultSize": 206,
              "serviceLoad": 12
          }
      }

       

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            pierre.regazzoni Pierre Regazzoni
            pierre.regazzoni Pierre Regazzoni
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty