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

with index2 api enabled encoded_plan doesn't work properly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 5.0.0
    • 5.0.0
    • query
    • Security Level: Public
    • None
    • 5.0.0-2111
    • Triaged
    • Unknown

    Description

      This is related to CBSE-3291 and even more related to MB-22273. Basically sometimes using the encoded plan to execute a prepared statement from a different node does not yield the correct results, it will return 0 instead of 1412. However if index2 is turned off via:

      curl -u Administrator:password http://localhost:8093/admin/settings -XPOST -d '{"max-index-api":1}' 

      Then the results are correct

       here are the repro steps:

      1 - start with a fresh cluster that has had no prepared statement against it

      2 - create the index: create index `myidx` on `beer-sample`(`name`,`country`,`code`)where(`type`="brewery”) 

       

      3 - prepare the statement

      curl http://<ip address of node 1>:8093/query/service -d 'statement=prepare s1 from SELECT name, IFMISSINGORNULL(country,999), IFMISSINGORNULL(code,999) FROM `beer-sample` WHERE type = "brewery" AND name IS NOT MISSING'

      that produces a plan:

      {
      "requestID": "d0208bcb-d313-403a-8b3f-6f0a39b73538",
      "signature": "json",
      "results": [
      {
      "encoded_plan": "H4sIAAAAAAAA/6SUUU/bPhTFv4p1/zy0kv9IYRJbLe0Bbe0WqRTUMO0BqtZNbouZY2e2A+1Q9tmna1KVwjom9hbLP1/fc+6J7wFNbgssppWWBgQAByNLBAE+AQ62QieDdSDu4b/tAjL8XqPJETj8zK+VLhwaEJe70Ekdrq1TP4iqnLpVGpfoqdRQ+RDxC+mWGEBAgQtZ6yDmiO5/L8tK06lzp25BJA3/S/JtM2k2Hb2q5dQUuMpyaYBDbm/ReRCXD1+s05k9unN2OCOjZt3uBn0O5LY2wa1fYIonRUoMcpfqHs5UQdCEw0LpgG66ae5+X92wrmJdAXOHd+jW0HBQJA8EKJptXExVQUjveJ7gcTKfv3vTk8dHwOEbrn0lc0rCrtOkerPTzgI4+EoaH+3sr2QeQARXI4exNEukLlOT69ora0AkHIb2jnw1tdYwaZoJh9orswQBS6+Axv14KOfSSa1Rwz+NdhCNiz6bQoXYCnQ6f7aPvWdXGwOvoMukKdi+I20cmPLM2MBK5UlTt/tMT2pUUFKfO3uDOZnn0Nc6TAO68sFDXFUEvpA7qtuSatFeZx2Zuq/FbSA56/V6rysR87o5P3kqbqDMVlpDw22eIllwKMt4FrxaGhlqF0NykICAG2/p7zs42n63L1JcNRwCrughqBxW0iHzCVs4W7KsP+x/uGAEc5YOTtMsS0efzsajL8Nhp1XOqevf7RYYt9hgfHbKdiSzr5/74z6jQOymgZ2MPsbbWJqx0dkFa2tC8ysAAP//AFftYFYFAAA=",
      "name": "s1",

      ....

      4 - save the "encoded_plan": "...." bit

      5 - reset all nodes 

      6 - Now execute the following against each of the nodes you have

      curl http://<ip address of the node you are testing>:8093/query/service -H 'Content-Type: application/json' -d '

      { "prepared": "s1", "encoded_plan": "H4sIAAAAAAAA/6SUUU/bPhTFv4p1/zy0kv9IYRJbLe0Bbe0WqRTUMO0BqtZNbouZY2e2A+1Q9tmna1KVwjom9hbLP1/fc+6J7wFNbgssppWWBgQAByNLBAE+AQ62QieDdSDu4b/tAjL8XqPJETj8zK+VLhwaEJe70Ekdrq1TP4iqnLpVGpfoqdRQ+RDxC+mWGEBAgQtZ6yDmiO5/L8tK06lzp25BJA3/S/JtM2k2Hb2q5dQUuMpyaYBDbm/ReRCXD1+s05k9unN2OCOjZt3uBn0O5LY2wa1fYIonRUoMcpfqHs5UQdCEw0LpgG66ae5+X92wrmJdAXOHd+jW0HBQJA8EKJptXExVQUjveJ7gcTKfv3vTk8dHwOEbrn0lc0rCrtOkerPTzgI4+EoaH+3sr2QeQARXI4exNEukLlOT69ora0AkHIb2jnw1tdYwaZoJh9orswQBS6+Axv14KOfSSa1Rwz+NdhCNiz6bQoXYCnQ6f7aPvWdXGwOvoMukKdi+I20cmPLM2MBK5UlTt/tMT2pUUFKfO3uDOZnn0Nc6TAO68sFDXFUEvpA7qtuSatFeZx2Zuq/FbSA56/V6rysR87o5P3kqbqDMVlpDw22eIllwKMt4FrxaGhlqF0NykICAG2/p7zs42n63L1JcNRwCrughqBxW0iHzCVs4W7KsP+x/uGAEc5YOTtMsS0efzsajL8Nhp1XOqevf7RYYt9hgfHbKdiSzr5/74z6jQOymgZ2MPsbbWJqx0dkFa2tC8ysAAP//AFftYFYFAAA="}

      '

      (use the encoded plan you got from step 2)

      Prior to build 2111, the statement in step 4 should return 1412 rows for node 1, and 0 rows for all other nodes.
      After build 2111, it should always return 1412, for all the nodes.

      Attachments

        Issue Links

          For Gerrit Dashboard: MB-23073
          # Subject Branch Project Status CR V

          Activity

            People

              ajay.bhullar Ajay Bhullar
              ajay.bhullar Ajay Bhullar
              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