Commit 672f18c1 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


sql/filesort.cc:
  Now we call unlock_row only if there is no
  previous error.
parent f176092c
/*
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
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,
}
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();
/* It does not make sense to read more keys in case of a fatal 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