Uploaded image for project: 'Couchbase Python Client Library'
  1. Couchbase Python Client Library
  2. PYCBC-1222

Improved Query Error Handling

    XMLWordPrintable

Details

    • Task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.2.7
    • library
    • 1
    • SDK02: CB++ and Query Error, SDK06: Trxns, Indx Mg, Qry Err, SDK08: Node, Cld Init, Cnc Tst

    Description

      Refer to CBD-4565

      Attachments

        Issue Links

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

          Activity

            jared.casey Jared Casey added a comment - - edited

            Using CBS version >= 7.1.0 build 2098, issue the following query (or one similar) at least twice in order to generate a failure and see the new query error format.

            INSERT INTO `default` (KEY, VALUE)
            VALUES ("key2", { "type" : "test", "what" : "test doc" });
            

            Currently, the lcb_QUERY_ERROR_CONTEXT struct returns the following. The Python SDK builds a Query exception's QueryErrorContext from the contents in the returned lcb_QUERY_ERROR_CONTEXT struct. Until further fields are added to the struct the Python SDK cannot propagate new information related to query errors.

            const lcb_QUERY_ERROR_CONTEXT) $0 = {
              rc = LCB_ERR_DML_FAILURE
              first_error_code = 12009
              first_error_message = 0x0000000105fb4420 "DML Error, possible causes include concurrent modification. Failed to perform INSERT on key key2 - cause: Key key2 - cause: unable to complete action after 1 attempts: key exists"
              first_error_message_len = 178
              statement = 0x0000000102127250 "\n    INSERT INTO `default` (KEY, VALUE)\n    VALUES (\"key2\", { \"type\" : \"test\", \"what\" : \"test doc\" });\n    "
              statement_len = 107
              client_context_id = 0x0000000102126d29 "ea587d61397f4a1f"
              client_context_id_len = 16
              query_params = 0x0000000000000000
              query_params_len = 0
              http_response_code = 200
              http_response_message = 0x0000000000000000
              http_response_message_len = 0
              endpoint = 0x00000001021278a1 "localhost:8093"
              endpoint_len = 14
            }
            

            According to the doc associated with the CBD, the Query Error Response Body field of the QueryErrorContext should contain new fields (reason and retry).

            jared.casey Jared Casey added a comment - - edited Using CBS version >= 7.1.0 build 2098, issue the following query (or one similar) at least twice in order to generate a failure and see the new query error format. INSERT INTO `default` (KEY, VALUE) VALUES ("key2", { "type" : "test", "what" : "test doc" }); Currently, the lcb_QUERY_ERROR_CONTEXT struct returns the following. The Python SDK builds a Query exception's QueryErrorContext from the contents in the returned lcb_QUERY_ERROR_CONTEXT struct. Until further fields are added to the struct the Python SDK cannot propagate new information related to query errors. const lcb_QUERY_ERROR_CONTEXT) $0 = { rc = LCB_ERR_DML_FAILURE first_error_code = 12009 first_error_message = 0x0000000105fb4420 "DML Error, possible causes include concurrent modification. Failed to perform INSERT on key key2 - cause: Key key2 - cause: unable to complete action after 1 attempts: key exists" first_error_message_len = 178 statement = 0x0000000102127250 "\n INSERT INTO `default` (KEY, VALUE)\n VALUES (\"key2\", { \"type\" : \"test\", \"what\" : \"test doc\" });\n " statement_len = 107 client_context_id = 0x0000000102126d29 "ea587d61397f4a1f" client_context_id_len = 16 query_params = 0x0000000000000000 query_params_len = 0 http_response_code = 200 http_response_message = 0x0000000000000000 http_response_message_len = 0 endpoint = 0x00000001021278a1 "localhost:8093" endpoint_len = 14 } According to the doc associated with the CBD , the Query Error Response Body field of the QueryErrorContext should contain new fields (reason and retry).
            jared.casey Jared Casey added a comment -

            Added error_response_body field to QueryErrorContext.

            jared.casey Jared Casey added a comment - Added error_response_body field to QueryErrorContext.

            People

              jared.casey Jared Casey
              ray.cardillo Ray Cardillo
              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