Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-46796

Specific errors during prepare should get propagated to the client

    XMLWordPrintableJSON

Details

    • Fully Compatible
    • v4.4
    • Sharding 2020-05-04

    Description

      SERVER-44409 adds a test that attempts (and fails) to do a prepared transaction that creates a collection. The failure is expected, since we presently disallow collection creation inside prepared transactions.

      The test must presently check that commitTransaction_forTesting() fails with NoSuchTransaction, but the logs for the test confirm that the OperationNotSupportedInTransaction error does occur:

      [js_test:create_new_collections_prepared_transactions] 2020-03-11T12:45:54.642-0400 d20022| {"t":{"$date":"2020-03-11T12:45:54.641-0400"},"s":"I", "c":"TXN",     "id":22483,"ctx":"conn28","msg":"Participant shard received prepareTransaction for transaction with txnNumber {opCtx_getTxnNumber} on session {opCtx_getLogicalSessionId}","attr":{"opCtx_getTxnNumber":0,"opCtx_getLogicalSessionId":{"id":{"$uuid":"8edc05c3-fc28-4e7d-9468-b353e9a6ac31"},"uid":{"$binary":{"base64":"47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=","subType":"0"}}}}}
      [js_test:create_new_collections_prepared_transactions] 2020-03-11T12:45:54.643-0400 d20022| {"t":{"$date":"2020-03-11T12:45:54.642-0400"},"s":"I", "c":"TXN",     "id":51802,"ctx":"conn28","msg":"transaction","attr":{"parameters":{"lsid":{"id":{"$uuid":"8edc05c3-fc28-4e7d-9468-b353e9a6ac31"},"uid":{"$binary":{"base64":"47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=","subType":"0"}}},"txnNumber":0,"autocommit":false,"readConcern":{"provenance":"clientSupplied"}},"readTimestamp":"Timestamp(0, 0)","terminationCause":"aborted","timeActiveMicros":58189,"timeInactiveMicros":121171,"numYields":0,"locks":{"ReplicationStateTransition":{"acquireCount":{"w":3}},"Global":{"acquireCount":{"w":2}},"Database":{"acquireCount":{"w":2}},"Collection":{"acquireCount":{"r":1,"w":2}},"Mutex":{"acquireCount":{"r":3}}},"storage":{},"wasPrepared":false,"durationMillis":179}}
      [js_test:create_new_collections_prepared_transactions] 2020-03-11T12:45:54.643-0400 d20020| {"t":{"$date":"2020-03-11T12:45:54.643-0400"},"s":"D3","c":"TXN",     "id":22479,"ctx":"TransactionCoordinator","msg":"{txnIdToString_lsid_txnNumber} Coordinator shard received {status} from shard {shardId} for {commandObj}","attr":{"txnIdToString_lsid_txnNumber":"8edc05c3-fc28-4e7d-9468-b353e9a6ac31:0","status":{"code":263,"codeName":"OperationNotSupportedInTransaction","errmsg":"Cannot create new collections inside distributed transactions"},"shardId":"create_new_collections_prepared_transactions-rs0","commandObj":{"prepareTransaction":1,"lsid":{"id":{"$uuid":"8edc05c3-fc28-4e7d-9468-b353e9a6ac31"},"uid":{"$binary":{"base64":"47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=","subType":"0"}}},"txnNumber":0,"autocommit":false,"writeConcern":{"w":"majority"}}}}

      It seems that the coordinator shard does not propagate the OperationNotSupportedInTransaction error to the caller. It would be nice to propagate errors during prepare to more clearly communicate what caused the prepare to fail.

      Attachments

        Issue Links

          Activity

            People

              gregory.noma@mongodb.com Gregory Noma
              maria.vankeulen@mongodb.com Maria van Keulen
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: