Commit graph

3348 commits

Author SHA1 Message Date
Alexey Botchkov
92265da9d7 MDEV-4472 Audit-plugin. Server-related part of the task.
file_logger became the service.
     Data like query_id now are sent to the audit plugin.
     Fix for MDEV-4770 ported from 10.0.
     Fix added for the read_maria_plugin_info().
     Log rotation can be disabled with 'set rotations=0'.
2013-09-09 16:56:35 +05:00
Sergei Golubchik
b838d081ad mysql-5.5.33 merge 2013-09-06 22:31:30 +02:00
Sergei Golubchik
c06eaf21b7 MDEV-4165 [PATCH] RFE: make tmpdir a build-time configurable option
support -DTMPDIR=/path in CMakeLists.txt

Patch by Honza Horak.
2013-08-17 17:20:09 +04:00
Sergei Golubchik
758b012ff2 fix a comment 2013-08-14 11:12:57 +02:00
Alexander Barkov
b59738a598 Merge from 5.3
modified:
  mysql-test/r/dyncol.result
  mysql-test/r/type_time.result
  mysql-test/t/dyncol.test
  mysql-test/t/type_time.test
  mysys/ma_dyncol.c
  sql/item.cc
  sql/item_func.cc
pending merges:
  Alexander Barkov 2013-08-12 MDEV-4652 Wrong result for CONCAT(GREATEST(T...
    sanja@montyprogr... 2013-08-01 MDEV-4811 Assertion `offset < 0x1f' f...
2013-08-12 17:33:08 +04:00
unknown
04fd2f18cb MDEV-4811 Assertion `offset < 0x1f' fails in type_and_offset_store on COLUMN_ADD
MDEV-4812 Valgrind warnings (Invalid write) in dynamic_column_update_many on COLUMN_ADD

Fixed problem of working on wrong data (do not allow offset to out of string length).
2013-08-01 11:46:11 +03:00
Vladislav Vaintroub
3ef0157daa MDEV-4815 - allow multiple mysql_server_init() / mysql_server_end() in the same process, for embedded library.
- Reset  static variables that are used to signal "init done"  for DBUG, in dbug_end()
- Set string server variables to NULL after memory for the value is freed - avoids double free()
- fix DBUG_ASSERTs that happened during reinitialization.
2013-07-29 16:03:41 +02:00
Sergei Golubchik
005c7e5421 mysql-5.5.32 merge 2013-07-16 19:09:54 +02:00
Sergei Golubchik
b9f220b45a 5.3 merge 2013-07-16 19:03:06 +02:00
Sergei Golubchik
8de120e2b9 5.2 merge 2013-07-15 18:32:25 +02:00
Vladislav Vaintroub
6bef652d91 MDEV-4409 - Fix deadlock in MySQL key cache code, that can happen if there is a key cache resize running in parallel with an update.
If there is a key cache resize,a  thread writing to key cache, will pause waiting  until resize finishes. However this thread is won't be woken, because resize does not  signaling waiters anymore. This is a regression introduced in WL#86(segmented MyISAM key cache)
The fix is to unconditionally release  threads waiting on resize_queue when resize  finishes, as in pre-WL#86 code.
2013-07-09 22:24:57 +02:00
Georgi Kodinov
3b4bc33d93 merge back to the 5.5 tree and fix indentation 2013-06-28 17:13:44 +03:00
Georgi Kodinov
1827eb8a2a Bug #16996656: UNIQUE OPTION PREFIXES NOT DEPRECATED IN 5.5+
Backported the deprecation warnings from WL#6978 to 5.5
2013-06-26 12:19:02 +03:00
Vladislav Vaintroub
be06b886a2 MDEV-4503 : Installation fails if TEMP directory contains "~" subdirectory.
Remove special handling for ~ in the middle of the path  in cleanup_dir_name() - according to Monty, this was ancient code that tried to emulate Emacs behavior
2013-06-17 19:18:14 +02:00
Vladislav Vaintroub
c61c1d7ce1 MDEV-4576 : Aria storage engine's temporary files might not be deleted (Errcode : 13)
See also MySQL Bug #39750  and similar ones.

Fix my_delete() on Windows, to safely remvoe files on Windows, including files  that are opened by another threads in the same process, antiviruses and  backup applications. If file to be deleted is  also  opened by another thread, the file is renamed to unique name prior to deletion - this makes it possible to create file with the same name right after deletion.
With this patch my_delete_allow_opened() becomes obsolete and is replaced with my_delete().

This patch is rework of the patch  http://lists.mysql.com/commits/59327  for MySQL bug#39750.
2013-06-16 22:13:26 +02:00
Vladislav Vaintroub
4b058643cd MDEV-4601 : Allow MariaDB to be build without non-blocking client.
Non-blocking client currently can be build on Windows, GCC on i386 and x64, or any OS wth ucontext.h header. Prior to this patch, build failed if neither of these conditions is true.
Fix to avoid compiler errors in these case - non-blocking API would not be useful on , but otherwise everything will work as before.
2013-06-15 14:22:03 +02:00
Tor Didriksen
c94ccb237e Bug#16729109: FIX COMPILATION WARNINGS WITH GCC 4.8
Backport to 5.5
(external Bug#69407 Build warnings with mysql)


support-files/build-tags:
  Run etags on sql_yacc.yy, ignore other .yy files
unittest/mysys/explain_filename-t.cc:
  NO_PLAN seems to fail on some platforms, use the actual number instead.
2013-06-14 10:52:23 +02:00
Ashish Agarwal
0c4f4ff015 Bug#16194302: SUPPORT FOR FLOATING-POINT SYSTEM VARIABLES
USING THE PLUGIN INTERFACE.

ISSUE: No support for floating-point plugin
       system variables.

SOLUTION: Allowing plugins to define and expose floating-point
          system variables of type double. MYSQL_SYSVAR_DOUBLE
          and MYSQL_THDVAR_DOUBLE are added.

ISSUE: Fractional part of the def, min, max values of system
       variables are ignored.

SOLUTION: Adding functions that are used to store the raw
          representation of a double in the raw bits of unsigned
          longlong in a way that the binary representation
          remains the same.
2013-05-19 23:38:06 +05:30
Sergei Golubchik
b381cf843c mysql-5.5.31 merge 2013-05-07 13:05:09 +02:00
Sergei Golubchik
07315d3603 strmake_buf(X,Y) helper, equivalent to strmake(X,Y,sizeof(X)-1)
with a bit of lame protection against abuse.
2013-04-17 19:42:34 +02:00
Tor Didriksen
c94ca7d9cf Bug#16626742 IN MY_MD5FINAL IN MYSYS/MD5.C, CTX IS NOT PROPERLY ZEROED AS INTENDED
Zero out the entire struct, rather than the first sizeof(void*) bytes.
2013-04-17 09:26:51 +02:00
Sergei Golubchik
2901497b18 MDEV-4243 Warnings/errors while compiling with clang 2013-03-28 20:04:14 +01:00
Sujatha Sivakumar
9a1d651b0e Merge from mysql-5.1 to mysql-5.5 2013-03-28 14:18:51 +05:30
Sujatha Sivakumar
d054027c4b Bug#14324766:PARTIALLY WRITTEN INSERT STATEMENT IN BINLOG
NO ERRORS REPORTED
      
Problem:
=======
Errors from my_b_fill are ignored. MYSQL_BIN_LOG::write_cache
code assumes that 0 returned from my_b_fill always means
end-of-cache, but that is incorrect. It can result in error
and the error is ignored. Other callers of my_b_fill don't
check for error: my_b_copy_to_file, maybe my_b_gets.
      
Fix:
===
An error handler is already present to check the "cache"
error that is reported during "MYSQL_BIN_LOG::write_cache"
call. Hence error handlers are added for "my_b_copy_to_file"
and "my_b_gets".
During my_b_fill() function call, when the cache read fails
info->error= -1 is set. Hence a check for "info->error"
is added for the above to callers upon their return.

mysys/mf_iocache2.c:
  Added a check for "cache->error" and simulation of cache read failure
mysys/my_read.c:
  Simulation of read failure
sql/log_event.cc:
  Added debug simulation
sql/sql_repl.cc:
  Added a check for cache error
2013-03-28 14:14:39 +05:30
Murthy Narkedimilli
8afe262ae5 Fix for Bug 16395495 - OLD FSF ADDRESS IN GPL HEADER 2013-03-19 15:53:48 +01:00
Murthy Narkedimilli
fe85f54640 Bug 16395495 - OLD FSF ADDRESS IN GPL HEADER 2013-03-19 13:29:12 +01:00
Venkatesh Duggirala
0ebb72b508 BUG#11753923-SQL THREAD CRASHES ON DISK FULL
Fixing post push issue
Simulator name used needs to be changed to make it
work properly.

Analysis: 
Debug control list addition (ListAddDel function
dbug.c file) code was written in such a way that
if new element is subset of already existing element,
then the new element is not added.
i.e., set @@global.debug = '+d,abcd', is existing in
the list then you cannot add "a" or "ab" or "abc"
in the list.
2013-03-01 15:01:32 +05:30
Sergei Golubchik
213f1c76a0 5.3->5.5 merge 2013-02-28 22:47:29 +01:00
Sergei Golubchik
c4341d5095 5.2 -> 5.3 2013-02-28 21:48:47 +01:00
Sergei Golubchik
5dec570d7c 5.1 -> 5.2 merge 2013-02-28 19:00:58 +01:00
Sergei Golubchik
8161c6772d merge with mysql-5.5.30 minus few incorrect or not applicable changesets 2013-02-28 18:42:49 +01:00
Sergei Golubchik
08ba257846 mysql-5.1 merge
mysys/errors.c:
  revert upstream's fix. use a much simpler one
mysys/my_write.c:
  revert upstream's fix. use a simpler one
sql/item_xmlfunc.cc:
  useless, but ok
sql/mysqld.cc:
  simplify upstream's fix
storage/heap/hp_delete.c:
  remove upstream's fix.
  we'll use a much less expensive approach.
2013-02-28 09:58:39 +01:00
Murthy Narkedimilli
053d7e775c Updated/added copyright headers. 2013-02-25 15:26:00 +01:00
Vladislav Vaintroub
b3ad9de0c0 MDEV-4194: Fix typo (missing comma) in mysys error messages 2013-02-21 23:20:26 +01:00
Venkata Sidagam
8be7fa51a3 Bug #11752803 SERVER CRASHES IF MAX_CONNECTIONS DECREASED BELOW
CERTAIN LEVEL

Merging from 5.1 to 5.5
2013-01-24 14:13:42 +05:30
Venkata Sidagam
776df0a366 Bug #11752803 SERVER CRASHES IF MAX_CONNECTIONS DECREASED BELOW
CERTAIN LEVEL
      
Problem description: mysqld crashes when we update the max_connections 
variable to lesser value than the number of currently open connections.
      
Analysis: The "alarm_queue.max_elements" size will be decided at the 
server start time and it will get modified if we change max_connections 
value. In the current scenario the value of "alarm_queue.max_elements" 
is decremented when the max_connections is set to 2. When updating the  
"alarm_queue.max_elements" value we are not updating "max_used_alarms" 
value. Hence, instead of getting the warning "thr_alarm queue is full" 
it is ending up in asserting the server at the time of inserting new 
elements in the queue.
      
Fix: the fix is to dynamically increase the size of the alarm_queue.
In order to do that, queue_insert_safe() should be used instead if
queue_insert().
2013-01-24 14:02:54 +05:30
Sergei Golubchik
aca8e7ed6b 5.3 merge 2013-01-15 19:07:46 +01:00
Nisha Gopalakrishnan
d01b5c392c Bug#11757464:SERVER CRASH IN RECURSIVE CALL WHEN OOM
Analysis:
---------

When the server is out of memory, an error is raised
to indicate the same. Handling the error requires
more memory to be allocated which fails, hence the
error handling loops in a recursion and causes the
server to crash.

Fix:
---
a) Prevents pushing the 'out of memory' error condition
to the diagnostic area as it requires memory allocation.
GET DIAGNOSTICS, SHOW WARNINGS and SHOW ERRORS statements
will not show information about this error. However the
'out of memory' error is returned to the client.
b) It sets the ME_FATALERROR flag when 'out of memory' errors
are reported (for places where the flag is not already set).
This flag prevents activation of SP error handlers which also
require memory allocation and therefore are likely to fail.
2013-01-15 15:30:26 +05:30
Sergei Golubchik
4f67a14700 5.2->5.3 merge 2013-01-10 15:40:21 +01:00
Nirbhay Choubey
62d7006f0b Merge of patch for Bug#16066243 from mysql-5.1. 2013-01-07 16:19:06 +05:30
Nirbhay Choubey
e7c2ae94dd Bug#16066243 PB2 FAILURES I_MAIN.BUG15912213 AND
I_MAIN.CTYPE_UTF8 FOR MACOSX10.6 FOR 5.1

Part 2: Fix for test failures on Windows.
2013-01-07 16:16:08 +05:30
Nirbhay Choubey
31a720abbd Merge of patch for bug#16066243 from mysql-5.1. 2013-01-04 16:42:49 +05:30
Nirbhay Choubey
1ef420b8d4 Bug#16066243 PB2 FAILURES I_MAIN.BUG15912213 AND
I_MAIN.CTYPE_UTF8 FOR MACOSX10.6 FOR 5.1

While converting directory name to filename, a
file separator (FN_LIBCHAR) might get appended
to the resulting file name. This can result in
off-by-one error when length of the input string
is equal to FN_REFLEN. In this case, the terminating
'\0' gets written beyond the buffer allocated to store
the result.

Fixed by incrementing the dst buffer size by 1. As
extra safety, switched to strnmov() and added a debug
assert to check the length of the input file name.

No test case added as the scenario is already
covered by the test cases added for bugs in
the description.
2013-01-04 16:38:12 +05:30
Venkatesh Duggirala
ce7e7a99a0 BUG#11753923-SQL THREAD CRASHES ON DISK FULL
Merging fix from mysql-5.1
2013-01-02 18:32:38 +05:30
Venkatesh Duggirala
3932392030 BUG#11753923-SQL THREAD CRASHES ON DISK FULL
Problem:If Disk becomes full while writing into the binlog,
then the server instance hangs till someone frees the space.
After user frees up the disk space, mysql server crashes
with an assert (m_status != DA_EMPTY)

Analysis: wait_for_free_space is being called in an
infinite loop i.e., server instance will hang until
someone frees up the space. So there is no need to
set status bit in diagnostic area.

Fix: Replace my_error/my_printf_error with
sql_print_warning() which prints the warning in error log.

include/my_sys.h:
  Provision to call sql_print_warning from mysys files
mysys/errors.c:
  Replace my_error/my_printf_error with
  sql_print_warning() which prints the warning in error log.
mysys/my_error.c:
  implementation of my_printf_warning
mysys/my_write.c:
  Adding logic to break infinite loop in the simulation
sql/mysqld.cc:
  Provision to call sql_print_warning from mysys files
2013-01-02 16:31:58 +05:30
Vladislav Vaintroub
77b4290b28 merge 2012-12-21 14:04:25 +01:00
Ahmad Abdullateef
b12fe50226 BUG#14727815 - CRASH IN PTHREAD_RWLOCK_WRLOCK/SRW_UNLOCK
IN QUERY CACHE CODE

DESCRIPTION:
MySQL Server crashes sporadically when Query Caching is on and
the server has high contention among clients. 


ANALYSIS :

Scenario 1:
In Query_cache::move_by_type() when handling RESULT or its related blocks,
Write Lock is acquired on its parent Query block. However the next and prev
pointers are cached in local variables before lock acquisition. In an extremely
high contention scenario there exists a possibility that
Query_cache::append_result_data() is operating on the same query block
and as a consequence might append a new Result block to the end of Result
blocks Linked List of the Query. This would manipulate the next, prev pointers
of the Block being processed in move_by_type(), however the local pointers
still point to previous nodes there by causing Data Corruption leading to crash.

Scenario 2:
In Windows SDK "BOOL" is typedefed as "int" and BOOLEAN is typedefed as
"usigned char". The function pointer definition "srw_bool_func" mistakenly uses 
BOOL instead of BOOLEAN thereby virtually making the function 
my_TryAcquireSRWLockExclusive() always succeed because only the LSB of EAX
has the actual result of the call, however due to type mismatch all bytes of EAX
are used for evaluation. Again during high contention scenarios in 
Query_cache::free_old_query() calls try_lock_writing() on a Query, this call 
always succeeds and the query is freed, even though it is used by some other
thread, in this case Query_cache::send_result_to_client() was using it and the
code causes a crash because it accessed free or reallocated memory.

FIX :

Scenario 1:
The next, prev pointers are now accessed only after Lock acquisition in 
Query_cache::move_by_type().

Scenario 2:
In the definition of "srw_bool_func" BOOL has been replaced with "BOOLEAN"
2012-12-18 22:16:12 +05:30
Ravinder Thakur
2d16c5bd4b bug#11761752: DO NOT ALLOW USE OF ALTERNATE DATA STREAMS ON NTFS FILESYSTEM.
File names with colon are being disallowed because of the Alternate Data 
Stream (ADS) feature of NTFS that could be misused. ADS allows data to be 
written to alternate streams of a normal file. The data in alternate 
streams cannot be seen by normal tools on Windows (explorer, cmd.exe). As 
a result someone can use this feature to hide large amount of data in 
alternate streams and admins will have no easy way of figuring out the 
files that are using that disk space. The fix also disallows ADS in the 
scenarios where file name is passed as some dynamic variable.

An important thing about the fix is that it DOES NOT disallow ADS file 
names if they are not dynamic (i.e. if the file is created by using some 
option that needs local access to the MySQL server, for example error log
file). The reasoning is that if some MySQL option related to files 
requires access to the local machine (it is not dynamic), then user can very 
well create data in ADS by some other means. This fixes only those scenarios 
which can allow users to create data in ADS over the wire.

File names with colon are being disallowed only on Windows. UNIX 
(Linux in particular) supports NTFS, but it will not be a common 
scenario for someone to configure a NTFS file system to store MySQL 
data on Linux.

Changes in file bug11761752-master.opt are needed due to 
bug number 15937938.
2012-12-13 20:33:44 +05:30
Ravinder Thakur
e604bb8a03 Merging from 5.1 to 5.5 for bug#11761752 2012-12-13 20:58:09 +05:30
Vladislav Vaintroub
c4b35f9279 MDEV-3918: myisamchk bogus error for files larger than 4GB.
The failure is caused by failing stat() call . C Runtime function stat() uses old struct with 32bit st_size member,
and since Visual Studio 2010 , it returns an error on st_size overflow (i.e on files larger than 4GB)

Fix replaces stat() by my_stat(), the later is backed by 64bit-able stat64().
2012-12-06 00:37:06 +01:00