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

unable to decode prepared statement

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 4.5.0
    • 4.5.0
    • query
    • 3 nodes
      build version 2566
      1 bucket: default
      primary index on default
      3 indexes like CREATE INDEX I1 ON default(a,b) WHERE a is valued
    • Untriaged
    • Yes

    Description

      In the course of investigating MB-19659, I have run into a problem with prepared statements. I thought this bug had been fixed.

      I installed 2566 on a machine, and ran statement curl http://172.23.123.102:8093/query/service -d "statement=prepare select count(1) from default where a = ? and b = ?"

      Based on the results, I assembled this request

      curl http://172.23.123.100:8093/query/service -H "Content-Type: application/json" -d '

      { "encoded_plan": "H4sIAAAJbogA/7RTwY7aMBD9FcvlAFJYkRC2IVJV9dIWqYdVOVYrcOIhuHWc1LFZWpR+e8cmsApsD0Xam+N5fvPmzcuBgsorDnxVS6ZoSmlAFSsBTzzk2XQa3o/vs7fROE42yXgexcl4MoniiMM8jmYzRFc1aGYqTdMDffP8QZfw0yI3IORPvhWSa0D+b33QB2u2lRa/HcqDbmJZKA77ZY76kaXagW4QcjyR4XDNYcOsNOu7NVuPRidMv5L1KyUY9lwe3a0Fd4DHgG6ENKBXpzaH85OLPkQ0ZMekBY7vUqMttAEVTigKFiHtPlYCR6azeTaBZBbP8yTJ4/kGqz/gV1Oz3C/iyNtt5voWb1TjTfnKVAFO1GdRbJ0HA9doEDnhC5VL24gK7ZsG9Ev11Ku3LUKwrAqkLhpB26Dv8QPTTEqQ50XctKmP3j1vtOLCeDV0OPzHqsg7MghHhClOXoJkHSRChy/lLhSyM/lJV7bGdqwoNBTMQJcMq8ww9PssHGLl3MbKY4tGXDGh4hK4wNf/TRdcjq9u0PQqm+gMetDVd8hdijQ0aOvKDXsME+xrBzwLa18e58TgrEMErbXYCQkF+L+j21Z6SmsaXhm8NBpY6elpIwrFjNU+xBjOlCpbZpgYrBnY43vkh5ppIA1IbEtO8shGVyXp2pCnLSCEYTre+/hk7kTbvwEAAP//H56ogO4EAAA=", "prepared": "d1db3316-6b72-48f8-9248-00242de94255", "args":["A1","B2"]}

      This request failed:

      {
      "requestID": "c339e667-7578-4744-9115-68e2c801b9a1",
      "errors": [

      { "code": 4070, "msg": "Unable to decode prepared statement - cause: Unrecognizable prepared statement - cause: JSON unmarshalling error: json: cannot unmarshal bool into Go value of type value.Value" }

      ],
      "status": "fatal",
      "metrics":

      { "elapsedTime": "78.352µs", "executionTime": "76.518µs", "resultCount": 0, "resultSize": 0, "errorCount": 1 }

      }

      Attachments

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

        Activity

          This problem is also visible through the Java SDK.

          johan.larson Johan Larson (Inactive) added a comment - This problem is also visible through the Java SDK.

          This problem still happens if the query is replaced by an unparameterized one, but the error is different:

          prepare select count(1) from default where a = 3 and b = 5

          ~/projects/MB-19659-prepared-stmt $ cat qr4
          curl http://172.23.123.102:8093/query/service -H "Content-Type: application/json" -d '

          { "encoded_plan": "H4sIAAAJbogA/5yQT4/TMBDFv4o1cGildEVw/ySROCAurMQB0SNaNY49SQyJHWxnt7AKn51xNtVSEBeUi+P383tv5hHQSKtQnYZOGCgAEjCiRzqJnGd1VeebrdzuN9u94huBXG5knr1WGee7Q14TbQd0IlgHxSO8eP6BI34byRsJ+Slb3SmH5P/5Gno7htY6/SNSM/RfLrdG4fmdHU04ShqCrOw9Ok/c04mtVqXCWoxdKG9KUa7XF+Zaqa6VHoN4ltc3pVYRuEtAx0AK1hyWn5Om6oApP+wPuK/Uq3SbZbH1V/zuByHjQhenZcN/39KN8fNwn4RpMK7ivW7aOEbM2cXkWyO70WtLS+AJfLAPv6nTRACJpiHbxmuYkn/t6aOzX1DGUIee0k8BXf+UjechsjJiq3QN0x19CQxO3+sOG/Sx11K6uJQv0unPsGNwKHqYH3vdGBFGN8/0MiXVjH2FjhpCwDO9J38chEPmsaNi7BLPamd7tsSwhxYJEewN40wYxSo67WD6FQAA//9BSc3wxQIAAA==", "prepared": "a938fbf9-4c46-46d3-ae3c-c982d833579f" }

          '
          ~/projects/MB-19659-prepared-stmt $ sh qr4
          {
          "requestID": "7a9e1cee-94a3-48ca-b93b-aed42ca60b9f",
          "errors": [

          { "code": 4070, "msg": "Unable to decode prepared statement - cause: Unrecognizable prepared statement - cause: JSON unmarshalling error: Keyspace not found keyspace - cause: No bucket named " }

          ],
          "status": "fatal",
          "metrics":

          { "elapsedTime": "72.578µs", "executionTime": "70.078µs", "resultCount": 0, "resultSize": 0, "errorCount": 1 }

          }

          johan.larson Johan Larson (Inactive) added a comment - This problem still happens if the query is replaced by an unparameterized one, but the error is different: prepare select count(1) from default where a = 3 and b = 5 ~/projects/ MB-19659 -prepared-stmt $ cat qr4 curl http://172.23.123.102:8093/query/service -H "Content-Type: application/json" -d ' { "encoded_plan": "H4sIAAAJbogA/5yQT4/TMBDFv4o1cGildEVw/ySROCAurMQB0SNaNY49SQyJHWxnt7AKn51xNtVSEBeUi+P383tv5hHQSKtQnYZOGCgAEjCiRzqJnGd1VeebrdzuN9u94huBXG5knr1WGee7Q14TbQd0IlgHxSO8eP6BI34byRsJ+Slb3SmH5P/5Gno7htY6/SNSM/RfLrdG4fmdHU04ShqCrOw9Ok/c04mtVqXCWoxdKG9KUa7XF+Zaqa6VHoN4ltc3pVYRuEtAx0AK1hyWn5Om6oApP+wPuK/Uq3SbZbH1V/zuByHjQhenZcN/39KN8fNwn4RpMK7ivW7aOEbM2cXkWyO70WtLS+AJfLAPv6nTRACJpiHbxmuYkn/t6aOzX1DGUIee0k8BXf+UjechsjJiq3QN0x19CQxO3+sOG/Sx11K6uJQv0unPsGNwKHqYH3vdGBFGN8/0MiXVjH2FjhpCwDO9J38chEPmsaNi7BLPamd7tsSwhxYJEewN40wYxSo67WD6FQAA//9BSc3wxQIAAA==", "prepared": "a938fbf9-4c46-46d3-ae3c-c982d833579f" } ' ~/projects/ MB-19659 -prepared-stmt $ sh qr4 { "requestID": "7a9e1cee-94a3-48ca-b93b-aed42ca60b9f", "errors": [ { "code": 4070, "msg": "Unable to decode prepared statement - cause: Unrecognizable prepared statement - cause: JSON unmarshalling error: Keyspace not found keyspace - cause: No bucket named " } ], "status": "fatal", "metrics": { "elapsedTime": "72.578µs", "executionTime": "70.078µs", "resultCount": 0, "resultSize": 0, "errorCount": 1 } }

          Johan,

          Please post the output of the PREPARE:

          prepare select count(1) from default where a = ? and b = ?

          Thanks,
          Gerald

          gerald Gerald Sangudi (Inactive) added a comment - Johan, Please post the output of the PREPARE: prepare select count(1) from default where a = ? and b = ? Thanks, Gerald

          Getting rid of the duplicate indexes doesn't make a difference.

          johan.larson Johan Larson (Inactive) added a comment - Getting rid of the duplicate indexes doesn't make a difference.

          {
          "requestID": "e11f99e6-149a-429f-bf1a-18c89ba2e56b",
          "signature": "json",
          "results": [
          {
          "encoded_plan": "H4sIAAAJbogA/7RTwY7aMBT8FcvlAFJYbSi7gkhV1UtbpB5W5Vit4CV+CW4dJ3Vslhal395nE1gFtoci7c1kxvPG84Y9R51VAsWqVqB5wnnENZRIJzGZ5/cizse3s9l0PM1jHMME0zHcC8gEQdMYiF3VaMBWhid7/ub5B1/iT0faSJQ/2UYqYZD0v/VJH5zdVEb+9qxAukploQXulhn5J5Vqi6YhyuHEhsO1wBycsuubNaxHoyOnj6R9pEQLz/DoZi2FJzxGPJfKolkdx+xPV87mMNmwLSiHgu4l1jhsIy69UTIsY979WEl6Mr+bp7c4u5vOs9ksm85zQn/gr6aGLCzioNtt5vIrfdFNCOUr6AK9qc+y2PgMBn7QYOKNL3SmXCMriu9txL9UTz28bYlCsC5Iumgkb6N+xg9gQClUp0VctamPIb0QtBbSBjd8OPzHqtg7NohHDLRgL1HSjjKhhM/tLjSpg/pkKlfTOCgKgwVY7JrhtB3GYZ+FZ6x82oQ8thTEhRI5LlFIuv3fctH58/UVnl5lE11AD6b6jplvkcGGYl35xx7KhLvaE0/G2pefc1Tw0RGD10ZupcICw7+j21ZybGsSXwS8tAahDPK8kYUG60woMZUz4dqVKTWGMIs7uk/6WINB1qCisexoj+WmKlk3hj1tkChA7Xgf6pP6E2//BgAA///G+AyZ7gQAAA==",
          "name": "d29f6d1f-0884-4f1e-a2eb-a6dacdf6d41a",
          "operator": {
          "#operator": "Sequence",
          "~children": [
          {
          "#operator": "Authorize",
          "child": {
          "#operator": "Sequence",
          "~children": [
          {
          "#operator": "IndexScan",
          "covers": [
          "cover ((`default`.`a`))",
          "cover ((`default`.`b`))",
          "cover ((meta(`default`).`id`))"
          ],
          "filter_covers":

          { "cover (((`default`.`a`) is valued))": true }

          ,
          "index": "i1",
          "index_id": "59b0e8549c88c49f",
          "keyspace": "default",
          "namespace": "default",
          "spans": [
          {
          "Range":

          { "High": [ "$1", "$2" ], "Inclusion": 3, "Low": [ "$1", "$2" ] }

          }
          ],
          "using": "gsi"
          },
          {
          "#operator": "Parallel",
          "~child": {
          "#operator": "Sequence",
          "~children": [

          { "#operator": "Filter", "condition": "((cover ((`default`.`a`)) = $1) and (cover ((`default`.`b`)) = $2))" }

          ,

          { "#operator": "InitialGroup", "aggregates": [ "count(1)" ], "group_keys": [] }

          ]
          }
          },

          { "#operator": "IntermediateGroup", "aggregates": [ "count(1)" ], "group_keys": [] }

          ,

          { "#operator": "FinalGroup", "aggregates": [ "count(1)" ], "group_keys": [] }

          ,
          {
          "#operator": "Parallel",
          "~child": {
          "#operator": "Sequence",
          "~children": [
          {
          "#operator": "InitialProject",
          "result_terms": [

          { "expr": "count(1)" }

          ]
          },

          { "#operator": "FinalProject" }

          ]
          }
          }
          ]
          },
          "privileges":

          { "default:default": 1 }

          },

          { "#operator": "Stream" }

          ]
          },
          "signature":

          { "$1": "number" }

          ,
          "text": "prepare select count(1) from default where a = ? and b = ?"
          }
          ],
          "status": "success",
          "metrics":

          { "elapsedTime": "5.66512ms", "executionTime": "5.583929ms", "resultCount": 1, "resultSize": 6015 }

          }

          johan.larson Johan Larson (Inactive) added a comment - { "requestID": "e11f99e6-149a-429f-bf1a-18c89ba2e56b", "signature": "json", "results": [ { "encoded_plan": "H4sIAAAJbogA/7RTwY7aMBT8FcvlAFJYbSi7gkhV1UtbpB5W5Vit4CV+CW4dJ3Vslhal395nE1gFtoci7c1kxvPG84Y9R51VAsWqVqB5wnnENZRIJzGZ5/cizse3s9l0PM1jHMME0zHcC8gEQdMYiF3VaMBWhid7/ub5B1/iT0faSJQ/2UYqYZD0v/VJH5zdVEb+9qxAukploQXulhn5J5Vqi6YhyuHEhsO1wBycsuubNaxHoyOnj6R9pEQLz/DoZi2FJzxGPJfKolkdx+xPV87mMNmwLSiHgu4l1jhsIy69UTIsY979WEl6Mr+bp7c4u5vOs9ksm85zQn/gr6aGLCzioNtt5vIrfdFNCOUr6AK9qc+y2PgMBn7QYOKNL3SmXCMriu9txL9UTz28bYlCsC5Iumgkb6N+xg9gQClUp0VctamPIb0QtBbSBjd8OPzHqtg7NohHDLRgL1HSjjKhhM/tLjSpg/pkKlfTOCgKgwVY7JrhtB3GYZ+FZ6x82oQ8thTEhRI5LlFIuv3fctH58/UVnl5lE11AD6b6jplvkcGGYl35xx7KhLvaE0/G2pefc1Tw0RGD10ZupcICw7+j21ZybGsSXwS8tAahDPK8kYUG60woMZUz4dqVKTWGMIs7uk/6WINB1qCisexoj+WmKlk3hj1tkChA7Xgf6pP6E2//BgAA///G+AyZ7gQAAA==", "name": "d29f6d1f-0884-4f1e-a2eb-a6dacdf6d41a", "operator": { "#operator": "Sequence", "~children": [ { "#operator": "Authorize", "child": { "#operator": "Sequence", "~children": [ { "#operator": "IndexScan", "covers": [ "cover ((`default`.`a`))", "cover ((`default`.`b`))", "cover ((meta(`default`).`id`))" ], "filter_covers": { "cover (((`default`.`a`) is valued))": true } , "index": "i1", "index_id": "59b0e8549c88c49f", "keyspace": "default", "namespace": "default", "spans": [ { "Range": { "High": [ "$1", "$2" ], "Inclusion": 3, "Low": [ "$1", "$2" ] } } ], "using": "gsi" }, { "#operator": "Parallel", "~child": { "#operator": "Sequence", "~children": [ { "#operator": "Filter", "condition": "((cover ((`default`.`a`)) = $1) and (cover ((`default`.`b`)) = $2))" } , { "#operator": "InitialGroup", "aggregates": [ "count(1)" ], "group_keys": [] } ] } }, { "#operator": "IntermediateGroup", "aggregates": [ "count(1)" ], "group_keys": [] } , { "#operator": "FinalGroup", "aggregates": [ "count(1)" ], "group_keys": [] } , { "#operator": "Parallel", "~child": { "#operator": "Sequence", "~children": [ { "#operator": "InitialProject", "result_terms": [ { "expr": "count(1)" } ] }, { "#operator": "FinalProject" } ] } } ] }, "privileges": { "default:default": 1 } }, { "#operator": "Stream" } ] }, "signature": { "$1": "number" } , "text": "prepare select count(1) from default where a = ? and b = ?" } ], "status": "success", "metrics": { "elapsedTime": "5.66512ms", "executionTime": "5.583929ms", "resultCount": 1, "resultSize": 6015 } }

          Ok, thanks. The problem is unmarshaling of FilterCovers. Fix coming shortly.

          gerald Gerald Sangudi (Inactive) added a comment - Ok, thanks. The problem is unmarshaling of FilterCovers. Fix coming shortly.
          gerald Gerald Sangudi (Inactive) added a comment - Fixed by http://review.couchbase.org/#/c/64218/

          Added a test case for same.

          Prerna.Manaktala Prerna Manaktala (Inactive) added a comment - Added a test case for same.

          People

            gerald Gerald Sangudi (Inactive)
            johan.larson Johan Larson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty