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

N1QL TX timeout transaction not implicitly closed in cbq session

    XMLWordPrintable

Details

    • Untriaged
    • 1
    • Unknown

    Description

      In cbq, if transaction timeout i still need to issue rollback to issue new statement in same sessions.

      Problem description:

      1. open cbq session
      2. set timeout to 10s
      3. start transaction
      4. issue select statement
      5. eventually you will get error: "code": 17010, "msg": "Transaction timeout"
      6. any subsequent statement will fail
      7. issue rollback (also get an 17010 error)
      8. you can now issue statement

      I would expect that the first timeout error implicit close the transaction and can simply issue new statement.

      Example:

      cbq> \SET -txtimeout "10s";
      cbq> start work;
      {
          "requestID": "df0666c9-0783-49ea-afdf-bef4fc1a75fa",
          "signature": "json",
          "results": [
          {
              "txid": "49aba2d4-a50d-49aa-8b25-85df987ac2c9"
          }
          ],
          "status": "success",
          "metrics": {
              "elapsedTime": "1.00911ms",
              "executionTime": "784.317µs",
              "resultCount": 1,
              "resultSize": 62,
              "serviceLoad": 6
          }
      }
      cbq> select airportname from `travel-sample` where type = 'airport' and city = 'lyon';
      {
          "requestID": "4853d1bd-bc98-47bc-ae27-cdd9a9501a89",
          "signature": {
              "airportname": "json"
          },
          "results": [
          {
              "airportname": "Lyon Part-Dieu Railway"
          },
          {
              "airportname": "Bron"
          },
          {
              "airportname": "Saint Exupery"
          }
          ],
          "status": "success",
          "metrics": {
              "elapsedTime": "8.406156ms",
              "executionTime": "8.177442ms",
              "resultCount": 3,
              "resultSize": 138,
              "serviceLoad": 1
          }
      }
      cbq> select airportname from `travel-sample` where type = 'airport' and city = 'lyon';
      {
          "requestID": "cb4b5df8-8aba-49cd-9d83-6cde6a423381",
          "signature": {
              "airportname": "json"
          },
          "results": [
          {
              "airportname": "Lyon Part-Dieu Railway"
          },
          {
              "airportname": "Saint Exupery"
          },
          {
              "airportname": "Bron"
          }
          ],
          "status": "success",
          "metrics": {
              "elapsedTime": "20.126192ms",
              "executionTime": "19.847143ms",
              "resultCount": 3,
              "resultSize": 138,
              "serviceLoad": 1
          }
      }
      cbq> select airportname from `travel-sample` where type = 'airport' and city = 'lyon';
      {
          "requestID": "723a3652-57e3-4382-817d-ac9cbd5c0701",
          "errors": [
              {
                  "code": 17010,
                  "msg": "Transaction timeout"
              }
          ],
          "status": "fatal",
          "metrics": {
              "elapsedTime": "378.041µs",
              "executionTime": "266.676µs",
              "resultCount": 0,
              "resultSize": 0,
              "serviceLoad": 0,
              "errorCount": 1
          }
      }
      cbq> start work;
      {
          "requestID": "d5a03ba2-b5aa-44f5-9461-aecd31d9505e",
          "errors": [
              {
                  "code": 17010,
                  "msg": "Transaction timeout"
              }
          ],
          "status": "fatal",
          "metrics": {
              "elapsedTime": "394.033µs",
              "executionTime": "247.127µs",
              "resultCount": 0,
              "resultSize": 0,
              "serviceLoad": 0,
              "errorCount": 1
          }
      }
      cbq> select airportname from `travel-sample` where type = 'airport' and city = 'lyon';
      {
          "requestID": "9b075a27-7cc1-4849-ae65-c3908c6d4ad2",
          "errors": [
              {
                  "code": 17010,
                  "msg": "Transaction timeout"
              }
          ],
          "status": "fatal",
          "metrics": {
              "elapsedTime": "264.317µs",
              "executionTime": "196.581µs",
              "resultCount": 0,
              "resultSize": 0,
              "serviceLoad": 0,
              "errorCount": 1
          }
      }
      cbq> rollback;
      {
          "requestID": "93a24190-1130-41a5-851d-e34df7c68615",
          "errors": [
              {
                  "code": 17004,
                  "msg": "Transaction context error: transaction (49aba2d4-a50d-49aa-8b25-85df987ac2c9) is not present"
              }
          ],
          "status": "fatal",
          "metrics": {
              "elapsedTime": "496.939µs",
              "executionTime": "323.951µs",
              "resultCount": 0,
              "resultSize": 0,
              "serviceLoad": 0,
              "errorCount": 1
          }
      }
      cbq> select airportname from `travel-sample` where type = 'airport' and city = 'lyon';
      {
          "requestID": "6b83f815-0622-4e77-b386-63be655918b6",
          "signature": {
              "airportname": "json"
          },
          "results": [
          {
              "airportname": "Lyon Part-Dieu Railway"
          },
          {
              "airportname": "Bron"
          },
          {
              "airportname": "Saint Exupery"
          }
          ],
          "status": "success",
          "metrics": {
              "elapsedTime": "7.811984ms",
              "executionTime": "7.580124ms",
              "resultCount": 3,
              "resultSize": 138,
              "serviceLoad": 6
          }
      }
      
      

      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:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty