Skip to content

Commit

Permalink
Update Detection section per additional review
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeCRL committed Oct 8, 2024
1 parent 60e2be8 commit d523808
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/current/advisories/a131639.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,18 @@ node 123 observed possible symptoms at 2024-09-01 12:34:56 on ranges 123456

If the detection script finds symptoms of a potential lease expiration regression and you suspect that a particular row may have been subject to a lost write, you can query the primary and secondary indexes to confirm that the row exists in both places.

For example, if you suspect that a row in `my_table` with primary key `pk=1` has a lost write, you can run the following queries to confirm:
For example, if you suspect that a row in `my_table` with primary key `pk=1` and secondary index keys `a=2` and `b=3` has a lost write, you can run the following queries to confirm:

{% include_cached copy-clipboard.html %}
~~~ sql
SELECT count(*) FROM my_table@primary WHERE pk = 1 AS OF SYSTEM TIME '-10s';
SELECT count(*) FROM my_table@<secondary index 1> WHERE pk = 1 AS OF SYSTEM TIME '-10s';
SELECT count(*) FROM my_table@<secondary index 2> WHERE pk = 1 AS OF SYSTEM TIME '-10s';
-- ...
SELECT count(*) FROM my_table@my_table_pkey WHERE pk = 1 AS OF SYSTEM TIME '-10s';
SELECT count(*) FROM my_table@my_table_a_idx WHERE pk = 1 AND a=2 AS OF SYSTEM TIME '-10s';
SELECT count(*) FROM my_table@my_table_b_idx WHERE pk = 1 AND b=3 AS OF SYSTEM TIME '-10s';
~~~

If any of these queries return different values for `count`, that likely indicates a lost write.

Please note that the secondary index queries will perform full table scans, which are not recommended if the cluster is already overloaded. The `AS OF SYSTEM TIME` clause can mitigate the impact on foreground traffic, but it won't eliminate it in case of overload.
The `AS OF SYSTEM TIME` clauses are added to minimize the impact on foreground traffic.

If you are unsure which rows may have been affected but suspect that your cluster experienced lost writes, please contact the [support team](https://support.cockroachlabs.com).

Expand Down

0 comments on commit d523808

Please sign in to comment.