mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Merge mysql.com:/home/mydev/mysql-5.0
into mysql.com:/home/mydev/mysql-5.0-5000 sql/set_var.cc: Auto merged sql/sql_select.cc: Auto merged
This commit is contained in:
@@ -88,12 +88,13 @@ typedef struct st_key_cache
|
|||||||
ulong param_division_limit; /* min. percentage of warm blocks */
|
ulong param_division_limit; /* min. percentage of warm blocks */
|
||||||
ulong param_age_threshold; /* determines when hot block is downgraded */
|
ulong param_age_threshold; /* determines when hot block is downgraded */
|
||||||
|
|
||||||
/* Statistics variables */
|
/* Statistics variables. These are reset in reset_key_cache_counters(). */
|
||||||
ulong global_blocks_changed; /* number of currently dirty blocks */
|
ulong global_blocks_changed; /* number of currently dirty blocks */
|
||||||
ulong global_cache_w_requests;/* number of write requests (write hits) */
|
ulong global_cache_w_requests;/* number of write requests (write hits) */
|
||||||
ulong global_cache_write; /* number of writes from the cache to files */
|
ulong global_cache_write; /* number of writes from the cache to files */
|
||||||
ulong global_cache_r_requests;/* number of read requests (read hits) */
|
ulong global_cache_r_requests;/* number of read requests (read hits) */
|
||||||
ulong global_cache_read; /* number of reads from files to the cache */
|
ulong global_cache_read; /* number of reads from files to the cache */
|
||||||
|
|
||||||
int blocks; /* max number of blocks in the cache */
|
int blocks; /* max number of blocks in the cache */
|
||||||
my_bool in_init; /* Set to 1 in MySQL during init/resize */
|
my_bool in_init; /* Set to 1 in MySQL during init/resize */
|
||||||
} KEY_CACHE;
|
} KEY_CACHE;
|
||||||
@@ -132,5 +133,7 @@ extern my_bool multi_key_cache_set(const byte *key, uint length,
|
|||||||
KEY_CACHE *key_cache);
|
KEY_CACHE *key_cache);
|
||||||
extern void multi_key_cache_change(KEY_CACHE *old_data,
|
extern void multi_key_cache_change(KEY_CACHE *old_data,
|
||||||
KEY_CACHE *new_data);
|
KEY_CACHE *new_data);
|
||||||
|
extern int reset_key_cache_counters(const char *name,
|
||||||
|
KEY_CACHE *key_cache);
|
||||||
C_MODE_END
|
C_MODE_END
|
||||||
#endif /* _keycache_h */
|
#endif /* _keycache_h */
|
||||||
|
@@ -81,6 +81,17 @@ dict_create_sys_tables_tuple(
|
|||||||
|
|
||||||
dfield_set_data(dfield, ptr, 8);
|
dfield_set_data(dfield, ptr, 8);
|
||||||
/* 7: MIX_LEN --------------------------*/
|
/* 7: MIX_LEN --------------------------*/
|
||||||
|
|
||||||
|
/* Track corruption reported on mailing list Jan 14, 2005 */
|
||||||
|
if (table->mix_len != 0 && table->mix_len != 0x80000000) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"InnoDB: Error: mix_len is %lu in table %s\n", (ulong)table->mix_len,
|
||||||
|
table->name);
|
||||||
|
mem_analyze_corruption((byte*)&(table->mix_len));
|
||||||
|
|
||||||
|
ut_error;
|
||||||
|
}
|
||||||
|
|
||||||
dfield = dtuple_get_nth_field(entry, 5);
|
dfield = dtuple_get_nth_field(entry, 5);
|
||||||
|
|
||||||
ptr = mem_heap_alloc(heap, 4);
|
ptr = mem_heap_alloc(heap, 4);
|
||||||
|
@@ -2920,9 +2920,9 @@ loop:
|
|||||||
constraint_name = NULL;
|
constraint_name = NULL;
|
||||||
|
|
||||||
if (ptr1 < ptr2) {
|
if (ptr1 < ptr2) {
|
||||||
/* The user has specified a constraint name. Pick it so
|
/* The user may have specified a constraint name. Pick it so
|
||||||
that we can store 'databasename/constraintname' as the id of
|
that we can store 'databasename/constraintname' as the id of
|
||||||
the id of the constraint to system tables. */
|
of the constraint to system tables. */
|
||||||
ptr = ptr1;
|
ptr = ptr1;
|
||||||
|
|
||||||
ptr = dict_accept(ptr, "CONSTRAINT", &success);
|
ptr = dict_accept(ptr, "CONSTRAINT", &success);
|
||||||
@@ -2959,6 +2959,10 @@ loop:
|
|||||||
|
|
||||||
ptr = dict_accept(ptr, "FOREIGN", &success);
|
ptr = dict_accept(ptr, "FOREIGN", &success);
|
||||||
|
|
||||||
|
if (!success) {
|
||||||
|
goto loop;
|
||||||
|
}
|
||||||
|
|
||||||
if (!isspace(*ptr)) {
|
if (!isspace(*ptr)) {
|
||||||
goto loop;
|
goto loop;
|
||||||
}
|
}
|
||||||
|
@@ -728,6 +728,7 @@ dict_load_table(
|
|||||||
ulint space;
|
ulint space;
|
||||||
ulint n_cols;
|
ulint n_cols;
|
||||||
ulint err;
|
ulint err;
|
||||||
|
ulint mix_len;
|
||||||
mtr_t mtr;
|
mtr_t mtr;
|
||||||
|
|
||||||
#ifdef UNIV_SYNC_DEBUG
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
@@ -775,6 +776,22 @@ dict_load_table(
|
|||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Track a corruption bug reported on the MySQL mailing list Jan 14,
|
||||||
|
2005: mix_len had a value different from 0 */
|
||||||
|
|
||||||
|
field = rec_get_nth_field_old(rec, 7, &len);
|
||||||
|
ut_a(len == 4);
|
||||||
|
|
||||||
|
mix_len = mach_read_from_4(field);
|
||||||
|
|
||||||
|
if (mix_len != 0 && mix_len != 0x80000000) {
|
||||||
|
ut_print_timestamp(stderr);
|
||||||
|
|
||||||
|
fprintf(stderr,
|
||||||
|
" InnoDB: table %s has a nonsensical mix len %lu\n",
|
||||||
|
name, (ulong)mix_len);
|
||||||
|
}
|
||||||
|
|
||||||
#if MYSQL_VERSION_ID < 50003
|
#if MYSQL_VERSION_ID < 50003
|
||||||
/* Starting from MySQL 5.0.3, the high-order bit of MIX_LEN is the
|
/* Starting from MySQL 5.0.3, the high-order bit of MIX_LEN is the
|
||||||
"compact format" flag. */
|
"compact format" flag. */
|
||||||
|
@@ -480,28 +480,33 @@ fil_node_open_file(
|
|||||||
ut_a(node->n_pending == 0);
|
ut_a(node->n_pending == 0);
|
||||||
ut_a(node->open == FALSE);
|
ut_a(node->open == FALSE);
|
||||||
|
|
||||||
/* printf("Opening file %s\n", node->name); */
|
|
||||||
|
|
||||||
if (space->purpose == FIL_LOG) {
|
|
||||||
node->handle = os_file_create(node->name, OS_FILE_OPEN,
|
|
||||||
OS_FILE_AIO, OS_LOG_FILE, &ret);
|
|
||||||
} else if (node->is_raw_disk) {
|
|
||||||
node->handle = os_file_create(node->name,
|
|
||||||
OS_FILE_OPEN_RAW,
|
|
||||||
OS_FILE_AIO, OS_DATA_FILE, &ret);
|
|
||||||
} else {
|
|
||||||
node->handle = os_file_create(node->name, OS_FILE_OPEN,
|
|
||||||
OS_FILE_AIO, OS_DATA_FILE, &ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
ut_a(ret);
|
|
||||||
|
|
||||||
node->open = TRUE;
|
|
||||||
|
|
||||||
system->n_open++;
|
|
||||||
|
|
||||||
if (node->size == 0) {
|
if (node->size == 0) {
|
||||||
|
/* It must be a single-table tablespace and we do not know the
|
||||||
|
size of the file yet. First we open the file in the normal
|
||||||
|
mode, no async I/O here, for simplicity. Then do some checks,
|
||||||
|
and close the file again.
|
||||||
|
NOTE that we could not use the simple file read function
|
||||||
|
os_file_read() in Windows to read from a file opened for
|
||||||
|
async I/O! */
|
||||||
|
|
||||||
|
node->handle = os_file_create_simple_no_error_handling(
|
||||||
|
node->name, OS_FILE_OPEN,
|
||||||
|
OS_FILE_READ_ONLY, &success);
|
||||||
|
if (!success) {
|
||||||
|
/* The following call prints an error message */
|
||||||
|
os_file_get_last_error(TRUE);
|
||||||
|
|
||||||
|
ut_print_timestamp(stderr);
|
||||||
|
|
||||||
|
fprintf(stderr,
|
||||||
|
" InnoDB: Fatal error: cannot open %s\n."
|
||||||
|
"InnoDB: Have you deleted .ibd files under a running mysqld server?\n",
|
||||||
|
node->name);
|
||||||
|
ut_a(0);
|
||||||
|
}
|
||||||
|
|
||||||
ut_a(space->purpose != FIL_LOG);
|
ut_a(space->purpose != FIL_LOG);
|
||||||
|
ut_a(space->id != 0);
|
||||||
|
|
||||||
os_file_get_size(node->handle, &size_low, &size_high);
|
os_file_get_size(node->handle, &size_low, &size_high);
|
||||||
|
|
||||||
@@ -511,15 +516,10 @@ fil_node_open_file(
|
|||||||
node->size = (ulint) (size_bytes / UNIV_PAGE_SIZE);
|
node->size = (ulint) (size_bytes / UNIV_PAGE_SIZE);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/* It must be a single-table tablespace and we do not know the
|
|
||||||
size of the file yet */
|
|
||||||
|
|
||||||
ut_a(space->id != 0);
|
|
||||||
|
|
||||||
if (size_bytes < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) {
|
if (size_bytes < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"InnoDB: Error: the size of single-table tablespace file %s\n"
|
"InnoDB: Error: the size of single-table tablespace file %s\n"
|
||||||
"InnoDB: is only %lu %lu, should be at least %lu!", node->name,
|
"InnoDB: is only %lu %lu, should be at least %lu!\n", node->name,
|
||||||
(ulong) size_high,
|
(ulong) size_high,
|
||||||
(ulong) size_low, (ulong) (4 * UNIV_PAGE_SIZE));
|
(ulong) size_low, (ulong) (4 * UNIV_PAGE_SIZE));
|
||||||
|
|
||||||
@@ -539,6 +539,10 @@ fil_node_open_file(
|
|||||||
|
|
||||||
ut_free(buf2);
|
ut_free(buf2);
|
||||||
|
|
||||||
|
/* Close the file now that we have read the space id from it */
|
||||||
|
|
||||||
|
os_file_close(node->handle);
|
||||||
|
|
||||||
if (space_id == ULINT_UNDEFINED || space_id == 0) {
|
if (space_id == ULINT_UNDEFINED || space_id == 0) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"InnoDB: Error: tablespace id %lu in file %s is not sensible\n",
|
"InnoDB: Error: tablespace id %lu in file %s is not sensible\n",
|
||||||
@@ -566,6 +570,30 @@ fil_node_open_file(
|
|||||||
space->size += node->size;
|
space->size += node->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* printf("Opening file %s\n", node->name); */
|
||||||
|
|
||||||
|
/* Open the file for reading and writing, in Windows normally in the
|
||||||
|
unbuffered async I/O mode, though global variables may make
|
||||||
|
os_file_create() to fall back to the normal file I/O mode. */
|
||||||
|
|
||||||
|
if (space->purpose == FIL_LOG) {
|
||||||
|
node->handle = os_file_create(node->name, OS_FILE_OPEN,
|
||||||
|
OS_FILE_AIO, OS_LOG_FILE, &ret);
|
||||||
|
} else if (node->is_raw_disk) {
|
||||||
|
node->handle = os_file_create(node->name,
|
||||||
|
OS_FILE_OPEN_RAW,
|
||||||
|
OS_FILE_AIO, OS_DATA_FILE, &ret);
|
||||||
|
} else {
|
||||||
|
node->handle = os_file_create(node->name, OS_FILE_OPEN,
|
||||||
|
OS_FILE_AIO, OS_DATA_FILE, &ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
ut_a(ret);
|
||||||
|
|
||||||
|
node->open = TRUE;
|
||||||
|
|
||||||
|
system->n_open++;
|
||||||
|
|
||||||
if (space->purpose == FIL_TABLESPACE && space->id != 0) {
|
if (space->purpose == FIL_TABLESPACE && space->id != 0) {
|
||||||
/* Put the node to the LRU list */
|
/* Put the node to the LRU list */
|
||||||
UT_LIST_ADD_FIRST(LRU, system->LRU, node);
|
UT_LIST_ADD_FIRST(LRU, system->LRU, node);
|
||||||
@@ -4129,7 +4157,8 @@ fil_flush_file_spaces(
|
|||||||
space = UT_LIST_GET_FIRST(system->space_list);
|
space = UT_LIST_GET_FIRST(system->space_list);
|
||||||
|
|
||||||
while (space) {
|
while (space) {
|
||||||
if (space->purpose == purpose) {
|
if (space->purpose == purpose && !space->is_being_deleted) {
|
||||||
|
|
||||||
space->n_pending_flushes++; /* prevent dropping of the
|
space->n_pending_flushes++; /* prevent dropping of the
|
||||||
space while we are
|
space while we are
|
||||||
flushing */
|
flushing */
|
||||||
|
@@ -2897,11 +2897,6 @@ recv_recovery_from_checkpoint_finish(void)
|
|||||||
int i;
|
int i;
|
||||||
os_thread_id_t recovery_thread_id;
|
os_thread_id_t recovery_thread_id;
|
||||||
|
|
||||||
/* Rollback the uncommitted transactions which have no user session */
|
|
||||||
|
|
||||||
fprintf(stderr,
|
|
||||||
"InnoDB: Starting to apply log records to the database...\n");
|
|
||||||
|
|
||||||
/* Apply the hashed log records to the respective file pages */
|
/* Apply the hashed log records to the respective file pages */
|
||||||
|
|
||||||
if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) {
|
if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) {
|
||||||
@@ -2938,6 +2933,9 @@ recv_recovery_from_checkpoint_finish(void)
|
|||||||
recv_sys_free();
|
recv_sys_free();
|
||||||
#endif
|
#endif
|
||||||
if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO) {
|
if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO) {
|
||||||
|
/* Rollback the uncommitted transactions which have no user
|
||||||
|
session */
|
||||||
|
|
||||||
os_thread_create(trx_rollback_or_clean_all_without_sess,
|
os_thread_create(trx_rollback_or_clean_all_without_sess,
|
||||||
(void *)&i, &recovery_thread_id);
|
(void *)&i, &recovery_thread_id);
|
||||||
}
|
}
|
||||||
|
@@ -88,7 +88,7 @@ os_thread_create(
|
|||||||
/*=============*/
|
/*=============*/
|
||||||
/* out: handle to the thread */
|
/* out: handle to the thread */
|
||||||
#ifndef __WIN__
|
#ifndef __WIN__
|
||||||
os_posix_f_t start_f,
|
os_posix_f_t start_f,
|
||||||
#else
|
#else
|
||||||
ulint (*start_f)(void*), /* in: pointer to function
|
ulint (*start_f)(void*), /* in: pointer to function
|
||||||
from which to start */
|
from which to start */
|
||||||
|
@@ -241,6 +241,7 @@ USE_EMBEDDED_SERVER=""
|
|||||||
RESULT_EXT=""
|
RESULT_EXT=""
|
||||||
TEST_MODE="default"
|
TEST_MODE="default"
|
||||||
|
|
||||||
|
NDB_MGM_EXTRA_OPTS=
|
||||||
NDB_MGMD_EXTRA_OPTS=
|
NDB_MGMD_EXTRA_OPTS=
|
||||||
NDBD_EXTRA_OPTS=
|
NDBD_EXTRA_OPTS=
|
||||||
|
|
||||||
@@ -264,6 +265,8 @@ while test $# -gt 0; do
|
|||||||
--ndb-connectstring=*)
|
--ndb-connectstring=*)
|
||||||
USE_NDBCLUSTER="--ndbcluster" ;
|
USE_NDBCLUSTER="--ndbcluster" ;
|
||||||
USE_RUNNING_NDBCLUSTER=`$ECHO "$1" | $SED -e "s;--ndb-connectstring=;;"` ;;
|
USE_RUNNING_NDBCLUSTER=`$ECHO "$1" | $SED -e "s;--ndb-connectstring=;;"` ;;
|
||||||
|
--ndb_mgm-extra-opts=*)
|
||||||
|
NDB_MGM_EXTRA_OPTS=`$ECHO "$1" | $SED -e "s;--ndb_mgm-extra-opts=;;"` ;;
|
||||||
--ndb_mgmd-extra-opts=*)
|
--ndb_mgmd-extra-opts=*)
|
||||||
NDB_MGMD_EXTRA_OPTS=`$ECHO "$1" | $SED -e "s;--ndb_mgmd-extra-opts=;;"` ;;
|
NDB_MGMD_EXTRA_OPTS=`$ECHO "$1" | $SED -e "s;--ndb_mgmd-extra-opts=;;"` ;;
|
||||||
--ndbd-extra-opts=*)
|
--ndbd-extra-opts=*)
|
||||||
@@ -470,7 +473,7 @@ SMALL_SERVER="--key_buffer_size=1M --sort_buffer=256K --max_heap_table_size=1M"
|
|||||||
export MASTER_MYPORT MASTER_MYPORT1 SLAVE_MYPORT MYSQL_TCP_PORT MASTER_MYSOCK MASTER_MYSOCK1
|
export MASTER_MYPORT MASTER_MYPORT1 SLAVE_MYPORT MYSQL_TCP_PORT MASTER_MYSOCK MASTER_MYSOCK1
|
||||||
|
|
||||||
NDBCLUSTER_BASE_PORT=`expr $NDBCLUSTER_PORT + 2`
|
NDBCLUSTER_BASE_PORT=`expr $NDBCLUSTER_PORT + 2`
|
||||||
NDBCLUSTER_OPTS="--port=$NDBCLUSTER_PORT --port-base=$NDBCLUSTER_BASE_PORT --data-dir=$MYSQL_TEST_DIR/var --ndb_mgmd-extra-opts=\"$NDB_MGMD_EXTRA_OPTS\" --ndbd-extra-opts=\"$NDBD_EXTRA_OPTS\""
|
NDBCLUSTER_OPTS="--port=$NDBCLUSTER_PORT --port-base=$NDBCLUSTER_BASE_PORT --data-dir=$MYSQL_TEST_DIR/var --ndb_mgm-extra-opts=$NDB_MGM_EXTRA_OPTS --ndb_mgmd-extra-opts=$NDB_MGMD_EXTRA_OPTS --ndbd-extra-opts=$NDBD_EXTRA_OPTS"
|
||||||
|
|
||||||
if [ x$SOURCE_DIST = x1 ] ; then
|
if [ x$SOURCE_DIST = x1 ] ; then
|
||||||
MY_BASEDIR=$MYSQL_TEST_DIR
|
MY_BASEDIR=$MYSQL_TEST_DIR
|
||||||
|
@@ -58,6 +58,7 @@ ndb_con_op=105000
|
|||||||
ndb_dmem=80M
|
ndb_dmem=80M
|
||||||
ndb_imem=24M
|
ndb_imem=24M
|
||||||
|
|
||||||
|
NDB_MGM_EXTRA_OPTS=
|
||||||
NDB_MGMD_EXTRA_OPTS=
|
NDB_MGMD_EXTRA_OPTS=
|
||||||
NDBD_EXTRA_OPTS=
|
NDBD_EXTRA_OPTS=
|
||||||
|
|
||||||
@@ -97,6 +98,9 @@ while test $# -gt 0; do
|
|||||||
--port-base=*)
|
--port-base=*)
|
||||||
port_base=`echo "$1" | sed -e "s;--port-base=;;"`
|
port_base=`echo "$1" | sed -e "s;--port-base=;;"`
|
||||||
;;
|
;;
|
||||||
|
--ndb_mgm-extra-opts=*)
|
||||||
|
NDB_MGM_EXTRA_OPTS=`echo "$1" | sed -e "s;--ndb_mgm-extra-opts=;;"`
|
||||||
|
;;
|
||||||
--ndb_mgmd-extra-opts=*)
|
--ndb_mgmd-extra-opts=*)
|
||||||
NDB_MGMD_EXTRA_OPTS=`echo "$1" | sed -e "s;--ndb_mgmd-extra-opts=;;"`
|
NDB_MGMD_EXTRA_OPTS=`echo "$1" | sed -e "s;--ndb_mgmd-extra-opts=;;"`
|
||||||
;;
|
;;
|
||||||
@@ -130,7 +134,7 @@ if [ ! -x "$exec_waiter" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec_mgmtclient="$exec_mgmtclient --no-defaults"
|
exec_mgmtclient="$exec_mgmtclient --no-defaults $NDB_MGM_EXTRA_OPTS"
|
||||||
exec_mgmtsrvr="$exec_mgmtsrvr --no-defaults $NDB_MGMD_EXTRA_OPTS"
|
exec_mgmtsrvr="$exec_mgmtsrvr --no-defaults $NDB_MGMD_EXTRA_OPTS"
|
||||||
exec_ndb="$exec_ndb --no-defaults $NDBD_EXTRA_OPTS"
|
exec_ndb="$exec_ndb --no-defaults $NDBD_EXTRA_OPTS"
|
||||||
exec_waiter="$exec_waiter --no-defaults"
|
exec_waiter="$exec_waiter --no-defaults"
|
||||||
@@ -178,8 +182,8 @@ fi
|
|||||||
|
|
||||||
# Edit file system path and ports in config file
|
# Edit file system path and ports in config file
|
||||||
if [ $initial_ndb ] ; then
|
if [ $initial_ndb ] ; then
|
||||||
rm -f $fs_ndb/ndb_*
|
rm -f $fs_ndb/ndb_* 2>&1 | cat > /dev/null
|
||||||
sed \
|
sed \
|
||||||
-e s,"CHOOSE_MaxNoOfOrderedIndexes","$ndb_no_ord",g \
|
-e s,"CHOOSE_MaxNoOfOrderedIndexes","$ndb_no_ord",g \
|
||||||
-e s,"CHOOSE_MaxNoOfConcurrentOperations","$ndb_con_op",g \
|
-e s,"CHOOSE_MaxNoOfConcurrentOperations","$ndb_con_op",g \
|
||||||
-e s,"CHOOSE_DataMemory","$ndb_dmem",g \
|
-e s,"CHOOSE_DataMemory","$ndb_dmem",g \
|
||||||
|
@@ -246,3 +246,11 @@ SELECT FOUND_ROWS();
|
|||||||
FOUND_ROWS()
|
FOUND_ROWS()
|
||||||
0
|
0
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (a int, b int);
|
||||||
|
INSERT INTO t1 VALUES (1,2), (1,3), (1,4), (1,5);
|
||||||
|
SELECT SQL_CALC_FOUND_ROWS DISTINCT 'a' FROM t1 GROUP BY b LIMIT 2;
|
||||||
|
a
|
||||||
|
a
|
||||||
|
SELECT FOUND_ROWS();
|
||||||
|
FOUND_ROWS()
|
||||||
|
1
|
||||||
|
@@ -166,3 +166,12 @@ INSERT INTO t1 VALUES (0), (0), (1), (2);
|
|||||||
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a = 0 GROUP BY a HAVING a > 10;
|
SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a = 0 GROUP BY a HAVING a > 10;
|
||||||
SELECT FOUND_ROWS();
|
SELECT FOUND_ROWS();
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #7945: group by + distinct with constant expression + limit
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a int, b int);
|
||||||
|
INSERT INTO t1 VALUES (1,2), (1,3), (1,4), (1,5);
|
||||||
|
SELECT SQL_CALC_FOUND_ROWS DISTINCT 'a' FROM t1 GROUP BY b LIMIT 2;
|
||||||
|
SELECT FOUND_ROWS();
|
||||||
|
@@ -2444,6 +2444,41 @@ static int flush_all_key_blocks(KEY_CACHE *keycache)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Reset the counters of a key cache.
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
reset_key_cache_counters()
|
||||||
|
name the name of a key cache
|
||||||
|
key_cache pointer to the key kache to be reset
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
This procedure is used by process_key_caches() to reset the counters of all
|
||||||
|
currently used key caches, both the default one and the named ones.
|
||||||
|
|
||||||
|
RETURN
|
||||||
|
0 on success (always because it can't fail)
|
||||||
|
*/
|
||||||
|
|
||||||
|
int reset_key_cache_counters(const char *name, KEY_CACHE *key_cache)
|
||||||
|
{
|
||||||
|
DBUG_ENTER("reset_key_cache_counters");
|
||||||
|
if (!key_cache->key_cache_inited)
|
||||||
|
{
|
||||||
|
DBUG_PRINT("info", ("Key cache %s not initialized.", name));
|
||||||
|
DBUG_RETURN(0);
|
||||||
|
}
|
||||||
|
DBUG_PRINT("info", ("Resetting counters for key cache %s.", name));
|
||||||
|
|
||||||
|
key_cache->global_blocks_changed= 0; /* Key_blocks_not_flushed */
|
||||||
|
key_cache->global_cache_r_requests= 0; /* Key_read_requests */
|
||||||
|
key_cache->global_cache_read= 0; /* Key_reads */
|
||||||
|
key_cache->global_cache_w_requests= 0; /* Key_write_requests */
|
||||||
|
key_cache->global_cache_write= 0; /* Key_writes */
|
||||||
|
DBUG_RETURN(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef DBUG_OFF
|
#ifndef DBUG_OFF
|
||||||
/*
|
/*
|
||||||
Test if disk-cache is ok
|
Test if disk-cache is ok
|
||||||
|
@@ -308,13 +308,6 @@ NdbRecAttr::arraySize() const
|
|||||||
return theArraySize;
|
return theArraySize;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
|
||||||
Int64
|
|
||||||
NdbRecAttr::int64_value() const
|
|
||||||
{
|
|
||||||
return *(Int64*)theRef;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
inline
|
||||||
Int32
|
Int32
|
||||||
NdbRecAttr::int32_value() const
|
NdbRecAttr::int32_value() const
|
||||||
@@ -336,13 +329,6 @@ NdbRecAttr::char_value() const
|
|||||||
return *(char*)theRef;
|
return *(char*)theRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
|
||||||
Uint64
|
|
||||||
NdbRecAttr::u_64_value() const
|
|
||||||
{
|
|
||||||
return *(Uint64*)theRef;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
inline
|
||||||
Uint32
|
Uint32
|
||||||
NdbRecAttr::u_32_value() const
|
NdbRecAttr::u_32_value() const
|
||||||
@@ -364,20 +350,6 @@ NdbRecAttr::u_char_value() const
|
|||||||
return *(Uint8*)theRef;
|
return *(Uint8*)theRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
|
||||||
float
|
|
||||||
NdbRecAttr::float_value() const
|
|
||||||
{
|
|
||||||
return *(float*)theRef;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
double
|
|
||||||
NdbRecAttr::double_value() const
|
|
||||||
{
|
|
||||||
return *(double*)theRef;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
inline
|
||||||
void
|
void
|
||||||
NdbRecAttr::release()
|
NdbRecAttr::release()
|
||||||
|
@@ -281,3 +281,35 @@ NdbOut& operator<<(NdbOut& out, const NdbRecAttr &r)
|
|||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Int64
|
||||||
|
NdbRecAttr::int64_value() const
|
||||||
|
{
|
||||||
|
Int64 val;
|
||||||
|
memcpy(&val,theRef,8);
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
Uint64
|
||||||
|
NdbRecAttr::u_64_value() const
|
||||||
|
{
|
||||||
|
Uint64 val;
|
||||||
|
memcpy(&val,theRef,8);
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
float
|
||||||
|
NdbRecAttr::float_value() const
|
||||||
|
{
|
||||||
|
float val;
|
||||||
|
memcpy(&val,theRef,sizeof(val));
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
double
|
||||||
|
NdbRecAttr::double_value() const
|
||||||
|
{
|
||||||
|
double val;
|
||||||
|
memcpy(&val,theRef,sizeof(val));
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include <ndb_global.h>
|
||||||
#include "NdbApi.hpp"
|
#include "NdbApi.hpp"
|
||||||
#include <NdbSchemaCon.hpp>
|
#include <NdbSchemaCon.hpp>
|
||||||
#include <NdbMain.h>
|
#include <NdbMain.h>
|
||||||
|
@@ -49,6 +49,7 @@ Arguments:
|
|||||||
|
|
||||||
* *************************************************** */
|
* *************************************************** */
|
||||||
|
|
||||||
|
#include <ndb_global.h>
|
||||||
#include "NdbApi.hpp"
|
#include "NdbApi.hpp"
|
||||||
|
|
||||||
#include <NdbMain.h>
|
#include <NdbMain.h>
|
||||||
|
@@ -47,6 +47,7 @@ Revision history:
|
|||||||
|
|
||||||
* *************************************************** */
|
* *************************************************** */
|
||||||
|
|
||||||
|
#include <ndb_global.h>
|
||||||
#include <NdbApi.hpp>
|
#include <NdbApi.hpp>
|
||||||
|
|
||||||
#include <NdbMain.h>
|
#include <NdbMain.h>
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
|
|
||||||
|
#include <ndb_global.h>
|
||||||
#include <NdbApi.hpp>
|
#include <NdbApi.hpp>
|
||||||
#include <NdbOut.hpp>
|
#include <NdbOut.hpp>
|
||||||
#include <NdbTick.h>
|
#include <NdbTick.h>
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||||
|
|
||||||
|
#include <ndb_global.h>
|
||||||
#include "HugoCalculator.hpp"
|
#include "HugoCalculator.hpp"
|
||||||
#include <NDBT.hpp>
|
#include <NDBT.hpp>
|
||||||
#include <Base64.hpp>
|
#include <Base64.hpp>
|
||||||
|
@@ -1064,7 +1064,6 @@ extern struct system_variables global_system_variables;
|
|||||||
extern struct system_variables max_system_variables;
|
extern struct system_variables max_system_variables;
|
||||||
extern struct system_status_var global_status_var;
|
extern struct system_status_var global_status_var;
|
||||||
extern struct rand_struct sql_rand;
|
extern struct rand_struct sql_rand;
|
||||||
extern KEY_CACHE *sql_key_cache;
|
|
||||||
|
|
||||||
extern const char *opt_date_time_formats[];
|
extern const char *opt_date_time_formats[];
|
||||||
extern KNOWN_DATE_TIME_FORMAT known_date_time_formats[];
|
extern KNOWN_DATE_TIME_FORMAT known_date_time_formats[];
|
||||||
|
@@ -395,7 +395,6 @@ struct system_status_var global_status_var;
|
|||||||
|
|
||||||
MY_TMPDIR mysql_tmpdir_list;
|
MY_TMPDIR mysql_tmpdir_list;
|
||||||
MY_BITMAP temp_pool;
|
MY_BITMAP temp_pool;
|
||||||
KEY_CACHE *sql_key_cache;
|
|
||||||
|
|
||||||
CHARSET_INFO *system_charset_info, *files_charset_info ;
|
CHARSET_INFO *system_charset_info, *files_charset_info ;
|
||||||
CHARSET_INFO *national_charset_info, *table_alias_charset;
|
CHARSET_INFO *national_charset_info, *table_alias_charset;
|
||||||
@@ -1867,14 +1866,14 @@ We will try our best to scrape up some info that will hopefully help diagnose\n\
|
|||||||
the problem, but since we have already crashed, something is definitely wrong\n\
|
the problem, but since we have already crashed, something is definitely wrong\n\
|
||||||
and this may fail.\n\n");
|
and this may fail.\n\n");
|
||||||
fprintf(stderr, "key_buffer_size=%lu\n",
|
fprintf(stderr, "key_buffer_size=%lu\n",
|
||||||
(ulong) sql_key_cache->key_cache_mem_size);
|
(ulong) dflt_key_cache->key_cache_mem_size);
|
||||||
fprintf(stderr, "read_buffer_size=%ld\n", global_system_variables.read_buff_size);
|
fprintf(stderr, "read_buffer_size=%ld\n", global_system_variables.read_buff_size);
|
||||||
fprintf(stderr, "max_used_connections=%ld\n", max_used_connections);
|
fprintf(stderr, "max_used_connections=%ld\n", max_used_connections);
|
||||||
fprintf(stderr, "max_connections=%ld\n", max_connections);
|
fprintf(stderr, "max_connections=%ld\n", max_connections);
|
||||||
fprintf(stderr, "threads_connected=%d\n", thread_count);
|
fprintf(stderr, "threads_connected=%d\n", thread_count);
|
||||||
fprintf(stderr, "It is possible that mysqld could use up to \n\
|
fprintf(stderr, "It is possible that mysqld could use up to \n\
|
||||||
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = %ld K\n\
|
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = %ld K\n\
|
||||||
bytes of memory\n", ((ulong) sql_key_cache->key_cache_mem_size +
|
bytes of memory\n", ((ulong) dflt_key_cache->key_cache_mem_size +
|
||||||
(global_system_variables.read_buff_size +
|
(global_system_variables.read_buff_size +
|
||||||
global_system_variables.sortbuff_size) *
|
global_system_variables.sortbuff_size) *
|
||||||
max_connections)/ 1024);
|
max_connections)/ 1024);
|
||||||
@@ -2141,12 +2140,12 @@ extern "C" void *signal_hand(void *arg __attribute__((unused)))
|
|||||||
case SIGHUP:
|
case SIGHUP:
|
||||||
if (!abort_loop)
|
if (!abort_loop)
|
||||||
{
|
{
|
||||||
|
mysql_print_status((THD*) 0); // Print some debug info
|
||||||
reload_acl_and_cache((THD*) 0,
|
reload_acl_and_cache((THD*) 0,
|
||||||
(REFRESH_LOG | REFRESH_TABLES | REFRESH_FAST |
|
(REFRESH_LOG | REFRESH_TABLES | REFRESH_FAST |
|
||||||
REFRESH_GRANT |
|
REFRESH_GRANT |
|
||||||
REFRESH_THREADS | REFRESH_HOSTS),
|
REFRESH_THREADS | REFRESH_HOSTS),
|
||||||
(TABLE_LIST*) 0, NULL); // Flush logs
|
(TABLE_LIST*) 0, NULL); // Flush logs
|
||||||
mysql_print_status((THD*) 0); // Send debug some info
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#ifdef USE_ONE_SIGNAL_HAND
|
#ifdef USE_ONE_SIGNAL_HAND
|
||||||
@@ -2820,8 +2819,6 @@ server.");
|
|||||||
|
|
||||||
/* call ha_init_key_cache() on all key caches to init them */
|
/* call ha_init_key_cache() on all key caches to init them */
|
||||||
process_key_caches(&ha_init_key_cache);
|
process_key_caches(&ha_init_key_cache);
|
||||||
/* We must set dflt_key_cache in case we are using ISAM tables */
|
|
||||||
dflt_key_cache= sql_key_cache;
|
|
||||||
|
|
||||||
#if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT) && !defined(EMBEDDED_LIBRARY)
|
#if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT) && !defined(EMBEDDED_LIBRARY)
|
||||||
if (locked_in_memory && !getuid())
|
if (locked_in_memory && !getuid())
|
||||||
@@ -5875,10 +5872,10 @@ static void mysql_init_variables(void)
|
|||||||
threads.empty();
|
threads.empty();
|
||||||
thread_cache.empty();
|
thread_cache.empty();
|
||||||
key_caches.empty();
|
key_caches.empty();
|
||||||
multi_keycache_init();
|
if (!(dflt_key_cache= get_or_create_key_cache(default_key_cache_base.str,
|
||||||
if (!(sql_key_cache= get_or_create_key_cache(default_key_cache_base.str,
|
|
||||||
default_key_cache_base.length)))
|
default_key_cache_base.length)))
|
||||||
exit(1);
|
exit(1);
|
||||||
|
multi_keycache_init(); /* set key_cache_hash.default_value = dflt_key_cache */
|
||||||
|
|
||||||
/* Initialize structures that is used when processing options */
|
/* Initialize structures that is used when processing options */
|
||||||
replicate_rewrite_db.empty();
|
replicate_rewrite_db.empty();
|
||||||
|
@@ -2234,7 +2234,7 @@ bool sys_var_key_buffer_size::update(THD *thd, set_var *var)
|
|||||||
|
|
||||||
if (!tmp) // Zero size means delete
|
if (!tmp) // Zero size means delete
|
||||||
{
|
{
|
||||||
if (key_cache == sql_key_cache)
|
if (key_cache == dflt_key_cache)
|
||||||
goto end; // Ignore default key cache
|
goto end; // Ignore default key cache
|
||||||
|
|
||||||
if (key_cache->key_cache_inited) // If initied
|
if (key_cache->key_cache_inited) // If initied
|
||||||
@@ -2248,7 +2248,7 @@ bool sys_var_key_buffer_size::update(THD *thd, set_var *var)
|
|||||||
base_name->length, &list);
|
base_name->length, &list);
|
||||||
key_cache->in_init= 1;
|
key_cache->in_init= 1;
|
||||||
pthread_mutex_unlock(&LOCK_global_system_variables);
|
pthread_mutex_unlock(&LOCK_global_system_variables);
|
||||||
error= reassign_keycache_tables(thd, key_cache, sql_key_cache);
|
error= reassign_keycache_tables(thd, key_cache, dflt_key_cache);
|
||||||
pthread_mutex_lock(&LOCK_global_system_variables);
|
pthread_mutex_lock(&LOCK_global_system_variables);
|
||||||
key_cache->in_init= 0;
|
key_cache->in_init= 0;
|
||||||
}
|
}
|
||||||
|
@@ -5867,6 +5867,7 @@ void kill_one_thread(THD *thd, ulong id, bool only_kill_query)
|
|||||||
my_error(error, MYF(0), id);
|
my_error(error, MYF(0), id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Clear most status variables */
|
/* Clear most status variables */
|
||||||
|
|
||||||
static void refresh_status(void)
|
static void refresh_status(void)
|
||||||
@@ -5876,17 +5877,6 @@ static void refresh_status(void)
|
|||||||
{
|
{
|
||||||
if (ptr->type == SHOW_LONG)
|
if (ptr->type == SHOW_LONG)
|
||||||
*(ulong*) ptr->value= 0;
|
*(ulong*) ptr->value= 0;
|
||||||
else if (ptr->type == SHOW_KEY_CACHE_LONG)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
Reset value in 'default' key cache.
|
|
||||||
This needs to be recoded when we have thread specific key values
|
|
||||||
*/
|
|
||||||
char *value= (((char*) sql_key_cache) +
|
|
||||||
(uint) ((char*) (ptr->value) -
|
|
||||||
(char*) &dflt_key_cache_var));
|
|
||||||
*(ulong*) value= 0;
|
|
||||||
}
|
|
||||||
else if (ptr->type == SHOW_LONG_STATUS)
|
else if (ptr->type == SHOW_LONG_STATUS)
|
||||||
{
|
{
|
||||||
THD *thd= current_thd;
|
THD *thd= current_thd;
|
||||||
@@ -5895,6 +5885,8 @@ static void refresh_status(void)
|
|||||||
bzero((char*) &thd->status_var, sizeof(thd->status_var));
|
bzero((char*) &thd->status_var, sizeof(thd->status_var));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* Reset the counters of all key caches (default and named). */
|
||||||
|
process_key_caches(reset_key_cache_counters);
|
||||||
pthread_mutex_unlock(&LOCK_status);
|
pthread_mutex_unlock(&LOCK_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4474,9 +4474,15 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
|
|||||||
x = used key parts (1 <= x <= c)
|
x = used key parts (1 <= x <= c)
|
||||||
*/
|
*/
|
||||||
double rec_per_key;
|
double rec_per_key;
|
||||||
|
#if 0
|
||||||
if (!(rec_per_key=(double)
|
if (!(rec_per_key=(double)
|
||||||
keyinfo->rec_per_key[keyinfo->key_parts-1]))
|
keyinfo->rec_per_key[keyinfo->key_parts-1]))
|
||||||
rec_per_key=(double) s->records/rec+1;
|
rec_per_key=(double) s->records/rec+1;
|
||||||
|
#else
|
||||||
|
rec_per_key= keyinfo->rec_per_key[keyinfo->key_parts-1] ?
|
||||||
|
(double) keyinfo->rec_per_key[keyinfo->key_parts-1] :
|
||||||
|
(double) s->records/rec+1;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!s->records)
|
if (!s->records)
|
||||||
tmp=0;
|
tmp=0;
|
||||||
@@ -10766,13 +10772,14 @@ remove_duplicates(JOIN *join, TABLE *entry,List<Item> &fields, Item *having)
|
|||||||
field_count++;
|
field_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!field_count)
|
if (!field_count && !(join->select_options & OPTION_FOUND_ROWS))
|
||||||
{ // only const items
|
{ // only const items with no OPTION_FOUND_ROWS
|
||||||
join->unit->select_limit_cnt= 1; // Only send first row
|
join->unit->select_limit_cnt= 1; // Only send first row
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
Field **first_field=entry->field+entry->s->fields - field_count;
|
Field **first_field=entry->field+entry->s->fields - field_count;
|
||||||
offset=entry->field[entry->s->fields - field_count]->offset();
|
offset= field_count ?
|
||||||
|
entry->field[entry->s->fields - field_count]->offset() : 0;
|
||||||
reclength=entry->s->reclength-offset;
|
reclength=entry->s->reclength-offset;
|
||||||
|
|
||||||
free_io_cache(entry); // Safety
|
free_io_cache(entry); // Safety
|
||||||
|
@@ -1512,7 +1512,7 @@ static bool show_status_array(THD *thd, const char *wild,
|
|||||||
#endif /* HAVE_OPENSSL */
|
#endif /* HAVE_OPENSSL */
|
||||||
case SHOW_KEY_CACHE_LONG:
|
case SHOW_KEY_CACHE_LONG:
|
||||||
case SHOW_KEY_CACHE_CONST_LONG:
|
case SHOW_KEY_CACHE_CONST_LONG:
|
||||||
value= (value-(char*) &dflt_key_cache_var)+ (char*) sql_key_cache;
|
value= (value-(char*) &dflt_key_cache_var)+ (char*) dflt_key_cache;
|
||||||
end= int10_to_str(*(long*) value, buff, 10);
|
end= int10_to_str(*(long*) value, buff, 10);
|
||||||
break;
|
break;
|
||||||
case SHOW_UNDEF: // Show never happen
|
case SHOW_UNDEF: // Show never happen
|
||||||
|
Reference in New Issue
Block a user