Skip to content

Propagate errors to top-level for TPCC#207

Open
danielmitterdorfer wants to merge 1 commit into
pingcap:masterfrom
danielmitterdorfer:fail-on-check-error
Open

Propagate errors to top-level for TPCC#207
danielmitterdorfer wants to merge 1 commit into
pingcap:masterfrom
danielmitterdorfer:fail-on-check-error

Conversation

@danielmitterdorfer
Copy link
Copy Markdown

With this commit we propagate all errors in any of the TPCC subcommands to the top-level and exit the application with an error message and a non-zero exit code.

Closes #206

With this commit we propagate all errors in any of the TPCC subcommands to the
top-level and exit the application with an error message and a non-zero
exit code.

Closes pingcap#206
@pingcap-cla-assistant
Copy link
Copy Markdown

pingcap-cla-assistant Bot commented May 22, 2026

CLA assistant check
All committers have signed the CLA.

@danielmitterdorfer
Copy link
Copy Markdown
Author

A couple of notes on the implementation:

When we test the scenario from #206 now, we get the following behavior:

begin to check warehouse 1 at condition 3.3.2.9
begin to check warehouse 1 at condition 3.3.2.10
Error: check warehouse 1 at condition 3.3.2.10 failed exec SELECT count(*)
        FROM (  SELECT  c.c_id, c.c_d_id, c.c_w_id, c.c_balance c1,
                                   (SELECT sum(ol_amount) FROM orders, order_line
                                         WHERE OL_W_ID=O_W_ID
                                           AND OL_D_ID = O_D_ID
                                           AND OL_O_ID = O_ID
                                           AND OL_DELIVERY_D IS NOT NULL
                                           AND O_W_ID=?
                                           AND O_D_ID=c.C_D_ID
                                           AND O_C_ID=c.C_ID) sm, (SELECT  sum(h_amount)  from  history
                                                                                                WHERE H_C_W_ID=?
                                                                                                  AND H_C_D_ID=c.C_D_ID
                                                                                                  AND H_C_ID=c.C_ID) smh
                         FROM customer c
                        WHERE  c.c_w_id = ? ) t
   WHERE c1<>sm-smh failed driver: bad connection

$ echo $?
1

I also added cmd.SilenceUsage = true to all subcommands (but not the root command) to suppress that an additional usage string is shown after the error message (which is cobra's default behavior).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tpcc prepare exits with code 0 when consistency check fails

1 participant