Applied innodb-5.1-ss1186

Fixes bugs:
- Bug #20877: InnoDB data dictionary memory footprint is too big
- Bug #24741: existing cascade clauses disappear when adding foreign keys


mysql-test/r/innodb.result:
  Applied innodb-5.1-ss1186
  
  Revision r1186:
  dict_load_foreign(): Use a local variable instead of the 10-bit field
  foreign->n_fields in order to preserve ON UPDATE CASCADE and
  ON DELETE CASCADE flags.  For some reason, gcc does not warn about
  shifting a 10-bit field to right by 24 bits.  (Bug #24741)
  
  This bug was introduced while reducing the memory footprint of the
  InnoDB data dictionary (Bug #20877).
  
  innodb.test, innodb.result: Add a test case.
mysql-test/t/innodb.test:
  Applied innodb-5.1-ss1186
  
  Revision r1186:
  dict_load_foreign(): Use a local variable instead of the 10-bit field
  foreign->n_fields in order to preserve ON UPDATE CASCADE and
  ON DELETE CASCADE flags.  For some reason, gcc does not warn about
  shifting a 10-bit field to right by 24 bits.  (Bug #24741)
  
  This bug was introduced while reducing the memory footprint of the
  InnoDB data dictionary (Bug #20877).
  
  innodb.test, innodb.result: Add a test case.
storage/innobase/buf/buf0flu.c:
  Applied innodb-5.1-ss1186
  
  Revision r1168:
  buf_flush_batch(): Remove the test page_count != ULINT_UNDEFINED.
  The variable is initialized to zero, and after that it is only added to.
  Maybe the one who introduced the variable srv_buf_pool_flushed overlooked
  that there is a separate return statement for returning ULINT_UNDEFINED?
storage/innobase/dict/dict0load.c:
  Applied innodb-5.1-ss1186
  
  Revision r1186:
  dict_load_foreign(): Use a local variable instead of the 10-bit field
  foreign->n_fields in order to preserve ON UPDATE CASCADE and
  ON DELETE CASCADE flags.  For some reason, gcc does not warn about
  shifting a 10-bit field to right by 24 bits.  (Bug #24741)
  
  This bug was introduced while reducing the memory footprint of the
  InnoDB data dictionary (Bug #20877).
  
  innodb.test, innodb.result: Add a test case.
storage/innobase/include/ut0ut.h:
  Applied innodb-5.1-ss1186
  
  Revision r1165:
  ut_2_power_up(): Add __attribute__((const)), because otherwise this function
  is repeatedly called in buf_flush_free_margin() due to the definitions
  of BUF_READ_AHEAD_AREA and other macros starting with BUF_READ_AHEAD_.
storage/innobase/que/que0que.c:
  Applied innodb-5.1-ss1186
  
  Revision r1158:
  Modify que_fork_start_command() to do only one pass over the thread list
  instead of three.
This commit is contained in:
unknown 2007-01-21 18:18:11 -07:00
commit 8ca715509e
6 changed files with 74 additions and 39 deletions

View file

@ -335,6 +335,8 @@ que_fork_start_command(
que_fork_t* fork) /* in: a query fork */
{
que_thr_t* thr;
que_thr_t* suspended_thr = NULL;
que_thr_t* completed_thr = NULL;
fork->state = QUE_FORK_ACTIVE;
@ -344,14 +346,18 @@ que_fork_start_command(
but in a parallelized select, which necessarily is non-scrollable,
there may be several to choose from */
/*---------------------------------------------------------------
First we try to find a query thread in the QUE_THR_COMMAND_WAIT state
*/
/* First we try to find a query thread in the QUE_THR_COMMAND_WAIT
state. Then we try to find a query thread in the QUE_THR_SUSPENDED
state, finally we try to find a query thread in the QUE_THR_COMPLETED
state */
thr = UT_LIST_GET_FIRST(fork->thrs);
while (thr != NULL) {
if (thr->state == QUE_THR_COMMAND_WAIT) {
/* We make a single pass over the thr list within which we note which
threads are ready to run. */
while (thr) {
switch (thr->state) {
case QUE_THR_COMMAND_WAIT:
/* We have to send the initial message to query thread
to start it */
@ -359,49 +365,44 @@ que_fork_start_command(
que_thr_init_command(thr);
return(thr);
}
ut_ad(thr->state != QUE_THR_LOCK_WAIT);
thr = UT_LIST_GET_NEXT(thrs, thr);
}
/*----------------------------------------------------------------
Then we try to find a query thread in the QUE_THR_SUSPENDED state */
thr = UT_LIST_GET_FIRST(fork->thrs);
while (thr != NULL) {
if (thr->state == QUE_THR_SUSPENDED) {
case QUE_THR_SUSPENDED:
/* In this case the execution of the thread was
suspended: no initial message is needed because
execution can continue from where it was left */
if (!suspended_thr) {
suspended_thr = thr;
}
que_thr_move_to_run_state(thr);
break;
case QUE_THR_COMPLETED:
if (!completed_thr) {
completed_thr = thr;
}
break;
case QUE_THR_LOCK_WAIT:
ut_error;
return(thr);
}
thr = UT_LIST_GET_NEXT(thrs, thr);
}
/*-----------------------------------------------------------------
Then we try to find a query thread in the QUE_THR_COMPLETED state */
if (suspended_thr) {
thr = UT_LIST_GET_FIRST(fork->thrs);
thr = suspended_thr;
que_thr_move_to_run_state(thr);
while (thr != NULL) {
if (thr->state == QUE_THR_COMPLETED) {
que_thr_init_command(thr);
} else if (completed_thr) {
return(thr);
}
thr = UT_LIST_GET_NEXT(thrs, thr);
thr = completed_thr;
que_thr_init_command(thr);
}
/* Else we return NULL */
return(NULL);
return(thr);
}
/**************************************************************************