mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
merged
This commit is contained in:
@ -1262,16 +1262,10 @@ EOF
|
||||
#
|
||||
echo -n "making sure specific build files are writable... "
|
||||
for file in \
|
||||
Docs/include.texi \
|
||||
Docs/mysql.info \
|
||||
Docs/manual.txt \
|
||||
Docs/manual_toc.html \
|
||||
Docs/manual.html \
|
||||
Docs/INSTALL-BINARY \
|
||||
INSTALL-SOURCE \
|
||||
COPYING \
|
||||
COPYING.LIB \
|
||||
MIRRORS
|
||||
COPYING
|
||||
do
|
||||
if test -e $file; then
|
||||
chmod +w $file
|
||||
|
@ -285,13 +285,6 @@ C_MODE_START int __cxa_pure_virtual() {\
|
||||
#include <alloca.h>
|
||||
#endif
|
||||
#ifdef HAVE_ATOMIC_ADD
|
||||
#define __SMP__
|
||||
#ifdef HAVE_LINUX_CONFIG_H
|
||||
#include <linux/config.h> /* May define CONFIG_SMP */
|
||||
#endif
|
||||
#ifndef CONFIG_SMP
|
||||
#define CONFIG_SMP
|
||||
#endif
|
||||
#if defined(__ia64__)
|
||||
#define new my_arg_new
|
||||
#define need_to_restore_new 1
|
||||
|
@ -460,3 +460,17 @@ insert into t2 values ();
|
||||
select * from t1;
|
||||
select * from t2;
|
||||
drop table t1,t2;
|
||||
#
|
||||
# Bug#10224 - ANALYZE TABLE crashing with simultaneous
|
||||
# CREATE ... SELECT statement.
|
||||
# This tests two additional possible errors and a hang if
|
||||
# an improper fix is present.
|
||||
#
|
||||
create table t1 (a int);
|
||||
--error 1093
|
||||
create table t1 select * from t1;
|
||||
--error 1093
|
||||
create table t2 union = (t1) select * from t1;
|
||||
flush tables with read lock;
|
||||
unlock tables;
|
||||
drop table t1;
|
||||
|
@ -76,9 +76,6 @@ if [ $BASE_SYSTEM != "netware" ] ; then
|
||||
fi
|
||||
|
||||
for i in ChangeLog \
|
||||
Docs/manual.html \
|
||||
Docs/manual.txt \
|
||||
Docs/manual_toc.html \
|
||||
Docs/mysql.info
|
||||
do
|
||||
if [ -f $i ]
|
||||
|
69
sql/lock.cc
69
sql/lock.cc
@ -82,8 +82,24 @@ static int unlock_external(THD *thd, TABLE **table,uint count);
|
||||
static void print_lock_error(int error);
|
||||
|
||||
|
||||
MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count,
|
||||
bool ignore_global_read_lock)
|
||||
/*
|
||||
Lock tables.
|
||||
|
||||
SYNOPSIS
|
||||
mysql_lock_tables()
|
||||
thd The current thread.
|
||||
tables An array of pointers to the tables to lock.
|
||||
count The number of tables to lock.
|
||||
flags Options:
|
||||
MYSQL_LOCK_IGNORE_GLOBAL_READ_LOCK Ignore a global read lock
|
||||
MYSQL_LOCK_IGNORE_FLUSH Ignore a flush tables.
|
||||
|
||||
RETURN
|
||||
A lock structure pointer on success.
|
||||
NULL on error.
|
||||
*/
|
||||
|
||||
MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count, uint flags)
|
||||
{
|
||||
MYSQL_LOCK *sql_lock;
|
||||
TABLE *write_lock_used;
|
||||
@ -94,7 +110,8 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count,
|
||||
if (!(sql_lock = get_lock_data(thd,tables,count, 0,&write_lock_used)))
|
||||
break;
|
||||
|
||||
if (global_read_lock && write_lock_used && ! ignore_global_read_lock)
|
||||
if (global_read_lock && write_lock_used &&
|
||||
! (flags & MYSQL_LOCK_IGNORE_GLOBAL_READ_LOCK))
|
||||
{
|
||||
/*
|
||||
Someone has issued LOCK ALL TABLES FOR READ and we want a write lock
|
||||
@ -128,7 +145,7 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count,
|
||||
thd->some_tables_deleted=1; // Try again
|
||||
sql_lock->lock_count=0; // Locks are alread freed
|
||||
}
|
||||
else if (!thd->some_tables_deleted)
|
||||
else if (!thd->some_tables_deleted || (flags & MYSQL_LOCK_IGNORE_FLUSH))
|
||||
{
|
||||
thd->locked=0;
|
||||
break;
|
||||
@ -914,47 +931,3 @@ void make_global_read_lock_block_commit(THD *thd)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Set protection against global read lock.
|
||||
|
||||
SYNOPSIS
|
||||
set_protect_against_global_read_lock()
|
||||
void
|
||||
|
||||
RETURN
|
||||
FALSE OK, no global read lock exists.
|
||||
TRUE Error, global read lock exists already.
|
||||
*/
|
||||
|
||||
my_bool set_protect_against_global_read_lock(void)
|
||||
{
|
||||
my_bool global_read_lock_exists;
|
||||
|
||||
pthread_mutex_lock(&LOCK_open);
|
||||
if (! (global_read_lock_exists= test(global_read_lock)))
|
||||
protect_against_global_read_lock++;
|
||||
pthread_mutex_unlock(&LOCK_open);
|
||||
return global_read_lock_exists;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Unset protection against global read lock.
|
||||
|
||||
SYNOPSIS
|
||||
unset_protect_against_global_read_lock()
|
||||
void
|
||||
|
||||
RETURN
|
||||
void
|
||||
*/
|
||||
|
||||
void unset_protect_against_global_read_lock(void)
|
||||
{
|
||||
pthread_mutex_lock(&LOCK_open);
|
||||
protect_against_global_read_lock--;
|
||||
pthread_mutex_unlock(&LOCK_open);
|
||||
pthread_cond_broadcast(&COND_refresh);
|
||||
}
|
||||
|
||||
|
||||
|
@ -978,8 +978,11 @@ extern pthread_t signal_thread;
|
||||
extern struct st_VioSSLAcceptorFd * ssl_acceptor_fd;
|
||||
#endif /* HAVE_OPENSSL */
|
||||
|
||||
MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **table, uint count,
|
||||
bool ignore_global_read_lock= FALSE);
|
||||
MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **table, uint count, uint flags);
|
||||
/* mysql_lock_tables() flags bits */
|
||||
#define MYSQL_LOCK_IGNORE_GLOBAL_READ_LOCK 0x0001
|
||||
#define MYSQL_LOCK_IGNORE_FLUSH 0x0002
|
||||
|
||||
void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock);
|
||||
void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock);
|
||||
void mysql_unlock_some_tables(THD *thd, TABLE **table,uint count);
|
||||
|
@ -184,7 +184,7 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables)
|
||||
ptr[0]= tables[0].table;
|
||||
ptr[1]= tables[1].table;
|
||||
ptr[2]= tables[2].table;
|
||||
if (!(lock=mysql_lock_tables(thd,ptr,3)))
|
||||
if (! (lock= mysql_lock_tables(thd, ptr, 3, 0)))
|
||||
{
|
||||
sql_print_error("Fatal error: Can't lock privilege tables: %s",
|
||||
thd->net.last_error);
|
||||
@ -2658,7 +2658,7 @@ my_bool grant_init(THD *org_thd)
|
||||
TABLE *ptr[2]; // Lock tables for quick update
|
||||
ptr[0]= tables[0].table;
|
||||
ptr[1]= tables[1].table;
|
||||
if (!(lock=mysql_lock_tables(thd,ptr,2)))
|
||||
if (! (lock= mysql_lock_tables(thd, ptr, 2, 0)))
|
||||
goto end;
|
||||
|
||||
t_table = tables[0].table; c_table = tables[1].table;
|
||||
|
@ -1163,7 +1163,7 @@ bool reopen_tables(THD *thd,bool get_locks,bool in_refresh)
|
||||
MYSQL_LOCK *lock;
|
||||
/* We should always get these locks */
|
||||
thd->some_tables_deleted=0;
|
||||
if ((lock=mysql_lock_tables(thd,tables,(uint) (tables_ptr-tables))))
|
||||
if ((lock= mysql_lock_tables(thd, tables, (uint) (tables_ptr-tables), 0)))
|
||||
{
|
||||
thd->locked_tables=mysql_lock_merge(thd->locked_tables,lock);
|
||||
}
|
||||
@ -1644,7 +1644,7 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type)
|
||||
{
|
||||
DBUG_ASSERT(thd->lock == 0); // You must lock everything at once
|
||||
if ((table->reginfo.lock_type= lock_type) != TL_UNLOCK)
|
||||
if (!(thd->lock=mysql_lock_tables(thd,&table_list->table,1)))
|
||||
if (! (thd->lock= mysql_lock_tables(thd, &table_list->table, 1, 0)))
|
||||
table= 0;
|
||||
}
|
||||
}
|
||||
@ -1794,7 +1794,7 @@ int lock_tables(THD *thd, TABLE_LIST *tables, uint count)
|
||||
if (!table->derived)
|
||||
*(ptr++)= table->table;
|
||||
}
|
||||
if (!(thd->lock=mysql_lock_tables(thd,start, (uint) (ptr - start))))
|
||||
if (!(thd->lock=mysql_lock_tables(thd,start, (uint) (ptr - start), 0)))
|
||||
return -1; /* purecov: inspected */
|
||||
}
|
||||
else
|
||||
|
@ -454,7 +454,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
|
||||
protocol->send_fields(&list,1);
|
||||
|
||||
HANDLER_TABLES_HACK(thd);
|
||||
lock= mysql_lock_tables(thd, &tables->table, 1);
|
||||
lock= mysql_lock_tables(thd, &tables->table, 1, 0);
|
||||
HANDLER_TABLES_HACK(thd);
|
||||
|
||||
if (!lock)
|
||||
|
@ -882,10 +882,13 @@ static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list)
|
||||
Avoid that a global read lock steps in while we are creating the
|
||||
new thread. It would block trying to open the table. Hence, the
|
||||
DI thread and this thread would wait until after the global
|
||||
readlock is gone. If the read lock exists already, we leave with
|
||||
no table and then switch to non-delayed insert.
|
||||
readlock is gone. Since the insert thread needs to wait for a
|
||||
global read lock anyway, we do it right now. Note that
|
||||
wait_if_global_read_lock() sets a protection against a new
|
||||
global read lock when it succeeds. This needs to be released by
|
||||
start_waiting_global_read_lock().
|
||||
*/
|
||||
if (set_protect_against_global_read_lock())
|
||||
if (wait_if_global_read_lock(thd, 0, 1))
|
||||
goto err;
|
||||
if (!(tmp=new delayed_insert()))
|
||||
{
|
||||
@ -927,7 +930,11 @@ static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list)
|
||||
pthread_cond_wait(&tmp->cond_client,&tmp->mutex);
|
||||
}
|
||||
pthread_mutex_unlock(&tmp->mutex);
|
||||
unset_protect_against_global_read_lock();
|
||||
/*
|
||||
Release the protection against the global read lock and wake
|
||||
everyone, who might want to set a global read lock.
|
||||
*/
|
||||
start_waiting_global_read_lock(thd);
|
||||
thd->proc_info="got old table";
|
||||
if (tmp->thd.killed)
|
||||
{
|
||||
@ -963,7 +970,11 @@ static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list)
|
||||
|
||||
err1:
|
||||
thd->fatal_error();
|
||||
unset_protect_against_global_read_lock();
|
||||
/*
|
||||
Release the protection against the global read lock and wake
|
||||
everyone, who might want to set a global read lock.
|
||||
*/
|
||||
start_waiting_global_read_lock(thd);
|
||||
err:
|
||||
pthread_mutex_unlock(&LOCK_delayed_create);
|
||||
DBUG_RETURN(0); // Continue with normal insert
|
||||
@ -1319,7 +1330,8 @@ extern "C" pthread_handler_decl(handle_delayed_insert,arg)
|
||||
handler will close the table and finish when the outstanding
|
||||
inserts are done.
|
||||
*/
|
||||
if (! (thd->lock= mysql_lock_tables(thd, &di->table, 1, TRUE)))
|
||||
if (! (thd->lock= mysql_lock_tables(thd, &di->table, 1,
|
||||
MYSQL_LOCK_IGNORE_GLOBAL_READ_LOCK)))
|
||||
{
|
||||
di->dead= 1; // Some fatal error
|
||||
thd->killed= 1;
|
||||
|
@ -2430,6 +2430,24 @@ mysql_execute_command(THD *thd)
|
||||
goto unsent_create_error;
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
The create-select command will open and read-lock the select table
|
||||
and then create, open and write-lock the new table. If a global
|
||||
read lock steps in, we get a deadlock. The write lock waits for
|
||||
the global read lock, while the global read lock waits for the
|
||||
select table to be closed. So we wait until the global readlock is
|
||||
gone before starting both steps. Note that
|
||||
wait_if_global_read_lock() sets a protection against a new global
|
||||
read lock when it succeeds. This needs to be released by
|
||||
start_waiting_global_read_lock(). We protect the normal CREATE
|
||||
TABLE in the same way. That way we avoid that a new table is
|
||||
created during a gobal read lock.
|
||||
*/
|
||||
if (wait_if_global_read_lock(thd, 0, 1))
|
||||
{
|
||||
res= -1;
|
||||
break;
|
||||
}
|
||||
/*
|
||||
If we are using SET CHARSET without DEFAULT, add an implicite
|
||||
DEFAULT to not confuse old users. (This may change).
|
||||
@ -2493,13 +2511,16 @@ mysql_execute_command(THD *thd)
|
||||
if (!res)
|
||||
send_ok(thd);
|
||||
}
|
||||
|
||||
// put tables back for PS rexecuting
|
||||
tables= lex->link_first_table_back(tables, create_table,
|
||||
create_table_local);
|
||||
/*
|
||||
Release the protection against the global read lock and wake
|
||||
everyone, who might want to set a global read lock.
|
||||
*/
|
||||
start_waiting_global_read_lock(thd);
|
||||
break;
|
||||
|
||||
res= 1; //error reported
|
||||
unsent_create_error:
|
||||
// put tables back for PS rexecuting
|
||||
tables= lex->link_first_table_back(tables, create_table,
|
||||
|
@ -81,7 +81,7 @@ static int send_file(THD *thd)
|
||||
char fname[FN_REFLEN+1];
|
||||
const char *errmsg = 0;
|
||||
int old_timeout;
|
||||
uint packet_len;
|
||||
unsigned long packet_len;
|
||||
char buf[IO_SIZE]; // It's safe to alloc this
|
||||
DBUG_ENTER("send_file");
|
||||
|
||||
|
@ -1536,7 +1536,7 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
|
||||
if (!table)
|
||||
DBUG_RETURN(0);
|
||||
table->reginfo.lock_type=TL_WRITE;
|
||||
if (!((*lock)=mysql_lock_tables(thd,&table,1)))
|
||||
if (! ((*lock)= mysql_lock_tables(thd, &table, 1, MYSQL_LOCK_IGNORE_FLUSH)))
|
||||
{
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
hash_delete(&open_cache,(byte*) table);
|
||||
|
@ -1,263 +0,0 @@
|
||||
%define mysql_version @VERSION@
|
||||
%define shared_lib_version @SHARED_LIB_VERSION@
|
||||
%define release 2
|
||||
%define mysqld_user mysql
|
||||
|
||||
%define see_base For a description of MySQL see the base MySQL RPM or http://www.mysql.com
|
||||
|
||||
Name: MySQL
|
||||
Summary: MySQL: a very fast and reliable SQL database engine
|
||||
Group: Applications/Databases
|
||||
Summary(pt_BR): MySQL: Um servidor SQL r<>pido e confi<66>vel.
|
||||
Group(pt_BR): Aplica<63><61>es/Banco_de_Dados
|
||||
Version: @MYSQL_NO_DASH_VERSION@
|
||||
Release: %{release}
|
||||
Copyright: GPL / LGPL
|
||||
Source: http://www.mysql.com/Downloads/MySQL-@MYSQL_BASE_VERSION@/mysql-%{mysql_version}.tar.gz
|
||||
Icon: mysql.gif
|
||||
URL: http://www.mysql.com/
|
||||
Packager: David Axmark <david@mysql.com>, Monty <monty@mysql.com>
|
||||
Provides: msqlormysql MySQL-server
|
||||
Obsoletes: mysql
|
||||
|
||||
# Think about what you use here since the first step is to
|
||||
# run a rm -rf
|
||||
BuildRoot: /var/tmp/mysql-max
|
||||
|
||||
# From the manual
|
||||
%description
|
||||
MySQL is a true multi-user, multi-threaded SQL (Structured Query
|
||||
Language) database server. MySQL is a client/server implementation
|
||||
that consists of a server daemon (mysqld) and many different client
|
||||
programs/libraries.
|
||||
|
||||
The main goals of MySQL are speed, robustness and ease of use. MySQL
|
||||
was originally developed because we needed a SQL server that could
|
||||
handle very big databases with magnitude higher speed than what any
|
||||
database vendor could offer to us. And since we did not need all the
|
||||
features that made their server slow we made our own. We have now been
|
||||
using MySQL since 1996 in a environment with more than 40 databases,
|
||||
10,000 tables, of which more than 500 have more than 7 million
|
||||
rows. This is about 200G of data.
|
||||
|
||||
The base upon which MySQL is built is a set of routines that have been
|
||||
used in a highly demanding production environment for many
|
||||
years. While MySQL is still in development, it already offers a rich
|
||||
and highly useful function set.
|
||||
|
||||
The MySQL-max version differs from the normal MySQL server distribution
|
||||
in that the BDB and Innobase table handlers are enabled by default.
|
||||
You can use any normal MySQL client with the MySQL-max server.
|
||||
|
||||
See the documentation for more information.
|
||||
|
||||
%description -l pt_BR
|
||||
O MySQL <20> um servidor de banco de dados SQL realmente multiusu<73>rio e\
|
||||
multi-tarefa. A linguagem SQL <20> a mais popular linguagem para banco de\
|
||||
dados no mundo. O MySQL <20> uma implementa<74><61>o cliente/servidor que\
|
||||
consiste de um servidor chamado mysqld e diversos\
|
||||
programas/bibliotecas clientes. Os principais objetivos do MySQL s<>o:\
|
||||
velocidade, robustez e facilidade de uso. O MySQL foi originalmente\
|
||||
desenvolvido porque n<>s na Tcx precis<69>vamos de um servidor SQL que\
|
||||
pudesse lidar com grandes bases de dados e com uma velocidade muito\
|
||||
maior do que a que qualquer vendedor podia nos oferecer. Estamos\
|
||||
usando\
|
||||
o MySQL desde 1996 em um ambiente com mais de 40 bases de dados com 10.000\
|
||||
tabelas, das quais mais de 500 t<>m mais de 7 milh<6C>es de linhas. Isto <20> o\
|
||||
equivalente a aproximadamente 50G de dados cr<63>ticos. A base da constru<72><75>o do\
|
||||
MySQL <20> uma s<>rie de rotinas que foram usadas em um ambiente de produ<64><75>o com\
|
||||
alta demanda por muitos anos. Mesmo o MySQL estando ainda em desenvolvimento,\
|
||||
ele j<> oferece um conjunto de fun<75><6E>es muito ricas e <20>teis. Veja a documenta<74><61>o\
|
||||
para maiores informa<6D><61>es.
|
||||
|
||||
%prep
|
||||
%setup -n mysql-max-%{mysql_version}
|
||||
# %setup -T -D -a 1 -n mysql-max-%{mysql_version}
|
||||
|
||||
%build
|
||||
# The all-static flag is to make the RPM work on different
|
||||
# distributions. This version tries to put shared mysqlclient libraries
|
||||
# in a separate package.
|
||||
|
||||
BuildMySQL() {
|
||||
# The --enable-assembler simply does nothing on systems that does not
|
||||
# support assembler speedups.
|
||||
sh -c "PATH=\"${MYSQL_BUILD_PATH:-/bin:/usr/bin}\" \
|
||||
CC=\"${MYSQL_BUILD_CC:-egcs}\" \
|
||||
CFLAGS=\"${MYSQL_BUILD_CFLAGS:- -O6 -fno-omit-frame-pointer}\" \
|
||||
CXX=\"${MYSQL_BUILD_CXX:-egcs}\" \
|
||||
CXXFLAGS=\"${MYSQL_BUILD_CXXFLAGS:- -O6 \
|
||||
-felide-constructors -fno-exceptions -fno-rtti \
|
||||
-fno-omit-frame-pointer}\" \
|
||||
./configure \
|
||||
$* \
|
||||
--enable-assembler \
|
||||
--with-mysqld-user=%{mysqld_user} \
|
||||
--with-unix-socket-path=/var/lib/mysql/mysql.sock \
|
||||
--prefix=/ \
|
||||
--with-extra-charsets=complex \
|
||||
--exec-prefix=/usr \
|
||||
--libexecdir=/usr/sbin \
|
||||
--sysconfdir=/etc \
|
||||
--datadir=/usr/share \
|
||||
--localstatedir=/var/lib/mysql \
|
||||
--infodir=/usr/info \
|
||||
--includedir=/usr/include \
|
||||
--mandir=/usr/man \
|
||||
--with-berkeley-db \
|
||||
--with-innodb \
|
||||
--with-comment=\"Official MySQL-Max RPM\";
|
||||
# Add this for more debugging support
|
||||
# --with-debug
|
||||
# Add this for MyISAM RAID support:
|
||||
# --with-raid
|
||||
"
|
||||
make
|
||||
}
|
||||
|
||||
# Use the build root for temporary storage of the shared libraries.
|
||||
|
||||
RBR=$RPM_BUILD_ROOT
|
||||
MBD=$RPM_BUILD_DIR/mysql-max-%{mysql_version}
|
||||
if test -z "$RBR" -o "$RBR" = "/"
|
||||
then
|
||||
echo "RPM_BUILD_ROOT has stupid value"
|
||||
exit 1
|
||||
fi
|
||||
rm -rf $RBR
|
||||
mkdir -p $RBR
|
||||
|
||||
#cd $MBD/db-%{db_version}/dist
|
||||
#./configure --prefix=$RBR/usr/BDB
|
||||
#make install
|
||||
#
|
||||
#echo $RBR $MBD
|
||||
#cd $MBD
|
||||
|
||||
BuildMySQL "--disable-shared" \
|
||||
"--with-mysqld-ldflags='-all-static'" \
|
||||
"--with-client-ldflags='-all-static'"
|
||||
|
||||
%install -n mysql-max-%{mysql_version}
|
||||
RBR=$RPM_BUILD_ROOT
|
||||
MBD=$RPM_BUILD_DIR/mysql-max-%{mysql_version}
|
||||
# Ensure that needed directories exists
|
||||
install -d $RBR/etc/{logrotate.d,rc.d/init.d}
|
||||
install -d $RBR/var/lib/mysql/mysql
|
||||
install -d $RBR/usr/share/sql-bench
|
||||
install -d $RBR/usr/share/mysql-test
|
||||
install -d $RBR/usr/{sbin,share,man,include}
|
||||
install -d $RBR/usr/doc/MySQL-%{mysql_version}
|
||||
install -d $RBR/usr/lib
|
||||
# Make install
|
||||
make install DESTDIR=$RBR benchdir_root=/usr/share/
|
||||
|
||||
# Install logrotate and autostart
|
||||
install -m644 $MBD/support-files/mysql-log-rotate $RBR/etc/logrotate.d/mysql
|
||||
install -m755 $MBD/support-files/mysql.server $RBR/etc/rc.d/init.d/mysql
|
||||
|
||||
# Install docs
|
||||
install -m644 $RPM_BUILD_DIR/mysql-max-%{mysql_version}/Docs/mysql.info \
|
||||
$RBR/usr/info/mysql.info
|
||||
for file in README COPYING COPYING.LIB Docs/manual_toc.html Docs/manual.html \
|
||||
Docs/manual.txt Docs/manual.texi Docs/manual.ps \
|
||||
support-files/my-huge.cnf support-files/my-large.cnf \
|
||||
support-files/my-medium.cnf support-files/my-small.cnf
|
||||
do
|
||||
b=`basename $file`
|
||||
install -m644 $MBD/$file $RBR/usr/doc/MySQL-%{mysql_version}/$b
|
||||
done
|
||||
|
||||
%pre
|
||||
if test -x /etc/rc.d/init.d/mysql
|
||||
then
|
||||
/etc/rc.d/init.d/mysql stop > /dev/null 2>&1
|
||||
echo "Giving mysqld a couple of seconds to exit nicely"
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
%post
|
||||
mysql_datadir=/var/lib/mysql
|
||||
|
||||
# Create data directory if needed
|
||||
if test ! -d $mysql_datadir; then mkdir $mysql_datadir; fi
|
||||
if test ! -d $mysql_datadir/mysql; then mkdir $mysql_datadir/mysql; fi
|
||||
if test ! -d $mysql_datadir/test; then mkdir $mysql_datadir/test; fi
|
||||
|
||||
# Make MySQL start/shutdown automatically when the machine does it.
|
||||
/sbin/chkconfig --add mysql
|
||||
|
||||
# Create a MySQL user. Do not report any problems if it already
|
||||
# exists. This is redhat specific and should be handled more portable
|
||||
useradd -M -r -d $mysql_datadir -s /bin/bash -c "MySQL server" mysql 2> /dev/null || true
|
||||
|
||||
# Change permissions so that the user that will run the MySQL daemon
|
||||
# owns all database files.
|
||||
chown -R mysql $mysql_datadir
|
||||
|
||||
# Initiate databases
|
||||
mysql_install_db -IN-RPM
|
||||
|
||||
# Change permissions again to fix any new files.
|
||||
chown -R mysql $mysql_datadir
|
||||
|
||||
# Fix permissions for the permission database so that only the user
|
||||
# can read them.
|
||||
chmod -R og-rw $mysql_datadir/mysql
|
||||
|
||||
# Restart in the same way that mysqld will be started normally.
|
||||
/etc/rc.d/init.d/mysql start
|
||||
|
||||
# Allow mysqld_safe to start mysqld and print a message before we exit
|
||||
sleep 2
|
||||
|
||||
%preun
|
||||
if test -x /etc/rc.d/init.d/mysql
|
||||
then
|
||||
/etc/rc.d/init.d/mysql stop > /dev/null
|
||||
fi
|
||||
# Remove autostart of mysql
|
||||
if test $1 = 0
|
||||
then
|
||||
/sbin/chkconfig --del mysql
|
||||
fi
|
||||
# We do not remove the mysql user since it may still own a lot of
|
||||
# database files.
|
||||
|
||||
%files
|
||||
%attr(-, root, root) %doc /usr/doc/MySQL-%{mysql_version}/
|
||||
|
||||
%attr(755, root, root) /usr/bin/isamchk
|
||||
%attr(755, root, root) /usr/bin/isamlog
|
||||
%attr(755, root, root) /usr/bin/pack_isam
|
||||
%attr(755, root, root) /usr/bin/myisamchk
|
||||
%attr(755, root, root) /usr/bin/myisamlog
|
||||
%attr(755, root, root) /usr/bin/myisampack
|
||||
%attr(755, root, root) /usr/bin/mysql_fix_privilege_tables
|
||||
%attr(755, root, root) /usr/bin/mysql_convert_table_format
|
||||
%attr(755, root, root) /usr/bin/mysql_install_db
|
||||
%attr(755, root, root) /usr/bin/mysql_setpermission
|
||||
%attr(755, root, root) /usr/bin/mysql_zap
|
||||
%attr(755, root, root) /usr/bin/mysqlbug
|
||||
%attr(755, root, root) /usr/bin/mysqltest
|
||||
%attr(755, root, root) /usr/bin/mysqlhotcopy
|
||||
%attr(755, root, root) /usr/bin/perror
|
||||
%attr(755, root, root) /usr/bin/replace
|
||||
%attr(755, root, root) /usr/bin/resolveip
|
||||
%attr(755, root, root) /usr/bin/mysqld_safe
|
||||
%attr(755, root, root) /usr/bin/mysqld_multi
|
||||
%attr(755, root, root) /usr/bin/my_print_defaults
|
||||
|
||||
%attr(644, root, root) /usr/info/mysql.info*
|
||||
|
||||
%attr(755, root, root) /usr/sbin/mysqld
|
||||
|
||||
%attr(644, root, root) /etc/logrotate.d/mysql
|
||||
%attr(755, root, root) /etc/rc.d/init.d/mysql
|
||||
|
||||
%attr(755, root, root) /usr/share/mysql/
|
||||
|
||||
%changelog
|
||||
|
||||
* Fri Apr 13 2001 Monty
|
||||
First version of mysql-max.spec.sh based on mysql.spec.sh
|
Reference in New Issue
Block a user