WL#1127: Optimize fatal_error and kill usage
Affects: Server-5.0
—
Status: Un-Assigned
The idea with this task is to make it faster and easier to detect is
something went wrong.
Currently we have to the following tests in sql_parse.cc:
in handle_one_connection:
while (!net->error && net->vio != 0 && !thd->killed)
{
if (do_command(thd))
break;
}
This should be replaced with:
while (!thd->killed)
do_command(thd);
(In other words, we should set thd->killed both if do_command() would
otherwise return true, which should only happen on 'quit', or when
net->error or net->vio are set. The later should never be set after
the loop has been entered.
In dispatch_command() we have:
while (!thd->killed && !thd->is_fatal_error && thd->lex.found_colon)
This should be replaced with:
while (!thd->killed && thd->lex.found_colon)
In other words, we should also set thd->killed when we set
thd->is_fatal_error. This will make this and other errors easier to
handler.
The above should be relatively easy to do after dimitri's patch where
thd->killed can be used to only kill a running query.
(We probably have to add a new killed state for the case of 'fatal_error',
which should work like KILL_QUERY).
Copyright (c) 2000, 2025, Oracle Corporation and/or its affiliates. All rights reserved.