Uploaded image for project: 'C++ Couchbase Client'
  1. C++ Couchbase Client
  2. CXXCBC-179

json streaming lexer fails to fully parse query response with profile

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 1.0.0-beta.3
    • 1.0.0-beta.2
    • None
    • None
    • 1
    • SDK20: Pathfinding + Wrappers

    Description

      Parsing of the below json seems to terminate early. This leads to a json parsing error when parsing the metadata. Repro here https://github.com/couchbaselabs/couchbase-cxx-client/pull/189

      JSON response

      {
          "requestID": "b4b2e8a1-975a-4851-96e7-d2b71f9019c6",
          "clientContextID": "1e7924f1-3d8e-476e-a151-4a5a68c9f995",
          "signature": {
              "*": "*"
          },
          "results": [
              {
                  "data": {
                      "tech": "C++"
                  }
              },
              {
                  "data": {
                      "tech": "Ruby"
                  }
              },
              {
                  "data": {
                      "tech": "Couchbase"
                  }
              }
          ],
          "status": "success",
          "profile": {
              "phaseTimes": {
                  "authorize": "8.729µs",
                  "instantiate": "14.288µs",
                  "parse": "767.821µs",
                  "plan": "38.661µs",
                  "run": "59.84µs"
              },
              "phaseOperators": {
                  "authorize": 1
              },
              "requestTime": "2022-05-10T14:44:46.851Z",
              "servicingHost": "hxn8-gxscnamx8vl.f4l7ztvzv7gy5nk.nonprod-project-avengers.com:8091",
              "executionTimings": {
                  "#operator": "Authorize",
                  "#stats": {
                      "#phaseSwitches": 4,
                      "execTime": "2.046µs",
                      "servTime": "6.683µs"
                  },
                  "privileges": {
                      "List": []
                  },
                  "~child": {
                      "#operator": "Sequence",
                      "#stats": {
                          "#phaseSwitches": 2,
                          "execTime": "1.419µs"
                      },
                      "~children": [
                          {
                              "#operator": "ExpressionScan",
                              "#stats": {
                                  "#itemsOut": 3,
                                  "#phaseSwitches": 7,
                                  "execTime": "6.707µs",
                                  "kernTime": "2.694µs",
                                  "usedMemory": 40
                              },
                              "alias": "data",
                              "expr": "[{\"tech\": \"C++\"}, {\"tech\": \"Ruby\"}, {\"tech\": \"Couchbase\"}]",
                              "optimizer_estimates": {
                                  "cardinality": 3,
                                  "cost": 0.024,
                                  "fr_cost": 0.008,
                                  "size": 64
                              },
                              "uncorrelated": true
                          },
                          {
                              "#operator": "InitialProject",
                              "#stats": {
                                  "#itemsIn": 3,
                                  "#itemsOut": 3,
                                  "#phaseSwitches": 14,
                                  "execTime": "12.588654ms",
                                  "kernTime": "15.831µs",
                                  "state": "running"
                              },
                              "optimizer_estimates": {
                                  "cardinality": 3,
                                  "cost": 0.048,
                                  "fr_cost": 0.016,
                                  "size": 64
                              },
                              "result_terms": [
                                  {
                                      "expr": "self",
                                      "star": true
                                  }
                              ]
                          },
                          {
                              "#operator": "Stream",
                              "#stats": {
                                  "#itemsIn": 3,
                                  "#itemsOut": 3,
                                  "#phaseSwitches": 4,
                                  "execTime": "12.589µs"
                              },
                              "optimizer_estimates": {
                                  "cardinality": 3,
                                  "cost": 0.048,
                                  "fr_cost": 0.016,
                                  "size": 64
                              }
                          }
                      ]
                  },
                  "~versions": [
                      "7.0.2-N1QL",
                      "7.0.3-7031-enterprise"
                  ]
              },
              "optimizerEstimates": {
                  "cardinality": 3,
                  "cost": 0.048
              }
          },
          "controls": {
              "scan_consistency": "unbounded",
              "use_cbo": "true",
              "stmtType": "SELECT"
          }
      }
      

      Parsed

      {
        "requestID": "4eb158e4-bdab-4e52-a0b9-6fa03dce404d",
        "clientContextID": "58a3f450-2eb5-4bfa-80b6-7ecd170cfda8",
        "signature": {"greeting":"string"},
        "results": [
        ],
        "status": "success",
        "profile": {"phaseTimes": {"authorize":"666.985µs","instantiate":"11.
        692µs","parse":"358.026µs","plan":"23.28µs","run":"726.594µs"},
        "phaseOperators": {"authorize":1},"requestTime": "2022-05-11T09:44:54.95Z",
        "servicingHost": "hxn8-gxscnamx8vl.f4l7ztvzv7gy5nk.nonprod-project-avengers.
        com:8091","executionTimings": {"#operator":"Authorize","#stats":
        {"#phaseSwitches":4,"execTime":"3.258µs","servTime":"663.727µs"},
        "privileges":{"List":[]},"~child":{"#operator":"Sequence","#stats":
        {"#phaseSwitches":2,"execTime":"2.157µs"},"~children":[{"#operator":
        "DummyScan","#stats":{"#itemsOut":1,"#phaseSwitches":3,"execTime":"554ns",
        "kernTime":"742ns"},"optimizer_estimates":{"cardinality":1,"cost":1.
        0842021724855044e-19,"fr_cost":1.0842021724855044e-19,"size":1}},
        {"#operator":"InitialProject","#stats":{"#itemsIn":1,"#itemsOut":1,
        "#phaseSwitche
      

      Attachments

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

        Activity

          People

            avsej Sergey Avseyev
            jake.rawsthorne Jake Rawsthorne
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes