Commit 1e04605a authored by mithun's avatar mithun

Bug #17307201 : FAILING ASSERTION: PREBUILT->TRX->CONC_STATE == 1

                FROM SUBSELECT
ISSUE         : In function find_all_keys.
                If selected row do not satisfy condition
                then we call unlock_row to release the locked
                row. Suppose if we have subquery in condition
                and we have an innodb error during its execution.
                Then we should not call the unlock_row. If the error
                is because of deadlock, innodb will rollback the
                transaction. And calling unlock_row without
                transaction is an invalid case hence an assertion
                failure.
SOLUTION      : We call unlock_row only if only there is no
                error occurred previously.
                The solution is back ported from 5.6
                defect number 14226481
parent 8843dd4d
/* /*
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -666,7 +666,12 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select, ...@@ -666,7 +666,12 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
} }
make_sortkey(param,sort_keys[idx++],ref_pos); make_sortkey(param,sort_keys[idx++],ref_pos);
} }
else
/*
Don't try unlocking the row if skip_record reported an error since in
this case the transaction might have been rolled back already.
*/
else if (!thd->is_error())
file->unlock_row(); file->unlock_row();
/* It does not make sense to read more keys in case of a fatal error */ /* It does not make sense to read more keys in case of a fatal error */
if (thd->is_error()) if (thd->is_error())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment