Commit graph

632 commits

Author SHA1 Message Date
davi@moksha.com.br
dd135211d8 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.
2007-10-18 15:45:07 -03:00
malff/marcsql@weblab.(none)
6428dacd44 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.
2007-10-11 17:55:18 -06:00
malff/marcsql@weblab.(none)
635f31822f Merge malff@bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
into  weblab.(none):/home/marcsql/TREE/mysql-5.1-30712
2007-08-31 16:04:36 -06:00
kostja@bodhi.(none)
467de3981b Merge bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
into  bodhi.(none):/opt/local/work/mysql-5.1-12713-new
2007-08-31 10:58:02 +04:00
kostja@bodhi.(none)
8d1af60da0 Never access thd->ha_data directly, use getters/setters from the plugin
API instead.
This is a pre-requisite of the fix for Bug 12713, which changes the
data type of thd->ha_data from void * to struct Ha_data.
2007-08-31 10:19:52 +04:00
malff/marcsql@weblab.(none)
88091e8250 Bug#30712 (open_performance_schema_table() cause an open table leak on
failures)

Fixed open_performance_schema_table() and close_performance_schema_table()
implementation and callers, to always execute balanced calls to:
  thd->reset_n_backup_open_tables_state(backup);
  thd->restore_backup_open_tables_state(backup);
2007-08-29 18:56:00 -06:00
jani@hynda.mysql.fi
2fd7a743e4 Merge hynda.mysql.fi:/home/my/mysql-5.1-main
into  hynda.mysql.fi:/home/my/mysql-5.1-marvel
2007-08-21 19:03:28 +03:00
mats@kindahl-laptop.dnsalias.net
112c64a00d Merge kindahl-laptop.dnsalias.net:/home/bkroot/mysql-5.1-rpl
into  kindahl-laptop.dnsalias.net:/home/bk/fix-mysql-5.1-rpl
2007-08-17 11:00:03 +02:00
mats@kindahl-laptop.dnsalias.net
9c4ef25c55 Renaming RELAY_LOG_INFO and st_relay_log_info to follow coding standards
(and be more friendly to Doxygen by removing unnecessary typedefs).
2007-08-16 07:37:50 +02:00
monty@mysql.com/narttu.mysql.fi
5d1c2dc913 Fixed problem that Start_log_event_v3::created was not set properly
(This is becasue 'when' is not anymore set in constructor)
2007-08-14 15:20:05 +03:00
monty@narttu.mysql.fi
9d609a59fd Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  mysql.com:/home/my/mysql-5.1
2007-08-14 00:22:34 +03:00
monty@mysql.com/nosik.monty.fi
e53a73e26c Fixed a lot of compiler warnings and errors detected by Forte C++ on Solaris
Faster thr_alarm()
Added 'Opened_files' status variable to track calls to my_open()
Don't give warnings when running mysql_install_db
Added option --source-install to mysql_install_db

I had to do the following renames() as used polymorphism didn't work with Forte compiler on 64 bit systems
index_read()      -> index_read_map()
index_read_idx()  -> index_read_idx_map()
index_read_last() -> index_read_last_map()
2007-08-13 16:11:25 +03:00
df@pippilotta.erinye.com
493634e4c7 Merge bk-internal:/home/bk/mysql-5.1-marvel
into  pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.1-build-marvel-engines
2007-08-03 17:15:23 +02:00
monty@mysql.com/nosik.monty.fi
113cd2d064 Removed compiler warning 2007-08-03 08:08:33 +03:00
monty@mysql.com/nosik.monty.fi
237d586700 Simplify logging code a bit (to make code smaller and faster)
Moved duplicated code to inline function store_timestamp()
Save thd->time_zone_used when logging to table as CSV internally cases it to be changed
Added MYSQL_LOCK_IGNORE_FLUSH to log tables to avoid deadlock in case of flush tables.
Mark log tables with TIMESTAMP_NO_AUTO_SET to avoid automatic timestamping
Set TABLE->no_replicate on open
2007-08-03 01:14:27 +03:00
monty@mysql.com/nosik.monty.fi
0174fa66d5 Don't save & restore time fields from thd when it's not needed.
Added back setting of 'some_tables_deleted' to not cause deadlocks in mysql_lock_table()
2007-08-02 10:50:00 +03:00
monty@nosik.monty.fi
93f0771fca Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  mysql.com:/home/my/mysql-5.1
2007-08-02 07:55:33 +03:00
tsmith@ramayana.hindu.god
a52a078f75 Merge tsmith@bk-internal.mysql.com:/home/bk/mysql-5.1-opt
into  ramayana.hindu.god:/home/tsmith/m/bk/maint/51
2007-08-01 18:40:02 -06:00
malff/marcsql@weblab.(none)
be83a97fa6 Merge malff@bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
into  weblab.(none):/home/marcsql/TREE/mysql-5.1-cleanup
2007-07-30 23:04:07 -06:00
malff/marcsql@weblab.(none)
edf784f444 Fixed ressource leak when activation of LOGGER failed. 2007-07-30 23:01:44 -06:00
serg@janus.mylan
f451ac1f96 handler::ha_write_row_no_binlog() hack removed,
existing table->no_replicate code is used instead
2007-07-30 19:56:02 +02:00
gkodinov/kgeorge@magare.gmz
cfbfb8bae8 (Pushing for Andrei)
Merge magare.gmz:/home/kgeorge/mysql/work/B27417-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/work/B27417-5.1-opt
2007-07-30 19:02:21 +03:00
gkodinov/kgeorge@magare.gmz
9a0e6ec6d2 (pushing for Andrei)
Bug #27417 thd->no_trans_update.stmt lost value inside of SF-exec-stack
  
Once had been set the flag might later got reset inside of a stored routine 
execution stack.
The reason was in that there was no check if a new statement started at time 
of resetting.
The artifact affects most of binlogable DML queries. Notice, that multi-update 
is wrapped up within
  bug@27716 fix, multi-delete bug@29136.
  
Fixed with saving parent's statement flag of whether the statement modified 
non-transactional table, and unioning (merging) the value with that was gained 
in mysql_execute_command.
  
Resettling thd->no_trans_update members into thd->transaction.`member`;
Asserting code;
Effectively the following properties are held.
  
1. At the end of a substatement thd->transaction.stmt.modified_non_trans_table
   reflects the fact if such a table got modified by the substatement.
   That also respects THD::really_abort_on_warnin() requirements.
2. Eventually thd->transaction.stmt.modified_non_trans_table will be computed as
   the union of the values of all invoked sub-statements.
   That fixes this bug#27417;

Computing of thd->transaction.all.modified_non_trans_table is refined to base to 
the stmt's value for all the case including insert .. select statement which 
before the patch had an extra issue bug@28960.
Minor issues are covered with mysql_load, mysql_delete, and binloggin of insert in
to temp_table select. 
  
The supplied test verifies limitely, mostly asserts. The ultimate testing is defered
for bug@13270, bug@23333.
2007-07-30 18:27:36 +03:00
gkodinov/kgeorge@magare.gmz
b6bb988d12 Moved the DBUG_ASSERT from bug 28983 to
a place where it would not obstruct
correct multithreading.
2007-07-30 16:03:52 +03:00
monty@mysql.com/nosik.monty.fi
b16289a5e0 Slow query log to file now displays queries with microsecond precission
--long-query-time is now given in seconds with microseconds as decimals
--min_examined_row_limit added for slow query log
long_query_time user variable is now double with 6 decimals
Added functions to get time in microseconds
Added faster time() functions for system that has gethrtime()  (Solaris)
We now do less time() calls.
Added field->in_read_set() and field->in_write_set() for easier field manipulation by handlers
set_var.cc and my_getopt() can now handle DOUBLE variables.
All time() calls changed to my_time()
my_time() now does retry's if time() call fails.
Added debug function for stopping in mysql_admin_table() when tables are locked
Some trivial function and struct variable renames to avoid merge errors.
Fixed compiler warnings
Initialization of some time variables on windows moved to my_init()
2007-07-30 11:33:50 +03:00
malff/marcsql@weblab.(none)
ac7b17eac4 Code review changes 2007-07-27 12:19:36 -06:00
malff/marcsql@weblab.(none)
c7bbd8917c 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.
2007-07-27 00:31:06 -06:00
tnurnberg@sin.intern.azundris.com
f1b5fa93ac Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.1-maint
into  mysql.com:/home/tnurnberg/22540/51-22540
2007-07-10 18:38:14 +02:00
tnurnberg@sin.intern.azundris.com
9b4c3d0db4 Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  mysql.com:/home/tnurnberg/22540/50-22540
2007-07-10 18:33:20 +02:00
tnurnberg@sin.intern.azundris.com
9310ad5f48 Merge mysql.com:/home/tnurnberg/22540/50-22540
into  mysql.com:/home/tnurnberg/22540/51-22540
2007-07-10 18:21:06 +02:00
tsmith@sita.local
5f12f35c34 Merge sita.local:/Users/tsmith/m/bk/51
into  sita.local:/Users/tsmith/m/bk/maint/51

This merge requires a post-merge fix to remove rpl_udf from
suite/rpl/t/disabled.def.
2007-07-09 03:27:03 -06:00
tsmith@sita.local
7b2b10e462 Merge sita.local:/Users/tsmith/m/bk/50
into  sita.local:/Users/tsmith/m/bk/maint/50
2007-07-09 01:22:54 -06:00
tnurnberg@mysql.com/sin.intern.azundris.com
3dfc83f1a1 Bug#22540: Incorrect value in column End_log_pos of SHOW BINLOG EVENTS using InnoDB
dollin' it up for Guilhem ;) -- test streamlined,
better comments, faster code, add'l assert.
2007-07-09 08:11:38 +02:00
tsmith@maint1.mysql.com
21b401bd26 WL#3914: Additonal accessors required to compile InnoDB as a plugin storage engine
Add more accessors to MySQL internals in mysql/plugin.h, for storage
engine plugins.

Add some accessors specific to the InnoDB storage engine, to allow
InnoDB to be compiled as a plugin (without MYSQL_SERVER).  InnoDB
has additional requirements, due to its foreign key support, etc.
2007-07-05 01:05:47 +02:00
gkodinov/kgeorge@magare.gmz
66bfc21362 Merge magare.gmz:/home/kgeorge/mysql/work/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/work/merge-5.1-opt
2007-07-04 11:46:45 +03:00
gkodinov/kgeorge@magare.gmz
bad7900a5a Bug #28983: 'reset master' in multiple threads and innodb tables
asserts debug binary

We can't reliably check if the binary log is opened without 
acquiring its mutex. 
Fixed by removing this check.
2007-07-03 10:36:37 +03:00
tnurnberg@sin.intern.azundris.com
2fbd3a2eca Bug#22540: Incorrect value in column End_log_pos of SHOW BINLOG EVENTS using InnoDB
minor fixes to appease pushbuild.
2007-07-02 07:13:40 +02:00
tnurnberg@sin.intern.azundris.com
5b98b71db6 Bug#22540: Incorrect value in column End_log_pos of SHOW BINLOG EVENTS using InnoDB
previous correction didn't. make sure "tail" is fixed up
when filling cache several times; rework formulae.
---
Merge sin.intern.azundris.com:/home/tnurnberg/22540/50-22540
into  sin.intern.azundris.com:/home/tnurnberg/22540/51-22540
2007-06-30 03:32:33 +02:00
tnurnberg@sin.intern.azundris.com
1ac88a2b41 Bug#22540: Incorrect value in column End_log_pos of SHOW BINLOG EVENTS using InnoDB
previous correction didn't. make sure "tail" is fixed up
when filling cache several times; rework formulae.
2007-06-30 02:30:42 +02:00
tnurnberg@sin.intern.azundris.com
3b9e5093a3 Bug#22540: Incorrect value in column End_log_pos of SHOW BINLOG EVENTS using InnoDB
windows fixies
2007-06-27 13:23:58 +02:00
tnurnberg@sin.intern.azundris.com
ec22bd2355 Bug#22540: Incorrect value in column End_log_pos of SHOW BINLOG EVENTS using InnoDB
Windows fixies
2007-06-27 13:19:28 +02:00
tnurnberg@sin.intern.azundris.com
dadc4c7499 Bug#22540: Incorrect value in column End_log_pos of SHOW BINLOG EVENTS using InnoDB
windows fixies
2007-06-27 09:31:47 +02:00
tnurnberg@sin.intern.azundris.com
131db8123f Bug#22540: Incorrect value in column End_log_pos of SHOW BINLOG EVENTS using InnoDB
windows fixies
2007-06-27 09:30:29 +02:00
tnurnberg@sin.intern.azundris.com
31e98955a5 Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  mysql.com:/home/ram/work/b29079/b29079.5.0
---
Bug #22540: Incorrect value in column End_log_pos of SHOW BINLOG EVENTS using InnoDB

fix binlog-writing so that end_log_pos is given correctly even
within transactions for both SHOW BINLOG and SHOW MASTER STATUS,
that is as absolute values (from log start) rather than relative
values (from transaction's start).
---
Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  sin.intern.azundris.com:/home/tnurnberg/22540/50-22540
---
Bug#22540: Incorrect value in column End_log_pos of SHOW BINLOG EVENTS using InnoDB

end_log_pos data within a transaction are relative to
the start of the transaction rather than absolute.
we fix those groups in situ before writing the log out.

additional comments and handling for groups with very
large single events, as suggested by Guilhem.
---
Merge bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  amd64.(none):/src/bug24732/my50-bug24732
---
Merge maint1.mysql.com:/data/localhome/tsmith/bk/50
into  maint1.mysql.com:/data/localhome/tsmith/bk/maint/50
---
Bug#22540: Incorrect value in column End_log_pos of SHOW BINLOG EVENTS using InnoDB
 
end_log_pos data within a transaction are relative to
the start of the transaction rather than absolute.
we fix those groups in situ before writing the log out.
 
additional comments and handling for groups with very
large single events, as suggested by Guilhem.
---
Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  sin.intern.azundris.com:/home/tnurnberg/22540/50-22540
---
Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.1-maint
into  sin.intern.azundris.com:/home/tnurnberg/22540/51-22540
---
Merge sin.intern.azundris.com:/home/tnurnberg/22540/50-22540
into  sin.intern.azundris.com:/home/tnurnberg/22540/51-22540
2007-06-27 08:18:24 +02:00
tnurnberg@sin.intern.azundris.com
874ccf025d Bug#22540: Incorrect value in column End_log_pos of SHOW BINLOG EVENTS using InnoDB
end_log_pos data within a transaction are relative to
the start of the transaction rather than absolute.
we fix those groups in situ before writing the log out.

additional comments and handling for groups with very
large single events, as suggested by Guilhem.
2007-06-25 18:41:17 +02:00
tnurnberg@sin.intern.azundris.com
4ca5aabf98 Bug #22540: Incorrect value in column End_log_pos of SHOW BINLOG EVENTS using InnoDB
fix binlog-writing so that end_log_pos is given correctly even
within transactions for both SHOW BINLOG and SHOW MASTER STATUS,
that is as absolute values (from log start) rather than relative
values (from transaction's start).
---
Merge sin.intern.azundris.com:/home/tnurnberg/22540/50-22540
into  sin.intern.azundris.com:/home/tnurnberg/22540/51-22540
---
Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.1-maint
into  sin.intern.azundris.com:/home/tnurnberg/22540/51-22540
2007-06-25 11:37:10 +02:00
tnurnberg@sin.intern.azundris.com
25af844f6f Bug #22540: Incorrect value in column End_log_pos of SHOW BINLOG EVENTS using InnoDB
fix binlog-writing so that end_log_pos is given correctly even
within transactions for both SHOW BINLOG and SHOW MASTER STATUS,
that is as absolute values (from log start) rather than relative
values (from transaction's start).
---
Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into  sin.intern.azundris.com:/home/tnurnberg/22540/50-22540
2007-06-25 11:34:23 +02:00
malff/marcsql@weblab.(none)
7e36d37eb0 Merge weblab.(none):/home/marcsql/TREE/mysql-5.1-base
into  weblab.(none):/home/marcsql/TREE/mysql-5.1-rt-merge
2007-06-15 11:36:31 -06:00
malff/marcsql@weblab.(none)
b27172eb70 build warning 2007-06-14 17:43:19 -06:00
malff/marcsql@weblab.(none)
dd2bdfda8d 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.
2007-06-13 22:05:22 -06:00