Commit a3208f42 authored by marko's avatar marko

ha_innobase::extra(): Replace references to prebuilt->trx with

thd_to_trx(ha_thd()), in order to avoid potential memory corruption.
parent a8c23d14
...@@ -6146,17 +6146,24 @@ ha_innobase::extra( ...@@ -6146,17 +6146,24 @@ ha_innobase::extra(
case HA_EXTRA_KEYREAD_PRESERVE_FIELDS: case HA_EXTRA_KEYREAD_PRESERVE_FIELDS:
prebuilt->keep_other_fields_on_keyread = 1; prebuilt->keep_other_fields_on_keyread = 1;
break; break;
/* IMPORTANT: prebuilt->trx can be obsolete in
this method, because it is not sure that MySQL
calls external_lock before this method with the
parameters below. We must not invoke update_thd()
either, because the calling threads may change.
CAREFUL HERE, OR MEMORY CORRUPTION MAY OCCUR! */
case HA_EXTRA_IGNORE_DUP_KEY: case HA_EXTRA_IGNORE_DUP_KEY:
prebuilt->trx->duplicates |= TRX_DUP_IGNORE; thd_to_trx(ha_thd())->duplicates |= TRX_DUP_IGNORE;
break; break;
case HA_EXTRA_WRITE_CAN_REPLACE: case HA_EXTRA_WRITE_CAN_REPLACE:
prebuilt->trx->duplicates |= TRX_DUP_REPLACE; thd_to_trx(ha_thd())->duplicates |= TRX_DUP_REPLACE;
break; break;
case HA_EXTRA_WRITE_CANNOT_REPLACE: case HA_EXTRA_WRITE_CANNOT_REPLACE:
prebuilt->trx->duplicates &= ~TRX_DUP_REPLACE; thd_to_trx(ha_thd())->duplicates &= ~TRX_DUP_REPLACE;
break; break;
case HA_EXTRA_NO_IGNORE_DUP_KEY: case HA_EXTRA_NO_IGNORE_DUP_KEY:
prebuilt->trx->duplicates &= thd_to_trx(ha_thd())->duplicates &=
~(TRX_DUP_IGNORE | TRX_DUP_REPLACE); ~(TRX_DUP_IGNORE | TRX_DUP_REPLACE);
break; break;
default:/* Do nothing */ default:/* Do nothing */
......
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