Skip to content

Commit

Permalink
contention: store contention events on non-SQL keys
Browse files Browse the repository at this point in the history
Previously, whenever we tried to add a contention event on a non-SQL
key, it would encounter an error during decoding tableID/indexID pair,
and the event was dropped. This commit extends the contention registry
to additionally store information about contention on non-SQL keys. That
information is stored in two levels:
- on the top level, all `SingleNonSQLKeyContention` objects are ordered
  by their keys
- on the bottom level, all `SingleTxnContention` objects are ordered by the
  number of times that transaction was observed to contend with other
  transactions.

`SingleTxnContention` protobuf message is moved out of
`SingleKeyContention` and is reused for non-SQL keys. This commit also
updates the status server API response. I assume that no changes are
needed with regards to backwards compatibility since the original
version was merged just a few weeks ago, and we haven't had a beta
released since then.

Release note (sql change): CockroachDB now also stores the information
about contention on non-SQL keys.
  • Loading branch information
yuzefovich committed Mar 15, 2021
1 parent 15fb8ad commit 2041f62
Show file tree
Hide file tree
Showing 13 changed files with 1,907 additions and 947 deletions.
52 changes: 34 additions & 18 deletions docs/generated/http/full.md
Original file line number Diff line number Diff line change
Expand Up @@ -1410,14 +1410,22 @@ Response returned by target query's gateway node.
ListContentionEvents retrieves the contention events across the entire
cluster.

On the highest level, all IndexContentionEvents objects are ordered
according to their importance (as defined by the number of contention
events within each object).
On the middle level, all SingleKeyContention objects are ordered by their
keys lexicographically.
On the lowest level, all SingleTxnContention objects are ordered by the
number of times that transaction was observed to contend with other
transactions.
For SQL keys the following orderings are maintained:
- on the highest level, all IndexContentionEvents objects are ordered
according to their importance (as defined by the number of contention
events within each object).
- on the middle level, all SingleKeyContention objects are ordered by their
keys lexicographically.
- on the lowest level, all SingleTxnContention objects are ordered by the
number of times that transaction was observed to contend with other
transactions.

For non-SQL keys the following orderings are maintained:
- on the top level, all SingleNonSQLKeyContention objects are ordered
by their keys lexicographically.
- on the bottom level, all SingleTxnContention objects are ordered by the
number of times that transaction was observed to contend with other
transactions.

Support status: [reserved](#support-status)

Expand Down Expand Up @@ -1445,7 +1453,7 @@ Response object for ListContentionEvents and ListLocalContentionEvents.

| Field | Type | Label | Description | Support status |
| ----- | ---- | ----- | ----------- | -------------- |
| events | [cockroach.sql.contentionpb.IndexContentionEvents](#cockroach.server.serverpb.ListContentionEventsResponse-cockroach.sql.contentionpb.IndexContentionEvents) | repeated | A list of contention events on this node or cluster. | [reserved](#support-status) |
| events | [cockroach.sql.contentionpb.SerializedRegistry](#cockroach.server.serverpb.ListContentionEventsResponse-cockroach.sql.contentionpb.SerializedRegistry) | | All available contention information on this node or cluster. | [reserved](#support-status) |
| errors | [ListContentionEventsError](#cockroach.server.serverpb.ListContentionEventsResponse-cockroach.server.serverpb.ListContentionEventsError) | repeated | Any errors that occurred during fan-out calls to other nodes. | [reserved](#support-status) |


Expand Down Expand Up @@ -1474,14 +1482,22 @@ An error wrapper object for ListContentionEventsResponse.

ListLocalContentionEvents retrieves the contention events on this node.

On the highest level, all IndexContentionEvents objects are ordered
according to their importance (as defined by the number of contention
events within each object).
On the middle level, all SingleKeyContention objects are ordered by their
keys lexicographically.
On the lowest level, all SingleTxnContention objects are ordered by the
number of times that transaction was observed to contend with other
transactions.
For SQL keys the following orderings are maintained:
- on the highest level, all IndexContentionEvents objects are ordered
according to their importance (as defined by the number of contention
events within each object).
- on the middle level, all SingleKeyContention objects are ordered by their
keys lexicographically.
- on the lowest level, all SingleTxnContention objects are ordered by the
number of times that transaction was observed to contend with other
transactions.

For non-SQL keys the following orderings are maintained:
- on the top level, all SingleNonSQLKeyContention objects are ordered
by their keys lexicographically.
- on the bottom level, all SingleTxnContention objects are ordered by the
number of times that transaction was observed to contend with other
transactions.

Support status: [reserved](#support-status)

Expand Down Expand Up @@ -1509,7 +1525,7 @@ Response object for ListContentionEvents and ListLocalContentionEvents.

| Field | Type | Label | Description | Support status |
| ----- | ---- | ----- | ----------- | -------------- |
| events | [cockroach.sql.contentionpb.IndexContentionEvents](#cockroach.server.serverpb.ListContentionEventsResponse-cockroach.sql.contentionpb.IndexContentionEvents) | repeated | A list of contention events on this node or cluster. | [reserved](#support-status) |
| events | [cockroach.sql.contentionpb.SerializedRegistry](#cockroach.server.serverpb.ListContentionEventsResponse-cockroach.sql.contentionpb.SerializedRegistry) | | All available contention information on this node or cluster. | [reserved](#support-status) |
| errors | [ListContentionEventsError](#cockroach.server.serverpb.ListContentionEventsResponse-cockroach.server.serverpb.ListContentionEventsError) | repeated | Any errors that occurred during fan-out calls to other nodes. | [reserved](#support-status) |


Expand Down
Loading

0 comments on commit 2041f62

Please sign in to comment.