Commit graph

48 commits

Author SHA1 Message Date
Dmitry Shulga
8f237f5874 A fix and a test case for Bug#47924 -main.log_tables times out
sporadically.

The cause of the sporadic time out was a leaking protection
against the global read lock, taken by the RENAME statement,
and not released in case of an error occurred during RENAME.
The leaking protection counter would lead to the value of
protect_against_global_read never dropping to 0.
Consequently FLUSH TABLES in all connections, including the
one that leaked the protection, could not proceed.
 
The fix is to ensure that all branchesin RENAME code properly
release GRL protection.

mysql-test/r/log_tables.result:
  Added results for test for bug#47924.
mysql-test/t/log_tables.test:
  Added test for bug#47924.
sql/sql_rename.cc:
  mysql_rename_tables() modified: replaced return from function
  to goto to clean up code block in case of error.
2010-11-07 23:42:54 +06:00
Davi Arnaut
402bc523b2 Bug#36540: CREATE EVENT and ALTER EVENT statements fail with large server_id
The problem is that creating a event could fail if the value of
the variable server_id didn't fit in the originator column of
the event system table. The cause is two-fold: it was possible
to set server_id to a value outside the documented range (from
0 to 2^32-1) and the originator column of the event table didn't
have enough room for values in this range.

The log tables (general_log and slow_log) also don't have a proper
column type to store the server_id and having a large server_id
value could prevent queries from being logged.

The solution is to ensure that all system tables that store the
server_id value have a proper column type (int unsigned) and that
the variable can't be set to a value that is not within the range.

mysql-test/r/events_bugs.result:
  Add test case result for Bug#36540
mysql-test/r/log_tables.result:
  Update column type.
mysql-test/r/system_mysql_db.result:
  Update column type.
mysql-test/r/variables.result:
  Add test case result for server_id value range.
mysql-test/suite/sys_vars/r/server_id_basic_64.result:
  Update test case results.
mysql-test/t/events_bugs.test:
  Add test case for Bug#36540
mysql-test/t/log_tables.test:
  Fix column type.
mysql-test/t/variables.test:
  Add test case for server_id value range.
scripts/mysql_system_tables.sql:
  Columns that store the server_id value must be of type INT UNSIGNED,
  fix event (originator), general_log and slow_log (server_id) tables
  in accordance.
scripts/mysql_system_tables_fix.sql:
  Columns that store the server_id value must be of type INT UNSIGNED,
  fix event (originator), general_log and slow_log (server_id) tables
  in accordance.
sql/mysqld.cc:
  Set min and max values for the server_id variable.
  Unfortunately we can't easily change server_id variable type
  from ulong to uint32 because of the sys_var classes.
2009-03-11 17:30:56 -03:00
Sven Sandberg
ca59e88ce3 BUG#38350: Many tests don't clean up after themselves on exit.
Problem: Many test cases don't clean up after themselves (fail
to drop tables or fail to reset variables). This implies that:
(1) check-testcase in the new mtr that currently lives in
5.1-rpl failed. (2) it may cause unexpected results in
subsequent tests.
Fix: make all tests clean up.
Also: cleaned away unnecessary output in rpl_packet.result
Also: fixed bug where rpl_log called RESET MASTER with a running
slave. This is not supposed to work.
Also: removed unnecessary code from rpl_stm_EE_err2 and made it
verify that an error occurred.
Also: removed unnecessary code from rpl_ndb_ctype_ucs2_def.


mysql-test/extra/rpl_tests/rpl_loaddata.test:
  Made test clean up after itself.
mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test:
  Made test clean up after itself.
  Also removed unnecessary save_master_pos.
  Also made test verify that an error occurred.
mysql-test/extra/rpl_tests/rpl_truncate_helper.test:
  Made test clean up after itself.
mysql-test/include/query_cache.inc:
  Made test clean up after itself.
mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test:
  Made test clean up after itself.
mysql-test/suite/rpl/t/rpl_alter_db.test:
  Made test clean up after itself.
  Easiest to refactor the test a little, to use an auxiliary database instead of mysql:
  Then we don't need to read the collation at the start of the test and reset it at the
  end of the test. We can just drop the database.
mysql-test/suite/rpl/t/rpl_drop_db.test:
  Made test clean up after itself.
mysql-test/suite/rpl/t/rpl_drop_view.test:
  Made test clean up after itself.
mysql-test/suite/rpl/t/rpl_events.test:
  Made test clean up after itself.
mysql-test/suite/rpl/t/rpl_idempotency.test:
  Made test clean up after itself.
mysql-test/suite/rpl/t/rpl_ignore_table.test:
  Made test clean up after itself.
  The existing cleanup code didn't work, because the --replicate-*
  options prevented the "drop table" from being replicated. Moved
  "drop table t4" to a statement of its own.
mysql-test/suite/rpl/t/rpl_packet.test:
  Made test clean up after itself.
  Also replaced SHOW SLAVE STATUS by query_get_value(SHOW SLAVE STATUS...),
  since only one column of the result was interesting.
mysql-test/suite/rpl/t/rpl_row_max_relay_size.test:
  Made test clean up after itself.
  Instead of setting binlog format at the beginning of the test, we just
  do 'source include/have_binlog_format_row.inc' like all other tests.
mysql-test/suite/rpl_ndb/t/rpl_ndb_2other.test:
  Made test clean up after itself.
mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test:
  Made test clean up after itself.
  Also removed unnecessary 'create table; drop table'
  Also removed unnecessary use of --command
mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test:
  Made test clean up after itself.
mysql-test/t/innodb-autoinc-optimize.test:
  Made test clean up after itself.
mysql-test/t/innodb.test:
  Made test clean up after itself.
mysql-test/t/log_tables.test:
  Made test clean up after itself.
mysql-test/t/mysql_client_test.test:
  Made test clean up after itself.
mysql-test/t/partition.test:
  Made test clean up after itself.
mysql-test/t/status.test:
  Made test clean up after itself.
2008-11-13 20:19:00 +01:00
Andrei Elkin
ca2d184695 merging 5.1 -> 5.1 rpl. 3 of 4 conflicts are resolved similarly to 6.0->6.0-rpl merging.
mysql_upgrade results changed due to the error messesge of mysqlcheck has changed.
2008-11-12 19:51:47 +02:00
Mats Kindahl
32c161f3ea Merging 5.1 main into 5.1-rpl 2008-10-23 21:27:09 +02:00
Patrick Crews
b3e948e54f Bug#37798 main.log_tables fails randomly on powermacg5 and windows
Fixed .test file, re-recorded .result file

Ensured reset of system variables at the end of subtests.
2008-10-20 18:41:19 -04:00
Davi Arnaut
0406d409ea Bug#34306: Can't make copy of log tables when server binary log is enabled
The problem is that when statement-based replication was enabled,
statements such as INSERT INTO .. SELECT FROM .. and CREATE TABLE
.. SELECT FROM need to grab a read lock on the source table that
does not permit concurrent inserts, which would in turn be denied
if the source table is a log table because log tables can't be
locked exclusively.

The solution is to not take such a lock when the source table is
a log table as it is unsafe to replicate log tables under statement
based replication. Furthermore, the read lock that does not permits
concurrent inserts is now only taken if statement-based replication
is enabled and if the source table is not a log table.

include/thr_lock.h:
  Introduce yet another lock type that my get upgraded depending
  on the binary log format. This is not a optimal solution but
  can be easily improved later.
mysql-test/r/log_tables.result:
  Add test case result for Bug#34306
mysql-test/suite/binlog/r/binlog_stm_row.result:
  Add test case result for Bug#34306
mysql-test/suite/binlog/t/binlog_stm_row.test:
  Add test case for Bug#34306
mysql-test/t/log_tables.test:
  Add test case for Bug#34306
sql/lock.cc:
  Assert that TL_READ_DEFAULT is not a real lock type.
sql/mysql_priv.h:
  Export new function.
sql/mysqld.cc:
  Remove using_update_log.
sql/sql_base.cc:
  Introduce function that returns the appropriate read lock type
  depending on how the statement is going to be replicated. It will
  only take a TL_READ_NO_INSERT log if the binary is enabled and the
  binary log format is statement-based and the table is not a log table.
sql/sql_parse.cc:
  Remove using_update_log.
sql/sql_update.cc:
  Use new function to choose read lock type.
sql/sql_yacc.yy:
  The lock type is now decided at open_tables time. This old behavior was
  actually misleading as the binary log format can be dynamically switched
  and this would not change for statements that have already been parsed
  when the binary log format is changed (ie: prepared statements).
2008-09-29 10:53:40 -03:00
Horst Hunger
1fc5777320 Final fix for bug#38349: Did the changes due to the 2 reviews.
- Updated slow_query_log_file_basic and general_log_file basis instead of the func version as
the func version run good but the basic versions fail.
- Sent innodb.test to dev@innodb.com.
- variables.test has differences probably due to a bug in mtr or in the SET statement (see bug#39369).
- general_log_file_basic.test and slow_query_log_file_bsaic.test have differences, which might be 
produced by the new mtr (see bug#38124).
2008-09-10 12:50:39 +02:00
unknown
1ed34fed33 Bug#23924 general_log truncates queries with character set introducers.
Problem: logging of utf8-incompatible binary strings didn't work
Fix: hex-encoding of incompatible sequences.


mysql-test/r/log_tables.result:
  Adding test
mysql-test/t/log_tables.test:
  Adding test
sql/field.cc:
  Copying with hex escaping
sql/field.h:
  New field flag
sql/log.cc:
  Marking the column "general_log.argument" as hex-escaping field.
sql/sql_string.cc:
  New function to copy strings with hex-encoding of incompatible characters.
sql/sql_string.h:
  Prototype for the new function
2008-02-29 17:56:50 +04:00
unknown
6bfa2a01b5 Bug#32996 log_tables.test fails sporadically
Only select entries from the general_log that were issued by the current
connection.


mysql-test/r/log_tables.result:
  Update test result.
mysql-test/t/log_tables.test:
  Only select entries from the current thread.
2007-12-05 09:48:13 -02:00
unknown
f4f7e1f42c Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.1-opt
into  mysql.com:/misc/mysql/31700/51-31700


mysql-test/r/log_tables.result:
  Auto merged
2007-11-15 12:31:40 +01:00
unknown
dc7bc68f7f Bug#31700: thd->examined_row_count not incremented for 'const' type queries
tests adjusted for Windows


mysql-test/r/log_tables.result:
  Be more conservative in tests (for Windows)
mysql-test/t/log_tables.test:
  Be more conservative in tests (for Windows)
2007-11-15 12:30:35 +01:00
unknown
8021e495cf Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.1-opt
into  moonbone.local:/work/30081-bug-5.1-opt-mysql


client/mysql.cc:
  Auto merged
mysql-test/r/information_schema.result:
  Auto merged
mysql-test/r/log_tables.result:
  Auto merged
mysql-test/t/information_schema.test:
  Auto merged
sql/sql_show.cc:
  Auto merged
2007-11-13 13:29:42 +00:00
unknown
b1b1d62776 Bug#30081: "ON UPDATE CURRENT_TIMESTAMP" wasn't shown by the SHOW FIELDS
command and reported to a client.

The fact that a timestamp field will be set to NO on UPDATE wasn't shown 
by the SHOW COMMAND and reported to a client through connectors. This led to
problems in the ODBC connector and might lead to a user confusion.

A new filed flag called ON_UPDATE_NOW_FLAG is added. 
Constructors of the Field_timestamp set it when a field should be set to NOW
on UPDATE.

The get_schema_column_record function now reports whether a timestamp field
will be set to NOW on UPDATE.


mysql-test/t/information_schema.test:
  A test case adjusted after fixing the bug#30081.
mysql-test/r/type_timestamp.result:
  Adjusted a test case after fixing bug#30081.
mysql-test/r/type_ranges.result:
  Adjusted a test case after fixing bug#30081.
mysql-test/r/show_check.result:
  Adjusted a test case after fixing bug#30081.
mysql-test/r/ps_5merge.result:
  Adjusted a test case after fixing bug#30081.
mysql-test/r/ps_4heap.result:
  Adjusted a test case after fixing bug#30081.
mysql-test/r/ps_3innodb.result:
  Adjusted a test case after fixing bug#30081.
mysql-test/r/ps_2myisam.result:
  Adjusted a test case after fixing bug#30081.
mysql-test/r/metadata.result:
  Adjusted a test case after fixing bug#30081.
mysql-test/r/log_tables.result:
  Adjusted a test case after fixing bug#30081.
mysql-test/r/information_schema.result:
  A test case adjusted after fixing the bug#30081.
mysql-test/r/grant.result:
  Adjusted a test case after fixing bug#30081.
tests/mysql_client_test.c:
  A test case adjusted after fixing the bug#30081.
sql/sql_show.cc:
  Bug#30081: "ON UPDATE CURRENT_TIMESTAMP" wasn't shown by the SHOW FIELDS
  command and reported to a client.
  The get_schema_column_record function now reports whether a timestamp field
  will be set to NOW on UPDATE.
sql/field.cc:
  Bug#30081: "ON UPDATE CURRENT_TIMESTAMP" wasn't shown by the SHOW FIELDS
  command and reported to a client.
  Constructors of the Field_timestamp set the ON_UPDATE_NOW_FLAG on a field when
  it should be set to NOW on UPDATE.
include/mysql_com.h:
  Bug#30081: "ON UPDATE CURRENT_TIMESTAMP" wasn't shown by the SHOW FIELDS
  command and reported to a client.
  A new filed flag called ON_UPDATE_NOW_FLAG  is added.
client/mysql.cc:
  Bug#30081: "ON UPDATE CURRENT_TIMESTAMP" wasn't shown by the SHOW FIELDS
  command and reported to a client.
  The fieldflag2str function is adjusted to print the ON_UPDATE_NOW_FLAG.
2007-11-13 13:24:48 +00:00
unknown
c0fb459a38 Bug#31700: thd->examined_row_count not incremented for 'const' type queries
add 5.1-specific test showing that 'const' access increments 'examined'
counter in slow query log.


mysql-test/r/log_tables.result:
  5.1-only test showing that 'const' access increments counters
mysql-test/t/log_tables.test:
  5.1-only test showing that 'const' access increments counters
2007-11-10 21:51:47 +01:00
unknown
62fd471647 Merge anubis.xiphis.org:/usr/home/antony/work/mysql-5.1-engines
into  anubis.xiphis.org:/usr/home/antony/work/mysql-5.1-engines.merge


configure.in:
  Auto merged
mysql-test/r/heap_btree.result:
  Auto merged
mysql-test/r/log_tables.result:
  Auto merged
mysql-test/r/partition.result:
  Auto merged
mysql-test/r/system_mysql_db.result:
  Auto merged
mysql-test/t/heap_btree.test:
  Auto merged
mysql-test/t/log_tables.test:
  Auto merged
mysql-test/t/partition.test:
  Auto merged
mysys/my_getopt.c:
  Auto merged
scripts/mysql_system_tables.sql:
  Auto merged
sql/sql_base.cc:
  Auto merged
2007-10-19 13:06:37 -07:00
unknown
57600b02d0 Bug#31473
"CSV does not work with NULL value in datetime fields"
  Attempting to insert a row with a NULL value for a DATETIME field
  results in a CSV file which the storage engine cannot read.
  Don't blindly assume that "0" is acceptable for all field types,
  Since CSV does not support NULL, we find out from the field the
  default non-null value.
  Do not permit the creation of a table with a nullable columns.


mysql-test/r/csv.result:
  test for bug 31473
mysql-test/r/log_tables.result:
  change in results due to bugfix 31473
mysql-test/r/system_mysql_db.result:
  change in results due to bugfix 31473
mysql-test/t/csv.test:
  test for bug 31473
mysql-test/t/log_tables.test:
  due to bug31473, all columns in CSV tables must be declared as NOT NULL
scripts/mysql_system_tables.sql:
  due to bug31473, all columns in CSV tables must be declared as NOT NULL
storage/csv/ha_tina.cc:
  bug31473
    Don't blindly assume that "0" is acceptable for all field types,
    Since CSV does not support NULL, we find out from the field the
    default non-null value.
    Do not permit the creation of a table with a nullable columns;
2007-10-18 14:48:04 -07:00
unknown
7ae94a6887 Post merge fix for Bug 21557
mysql-test/r/log_tables.result:
  Update test result, general_log disabled.
mysql-test/t/log_tables.test:
  Disable the general_log before consulting it.
2007-10-18 17:24:57 -03:00
unknown
b9b481ec70 Bug#21557 entries in the general query log truncated at 1000 characters.
The general log write function (general_log_print) uses printf style
arguments which need to be pre-processed, meaning that the all arguments
are copied to a single buffer and the problem is that the buffer size is
constant (1022 characters) but queries can be much larger then this.

The solution is to introduce a new log write function that accepts a
buffer and it's length as arguments. The function is to be used when
a formatted output is not required, which is the case for almost all
query write-to-log calls.

This is a incompatible change with respect to the log format of prepared
statements.


mysql-test/r/log_tables.result:
  Add test case result for Bug#21557
mysql-test/t/log_tables.test:
  Add test case for Bug#21557
sql/log.cc:
  Introduce the logger function general_log_write which is similar to
  general_log_print but accepts a single buffer and the buffer length.
  The function doesn't perform any formatting and sends the buffer
  directly to the underlying log handlers.
sql/log.h:
  Introduce the logger function general_log_write.
sql/log_event.cc:
  Pass the query buffer directly to the logger function, formatting
  is not required on this case.
sql/mysql_priv.h:
  Prototype for the logger function general_log_write.
sql/sp_head.cc:
  Pass the query buffer directly to the logger function, formatting
  is not required on this case.
sql/sql_parse.cc:
  Pass the buffer directly to the logger function when formatting
  is not required.
sql/sql_prepare.cc:
  Don't log the statement id, it avoids making a extra copy of the query
  and the query is not truncated anymore if it exceeds the limit.
2007-10-18 15:45:07 -03:00
unknown
f22b95401e Merge malff@bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
into  weblab.(none):/home/marcsql/TREE/mysql-5.1-27858-b


mysql-test/r/log_tables.result:
  Auto merged
2007-10-11 17:58:32 -06:00
unknown
3df1613f27 Bug#27858 (Failing to log to a log table doesn't log anything to error log)
Before this patch, failures to write to the log tables (mysql.slow_log
and mysql.general_log) were improperly printed (the time was printed twice),
or not printed at all.

With this patch, failures to write to the log tables is reported in the
error log, for all cases of failures.


mysql-test/r/log_tables.result:
  Bug#27858 (Failing to log to a log table doesn't log anything to error log)
mysql-test/t/log_tables.test:
  Bug#27858 (Failing to log to a log table doesn't log anything to error log)
sql/log.cc:
  Bug#27858 (Failing to log to a log table doesn't log anything to error log)
2007-10-11 17:55:18 -06:00
unknown
ae270c4210 result fix 2007-09-20 16:27:58 +05:00
unknown
d2b9c8c219 Fix an unstable test.
mysql-test/r/log_tables.result:
  Update results.
mysql-test/t/log_tables.test:
  Silence a race condition: TRUNCATE code issues mysql_frm_type without
  a metadata lock, and finds no table if hits the moment when
  ALTER is swapping two tables.
2007-08-01 16:48:14 +04:00
unknown
4462578a1c WL#3984 (Revise locking of mysql.general_log and mysql.slow_log)
Bug#25422 (Hang with log tables)
Bug 17876 (Truncating mysql.slow_log in a SP after using cursor locks the
          thread)
Bug 23044 (Warnings on flush of a log table)
Bug 29129 (Resetting general_log while the GLOBAL READ LOCK is set causes
           a deadlock)

Prior to this fix, the server would hang when performing concurrent
ALTER TABLE or TRUNCATE TABLE statements against the LOG TABLES,
which are mysql.general_log and mysql.slow_log.

The root cause traces to the following code:
in sql_base.cc, open_table()
  if (table->in_use != thd)
  {
    /* wait_for_condition will unlock LOCK_open for us */
    wait_for_condition(thd, &LOCK_open, &COND_refresh);
  }
The problem with this code is that the current implementation of the
LOGGER creates 'fake' THD objects, like
- Log_to_csv_event_handler::general_log_thd
- Log_to_csv_event_handler::slow_log_thd
which are not associated to a real thread running in the server,
so that waiting for these non-existing threads to release table locks
cause the dead lock.

In general, the design of Log_to_csv_event_handler does not fit into the
general architecture of the server, so that the concept of general_log_thd
and slow_log_thd has to be abandoned:
- this implementation does not work with table locking
- it will not work with commands like SHOW PROCESSLIST
- having the log tables always opened does not integrate well with DDL
operations / FLUSH TABLES / SET GLOBAL READ_ONLY

With this patch, the fundamental design of the LOGGER has been changed to:
- always open and close a log table when writing a log
- remove totally the usage of fake THD objects
- clarify how locking of log tables is implemented in general.

See WL#3984 for details related to the new locking design.

Additional changes (misc bugs exposed and fixed):

1)

mysqldump which would ignore some tables in dump_all_tables_in_db(),
 but forget to ignore the same in dump_all_views_in_db().

2)

mysqldump would also issue an empty "LOCK TABLE" command when all the tables
to lock are to be ignored (numrows == 0), instead of not issuing the query.

3)

Internal errors handlers could intercept errors but not warnings
(see sql_error.cc).

4)

Implementing a nested call to open tables, for the performance schema tables,
exposed an existing bug in remove_table_from_cache(), which would perform:
  in_use->some_tables_deleted=1;
against another thread, without any consideration about thread locking.
This call inside remove_table_from_cache() was not required anyway,
since calling mysql_lock_abort() takes care of aborting -- cleanly -- threads
that might hold a lock on a table.
This line (in_use->some_tables_deleted=1) has been removed.


sql/handler.cc:
  Moved logic for system / log tables in the SQL layer.
sql/handler.h:
  Moved logic for system / log tables in the SQL layer.
sql/lock.cc:
  Revised locking of log tables
sql/log.cc:
  Major cleanup: changed how log tables are locked / written to.
sql/log.h:
  Major cleanup: changed how log tables are locked / written to.
sql/mysql_priv.h:
  performance schema helpers
sql/slave.cc:
  open_ltable() lock flags
sql/sp.cc:
  open_ltable() lock flags
sql/sql_acl.cc:
  open_ltable() lock flags
sql/sql_class.h:
  performance schema helpers
sql/sql_delete.cc:
  log tables cleanup in TRUNCATE
sql/sql_error.cc:
  Internal handlers can also intercept warnings
sql/sql_insert.cc:
  open_ltable() lock flags
sql/sql_parse.cc:
  performance schema helpers
sql/sql_plugin.cc:
  open_ltable() lock flags
sql/sql_rename.cc:
  log tables cleanup in RENAME
sql/sql_servers.cc:
  open_ltable() lock flags
sql/sql_show.cc:
  Move INFORMATION_SCHEMA_NAME to table.cc
sql/sql_table.cc:
  log tables cleanup (admin operations, ALTER TABLE)
sql/sql_udf.cc:
  open_ltable() lock flags
sql/table.cc:
  Implemented TABLE_CATEGORY.
sql/share/errmsg.txt:
  Changed the wording and name of ER_CANT_READ_LOCK_LOG_TABLE
sql/table.h:
  Implemented TABLE_CATEGORY.
storage/csv/ha_tina.cc:
  Moved logic for system / log tables in the SQL layer.
storage/csv/ha_tina.h:
  Moved logic for system / log tables in the SQL layer.
storage/myisam/ha_myisam.cc:
  Moved logic for system / log tables in the SQL layer.
storage/myisam/ha_myisam.h:
  Moved logic for system / log tables in the SQL layer.
client/mysqldump.c:
  Don't lock tables in the ignore list.
  Don't issue empty LOCK TABLES queries.
sql/sql_base.cc:
  log tables cleanup
  performance schema helpers
mysql-test/r/ps.result:
  Adjust test results
mysql-test/r/show_check.result:
  Adjust test results
mysql-test/r/status.result:
  Adjust test results
mysql-test/t/log_state.test:
  Added tests for Bug#29129
mysql-test/t/ps.test:
  Make the test output deterministic
mysql-test/t/show_check.test:
  Make the test output deterministic
mysql-test/r/log_state.result:
  Changed the default location of the log output to LOG_FILE,
  for backward compatibility with MySQL 5.0
  ---
  Adjust test results
mysql-test/r/log_tables.result:
  cleanup for -ps-protocol
mysql-test/t/log_tables.test:
  cleanup for -ps-protocol
sql/set_var.cc:
  Changed the default location of the log output to LOG_FILE,
  for backward compatibility with MySQL 5.0
  ---
  log tables cleanup
2007-07-27 00:31:06 -06:00
unknown
8b8b28881f Bug#27857 (Log tables supplies the wrong value for generating AUTO_INCREMENT
numbers)

Before this patch, the code in the class Log_to_csv_event_handler, which is
used by the global LOGGER object to write to the tables mysql.slow_log and
mysql_general_log, was supporting only records of the format defined for
these tables in the database creation scripts.

Also before this patch, the server would allow, with certain limitations,
to perform ALTER TABLE on the LOG TABLES.

As implemented, the behavior of the server, with regards to LOG TABLES,
is inconsistent:
- either ALTER TABLES on LOG TABLES should be prohibited,
and the code writing to these tables can make assumptions on the record
format,
- or ALTER TABLE on LOG TABLES is permitted, in which case the code
writing a record to these tables should be more flexible and honor
new fields.

In particular, adding an AUTO_INCREMENT column to the logs,
does not work as expected (per the bug report).

Given that the ALTER TABLE on log tables statement has been explicitly
implemented to check that the log should be off to perform the operation,
and that current test cases already cover this, the user expectation is
already set that this is a "feature" and should be supported.

With this patch, the server will:
- populate AUTO INCREMENT columns if present,
- populate any additional column with it's default value
when writing a record to the LOG TABLES.

Tests are provided, that detail the precise sequence of statements
a SUPER user might want to perform to add more columns to the log tables.


mysql-test/r/log_tables.result:
  Test case for bug#27857
mysql-test/t/log_tables.test:
  Test case for bug#27857
sql/log.cc:
  Set extra fields in log tables with default values.
2007-06-13 22:05:22 -06:00
unknown
1fc7f2117b WL#2936
"Server Variables for Plugins"
  Implement support for plugins to declare server variables.
  Demonstrate functionality by removing InnoDB specific code from sql/*
  New feature for HASH - HASH_UNIQUE flag
  New feature for DYNAMIC_ARRAY - initializer accepts preallocated ptr.
  Completed support for plugin reference counting.


include/hash.h:
  New flag for HASH
    HASH_UNIQUE
include/my_getopt.h:
  New data types for options: ENUM and SET.
  Use typelib to enumerate possible values.
  New flag variable:
    my_getopt_skip_unknown
include/my_sys.h:
  change to DYNAMIC_ARRAY init functions to support pre-allocated buffers
include/mysql.h:
  relocate inclusion of typelib due to longlong requirement
include/mysql/plugin.h:
  wl2936
    New declarations for plugin server variable support.
    New functions for use by plugins
include/mysys_err.h:
  new my_getopt return value: EXIT_ARGUMENT_INVALID
include/typelib.h:
  new typelib function: find_typeset(), returns an int which is a SET of
  the elements in the typelib
mysql-test/r/im_utils.result:
  change to more specific command line settings
  --skip-innodb => --skip-plugin-innodb
  etc.
mysql-test/r/log_tables.result:
  set default storage engine to MEMORY so that test will succeed even
  when some of the other named storage engines are not present
mysql-test/r/ndb_dd_basic.result:
  change in error message
mysql-test/r/partition_innodb.result:
  change in results
mysql-test/r/ps_1general.result:
  bdb doesn't exist, use myisam for a non-transactional engine
mysql-test/r/variables.result:
  information schema doesn't sort row results for server variables.
mysql-test/t/log_tables.test:
  set default storage engine to MEMORY so that test will succeed even
  when some of the other named storage engines are not present
mysql-test/t/ndb_dd_basic.test:
  ALTER LOGFILE GROUP no longer silently fail here
mysql-test/t/partition_innodb.test:
  ALTER TABLE no longer silently fails for unknown storage engine
mysql-test/t/ps_1general.test:
  remove unneccessary parts
  use myisam as it is an always present non-transactional engine
mysql-test/t/variables.test:
  information schema doesn't sort row results for server variables.
mysql-test/t/warnings_engine_disabled-master.opt:
  use the new style command line option
mysys/array.c:
  change to DYNAMIC_ARRAY init functions to support pre-allocated buffers
mysys/hash.c:
  New flag for HASH
    HASH_UNIQUE
  Implement HASH_UNIQUE functionality by performing a hash_search
mysys/my_getopt.c:
  New data types for options: ENUM and SET.
  Use typelib to enumerate possible values.
  New flag variable:
    my_getopt_skip_unknown
mysys/typelib.c:
  new typelib function: find_typeset(), returns an int which is a SET of
  the elements in the typelib
sql/ha_ndbcluster.cc:
  use ha_statistic_increment() method instead of
  statistic_increment() function
  ha_ndbcluster variable has gone away.
sql/ha_partition.cc:
  fix for reference counting
sql/ha_partition.h:
  fix for reference counting
sql/handler.cc:
  fixes for reference counting
sql/handler.h:
  fixes for reference counting
  some new methods to aid storage engine writers
sql/item_func.cc:
  find_sys_var() function now requires thd
sql/item_sum.cc:
  fixes for ref counting
sql/mysql_priv.h:
  remove unneccessary globals.
  new lock: LOCK_system_variables_hash
sql/mysqld.cc:
  Remove InnoBase specific code.
  Support plugin command line processing.
sql/set_var.cc:
  Remove InnoBase specific declarations
  Remove redundant declarations
  changes to permit new variables at run time
  changes for ref counting
sql/set_var.h:
  changes to permit new variables at run time
  changes for ref counting
sql/sql_base.cc:
  changes for ref counting
sql/sql_cache.cc:
  mark code as needing work in the future
sql/sql_class.cc:
  new functions to aid plugin authors
  initialize variables for dynamic plugin variables
sql/sql_class.h:
  remove InnoBase specific declarations
  New declarations for plugin variables.
sql/sql_connect.cc:
  initialization and cleanup of plugin variables
sql/sql_delete.cc:
  change for ref counting
sql/sql_insert.cc:
  change for ref counting
sql/sql_lex.cc:
  changes for ref counting and plugin variables
sql/sql_lex.h:
  add properties for plugin ref counting,
  add to distructor to clean up
sql/sql_partition.cc:
  changes for ref counting
sql/sql_plugin.cc:
  WL2936
    Plugin Variables
    New methods and code to support server variables for plugins.
    New code to complete plugin reference counting
    Debug code adds further indirection so that malloc debugging can be
    used to aid finding plugin ref count leaks
sql/sql_plugin.h:
  WL2936
    Plugin Variables
    New methods and code to support server variables for plugins.
    New code to complete plugin reference counting
    Debug code adds further indirection so that malloc debugging can be
    used to aid finding plugin ref count leaks
sql/sql_repl.cc:
  replication system variables moved here from set_var.cc
sql/sql_repl.h:
  new function to initialise replication server variables
sql/sql_select.cc:
  changes for ref counting
sql/sql_show.cc:
  changes for ref counting
sql/sql_table.cc:
  changes for ref counting
sql/sql_tablespace.cc:
  use supplied functions instead of digging into data structures manually
sql/sql_yacc.yy:
  changes for ref counting
  find_sys_var() now requires thd parameter
  changes on reporting errors to keep user-visible behaviour the same.
sql/structs.h:
  changes for ref counting
sql/table.cc:
  changes for ref counting
sql/table.h:
  changes for ref counting
storage/federated/ha_federated.cc:
  use ha_statistic_increment() method instead of statistic_increment()
  function
storage/heap/ha_heap.cc:
  use ha_statistic_increment() method instead of statistic_increment()
  function
storage/innobase/handler/ha_innodb.cc:
  use ha_statistic_increment() method instead of statistic_increment()
  function
  WL2936
    Move InnoBase specific code out of mysqld.cc and into here
    Declare all required server variables for InnoBase
storage/innobase/include/trx0trx.h:
  store a bit more state so that InnoBase does not have to dig into
  mysqld internal data structures.
storage/myisam/ha_myisam.cc:
  use ha_statistic_increment() method instead of statistic_increment()
  function
storage/myisammrg/ha_myisammrg.cc:
  use ha_statistic_increment() method instead of statistic_increment()
  function
2007-03-02 08:43:45 -08:00
unknown
fabf58c6cc Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  bodhi.local:/opt/local/work/mysql-5.1-runtime


mysql-test/r/log_tables.result:
  Auto merged
sql/handler.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
mysql-test/r/read_only.result:
  Manual merge.
mysql-test/t/read_only.test:
  Manual merge.
server-tools/instance-manager/guardian.cc:
  Manual merge.
2006-12-12 13:57:28 +03:00
unknown
ebd5aec15e Fix Bug #21328 mysqld issues warnings on ALTER CSV table to MyISAM
mysql-test/r/csv.result:
  update result file
mysql-test/r/log_tables.result:
  log_tables test contains alter of a CSV table with
  NULLs which results in warnings. In fact this is how
  the bug noticed. So, now when it is fixed we should
  update result file.
mysql-test/t/csv.test:
  add a test for the bug
storage/csv/ha_tina.cc:
  We should write 0 to the data file in the
  case we meet NULL. CSV does not support
  NULL values internally and we shouldn't
  distinguish them from 0 when writing a row
  (the alternative is to implement full NULL
  support). Otherwise other routines (such as
  Field::check_int() become confused).
  In 5.0 NULLs are stored as zeroes. In 5.1 it
  somehow turned into empty string. Which is wrong.
2006-12-04 03:07:44 +03:00
unknown
85b58cb43b Changed mysql.apply_status, mysql.binlog_index, and mysql.schema to mysql.ndb_apply_status, mysql.ndb_binlog_index, and mysql.ndb_schema 2006-12-01 15:49:07 +01:00
unknown
788ad30f08 Fixed a LOT of compiler warnings
Added missing DBUG_RETURN statements (in mysqldump.c)
Added missing enums
Fixed a lot of wrong DBUG_PRINT() statements, some of which could cause crashes
Removed usage of %lld and %p in printf strings as these are not portable or produces different results on different systems.


client/mysqldump.c:
  Fixed some compiler warnings
  Added some missing DBUG_RETURN
  Remove copying of 'cluster' database
client/mysqlslap.c:
  Fixed compiler warnings
client/mysqltest.c:
  After merge fix
extra/yassl/taocrypt/include/algebra.hpp:
  Removed compiler warning
mysql-test/include/im_check_env.inc:
  Fixed race condition (mysqld1 could report 'starting' or 'online'
mysql-test/mysql-test-run.pl:
  After merge fixes
  Added missing directory to LD_LIBRARY_PATH
mysql-test/r/ctype_cp1250_ch.result:
  After merge fix
mysql-test/r/im_cmd_line.result:
  Fixed race condition
mysql-test/r/im_daemon_life_cycle.result:
  Fixed race condition
mysql-test/r/im_instance_conf.result:
  Fixed race condition
mysql-test/r/im_life_cycle.result:
  Fixed race condition
mysql-test/r/im_utils.result:
  Fixed race condition
mysql-test/r/log_tables.result:
  Fixed wrong result
mysql-test/t/disabled.def:
  Disabled ndb_restore_partion, as ndb_restore_compate caused it to fail, becasue of table 'cluster/def/schema' which is stored in ndb_backup50
mysys/my_compress.c:
  Removed compiler warnings
mysys/my_getopt.c:
  Ensure we always have at least one space between option name and value
plugin/fulltext/plugin_example.c:
  Removed compiler warnings
server-tools/instance-manager/mysql_connection.cc:
  After merge fix
sql/event_data_objects.cc:
  Fixed compiler warnings
  Fixed platform compatibility issues (%lld is not portable)
sql/event_data_objects.h:
  Fixed compiler warnings
sql/event_db_repository.cc:
  Fixed compiler warnings
sql/event_queue.cc:
  Fixed compiler warnings
sql/event_scheduler.cc:
  Fixed compiler warnings
sql/events.cc:
  Fixed compiler warnings
sql/field.cc:
  Fixed compiler warnings
sql/ha_ndbcluster.cc:
  Fixed compiler warnings
sql/ha_ndbcluster_binlog.cc:
  Fixed compiler warnings
sql/ha_partition.cc:
  Fixed compiler warnings
sql/handler.cc:
  Fixed compiler warnings
sql/item_cmpfunc.cc:
  Fixed DBUG_PRINT style
sql/item_func.cc:
  Fixed compiler warnings
sql/log.cc:
  Fixed compiler warnings
sql/log_event.cc:
  Fixed compiler warnings
sql/mysqld.cc:
  Fixed compiler warnings
sql/opt_range.cc:
  Fixed compiler warnings
sql/repl_failsafe.cc:
  Indentation fixes
sql/rpl_rli.cc:
  Fixed compiler warnings
sql/rpl_tblmap.cc:
  Fixed compiler warnings
sql/set_var.cc:
  Fixed compiler warnings
sql/slave.cc:
  Fixed compiler warnings
sql/sp_head.cc:
  Fixed compiler warnings
sql/sql_base.cc:
  Fixed compiler warnings
  Fixed indentation
sql/sql_binlog.cc:
  Fixed compiler warnings
sql/sql_cache.cc:
  Fixed compiler warnings
sql/sql_class.cc:
  Fixed compiler warnings
sql/sql_handler.cc:
  Fixed compiler warnings
sql/sql_lex.cc:
  Fixed compiler warnings
sql/sql_parse.cc:
  Fixed compiler warnings
sql/sql_partition.cc:
  Fixed compiler warnings
sql/sql_prepare.cc:
  Fixed compiler warnings
sql/sql_table.cc:
  Fixed compiler warnings
sql/sql_test.cc:
  Fixed DBUG_PRINT style
sql/sql_trigger.cc:
  Fixed DBUG_PRINT style
sql/table.cc:
  Fixed compiler warnings
storage/federated/ha_federated.cc:
  Fixed compiler warnings
storage/myisam/mi_rsamepos.c:
  Fixed compiler warnings
storage/ndb/include/ndb_global.h.in:
  After merge fix
storage/ndb/include/util/NdbOut.hpp:
  Inform gcc that ndbout_c takes a printf() string as argument
storage/ndb/include/util/SimpleProperties.hpp:
  After merge fixes
storage/ndb/src/kernel/blocks/backup/Backup.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp:
  Fixed compiler warnings
  Fixed usage of uninitialized value (Got help from Jonas with patch)
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/blocks/lgman.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/blocks/pgman.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/blocks/restore.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/blocks/dbtup/DbtupFixAlloc.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/blocks/suma/Suma.cpp:
  Fixed compiler warnings
  Added missing enum's to switch
storage/ndb/src/kernel/vm/Configuration.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/vm/DLHashTable.hpp:
  Fixed compiler warnings
storage/ndb/src/kernel/vm/RWPool.hpp:
  Fixed compiler warnings
storage/ndb/src/kernel/vm/SimulatedBlock.cpp:
  Fixed compiler warnings
storage/ndb/src/kernel/vm/WOPool.hpp:
  Fixed compiler warnings
storage/ndb/src/kernel/vm/ndbd_malloc_impl.cpp:
  Fixed compiler warnings
storage/ndb/src/mgmclient/CommandInterpreter.cpp:
  Fixed compiler warnings
storage/ndb/src/mgmsrv/MgmtSrvr.cpp:
  Fixed compiler warnings
storage/ndb/src/ndbapi/DictCache.cpp:
  Fixed compiler warnings
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp:
  Fixed compiler warnings
storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp:
  Fixed compiler warnings
storage/ndb/src/ndbapi/NdbIndexOperation.cpp:
  Fixed compiler warnings
storage/ndb/src/ndbapi/NdbIndexStat.cpp:
  Initialize possible uninitialized variable
storage/ndb/src/ndbapi/NdbOperationInt.cpp:
  Fixed compiler warnings
storage/ndb/src/ndbapi/NdbRecAttr.cpp:
  Added missing enum's (To avoid compiler warnings)
storage/ndb/src/ndbapi/NdbScanOperation.cpp:
  Fixed compiler warnings
storage/ndb/src/ndbapi/ObjectMap.hpp:
  Fixed compiler warnings
storage/ndb/tools/desc.cpp:
  Fixed compiler warnings
storage/ndb/tools/restore/Restore.cpp:
  Fixed compiler warnings
storage/ndb/tools/restore/consumer_restore.cpp:
  Fixed compiler warnings
unittest/mytap/t/basic-t.c:
  Fixed compiler warnings
unittest/mytap/tap.c:
  Fixed compiler warnings
2006-11-27 01:47:38 +02:00
unknown
75ed6f1a3b Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.1-maint


BitKeeper/deleted/.del-CMakeLists.txt~1:
  Auto merged
BitKeeper/deleted/.del-make_win_bin_dist:
  Auto merged
configure.in:
  Auto merged
include/my_global.h:
  Auto merged
include/mysql.h:
  Auto merged
libmysqld/lib_sql.cc:
  Auto merged
mysql-test/include/mix1.inc:
  Auto merged
mysql-test/r/ctype_utf8.result:
  Auto merged
mysql-test/r/innodb_mysql.result:
  Auto merged
mysql-test/r/log_tables.result:
  Auto merged
mysql-test/r/trigger.result:
  Auto merged
mysql-test/r/view.result:
  Auto merged
mysql-test/t/ctype_utf8.test:
  Auto merged
mysql-test/t/im_daemon_life_cycle.imtest:
  Auto merged
mysql-test/t/sp-error.test:
  Auto merged
mysql-test/t/sp.test:
  Auto merged
mysql-test/t/trigger.test:
  Auto merged
mysql-test/t/view.test:
  Auto merged
netware/BUILD/mwenv:
  Auto merged
scripts/make_binary_distribution.sh:
  Auto merged
sql/Makefile.am:
  Auto merged
sql/handler.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/log.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sp.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_delete.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_trigger.cc:
  Auto merged
sql/sql_union.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
sql/sql_view.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/table.cc:
  Auto merged
storage/innobase/handler/ha_innodb.cc:
  Auto merged
tests/mysql_client_test.c:
  Auto merged
include/my_time.h:
  manual merge.
mysql-test/mysql-test-run.pl:
  manual merge.
mysql-test/r/ps.result:
  manual merge.
mysql-test/t/disabled.def:
  manual merge.
mysql-test/t/ps.test:
  manual merge.
2006-11-02 17:51:59 -05:00
unknown
5aa81b561e Merge pchardin@bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
into  mysql.com:/home/cps/mysql/devel/5.1-rename-bug


mysql-test/r/log_tables.result:
  Auto merged
mysql-test/t/log_tables.test:
  Auto merged
sql/handler.cc:
  Auto merged
sql/handler.h:
  Auto merged
sql/log.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sql_delete.cc:
  Auto merged
sql/sql_rename.cc:
  Auto merged
sql/table.cc:
  Auto merged
storage/csv/ha_tina.cc:
  Auto merged
storage/myisam/ha_myisam.cc:
  Auto merged
sql/log.cc:
  manual merge
sql/share/errmsg.txt:
  manual merge
sql/sql_table.cc:
  manual merge
2006-10-24 17:00:23 +04:00
unknown
9438b98519 Fix for Bug #17544 "Cannot do atomic log rotate",
Bug #21785 "Server crashes after rename of the log table" and
Bug #21966 "Strange warnings on create like/repair of the log
            tables"

According to the patch, from now on, one should use RENAME to
perform a log table rotation (this should also be reflected in
the manual).

Here is a sample:

use mysql;
CREATE TABLE IF NOT EXISTS general_log2 LIKE general_log;
RENAME TABLE general_log TO general_log_backup, general_log2 TO general_log;

The rules for Rename of the log tables are following:
      IF   1. Log tables are enabled
      AND  2. Rename operates on the log table and nothing is being
              renamed to the log table.
      DO   3. Throw an error message.
      ELSE 4. Perform rename.
 
The very RENAME query will go the the old (backup) table. This is
consistent with the behavoiur we have with binlog ROTATE LOGS
statement.

Other problems, which are solved by the patch are:

1) Now REPAIR of the log table is exclusive operation (as it should be), this
   also eliminates lock-related warnings. and
2) CREATE LIKE TABLE now usese usual read lock on the source table rather
   then name lock, which is too restrictive. This way we get rid of another
   log table-related warning, which occured because of the above fact
   (as a side-effect, name lock resulted in a warning).


mysql-test/r/log_tables.result:
  update result file
mysql-test/t/log_tables.test:
  Add tests for the bugs
sql/handler.cc:
  update comment
sql/handler.h:
  update function to reflect changes in log tables
  locking logic.
sql/lock.cc:
  Now we allow locking of the log tables for "privileged" threads
  Privileged thread must explicitly close and lock log tables. This
  is required for admin operations such as REPAIR.
sql/log.cc:
  Changes to the file:
  1) Add checks for table schema. It's more important now,
     as we allow rename of the log tables. Since we should
     check for schema when writing to a log table.
     E.g. if one created a table with one-only comlumn and
     renamed it to general_log, the server should cope with
     it.
  2) refactor LOGGER::flush(), so that we can now use the same
     machinery as we use in FLUSH LOGS in other statements:
     whenever we have to perform  a serious operation on the log
     tables, we have to
     (a) lock logger, which blocks other concurrent statements (such 
     as selects) (b) close logs. Then perform an
     exclusive operation, c) reenable logs and d) unlock logger.
  3) Add a function to check if a given table is a log table.
  4) Add support for "privileged" thread
  5) merge is_[general/slow]_log_table_enabled() into one function.
  6) Add new function: reopen _log_tables, which reopens the tables,
     which were enabled (after temporary close, required for admin
     operation)
sql/log.h:
  1) add a new call close_n_lock_tables(). Now we use it instead of
     LOGGER::flush() in FLUSH LOGS implementation.
  2) add a prototype for the function to check if a given
     table is a log table;
  3) add privileged table flag to table logger
  4) merge is_[general/slow]_log_table_enabled()
     into one function.
sql/mysql_priv.h:
  move log table defines to log.h
sql/sql_delete.cc:
  use new function check_if_log_table() instead of direct strcmp
sql/sql_rename.cc:
  Traverse the list of tables in mysql_rename_tables
  to make sure that log tables are processed correctly
  (that is, according to the rules specified in the
  main CS comment)
sql/sql_table.cc:
  1) mysql_admin_table() should disable logs if it performs
     exclusive admin operation on a log table. This way we
     also eliminate warning on REPAIR of the log table.
  2) mysql_create_like_table should read-lock the source table
     instead getting name lock on it. Name lock is too restrictive
     in this case.
sql/share/errmsg.txt:
  Add a new error message for rename of the log tables
sql/table.cc:
  use new function instead of direct strcmp.
  change my_strcasecmp() -> strcmp(), when
  comparing system db and table names
storage/csv/ha_tina.cc:
  update function to reflect changes in log tables
  locking logic.
storage/myisam/ha_myisam.cc:
  update function to reflect changes in log tables
  locking logic.
2006-10-13 17:26:46 +04:00
unknown
814723e2a1 Merge neptunus.(none):/home/msvensson/mysql/same_tools/my51-same_tools
into  neptunus.(none):/home/msvensson/mysql/mysql-5.1-new-maint


BitKeeper/deleted/.del-ps_6bdb.result:
  Auto merged
mysql-test/include/have_multi_ndb.inc:
  Auto merged
mysql-test/include/have_ndb.inc:
  Auto merged
mysql-test/r/log_tables.result:
  Auto merged
mysql-test/r/partition.result:
  Auto merged
mysql-test/r/ps_2myisam.result:
  Auto merged
mysql-test/r/ps_3innodb.result:
  Auto merged
mysql-test/r/ps_4heap.result:
  Auto merged
mysql-test/r/ps_5merge.result:
  Auto merged
mysql-test/r/ps_7ndb.result:
  Auto merged
mysql-test/r/query_cache.result:
  Auto merged
mysql-test/r/subselect.result:
  Auto merged
mysql-test/t/crash_commit_before.test:
  Auto merged
mysql-test/t/ps.test:
  Auto merged
mysql-test/t/sp.test:
  Auto merged
mysql-test/t/subselect.test:
  Auto merged
BitKeeper/deleted/.del-mtr_im.pl:
  Delete: mysql-test/lib/mtr_im.pl
client/mysqltest.c:
  Use remote
mysql-test/mysql-test-run.pl:
  Use remote
mysql-test/lib/mtr_process.pl:
  Use remote
2006-10-06 13:12:53 +02:00
unknown
70c1311fb9 Update test results to new mysqltest
Remove extra space for "send" commands


mysql-test/extra/rpl_tests/rpl_truncate_helper.test:
  Get $SERVER_VERSION from the mysqld
mysql-test/r/flush_table.result:
  Remove extra space for "send" commands
mysql-test/r/handler_innodb.result:
  Remove extra space for "send" commands
mysql-test/r/lock_multi.result:
  Remove extra space for "send" commands
mysql-test/r/log_tables.result:
  Remove extra space for "send" commands
2006-10-04 23:48:24 +02:00
unknown
dc4418edcf Automerge fix: "Out of range value" error message adjusted to 5.1. 2006-10-03 18:48:50 +05:00
unknown
ac4b662363 Remove unused error messages (no release contains them
at the moment, so we can safely do that). Update an error
mesage to make it translateable.


mysql-test/r/log_tables.result:
  update result file
sql/share/errmsg.txt:
  remove unused error messages
sql/sql_table.cc:
  Use name of the statements rather then English words.
  This way error message is translateable.
2006-09-27 17:48:00 +04:00
unknown
abbb201661 Post-review fixes for
Bug #18559 "log tables cannot change engine, and
            gets deadlocked when dropping w/ log on":
1) Add more generic error messages
2) Add new handlerton flag for engines, which support
   log tables
3) Remove (log-tables related) mutex lock in myisam to
   improve performance


mysql-test/r/log_tables.result:
  update result file to use new error messages
mysql-test/t/log_tables.test:
  update test file with new error messages
sql/handler.h:
  Add new handlerton flag, to mark whether engine
  supports log tables
sql/share/errmsg.txt:
  Add more generic error messages
sql/sql_table.cc:
  Update error messages
storage/csv/ha_tina.cc:
  CSV supports log tables
storage/myisam/ha_myisam.cc:
  MyISAM supports log tables
storage/myisam/mi_write.c:
  remove mutex lock to improve performance
2006-09-15 13:07:23 +04:00
unknown
1363c9b215 Fixed warning message breakage.
Fixed install breakage (my own fault)
Edited exampled cnf to remove bdb references. 


mysql-test/r/backup.result:
  fix warnings
mysql-test/r/im_options.result:
  Remove missed bdb skip
mysql-test/r/im_utils.result:
  Remove missed bdb-skip
mysql-test/r/log_tables.result:
  Fix warnings
mysql-test/r/show_check.result:
  Fix warnings
mysql-test/r/sp_trans.result:
  Fix warning
mysql-test/r/type_timestamp.result:
  Fix warning
mysql-test/r/warnings.result:
  Fix warning
mysql-test/t/disabled.def:
  Disabled Federation test
mysql-test/t/federated_transactions.test:
  Fixed comments in federation test
netware/mysql_install_db.c:
  Fix install breakage.
netware/mysql_test_run.c:
  Fix install breakage.
scripts/mysql_install_db.sh:
  Fix install breakage
storage/myisam/ftbench/ft-test-run.sh:
  Fixed test which is never run
support-files/my-innodb-heavy-4G.cnf.sh:
  Modified examples
support-files/my-small.cnf.sh:
  Modified examples
2006-08-13 22:28:41 -07:00
unknown
79b03c66bf Merge pchardin@bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
into  mysql.com:/home/cps/mysql/devel/5.1-curs-bug


sql/ha_myisam.cc:
  Auto merged
sql/handler.h:
  Auto merged
sql/sql_table.cc:
  Auto merged
mysql-test/r/log_tables.result:
  SCCS merged
mysql-test/t/log_tables.test:
  SCCS merged
2006-08-04 14:48:51 +04:00
unknown
157c42de97 Fix Bug #18559 "log tables cannot change engine, and
gets deadlocked when dropping w/ log on"

Log tables rely on concurrent insert machinery to add data.
This means that log tables are always opened and locked by
special (artificial) logger threads. Because of this, the thread
which tries to drop a log table starts to wait for the table
to be unlocked. Which will happen only if the log table is disabled.
Alike situation happens if one tries to alter a log table.
However in addition to the problem above, alter table calls
check_if_locking_is_allowed() routine for the engine. The
routine does not allow alter for the log tables. So, alter
doesn't start waiting forever for logs to be disabled, but 
returns with an error.
Another problem is that not all engines could be used for
the log tables. That's because they need concurrent insert.

In this patch we:
(1) Explicitly disallow to drop/alter a log table if it
    is currently used by the logger.
(2) Update MyISAM to support log tables
(3) Allow to drop log tables/alter log tables if log is
    disabled
At the same time we (4) Disallow to alter log tables to
unsupported engine (after this patch CSV and MyISAM are 
alowed)
Recommit with review fixes.


mysql-test/r/log_tables.result:
  Update result file.
  Note: there are warnings in result file. This is because of CSV
  bug (Bug #21328). They should go away after it is fixed.
mysql-test/t/log_tables.test:
  Add a test for the bug
sql/ha_myisam.cc:
  Add log table handling to myisam: as log tables
  use concurrent insert, they are typically
  locked with TL_CONCURRERENT_INSERT lock. So,
  disallow other threads to attempt locking of
  the log tables in incompatible modes. Because
  otherwise the threads will wait for the tables
  to be unlocked forever.
sql/handler.cc:
  Add a function to check if a table we're going to lock
  is a log table and if the lock mode we want allowed
sql/handler.h:
  Add a new function to check compatibility of the locking
sql/log.cc:
  we shouldn't close the log table if and only
  if this particular table is already closed
sql/log.h:
  add new functions to check if a log is enabled
sql/share/errmsg.txt:
  add new error messages
sql/sql_table.cc:
  DROP and ALTER TABLE should not work on log
  tables if the log tables are enabled
storage/csv/ha_tina.cc:
  move function to check if the locking for the log
  tables allowed to handler class, so that we can
  reuse it in other engines.
storage/myisam/mi_extra.c:
  add new ::extra() flag processing to myisam
storage/myisam/mi_open.c:
  init log table flag
storage/myisam/mi_write.c:
  update status after each write if it's a log table
storage/myisam/myisamdef.h:
  Add new log table flag to myisam share.
  We need it to distinguish between usual
  and log tables, as for the log tables we
  should provide concurrent insert in a
  different way than for usual tables: we
  want new rows to be immediately visible
  to other threads.
2006-08-03 21:28:15 +04:00
unknown
e1ec4de43f Fix Bug #20139 Infinite loop after "FLUSH" and "LOCK tabX, general_log"
Due to incorrect handling of FLUSH TABLES, log tables were marked for flush,
but not reopened. Later we started to wait for the log table to be closed
(disabled) after the flush. And as nobody disabled logs in concurrent treads,
the command lasted forever.
After internal consultations it was decided to skip logs during FLUSH TABLES.
The reasoning is that logging is done in the "log device", whatever it is
which is always active and controlled by FLUSH LOGS. So, to flush logs
one should use FLUSH LOGS, and not FLUSH TABLES.


mysql-test/r/log_tables.result:
  update result file
mysql-test/t/log_tables.test:
  add a test for the bug
sql/sql_base.cc:
  Skip log tables during FLUSH TABLES
2006-08-03 17:23:37 +04:00
unknown
041171fd81 Merge bk-internal:/home/bk/mysql-5.1-new
into  mysql.com:/home/jimw/my/mysql-5.1-clean


mysql-test/r/log_tables.result:
  Merge conflict
mysql-test/t/log_tables.test:
  Merge conflict
2006-05-23 09:49:04 -07:00
unknown
749f183265 update log_tables.test so it is less fragile
mysql-test/r/log_tables.result:
  update result so test is less fragile
mysql-test/t/log_tables.test:
  update test so it is less fragile
2006-05-23 15:01:23 +02:00
unknown
5b2cade4fa Bug #20004: log_tables fails on Windows due to output differences
This test included hostname information in the output, which varies
  between platforms.


mysql-test/r/log_tables.result:
  Update results
mysql-test/t/log_tables.test:
  Replace user_host selected from logs to avoid platform differences.
  Also, fix use of replace_column in test for bug 17600.
2006-05-22 11:34:41 -07:00
unknown
5fd44f2cc6 Fix Bug#17600: Invalid data logged into mysql.slow_log
Recommit with post-review fixes.


mysql-test/r/log_tables.result:
  update result
mysql-test/t/log_tables.test:
  add a test
sql/log.cc:
  Fix NULL handling in log tables
storage/csv/ha_tina.cc:
   Explicitly check fo NULLs, when writing a row.
   We should not hope, that the null field was
   cleaned up.
   Though usually we do call Field::reset() or
   restore_row(), before calling Field::set_null(),
   this depency is neither documented nor enforced
   by other means.
mysql-test/t/log_tables-master.opt:
  New BitKeeper file ``mysql-test/t/log_tables-master.opt''
2006-03-06 21:03:17 +03:00
unknown
c0b31dc2f0 Fix for Bug#16905 Log tables: unicode statements are logged incorrectly
mysql-test/r/log_tables.result:
  update result
mysql-test/t/log_tables.test:
  add a testcase
sql/log.cc:
  take into account client charset info, while logging
  into a table.
sql/log.h:
  pass the charset info along with the log messages
  to log them correctly
2006-02-03 13:05:14 +03:00
unknown
41536fcefe 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''
2006-01-19 05:56:06 +03:00