Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contention: record 40001 errors as contention events #111685

Merged
merged 2 commits into from
Oct 9, 2023

Commits on Oct 9, 2023

  1. contention: add contention_type field to ExtendedContentionEvent

    This commit adds the `contention_type` field to `ExtendedContentionEvent` and
    also adds it as a new column in `crdb_internal.transaction_contention_events`.
    
    Note that this field does not impact the following surfaces:
    - crdb_internal.cluster_contention_events
    - crdb_internal.cluster_contended_tables
    - crdb_internal.cluster_contended_indexes
    - crdb_internal.cluster_contended_keys
    
    Release note (sql change): New column `contention_type` in
    crdb_internal.transaction_contention_events table indicating
    the type of txn contention encountered. Current values are
    - LOCK_WAIT
    
    Part of: cockroachdb#111649
    xinhaoz committed Oct 9, 2023
    Configuration menu
    Copy the full SHA
    db5e8f5 View commit details
    Browse the repository at this point in the history
  2. sql, contention: record 40001 errors as contention events

    This commit writes contention events to the contention registry's
    event store when a 40001 error is returned at the end of a transaction.
    The criteria for writing the event to the store is:
    - If a `TransactionRetryWithProtoRefreshError` error was encountered
    - If there exists conflicting txn information on the error
    
    Enabling this feature is controlled by the cluster setting
    `sql.contention.record_serialization_conflicts.enabled` which is off by
    default.
    
    `SERIALIZATION_CONFLICT` is also added to the list of contention types
    in the contention protobufs. These contention events will have their
    txn ids mapped to txn fingerprints and will be surfaced in the table
    `crdb_internal.transaction_contention_events`.
    Note that all `SERIALIZATION_CONFLICT` type contention events will
    have a `contentino_duration` value of 0.
    
    Release note (cli change): New contention_type in table `SERIALIZATION_CONFLICT`
    `crdb_internal.transaction_contention_events`.  These contention events specify
    that contention occurred between 2 transactions due to serialization conflicts.
    
    Closes: cockroachdb#111649
    xinhaoz committed Oct 9, 2023
    Configuration menu
    Copy the full SHA
    cba5fd1 View commit details
    Browse the repository at this point in the history