Last active
September 14, 2021 14:47
-
-
Save mgartner/5aa462fc34f5434df5e06da3b71e74cb to your computer and use it in GitHub Desktop.
Example for reducing a TLP query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- How to reduce a TLP query. | |
-- Below is an example where the TLP predicate is `true`. | |
-- Put this at the end of a failing tlp.log. | |
SELECT IF( | |
( | |
SELECT count(*) FROM ( | |
-- Count all rows in the table here. | |
SELECT count(*) FROM t | |
INTERSECT | |
-- Count up the three TLP partitions here. | |
SELECT count(*) FROM ( | |
-- TLP partition 1 | |
SELECT count(*) FROM t WHERE true | |
UNION ALL | |
-- TLP partition 2 | |
SELECT count(*) FROM t WHERE NOT true | |
UNION ALL | |
-- TLP partition 3 | |
SELECT count(*) FROM t WHERE true IS NULL | |
) | |
) | |
) = 1, 1, crdb_internal.force_panic('TLP FAILURE') | |
); | |
-- Then use the bin/reduce tool to reduce the tlp.log. | |
-- | |
-- ./bin/reduce -contains 'crdb_internal' -binary ./cockroach -file tlp.log -v -chunk 15 | |
-- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment