summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorunknown <cps@outpost.site>2006-01-19 05:56:06 +0300
committerunknown <cps@outpost.site>2006-01-19 05:56:06 +0300
commit41536fcefe62a3997e8829fb3ccb0f4ff3316fb2 (patch)
tree7c4ed26ee5f9b700099b772510ed9aa085bad459 /scripts
parent471314df6a01f5f8e3f8054a8af4caac9aa0fb10 (diff)
downloadmariadb-git-41536fcefe62a3997e8829fb3ccb0f4ff3316fb2.tar.gz
WL1019: complete patch. Reapplied patch to the clean
tree to get rid of multiple typos in CS comments and unify the patch. configure.in: CSV is compiled in by default now include/my_base.h: add new ha_extra flag for the log tables mysql-test/include/im_check_os.inc: we should only run im tests if csv is on for now: im relies on mysqld options available only in csv build. mysql-test/include/system_db_struct.inc: check log tables structure mysql-test/lib/init_db.sql: create log tables when running tests. mysql-test/mysql-test-run.pl: Add old logs flag to IM tests. As IM could only deal with old logs (this feature is not needed with log tables) mysql-test/r/connect.result: update result mysql-test/r/csv.result: update result mysql-test/r/im_utils.result: update result mysql-test/r/information_schema.result: update result mysql-test/r/mysqlcheck.result: update result mysql-test/r/show_check.result: update result mysql-test/r/system_mysql_db.result: update result mysql-test/t/connect.test: disable test if CSV engine is not in: result depends on the presence of CSV-based log tables mysql-test/t/csv.test: add tests for concurrent insert (the functionality is added to CSV in this patch) mysql-test/t/information_schema.test: disable test if CSV engine is not in: result depends on the presence of CSV-based log tables mysql-test/t/mysqlcheck.test: disable test if CSV engine is not in: result depends on the presence of CSV-based log tables mysql-test/t/show_check.test: disable test if CSV engine is not in: result depends on the presence of CSV-based log tables mysql-test/t/system_mysql_db.test: disable test if CSV engine is not in: result depends on the presence of CSV-based log tables mysql-test/t/system_mysql_db_fix.test: disable test if CSV engine is not in: result depends on the presence of CSV-based log tables scripts/mysql_create_system_tables.sh: new system tables: slow_log and general_log scripts/mysql_fix_privilege_tables.sql: add new log tables: use an SP to create them for non-csv build to work fine. sql/ha_myisam.cc: move locking-related checks to the hanlder sql/ha_myisam.h: new function declared sql/handler.h: new virtual function is added: we should check for handler-related locking issues in the handler sql/lock.cc: from now on we check for handler-related locking issues in the handler itself rather then in lock.cc sql/log.cc: Add log tables support, refactoring: there are log event handlers with common interface. They are used by the LOGGER class, which is responsible for their initialization, cleanup and managment. Logging to the tables provided by one of the log event handler types. sql/log.h: declare new log classes sql/log_event.cc: convert old logging routines calls to use new API sql/mysql_priv.h: define common log routines and objects sql/mysqld.cc: Add support for the log tables. Their initalization, cleanup and specific options. sql/share/errmsg.txt: add new error messages for the log tables sql/slave.cc: convert old logging routines calls to use new API sql/sql_base.cc: TABLE objects used by the logger should be skipped during refreshes (as log tables are always opened and locked). fix table_is_used to skip them. This is needed for FLUSH LOGS to work sql/sql_db.cc: convert old logging routines calls to use new API sql/sql_delete.cc: fix TRUNCATE to work with log tables sql/sql_parse.cc: command_name is now an array of LEX_STRINGs sql/sql_prepare.cc: convert old logging routines calls to use new API sql/sql_show.cc: convert old logging routines calls to use new API sql/sql_table.cc: don't reoped the log tables for admin purposes sql/table.cc: mark log tables as such during the open sql/table.h: add log-related info storage/csv/ha_tina.cc: add support for concurrent insert (see bk commit - 5.1 tree (petr:1.1910) for standalone patch), add log tables-specific csv table handling. storage/csv/ha_tina.h: enable concurrent insert for CSV, add log table flag mysql-test/r/log_tables.result: New BitKeeper file ``mysql-test/r/log_tables.result'' mysql-test/t/log_tables.test: New BitKeeper file ``mysql-test/t/log_tables.test''
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mysql_create_system_tables.sh25
-rw-r--r--scripts/mysql_fix_privilege_tables.sql36
2 files changed, 61 insertions, 0 deletions
diff --git a/scripts/mysql_create_system_tables.sh b/scripts/mysql_create_system_tables.sh
index a90dfacabbd..eeb3e30e19a 100644
--- a/scripts/mysql_create_system_tables.sh
+++ b/scripts/mysql_create_system_tables.sh
@@ -42,6 +42,7 @@ i_ht=""
c_tzn="" c_tz="" c_tzt="" c_tztt="" c_tzls="" c_pl=""
i_tzn="" i_tz="" i_tzt="" i_tztt="" i_tzls="" i_pl=""
c_p="" c_pp=""
+c_gl="" c_sl=""
# Check for old tables
if test ! -f $mdata/db.frm
@@ -354,6 +355,7 @@ then
c_hr="$c_hr comment='keyword-topic relation';"
fi
+
if test ! -f $mdata/time_zone_name.frm
then
if test "$1" = "verbose" ; then
@@ -744,6 +746,27 @@ then
fi
+if test ! -f $mdata/general_log.frm
+then
+ if test "$1" = "verbose" ; then
+ echo "Preparing general_log table" 1>&2;
+ fi
+ c_gl="$c_gl CREATE PROCEDURE create_general_log_table() BEGIN DECLARE is_csv_enabled int DEFAULT 0; SELECT @@have_csv = 'YES' INTO is_csv_enabled; IF (is_csv_enabled) THEN CREATE TABLE general_log (event_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT, thread_id INTEGER, server_id INTEGER, command_type VARCHAR(64), argument MEDIUMTEXT) engine=CSV CHARACTER SET utf8 comment='General log'; END IF; END;
+CALL create_general_log_table();
+DROP PROCEDURE create_general_log_table;"
+fi
+
+
+if test ! -f $mdata/slow_log.frm
+then
+ if test "$1" = "verbose" ; then
+ echo "Preparing slow_log table" 1>&2;
+ fi
+ c_sl="$c_sl CREATE PROCEDURE create_slow_log_table() BEGIN DECLARE is_csv_enabled int DEFAULT 0; SELECT @@have_csv = 'YES' INTO is_csv_enabled; IF (is_csv_enabled) THEN CREATE TABLE slow_log (start_time TIMESTAMP NOT NULL, user_host MEDIUMTEXT NOT NULL, query_time TIME NOT NULL, lock_time TIME NOT NULL, rows_sent INTEGER NOT NULL, rows_examined INTEGER NOT NULL, db VARCHAR(512), last_insert_id INTEGER, insert_id INTEGER, server_id INTEGER, sql_text MEDIUMTEXT NOT NULL) engine=CSV CHARACTER SET utf8 comment='Slow log'; END IF; END;
+CALL create_slow_log_table();
+DROP PROCEDURE create_slow_log_table;"
+fi
+
if test ! -f $mdata/event.frm
then
c_ev="$c_ev CREATE TABLE event ("
@@ -812,6 +835,8 @@ $i_tzls
$c_p
$c_pp
+$c_gl
+$c_sl
$c_ev
CREATE DATABASE IF NOT EXISTS cluster_replication;
CREATE TABLE IF NOT EXISTS cluster_replication.binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM;
diff --git a/scripts/mysql_fix_privilege_tables.sql b/scripts/mysql_fix_privilege_tables.sql
index af995836c0c..d33339e4128 100644
--- a/scripts/mysql_fix_privilege_tables.sql
+++ b/scripts/mysql_fix_privilege_tables.sql
@@ -527,6 +527,42 @@ ALTER TABLE proc MODIFY db
MODIFY comment
char(64) collate utf8_bin DEFAULT '' NOT NULL;
+--
+-- Create missing log tables (5.1)
+--
+
+delimiter //
+CREATE PROCEDURE create_log_tables()
+BEGIN
+ DECLARE is_csv_enabled int DEFAULT 0;
+ SELECT @@have_csv = 'YES' INTO is_csv_enabled;
+ IF (is_csv_enabled) THEN
+ CREATE TABLE IF NOT EXISTS general_log (
+ event_time TIMESTAMP NOT NULL,
+ user_host MEDIUMTEXT,
+ thread_id INTEGER,
+ server_id INTEGER,
+ command_type VARCHAR(64),
+ argument MEDIUMTEXT
+ ) engine=CSV CHARACTER SET utf8 comment='General log';
+ CREATE TABLE IF NOT EXISTS slow_log (
+ start_time TIMESTAMP NOT NULL,
+ user_host MEDIUMTEXT NOT NULL,
+ query_time TIME NOT NULL,
+ lock_time TIME NOT NULL,
+ rows_sent INTEGER NOT NULL,
+ rows_examined INTEGER NOT NULL,
+ db VARCHAR(512),
+ last_insert_id INTEGER,
+ insert_id INTEGER,
+ server_id INTEGER,
+ sql_text MEDIUMTEXT NOT NULL
+ ) engine=CSV CHARACTER SET utf8 comment='Slow log';
+ END IF;
+END//
+delimiter ;
+CALL create_log_tables();
+DROP PROCEDURE create_log_tables;
#
# EVENT table
#