Commit 3cd36cb0 authored by Vasil Dimov's avatar Vasil Dimov

Re-enable the prefetch code in InnoDB internal SQL parser and fix two

bugs in it - accessing uninitialized ::len member (thanks, Jimmy!)
and a memory leak.

This is a followup to vasil.dimov@oracle.com-20110909070724-jvirxnpkbxieauz5
which disabled the prefetch code.
parent b1f927f5
...@@ -63,13 +63,7 @@ Created 12/19/1997 Heikki Tuuri ...@@ -63,13 +63,7 @@ Created 12/19/1997 Heikki Tuuri
/* Number of rows fetched, after which to start prefetching; MySQL interface /* Number of rows fetched, after which to start prefetching; MySQL interface
has another parameter */ has another parameter */
/* The prefetch code in the internal SQL is disabled because it has probably #define SEL_PREFETCH_LIMIT 1
never been used and has been found to contain a memory leak and a bug of
accessing uninitialized memory. Some simple performance tests show that
disabling it makes no difference in performance. It will be removed, but
until the removal happens we disable it by setting SEL_PREFETCH_LIMIT to a
high value. */
#define SEL_PREFETCH_LIMIT 1000000000
/* When a select has accessed about this many pages, it returns control back /* When a select has accessed about this many pages, it returns control back
to que_run_threads: this is to allow canceling runaway queries */ to que_run_threads: this is to allow canceling runaway queries */
...@@ -514,7 +508,7 @@ sel_col_prefetch_buf_alloc( ...@@ -514,7 +508,7 @@ sel_col_prefetch_buf_alloc(
sel_buf = column->prefetch_buf + i; sel_buf = column->prefetch_buf + i;
sel_buf->data = NULL; sel_buf->data = NULL;
sel_buf->len = 0;
sel_buf->val_buf_size = 0; sel_buf->val_buf_size = 0;
} }
} }
...@@ -539,6 +533,8 @@ sel_col_prefetch_buf_free( ...@@ -539,6 +533,8 @@ sel_col_prefetch_buf_free(
mem_free(sel_buf->data); mem_free(sel_buf->data);
} }
} }
mem_free(prefetch_buf);
} }
/*********************************************************************//** /*********************************************************************//**
......
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