Write UNION() for MERGE tables
This commit is contained in:
parent
6fd7fb49cb
commit
ece13efde9
@ -22747,6 +22747,10 @@ that can be used as one. You can only @code{SELECT}, @code{DELETE}, and
|
|||||||
@code{MERGE} table, you are only dropping the @code{MERGE}
|
@code{MERGE} table, you are only dropping the @code{MERGE}
|
||||||
specification.
|
specification.
|
||||||
|
|
||||||
|
Note that @code{DELETE FROM merge_table} used without a @code{WHERE}
|
||||||
|
will only clear the mapping for the table, not delete everything in the
|
||||||
|
mapped tables. (We plan to fix this in 4.0).
|
||||||
|
|
||||||
With identical tables we mean that all tables are created with identical
|
With identical tables we mean that all tables are created with identical
|
||||||
column information. You can't put a MERGE over tables where the columns
|
column information. You can't put a MERGE over tables where the columns
|
||||||
are packed differently or doesn't have exactly the same columns.
|
are packed differently or doesn't have exactly the same columns.
|
||||||
@ -35114,6 +35118,17 @@ to the log file (by default named 'hostname.log'). This log can
|
|||||||
be very useful when you suspect an error in a client and want to know
|
be very useful when you suspect an error in a client and want to know
|
||||||
exactly what @code{mysqld} thought the client send to it.
|
exactly what @code{mysqld} thought the client send to it.
|
||||||
|
|
||||||
|
By default, the @code{mysql.server} script starts the @strong{MySQL}
|
||||||
|
server with the @code{-l} option. If you need better performance when
|
||||||
|
you start using @strong{MySQL} in a production environment, you can
|
||||||
|
remove the @code{-l} option from @code{mysql.server} or change it to
|
||||||
|
@code{--log-binary}.
|
||||||
|
|
||||||
|
The entries in this log are written as @code{mysqld} receives the questions.
|
||||||
|
This may be different than the order in which the statements is executed.
|
||||||
|
This is in contrast to the update log and the binary log which is written
|
||||||
|
after the query is executed, but before any locks are released.
|
||||||
|
|
||||||
@cindex update log
|
@cindex update log
|
||||||
@cindex files, update log
|
@cindex files, update log
|
||||||
@node Update log, Binary log, Query log, Log files
|
@node Update log, Binary log, Query log, Log files
|
||||||
@ -35149,17 +35164,15 @@ cp hostname-old.log to-backup-directory
|
|||||||
rm hostname-old.log
|
rm hostname-old.log
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
By default, the @code{mysql.server} script starts the @strong{MySQL}
|
|
||||||
server with the @code{-l} option. If you need better performance when
|
|
||||||
you start using @strong{MySQL} in a production environment, you can
|
|
||||||
remove the @code{-l} option from @code{mysql.server} or change it to
|
|
||||||
@code{--log-update}.
|
|
||||||
|
|
||||||
Update logging is smart because it logs only statements that really update
|
Update logging is smart because it logs only statements that really update
|
||||||
data. So an @code{UPDATE} or a @code{DELETE} with a @code{WHERE} that finds no
|
data. So an @code{UPDATE} or a @code{DELETE} with a @code{WHERE} that finds no
|
||||||
rows is not written to the log. It even skips @code{UPDATE} statements that
|
rows is not written to the log. It even skips @code{UPDATE} statements that
|
||||||
set a column to the value it already has.
|
set a column to the value it already has.
|
||||||
|
|
||||||
|
The update logging is done immediately after a query completes but before
|
||||||
|
any locks are released or any commit is done. This ensures that the log
|
||||||
|
will be logged in the execution order.
|
||||||
|
|
||||||
If you want to update a database from update log files, you could do the
|
If you want to update a database from update log files, you could do the
|
||||||
following (assuming your update logs have names of the form
|
following (assuming your update logs have names of the form
|
||||||
@file{file_name.###}):
|
@file{file_name.###}):
|
||||||
@ -35229,6 +35242,10 @@ this program!
|
|||||||
If you are using @code{BEGIN} or @code{SET AUTO_COMMIT=0}, you must use
|
If you are using @code{BEGIN} or @code{SET AUTO_COMMIT=0}, you must use
|
||||||
the @strong{MySQL} binary log for backups instead of the old update log.
|
the @strong{MySQL} binary log for backups instead of the old update log.
|
||||||
|
|
||||||
|
The binary logging is done immediately after a query completes but before
|
||||||
|
any locks are released or any commit is done. This ensures that the log
|
||||||
|
will be logged in the execution order.
|
||||||
|
|
||||||
All updates (@code{UPDATE}, @code{DELETE} or @code{INSERT}) that changes
|
All updates (@code{UPDATE}, @code{DELETE} or @code{INSERT}) that changes
|
||||||
a transactional table (like BDB tables) is cached until a @code{COMMIT}.
|
a transactional table (like BDB tables) is cached until a @code{COMMIT}.
|
||||||
Any updates to a not transactional table is stored in the binary log at
|
Any updates to a not transactional table is stored in the binary log at
|
||||||
@ -35250,6 +35267,10 @@ When started with the @code{--log-slow-queries[=file_name]} option,
|
|||||||
more than @code{long_query_time} to execute. The time to get the initial
|
more than @code{long_query_time} to execute. The time to get the initial
|
||||||
table locks are not counted as execution time.
|
table locks are not counted as execution time.
|
||||||
|
|
||||||
|
The slow query log is logged after the query is executed and after all
|
||||||
|
locks has been released. This may be different than the order in which
|
||||||
|
the statements is executed.
|
||||||
|
|
||||||
If no file name is given, it defaults to the name of the host machine
|
If no file name is given, it defaults to the name of the host machine
|
||||||
suffixed with @code{-slow.log}. If a filename is given, but doesn't
|
suffixed with @code{-slow.log}. If a filename is given, but doesn't
|
||||||
contain a path, the file is written in the data directory.
|
contain a path, the file is written in the data directory.
|
||||||
@ -41421,6 +41442,12 @@ not yet 100 % confident in this code.
|
|||||||
@appendixsubsec Changes in release 3.23.34
|
@appendixsubsec Changes in release 3.23.34
|
||||||
@itemize @bullet
|
@itemize @bullet
|
||||||
@item
|
@item
|
||||||
|
@code{SHOW CREATE TABLE} now dumps the @code{UNION()} for @code{MERGE} tables.
|
||||||
|
@item
|
||||||
|
Fixed bug when replicating timestamps.
|
||||||
|
@item
|
||||||
|
Fixed bug in bi-directonal replication.
|
||||||
|
@item
|
||||||
Added the @code{INNOBASE} table handler and the @code{BDB} table handler
|
Added the @code{INNOBASE} table handler and the @code{BDB} table handler
|
||||||
to the @strong{MySQL} source distribution.
|
to the @strong{MySQL} source distribution.
|
||||||
@item
|
@item
|
||||||
@ -46205,6 +46232,10 @@ For the moment @code{MATCH} only works with @code{SELECT} statements.
|
|||||||
When using @code{SET CHARACTER SET}, one can't use translated
|
When using @code{SET CHARACTER SET}, one can't use translated
|
||||||
characters in database, table and column names.
|
characters in database, table and column names.
|
||||||
@item
|
@item
|
||||||
|
@code{DELETE FROM merge_table} used without a @code{WHERE}
|
||||||
|
will only clear the mapping for the table, not delete everything in the
|
||||||
|
mapped tables
|
||||||
|
@item
|
||||||
You cannot build in another directory when using
|
You cannot build in another directory when using
|
||||||
MIT-pthreads. Because this requires changes to MIT-pthreads, we are not
|
MIT-pthreads. Because this requires changes to MIT-pthreads, we are not
|
||||||
likely to fix this.
|
likely to fix this.
|
||||||
|
@ -860,7 +860,7 @@ end2:
|
|||||||
filename));
|
filename));
|
||||||
if (check_param.testflag & (T_REP_BY_SORT | T_REP))
|
if (check_param.testflag & (T_REP_BY_SORT | T_REP))
|
||||||
VOID(fprintf(stderr,
|
VOID(fprintf(stderr,
|
||||||
"Try fixing it by using the --safe-recover (-o) option\n"));
|
"Try fixing it by using the --safe-recover (-o) or the --force (-f) option\n"));
|
||||||
}
|
}
|
||||||
else if (!(param->error_printed & 2) &&
|
else if (!(param->error_printed & 2) &&
|
||||||
!(param->testflag & T_FORCE_CREATE))
|
!(param->testflag & T_FORCE_CREATE))
|
||||||
|
@ -81,6 +81,12 @@ a
|
|||||||
412
|
412
|
||||||
412
|
412
|
||||||
411
|
411
|
||||||
|
Table Create Table
|
||||||
|
t3 CREATE TABLE `t3` (
|
||||||
|
`a` int(11) NOT NULL default '0',
|
||||||
|
`b` char(20) default NULL,
|
||||||
|
KEY `a` (`a`)
|
||||||
|
) TYPE=MRG_MyISAM UNION=(t1,t2)
|
||||||
c
|
c
|
||||||
test1
|
test1
|
||||||
test1
|
test1
|
||||||
|
@ -72,6 +72,10 @@ then
|
|||||||
MY_BASEDIR_VERSION=$MY_PWD # Where bin, share and data are
|
MY_BASEDIR_VERSION=$MY_PWD # Where bin, share and data are
|
||||||
ledir=$MY_BASEDIR_VERSION/bin # Where mysqld is
|
ledir=$MY_BASEDIR_VERSION/bin # Where mysqld is
|
||||||
DATADIR=$MY_BASEDIR_VERSION/data
|
DATADIR=$MY_BASEDIR_VERSION/data
|
||||||
|
if test -z "defaults"
|
||||||
|
then
|
||||||
|
defaults="--defaults-extra-file=$MY_BASEDIR_VERSION/data/my.cnf"
|
||||||
|
fi
|
||||||
# Check if this is a 'moved install directory'
|
# Check if this is a 'moved install directory'
|
||||||
elif test -f ./var/mysql/db.frm -a -f ./share/mysql/english/errmsg.sys -a \
|
elif test -f ./var/mysql/db.frm -a -f ./share/mysql/english/errmsg.sys -a \
|
||||||
-x ./libexec/mysqld
|
-x ./libexec/mysqld
|
||||||
|
@ -238,3 +238,20 @@ int ha_myisammrg::create(const char *name, register TABLE *form,
|
|||||||
DBUG_RETURN(myrg_create(fn_format(buff,name,"","",2+4+16),
|
DBUG_RETURN(myrg_create(fn_format(buff,name,"","",2+4+16),
|
||||||
(const char **) table_names, (my_bool) 0));
|
(const char **) table_names, (my_bool) 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ha_myisammrg::append_create_info(String *packet)
|
||||||
|
{
|
||||||
|
char buff[FN_REFLEN];
|
||||||
|
packet->append(" UNION=(",8);
|
||||||
|
MYRG_TABLE *table,*first;
|
||||||
|
|
||||||
|
for (first=table=file->open_tables ; table != file->end_table ; table++)
|
||||||
|
{
|
||||||
|
char *name=table->table->s->filename;
|
||||||
|
fn_format(buff,name,"","",3);
|
||||||
|
if (table != first)
|
||||||
|
packet->append(',');
|
||||||
|
packet->append(buff,(uint) strlen(buff));
|
||||||
|
}
|
||||||
|
packet->append(')');
|
||||||
|
}
|
||||||
|
@ -72,4 +72,5 @@ class ha_myisammrg: public handler
|
|||||||
int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info);
|
int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info);
|
||||||
THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
|
THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
|
||||||
enum thr_lock_type lock_type);
|
enum thr_lock_type lock_type);
|
||||||
|
void append_create_info(String *packet);
|
||||||
};
|
};
|
||||||
|
@ -59,6 +59,7 @@ int mysql_update(THD *thd,TABLE_LIST *table_list,List<Item> &fields,
|
|||||||
READ_RECORD info;
|
READ_RECORD info;
|
||||||
DBUG_ENTER("mysql_update");
|
DBUG_ENTER("mysql_update");
|
||||||
LINT_INIT(used_index);
|
LINT_INIT(used_index);
|
||||||
|
LINT_INIT(timestamp_query_id);
|
||||||
|
|
||||||
if (!(table = open_ltable(thd,table_list,lock_type)))
|
if (!(table = open_ltable(thd,table_list,lock_type)))
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user