Commit graph

8371 commits

Author SHA1 Message Date
iangilfillan
f0ec34002a Correct FSF address 2017-03-10 18:21:29 +01:00
Sergei Golubchik
3d06f0f72c MDEV-11942 BLACKHOLE is no longer active in 10.1 by default, mysql_upgrade not handling the situation
fix the patch. add tests
2017-03-10 18:21:25 +01:00
Hartmut Holzgraefe
c372388e48 make mysql_upgrade try to install missing storage engine plugins (MDEV-11942) 2017-03-10 18:21:24 +01:00
Ramil Kalimullin
060b1eadf4 BUG#25575605: SETTING --SSL-MODE=REQUIRED SENDS CREDENTIALS BEFORE VERIFYING SSL CONNECTION
MYSQL_OPT_SSL_MODE option introduced.
It is set in case of --ssl-mode=REQUIRED and permits only SSL connection.

(cherry picked from commit 3b2d28578c526f347f5cfe763681eff365731f99)
2017-03-10 14:11:26 +05:30
Ramil Kalimullin
2531c8dcd1 BUG#25575605: SETTING --SSL-MODE=REQUIRED SENDS CREDENTIALS BEFORE VERIFYING SSL CONNECTION
MYSQL_OPT_SSL_MODE option introduced.
It is set in case of --ssl-mode=REQUIRED and permits only SSL connection.
2017-03-10 01:19:50 +04:00
Marko Mäkelä
ad0c218a44 Merge 10.0 into 10.1
Also, implement MDEV-11027 a little differently from 5.5 and 10.0:

recv_apply_hashed_log_recs(): Change the return type back to void
(DB_SUCCESS was always returned).

Report progress also via systemd using sd_notifyf().
2017-03-09 08:53:08 +02:00
klemens
7be541f281 spelling fixes 2017-03-07 13:38:06 +04:00
Vicențiu Ciorbaru
c4f3e64c23 Merge branch 'bb-10.0-vicentiu' into 10.0 2017-03-06 21:50:42 +02:00
Marko Mäkelä
adc91387e3 Merge 10.0 into 10.1 2017-03-03 13:27:12 +02:00
Vicențiu Ciorbaru
1acfa942ed Merge branch '5.5' into 10.0 2017-03-03 01:37:54 +02:00
Daniel Black
0af8b565f2 MDEV-11610: mysqladmin flush-X-log options
Add the following options to mysqladmin

+  flush-binary-log        Flush binary log
+  flush-engine-log        Flush engine log(s)
+  flush-error-log         Flush error log
+  flush-general-log       Flush general log
+  flush-relay-log         Flush relay log
+  flush-user-resources    Flush user resources
2017-03-02 15:16:00 +04:00
Daniel Black
33c1f20d8e MDEV-11610: Add --local to mysqladmin 2017-03-02 15:09:24 +04:00
Vladislav Vaintroub
d4baeca441 Windows : Fix server compile errors when compile with /Zc:strictStrings option 2017-02-28 12:57:33 +00:00
Sergei Golubchik
44534487d4 MDEV-11505 wrong databasename in mysqldump comment
fix_for_comment() uses a static buffer. cannot have two
fix_for_comment() calls as arguments to one printf().
2017-02-27 12:35:10 +01:00
Marko Mäkelä
2e67e66c3a Merge 10.0 into 10.1 2017-02-08 08:53:34 +02:00
Elena Stepanova
923d7d0ad2 Set sys_errno upon exec command 2017-02-01 02:12:55 +02:00
Vicențiu Ciorbaru
8e15768731 Merge branch '10.0' into 10.1 2017-01-16 03:18:14 +02:00
vicentiu
e9aed131ea Merge remote-tracking branch 'origin/5.5' into 10.0 2017-01-06 17:09:59 +02:00
Marko Mäkelä
0c1de94db6 Merge 10.0 into 10.1 2017-01-04 13:56:11 +02:00
Elena Stepanova
e5d7fc967e MDEV-10100 main.pool_of_threads fails sporadically in buildbot
Backport the fix to 5.5, because it fails there too

The patch fixes two test failures:
- on slow builders, sometimes a connection attempt which should
  fail due to the exceeded number of thread_pool_max_threads
  actually succeeds;
- on even slow builders, MTR sometimes cannot establish the
  initial connection, and check-testcase fails prior to the
  test start

The problem with check-testcase was caused by connect-timeout=2
which was set for all clients in the test config file. On slow
builders it might be not enough.
There is no way to override it for the pre-test check, so it needed
to be substantially increased or removed.

The other problem was caused by a race condition between sleeps
that the test performs in existing connections and the connect
timeout for the connection attempt which was expected to fail.
If sleeps finished before the connect-timeout was exceeded, it
would allow the connection to succeed.

To solve each problem without making the other one worse,
connect-timeout should be configured dynamically during the test.
Due to the nature of the test (all connections must be busy
at the moment when we need to change the timeout, and cannot execute
SET GLOBAL ...), it needs to be done independently from the server.

The solution:
- recognize 'connect_timeout' as a connection option in mysqltest's
  "connect" command;
- remove connect-timeout from the test configuration file;
- use the new connect_timeout option for those connections which
  are expected to fail;
- re-arrange the test flow to allow running a huge SLEEP
  without affecting the test execution time (because it would be
  interrupted after the main test flow is finished).

The test is still subject to false negatives, e.g. if the connection
fails due to timeout rather than due to the exceeded number of
allowed threads, or if the connection on extra port succeeds due
to a race condition and not because the special logic for the extra
port. But those false negatives have always been possible there
on slow builders, they should not be critical because faster builders
should catch such failures if they appear.

Conflicts:
	client/mysqltest.cc
	mysql-test/r/pool_of_threads.result
	mysql-test/t/pool_of_threads.test
2017-01-04 13:03:30 +02:00
Elena Stepanova
3871477c40 MDEV-10100 main.pool_of_threads fails sporadically in buildbot
The patch fixes two test failures:
- on slow builders, sometimes a connection attempt which should
  fail due to the exceeded number of thread_pool_max_threads
  actually succeeds;
- on even slow builders, MTR sometimes cannot establish the
  initial connection, and check-testcase fails prior to the
  test start

The problem with check-testcase was caused by connect-timeout=2
which was set for all clients in the test config file. On slow
builders it might be not enough.
There is no way to override it for the pre-test check, so it needed
to be substantially increased or removed.

The other problem was caused by a race condition between sleeps
that the test performs in existing connections and the connect
timeout for the connection attempt which was expected to fail.
If sleeps finished before the connect-timeout was exceeded, it
would allow the connection to succeed.

To solve each problem without making the other one worse,
connect-timeout should be configured dynamically during the test.
Due to the nature of the test (all connections must be busy
at the moment when we need to change the timeout, and cannot execute
SET GLOBAL ...), it needs to be done independently from the server.

The solution:
- recognize 'connect_timeout' as a connection option in mysqltest's
  "connect" command;
- remove connect-timeout from the test configuration file;
- use the new connect_timeout option for those connections which
  are expected to fail;
- re-arrange the test flow to allow running a huge SLEEP
  without affecting the test execution time (because it would be
  interrupted after the main test flow is finished).

The test is still subject to false negatives, e.g. if the connection
fails due to timeout rather than due to the exceeded number of
allowed threads, or if the connection on extra port succeeds due
to a race condition and not because the special logic for the extra
port. But those false negatives have always been possible there
on slow builders, they should not be critical because faster builders
should catch such failures if they appear.
2017-01-01 20:06:03 +02:00
Sergei Golubchik
9fefe97336 Merge branch 'mysql/5.5' into 5.5 2016-12-22 12:49:06 +01:00
Sergei Golubchik
2f20d297f8 Merge branch '10.0' into 10.1 2016-12-11 09:53:42 +01:00
Sergei Golubchik
3e8155c637 Merge branch '5.5' into 10.0 2016-12-09 16:33:48 +01:00
Sergei Golubchik
b5aa0f437f MDEV-11319 mysqlbinlog crashes or fails with out of memory while reading some encrypted binlogs
support encrypted binlogs. Not decryption, but at least recognizing
that event are encrypted and prining them as such
2016-12-06 09:45:50 +01:00
Sergei Golubchik
a98c85bb50 Merge branch '10.0-galera' into 10.1 2016-11-02 13:44:07 +01:00
Nirbhay Choubey
5db2195a35 Merge tag 'mariadb-10.0.28' into 10.0-galera 2016-10-28 15:50:13 -04:00
Vladislav Vaintroub
aec43216c8 MDEV-9409 Windows - workaround VS2015 CRT bug that makes
mysqldump/mysql_install_db.exe fail

The bug is described in
https://connect.microsoft.com/VisualStudio/Feedback/Details/1902345

When reading from a pipe in text mode, using CRT function such as fread(),
some newlines may be lost. Workaround is to use binary mode on reading side
and if necessary, replace \r\n with \n.
2016-10-27 19:45:44 +00:00
Sergei Golubchik
12c3e16dfa Merge branch '5.5' into 10.0 2016-10-25 16:41:43 +02:00
Sergei Golubchik
5a43a31ee8 mysqldump: comments and identifiers with new lines
don't let identifiers with new lines to break a comment
2016-10-14 01:12:04 +02:00
Sergei Golubchik
01b39b7b07 mysqltest: don't eat new lines in --exec
pass them through as is
2016-10-14 01:12:04 +02:00
Sergei Golubchik
383007c75d mysql cli: fix USE command quoting
* use proper sql quoting rules for USE, while preserving
  as much of historical behavior as possible
* short commands (\u) behave as before
2016-10-13 21:38:32 +02:00
Georgi Kodinov
0d43e570ba Bug #24496214: MISLEADING ERROR EXECUTING MYSQLADMIN SHUTDOWN AGAINST A SERVER
RUNNING FIREWALL

mysqladmin shutdown will try to extract the server's pid file before executing
the actual shutdown command.
It will do that by executing a SHOW VARIABLES query and processing the result.
However if that query fails it print a (somewhat confusing) error mesasage
and will still continue to do the shutdown command.
If that passes then the mysqladmin user will get an error but the shutdown will
still be successful.
This is confusing so the error message text is changed to say that this is a
non-fatal error and execution continues.
No test case added since it'd require a selective query failure device that's
not available in 5.5.
2016-09-08 18:12:02 +03:00
Sergei Golubchik
6b1863b830 Merge branch '10.0' into 10.1 2016-08-25 12:40:09 +02:00
Nirbhay Choubey
c309e99ff9 Merge branch '10.0' into 10.0-galera 2016-08-24 19:30:32 -04:00
Monty
b51109693e MDEV-10630 rpl.rpl_mdev6020 fails in buildbot with timeout
The issue was that when running with valgrind the wait for master_pos_Wait()
was not long enough.

This patch also fixes two other failures that could affect rpl_mdev6020:
- check_if_conflicting_replication_locks() didn't properly check domains
- 'did_mark_start_commit' was after signals to other threads was sent which could
  get the variable read too early.
2016-08-22 10:16:00 +03:00
Sergei Golubchik
309c08c17c Merge branch '5.5' into 10.0 2016-08-10 19:19:05 +02:00
Sergei Golubchik
a3f642415a MDEV-6128:[PATCH] mysqlcheck wrongly escapes '.' in table names
a correct fix:
* store properly quoted table names in tables4repair/etc lists
* tell handle_request_for_tables whether the name is aalready properly quoted
* test cases for all uses of fix_table_name()
2016-08-08 21:27:30 +02:00
Neha Kumari
22eec68941 Bug#23540182:MYSQLBINLOG DOES NOT FREE THE EXISTING CONNECTION BEFORE OPENING NEW REMOTE ONE
It happens when you are trying to read two or more log files from a
remote server using mysqlbinlog utility.

The reason for this is no matching mysql_close() that concludes the
life time of 'mysql' struct describing connection to the server.
This happens when mysqlbinlog is invoked with connecting to the server
and requesting more than one binlog file. In such case
dump_remote_log_entries() keeps calling safe_connect() per eachfile,
never caring to invoke mysql_close(). Only the final safe_connect()'s
allocation effect are cleaned by the base code.
That is with 2 files there's one 'mysql' connection descriptor struct
uncleaned/deallocated.

We are backporting the bug 21255763 (pushed in mysql-trunk)
in the earlier version of MySQL starting from 5.5 to 5.7.
which was pushed in mysql-trunk.

Fix:
Invoke mysql_close() just before mysql_init() in safe_connect()
defined in mysqlbinlog.cc. That makes possibly previously used 'mysql' be
reclaimed prior a new one is allocated.
2016-08-05 12:17:11 +05:30
Sergei Golubchik
a350e53b61 Merge branch 'mysql/5.5' into 5.5
without a fix for Bug#12818255 (MDEV-6581)
2016-08-03 20:38:25 +02:00
Sergei Golubchik
3361aee591 Merge branch '10.0' into 10.1 2016-06-28 22:01:55 +02:00
Nirbhay Choubey
14d62505d9 Merge tag 'mariadb-10.0.26' into 10.0-galera 2016-06-24 12:01:22 -04:00
Sergei Golubchik
c081c978a2 Merge branch '5.5' into bb-10.0 2016-06-21 14:11:02 +02:00
Sergei Golubchik
a482e76e65 fix a mysql-5.5.50 merge: mysqlcheck
quote identifiers correctly
2016-06-20 16:12:54 +02:00
Sergei Golubchik
ae29ea2d86 Merge branch 'mysql/5.5' into 5.5 2016-06-14 13:55:28 +02:00
Dan Ungureanu
3c77a00d55 MDEV-8012: Wrong exit code when asking for help
`--help` is a perfectly valid parameter and both `mysqladmin` and
`mysql_waitpid` should exit with success (zero errror code).

Signed-off-by: Vicențiu Ciorbaru <vicentiu@mariadb.org>
2016-06-12 22:47:18 +03:00
Vladislav Vaintroub
7adf04e237 MDEV-9366 : do_shutdown_server fails to detect server shutdown on Windows.
Fix test whether process is alive in mysqltest.

Also fix SHUT_RD definition on Windows to be SD_RECEIVE.
SD_BOTH  was used instead prior to this patch, and this would
occasionally make mysql_shutdown()  fail - when the socket for the current connection
is not able send the COM_SHUTDOWN response anymore.
2016-06-08 17:13:49 +00:00
Arun Kuruvila
df0d8efaf2 Bug#23035296: MAIN.MYSQLDUMP FAILS BECUASE OF UNEXPECTED
ERROR MESSAGE

Post push patch to fix test case failure.
2016-06-03 12:50:23 +05:30
Arun Kuruvila
96d90250c6 Bug#23035296: MAIN.MYSQLDUMP FAILS BECUASE OF UNEXPECTED
ERROR MESSAGE

Post push patch to fix test case failure.
2016-06-02 15:02:46 +05:30
Arun Kuruvila
5dc6a77b40 Bug#23035296: MAIN.MYSQLDUMP FAILS BECUASE OF UNEXPECTED
ERROR MESSAGE

Description:- Mtr test, "main.mysqldump" is failing with an
assert when "mysqlimport" client utility is executed with
the option "--use_threads".

Analysis:- "mysqlimport" uses the option, "--use_threads",
to spawn worker threads to complete its job in parallel. But
currently the main thread is not waiting for the worker
threads to complete its cleanup, rather just wait for the
worker threads to say its done doing its job. So the cleanup
is done in a race between the worker threads and the main
thread. This lead to an assertion failure.

Fix:- "my_thread_join()" is introduced in the main thread to
join all the worker threads it have spawned. This will let
the main thread to wait for all the worker threads to
complete its cleanup before calling "my_end()".
2016-05-30 15:20:08 +05:30
Shishir Jaiswal
9d72fb4af0 Bug#21977380 - POSSIBLE BUFFER OVERFLOW ISSUES
DESCRIPTION
===========
Buffer overflow is reported in a lot of code sections
spanning across server, client programs, Regex libraries
etc. If not handled appropriately, they can cause abnormal
behaviour.

ANALYSIS
========
The reported casea are the ones which are likely to result
in SEGFAULT, MEMORY LEAK etc.

FIX
===
- sprintf() has been replaced by my_snprintf() to avoid
buffer overflow.
- my_free() is done after checking if the pointer isn't
  NULL already and setting it to NULL thereafter at few
  places.
- Buffer is ensured to be large enough to hold the data.
- 'unsigned int' (aka 'uint') is replaced with 'size_t'
to avoid wraparound.
- Memory is freed (if not done so) after its alloced and
used.
- Inserted assert() for size check in InnoDb memcached
code (from 5.6 onwards)
- Other minor changes

(cherry picked from commit 3487e20959c940cbd24429afa795ebfc8a01e94f)
2016-05-16 11:33:57 +02:00
Shishir Jaiswal
cb29741568 Bug#21977380 - POSSIBLE BUFFER OVERFLOW ISSUES
DESCRIPTION
===========
Buffer overflow is reported in a lot of code sections
spanning across server, client programs, Regex libraries
etc. If not handled appropriately, they can cause abnormal
behaviour.

ANALYSIS
========
The reported casea are the ones which are likely to result
in SEGFAULT, MEMORY LEAK etc.

FIX
===
- sprintf() has been replaced by my_snprintf() to avoid
buffer overflow.
- my_free() is done after checking if the pointer isn't
  NULL already and setting it to NULL thereafter at few
  places.
- Buffer is ensured to be large enough to hold the data.
- 'unsigned int' (aka 'uint') is replaced with 'size_t'
to avoid wraparound.
- Memory is freed (if not done so) after its alloced and
used.
- Inserted assert() for size check in InnoDb memcached
code (from 5.6 onwards)
- Other minor changes
2016-05-16 13:46:49 +05:30
Sergei Golubchik
87e3e67f43 Merge branch '10.0' into 10.1 2016-05-04 15:23:26 +02:00
Nirbhay Choubey
8a1efa1bdd Merge branch '10.0' into 10.0-galera 2016-04-29 16:50:58 -04:00
Harin Vadodaria
6768f80c0b Bug#21973610
Post push fix : Fixing i_main.mysqlshow failure.
2016-04-29 11:06:41 +05:30
Alexey Botchkov
47e0717806 MDEV-9792 Backport MDEV-8713 to 10.1. 2016-04-27 11:08:46 +04:00
Sergei Golubchik
872649c7ba Merge branch '5.5' into 10.0 2016-04-26 23:05:26 +02:00
Alexey Botchkov
44554d6111 MDEV-9605 mysqlbinlog does not accept ssl-ca option as expected.
Added SSL support to the mysqlbinlog.
2016-04-26 14:37:19 +04:00
Sergey Vojtovich
0ea4c73dae Fixed compilation failure due to unused var. 2016-04-23 12:15:18 +04:00
Sergei Golubchik
b069d19284 Merge branch 'mysql/5.5' into 5.5 2016-04-20 15:25:55 +02:00
Sergei Golubchik
ce355304e6 MDEV-9885 Client doesn't start if 'TERM' unknown
1. don't exit if setupterm() failed
2. don't use vidattr() if setupterm() failed
2016-04-19 11:27:00 +02:00
Sergei Golubchik
3b0c7ac1f9 Merge branch '10.0' into 10.1 2016-03-21 13:02:53 +01:00
Sergei Golubchik
98ea806207 Merge branch '5.5' into 10.0 2016-03-21 11:54:45 +01:00
Sergei Golubchik
0b9fb9aea9 MDEV-9568 mysqlcheck crashes with nonexistent table name
remove erroneous free() call
2016-03-17 11:04:40 +01:00
iangilfillan
6befd84202 Update AskMonty and Atlassian references to MariaDB 2016-03-08 15:24:01 +02:00
Otto Kekäläinen
1777fd5f55 Fix spelling: occurred, execute, which etc 2016-03-04 02:09:37 +02:00
Nirbhay Choubey
0d58323e26 Merge tag 'mariadb-10.0.24' into 10.0-galera 2016-02-23 20:53:29 -05:00
Sergei Golubchik
a5679af1b1 Merge branch '10.0' into 10.1 2016-02-23 21:35:05 +01:00
Ramil Kalimullin
b3e9211e48 WL#9072: Backport WL#8785 to 5.5 2016-02-19 23:31:10 +04:00
Sergei Golubchik
271fed4106 Merge branch '5.5' into 10.0 2016-02-15 22:50:59 +01:00
Sergei Golubchik
5a0f2f5ea8 MDEV-9149 Ctrl-C in MySQL client does not interrupt query, but interrupts the session instead
mysql.cc:
Unlike the main MYSQL structure, kill_mysql did not have MYSQL_OPT_PROTOCOL set.

Move all connection-related settings to a separate function and
use it both for the main MYSQL and for kill_mysql.
2016-02-15 13:02:21 +01:00
Vicențiu Ciorbaru
2a47817896 MDEV-9225 mysql_upgrade segfault due to missing /etc/my.cnf.d
In case of missing includedir file, we would attempt to free a NULL
pointer. Make sure to guard against that.
2016-02-14 18:33:20 +02:00
Sergei Golubchik
c4cb240061 MDEV-9024 Build fails with VS2015
cherry-pick f1daf9ce from 10.0 branch
-------------------------------------

Fix build failures caused by new C runtime library
- isnan, snprintf, struct timespec are now defined, attempt to
redefine them leads
- P_tmpdir, tzname are no more defined
-  lfind() and lsearch() in lf_hash.c had to be renamed,  declaration
conflicts with some C runtime functions with the same name declared in
a header included by stdlib.h

 Also fix couple of annoying warnings :
- remove #define NOMINMAX from config.h to avoid "redefined" compiler
warnings(NOMINMAX is already in compile flags)

- disable incremental linker in Debug as well (feature not used much
and compiler crashes often)

Also simplify package building with Wix, require Wix 3.9 or later
(VS2015 is not compatible with old Wix 3.5/3.6)
2016-02-06 22:41:58 +01:00
Sergei Golubchik
ad94790f46 MDEV-9453 mysql_upgrade.exe error when mysql is migrated to mariadb
mysqlcheck tool can be used even if opt_systables_only is true
(to upgrade views from mysql - that overrides opt_systables_only)
2016-02-06 11:45:23 +01:00
Sergei Golubchik
f4faac4d6a Merge branch '10.0' into 10.1 2016-01-25 22:58:57 +01:00
Vladislav Vaintroub
3730d8a225 MDEV-9366 : do_shutdown_server fails to detect server shutdown on Windows.
Fix test whether process is alive in mysqltest.

Also fix SHUT_RD definition on Windows to be SD_RECEIVE.
SD_BOTH  was used instead prior to this patch, and this would
occasionally make mysql_shutdown()  fail - when the socket for the current connection
is not able send the COM_SHUTDOWN response anymore.
2016-01-07 17:27:08 +01:00
Sergei Golubchik
a2bcee626d Merge branch '10.0' into 10.1 2015-12-21 21:24:22 +01:00
Nirbhay Choubey
dad555a09c Merge tag 'mariadb-10.0.23' into 10.0-galera 2015-12-19 14:24:38 -05:00
Daniel Black
3b9423fda2 MDEV-7384: Add --persistent option for mysqlcheck
10.0 has an "analyze table .. persistent for all" syntax. This adds
--persistent to mysqlcheck(mysqlanalyize) to perform this extended
analyze table option.

Signed-off-by: Vicențiu Ciorbaru <vicentiu@mariadb.org>
2015-12-18 21:59:47 +02:00
Sergei Golubchik
1623995158 Merge branch '5.5' into 10.0 2015-12-13 00:10:40 +01:00
Sergei Golubchik
1a72c6fefd Merge branch 'bb-5.5-serg' into 5.5 2015-12-09 11:51:59 +01:00
Sergei Golubchik
abf9d35213 Merge branch 'mysql/5.5' into 5.5 2015-12-09 10:00:49 +01:00
Sergey Vojtovich
dac3149f3f MDEV-9001 - [PATCH] Fix DB name quoting in mysqldump --routine
Removed unused variable.
2015-12-08 17:21:07 +04:00
Sergei Golubchik
50a796dcba MDEV-8825 mysql_upgrade leaks the admin password when it spawns a shell process to execute mysqlcheck
don't put common arguments on the command-line,
use a config file instead
2015-12-08 10:16:41 +01:00
Sergei Golubchik
c21b927145 mysql_upgrade cleanup 2015-12-08 10:13:13 +01:00
Sergey Vojtovich
9f07c6b383 MDEV-9001 - [PATCH] Fix DB name quoting in mysqldump --routine
mysqldump --routine fails to dump databases containing backslash ("\")
character. This happened because escaped database name was being used as an
identifier while changing current database. Such identifers are not supposed
to be escaped, they must be properly quoted instead.
2015-12-03 16:33:50 +04:00
Monty
c3018b0ff4 Fixes to get all test to run on MacosX Lion 10.7
This includes fixing all utilities to not have any memory leaks,
as safemalloc warnings stopped tests from passing on MacOSX.

- Ensure that all clients takes character-set-dir, as the
  libmysqlclient library will use it.
- mysql-test-run now passes character-set-dir to all external clients.
- Changed dynstr_free() so that it can be called twice (made freeing code easier)
- Changed rpl_global_gtid_slave_state to be allocated dynamicly as it
  includes a mutex that needs to be initizlied/destroyed before my_end() is called.
- Removed rpl_slave_state::init() and rpl_slave_stage::deinit() as
  their job are better handling by constructor and delete.
- Print alias instead of table_name in check_duplicate_key as
  table_name may have been converted to lower case.

Other things:
- Fixed a case in time_to_datetime_with_warn() where we where
  using && instead of & in tests
2015-11-29 17:51:23 +02:00
Sergei Golubchik
beded7d9c9 Merge branch '10.0' into 10.1 2015-11-19 15:52:14 +01:00
Oleksandr Byelkin
19d99faf1e MDEV-8734 mysqlbinlog --start-position isn't bigint
fix it only for local operations.
2015-11-17 14:42:21 +01:00
Elena Stepanova
2828c2be55 MDEV-9124 mysqldump does not dump data if table name is same as view earlier on
While querying INFORMATION SCHEMA, check for a table's engine
only used table name, but not schema name; so, if there were different
rows with the same table name, a wrong one could be retrieved.
The result of the check affected the decision whether the contents
of the table should be dumped, and whether a DELAYED option can be used.
Fixed by adding a clause for table_schema to the query.
2015-11-13 03:23:22 +02:00
Vladislav Vaintroub
f1daf9ced4 MDEV-9024 Build fails with VS2015
Fix build failures caused by new C runtime library
- isnan, snprintf, struct timespec are now defined, attempt to
redefine them leads
- P_tmpdir, tzname are no more defined
-  lfind() and lsearch() in lf_hash.c had to be renamed,  declaration
conflicts with some C runtime functions with the same name declared in
a header included by stdlib.h

 Also fix couple of annoying warnings :
- remove #define NOMINMAX from config.h to avoid "redefined" compiler
warnings(NOMINMAX is already in compile flags)

- disable incremental linker in Debug as well (feature not used much
and compiler crashes often)


Also simplify package building with Wix, require Wix 3.9 or later
(VS2015 is not compatible with old Wix 3.5/3.6)
2015-11-06 17:27:24 +01:00
Harin Vadodaria
0dbd5a8797 Bug#21973610: BUFFER OVERFLOW ISSUES
Description : Incorrect usage of sprintf/strcpy caused
              possible buffer overflow issues at various
              places.

Solution : - Fixed mysql_plugin and mysqlshow
           - Fixed regex library issues

Reviewed-By : Georgi Kodinov <georgi.kodinov@oracle.com>
Reviewed-By : Venkata S Murthy Sidagam <venkata.sidagam@oracle.com>
2015-11-06 16:41:55 +05:30
Nirbhay Choubey
4d15112962 Merge tag 'mariadb-10.0.22' into 10.0-galera 2015-10-31 18:07:02 -04:00
Shishir Jaiswal
1942506b82 DESCRIPTION
===========
When doing an upgrade, you execute mysql_upgrade. If
mysql_upgrade fails to connect or it connects with a user
without the proper privileges, it will return the error:

    FATAL ERROR: Upgrade failed

which is not very informative.

ANALYSIS
========

In main() and check_version_match(), the condition for
errors are clubbed together and throw the same error msg.
The functions need to be splitted up and the corresponding
error msgs have to be displayed.

FIX
===
Splitted the functions and added the specific error msg.
2015-10-29 13:35:32 +05:30
Michael Widenius
18f7dfed17 Allow mysql_upgrade to enable event after table is corrected
new features:
set event_scheduler=ON|OFF will now try to init event scheduler
if it's not enabled
set event_scheduler=default will try to enable it based on
the value of the event_scheduler when mysqld was started
2015-10-21 16:31:11 +03:00
Arun Kuruvila
a86191c69c Bug #21235226 : THE --ENABLE-CLEARTEXT-PLUGIN IS NOT
IMPLEMENTED IN ALL CLIENT PROGRAMS

Description: Option "enable-cleartext-plugin" is not
available for the following client utilities:-
mysqldump
mysqlimport
mysqlshow
mysqlcheck

Analysis: The unavailability of this option limits the
features like PAM authentication from using the above
mentioned utilities.

Fix: Option "enable-cleartext-plugin" is implemented in the
above mentioned client utilities.
2015-10-14 12:00:39 +05:30
Sergei Golubchik
dfb74dea30 Merge branch '10.0' into 10.1 2015-10-12 00:37:58 +02:00
Sergei Golubchik
cfeedbfd3e Merge branch '5.5' into 10.0 2015-10-09 17:12:26 +02:00
Sergei Golubchik
16c4b3c68b fixes for buildbot:
* OSX (mysqlimport freeing unallocated memory)
* Windows (didn't compile MSI)
* fulltest2 (innodb crashes in --embedded --big)
2015-10-09 16:43:59 +02:00
Sergei Golubchik
82e9f6d948 Merge remote-tracking branch 'mysql/5.5' into 5.5 2015-10-08 22:54:24 +02:00
Sergei Golubchik
b85a00161e MDEV-8264 encryption for binlog
* Start_encryption_log_event
* --encrypt-binlog command line option

based on google patches.
2015-09-04 10:33:55 +02:00
Sergei Golubchik
5018a6606f cleanup: Log_event::read_log_event()
There are three Log_event::read_log_event() methods:
1. read the event image from IO_CACHE into String
2. create Log_event from the in-memory event image
3. read the event image from IO_CACHE and create Log_event

The 3rd was reading event image into memory and invoking the 2nd to
create Log_event. Now the 3rd also uses the 1st to read the event image
from IO_CACHE into memory, instead of duplicating its functionality.
2015-09-04 10:33:50 +02:00
Sergei Golubchik
530a6e7481 Merge branch '10.0' into 10.1
referenced_by_foreign_key2(), needed for InnoDB to compile,
was taken from 10.0-galera
2015-09-03 12:58:41 +02:00
Monty
4f0255cbf9 Fixed errors and bugs found by valgrind:
- If run with valgrind, mysqltest will now wait longer when syncronizing slave with master
- Ensure that we wait with cleanup() until slave thread has stopped.
- Added signal_thd_deleted() to signal close_connections() that all THD's has been freed.
- Check in handle_fatal_signal() that we don't use variables that has been freed.
- Increased some timeouts when run with --valgrind

Other things:
- Fixed wrong test in one_thread_per_connection_end() if galera is used.
- Removed not needed calls to THD_CHECK_SENTRY() when we are calling 'delete thd'.
2015-09-01 18:42:02 +03:00
Nirbhay Choubey
91acc8b16f Merge tag 'mariadb-10.0.21' into 10.0-galera 2015-08-08 14:21:22 -04:00
Sergei Golubchik
928edb5a91 Merge branch '5.5' into 10.0
5.5 without InnoDB/XtraDB changes
2015-08-05 09:45:17 +02:00
Jan Lindström
9a5787db51 Merge commit '96badb16afcf' into 10.0
Conflicts:
	client/mysql_upgrade.c
	mysql-test/r/func_misc.result
	mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
	mysql-test/suite/innodb/r/innodb-fk.result
	mysql-test/t/subselect_sj_mat.test
	sql/item.cc
	sql/item_func.cc
	sql/log.cc
	sql/log_event.cc
	sql/rpl_utility.cc
	sql/slave.cc
	sql/sql_class.cc
	sql/sql_class.h
	sql/sql_select.cc
	storage/innobase/dict/dict0crea.c
	storage/innobase/dict/dict0dict.c
	storage/innobase/handler/ha_innodb.cc
	storage/xtradb/dict/dict0crea.c
	storage/xtradb/dict/dict0dict.c
	storage/xtradb/handler/ha_innodb.cc
	vio/viosslfactories.c
2015-08-03 23:09:43 +03:00
Sergei Golubchik
6300f2f274 Merge tag 'mysql-5.5.45' into 5.5 2015-08-01 14:56:18 +02:00
Sergei Golubchik
79deefc4d7 MDEV-8340 Add "mysqlbinlog --binlog-row-event-max-size" support for MariaDB 5.5
Cherry-pick from 10.0:

  commit 126523d190
  Author: Sergei Golubchik <serg@mariadb.org>
  Date:   Mon Feb 23 20:53:41 2015 +0100

  MDEV-6703 Add "mysqlbinlog --binlog-row-event-max-size" support
2015-07-31 17:17:33 +02:00
Sergey Vojtovich
bfe2689cf6 MDEV-8379 - SUSE mariadb patches
Let mysql_upgrade return zero exit status when installation is up to date.
2015-07-31 14:29:04 +04:00
Sergei Golubchik
121f3e4c90 MDEV-7429 main.mysqldump fails sporadically in buildbot
prevent concurrent cleanups in multi-threaded mysqlimport
(they can happen if many threads get an error at the same time),
safe_exit() is not thread-safe.
2015-07-27 10:52:21 +02:00
Shishir Jaiswal
bf681d6bb3 Bug #20802751 - SEGMENTATION FAILURE WHEN RUNNING
MYSQLADMIN -U ROOT -P

DESCRIPTION
===========
Crash occurs when no command is given while executing
mysqladmin utility.

ANALYSIS
========
In mask_password() the final write to array 'temp_argv'
is done without checking if corresponding index 'argc'
is valid (non-negative) or not. In case its negative
(would happen when this function is called with 'argc'=0),
it may cause a SEGFAULT. Logically in such a case,
mask_password() should not have been called as it would do
no valid thing.

FIX
===
mask_password() is now called after checking 'argc'. This
function is now called only when 'argc' is positive
otherwise the process terminates
2015-07-08 11:53:54 +05:30
Arun Kuruvila
7c5d18e227 Bug #20772273 : MYSQLIMPORT --USE-THREADS DOESN'T USE
MULTIPLE THREADS

Description:- The utility "mysqlimport" does not use
multiple threads for the execution with option
"--use-threads". "mysqlimport" while importing multiple
files and multiple tables, uses a single thread even if the
number of threads are specified with "--use-threads" option.

Analysis:- This utility uses ifdef HAVE_LIBPTHREAD to check
for libpthread library and if defined uses libpthread
library for mutlithreaing. Since HAVE_LIBPTHREAD is not
defined anywhere in the source, "--use-threads" option is
silently ignored.

Fix:- "-DTHREADS" is set to the COMPILE_FLAGS  which will
enable pthreads. HAVE_LIBPTHREAD macro is removed.
2015-06-30 10:27:12 +05:30
Sergei Golubchik
658992699b Merge tag 'mariadb-10.0.20' into 10.1 2015-06-27 20:35:26 +02:00
Nirbhay Choubey
46024098be Merge tag 'mariadb-10.0.20' into 10.0-galera 2015-06-21 23:54:55 -04:00
Sergei Golubchik
26b0cf4d3f MDEV-8183 Adding option mysqldump --no-data-med
* new mysqldump option
* add more engines to the "external data engines" list
* redo the check to be able to print the list of engines in --help
2015-06-16 23:58:05 +02:00
Alexey Botchkov
02421aa284 MDEV-7871 Tests fail massively on "Assertion `status_var.memory_used == 0'" when run with --ps --embedded.
As the MF_THREAD_SPECIFIC was introduced to the alloc_root's and
   the prealloc added to the statement::mem_root and statement::result.alloc, we have to adjust
   the embedded server to it. The preallocation was removed for the embedded server as it
   makes no sence for it. The msyqltest should free the statement inside the proper thead to
   make the memory statistics happy.
2015-06-15 18:07:41 +05:00
Sergei Golubchik
810cf362ea Merge branch '5.5' into 10.0 2015-06-11 20:20:35 +02:00
Arun Kuruvila
95cb8c1dd3 Merge branch 'mysql-5.1' into mysql-5.5 2015-06-04 11:54:54 +05:30
Arun Kuruvila
044e3b1d07 Bug #20605441 : BUFFER OVERFLOW IN MYSQLSLAP
Description:- mysqlslap is a diagnostic utility designed to
emulate client load for a MySQL server and to report the
timing of each stage. This utility crashes when invalid
values are passed to the options 'num_int_cols_opt' or
'num_chars_cols_opt' or 'engine'.

Analysis:- mysqlslap uses "parse_option()" to parse the
values specified to the options 'num_int_cols_opt',
'num_chars_cols_opt' and 'engine'. These options takes
values separated by commas. In "parse_option()", the comma
separated values are separated and copied into a buffer
without checking the length of the string to be copied. The
size of the buffer is defined by a macro HUGE_STRING_LENGTH
whose value is 8196. So if the length of the any of the
comma separated value exceeds HUGE_STRING_LENGTH, will
result in a buffer overflow.

Fix:- A check is introduced in "parse_option()" to check
whether the size of the string to be copied is more than
HUGE_STRING_LENGTH. If it is more, an error, "Invalid value
specified for the option 'xxx'" is thrown.
Option length was incorrectly calculated for the last comma
separated value. So fixed that as well.
2015-06-04 11:53:17 +05:30
Sergei Golubchik
f806b4d44b MDEV-8124 mysqlcheck: --auto-repair runs REPAIR TABLE instead of REPAIR VIEW on views
create a separate list of views to repair, and repair them
in a separate loop.
2015-06-03 15:44:32 +02:00
Sergei Golubchik
535b514e4b MDEV-8123 mysqlcheck: new --process-views option conflicts with --quick, --extended and such 2015-06-03 15:44:31 +02:00
Sergei Golubchik
5091a4ba75 Merge tag 'mariadb-10.0.19' into 10.1 2015-06-01 15:51:25 +02:00
Vicențiu Ciorbaru
3839e91223 MDEV-8248: mysqldump incorrect identifier quoting during equality comparison
Use quote_for_equal to correctly escape characters.
2015-05-30 13:15:05 +03:00
Vicențiu Ciorbaru
ae4b24340d MDEV-6714 mysqldump slow with tables in big databases
mysqldump now attempts to make use of the INFORMATION_SCHEMA tables.
If the table name is not found with a case sensitive search, it
fallbacks to a case insensitive search.
2015-05-30 13:15:04 +03:00
Oleksandr Byelkin
c1fb91ef73 MDEV-7921: main.sp_sync fails in buildbot with valgrind
Part 1: first 2 cases of valgrind complain. context_analysis_only can be used on non-started LEX (opening tables)

obviouse fixes in DBUG and is_lex_started assignment.
2015-05-20 11:43:43 +02:00
Nirbhay Choubey
e11cad9e9d Merge tag 'mariadb-10.0.19' into 10.0-galera 2015-05-09 17:09:21 -04:00
Sergei Golubchik
95797b9677 MDEV-8096 vio timeouts are multiplied by 1000 for ssl
in when using vio->read_timeout (and write_timeout) to set
timeouts of a new vio, as in:

  vio_timeout(vio, 0, old_vio.read_timeout)
  vio_timeout(vio, 0, old_vio.write_timeout)

remember that timeouts are stored in ms, but vio_timeout()'s
argument is in seconds.
2015-05-05 21:56:46 +02:00
Sergei Golubchik
49c853fb94 Merge branch '5.5' into 10.0 2015-05-04 22:00:24 +02:00
Sergei Golubchik
6f17e233bf post-merge fixes 2015-04-29 12:40:52 +02:00
Sergei Golubchik
f9c02d7c29 Merge branch 'openquery/MDEV-6916-maria-5.5-check_view-r4408' into 5.5 2015-04-28 21:11:49 +02:00
Sergei Golubchik
053143efe1 MDEV-7883 Segmentation failure when running mysqladmin -u root -p
take into account that argc can be 0
(if there were no commands on the command line)
2015-04-27 15:42:12 +02:00
Daniel Black
83ce3529b8 quote table name in mysql_check:is_view. increment version too 2015-04-14 13:26:55 +10:00
Daniel Black
4987080ddb Don't run upgrade-views if not mysql or --upgrade-system-tables 2015-04-14 13:26:22 +10:00
Daniel Black
97e0aeaf72 mysqlcheck fix-view-algorithm -> upgrade-views
Change mysqlcheck option to upgrade-views={NO,YES,FROM_MYSQL}

mysql_upgrade now runs upgrade-views=yes to perform a checksum of all
views and add mariadb-version by default. upgrade-views=from_mysql if
MySQL is detected as teh origin version.
2015-04-14 12:43:50 +10:00
Daniel Black
808608cb3f corrected mysql_upgrade to always list output for every phase 2015-04-14 11:26:13 +10:00
Daniel Black
fc277cd4ba Add --fix-tables option to mysql-check
Mainly so that mysql_upgrade.c can use --skip-fix-tables

Correct mysql_upgrade_view test output based on phases and
previous error message changes.
2015-04-13 22:17:57 +10:00
Daniel Black
9b067a3e9f Corrections to mysqlcheck
Allow tables and views to be repaired in same command.
Make error messages represent if it is a REPAIR TABLE or REPAIR VIEW
Honor write_binlog even for REPAIR VIEW .. FROM MYSQL
opt_all_in_1 does a list of REPAIR TABLE and a list of REPAIR VIEW
If a table list is passes this is corrected with the right command
2015-04-12 21:05:01 +10:00
Daniel Black
96e277aed8 mysql_upgrade to pass binlog option to mysqlcheck
when doing the --fix-view-algorithm method to upgrade from MySQL.
2015-04-12 20:42:13 +10:00
Daniel Black
e5191dd11b mysql-upgrade -> fix-view-algorithm as mysqlcheck option 2015-04-12 17:26:50 +10:00
Daniel Black
25872e2802 Correct phase count on mysql_upgrade
Add static vars on phases to make merging consistent.

client/mysql_upgrade --verbose -S /tmp/s.sock
Looking for 'mysql' as: client/mysql
Looking for 'mysqlcheck' as: client/mysqlcheck
Phase 1/4: Fixing views - skipped - not required
Phase 2/4: Fixing table and database names
Processing databases
information_schema
mysql
performance_schema
test
Phase 3/4: Checking and upgrading tables
Processing databases
information_schema
mysql
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.host                                         OK
mysql.ndb_binlog_index                             OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.proxies_priv                                 OK
mysql.servers                                      OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.user                                         OK
performance_schema
test
Phase 4/4: Running 'mysql_fix_privilege_tables'...
OK
2015-04-12 17:21:02 +10:00
Daniel Black
ebd3c6ccbe Remove mysql-upgrade / skip-mysql-upgrade options from mysql-upgrade.c 2015-04-12 17:05:02 +10:00
Daniel Black
87f5bae0b5 Get my_getop to parse opt_mysql_upgrade in mysqlcheck
requested by Sergei Golubchik in review 9 Feb 2015 17:28:08 +0100
2015-04-12 16:50:16 +10:00
Oleksandr Byelkin
70960e7ab7 MDEV-6916: Upgrade from MySQL to MariaDB breaks already created views
mysql_upgrade upgrades views`

from r4408:

missing files from mysql-test/std_data/mysql_upgrade/*
2015-04-12 15:56:21 +10:00
Sergey Vojtovich
18e9c314e4 MDEV-6650 - LINT_INIT emits code in non-debug builds
Replaced all references to LINT_INIT with UNINIT_VAR and LINT_INIT_STRUCT.
Removed LINT_INIT macro.
2015-03-16 14:48:22 +04:00
Sergei Golubchik
2db62f686e Merge branch '10.0' into 10.1 2015-03-07 13:21:02 +01:00
Nirbhay Choubey
0f8cb3c399 MDEV-7615: Remove --galera-sst-mode option from mysqldump
Removed 'galera-sst-mode' option from mysqldump and added logic
in wsrep_sst_mysqldump script to retrieve gtid_binlog_state from
donor node and send it to the joiner node.
2015-02-27 22:30:38 -05:00
Nirbhay Choubey
af651c80f7 Merge tag 'mariadb-10.0.17' into 10.0-galera
Conflicts:
	storage/innobase/include/trx0trx.h
2015-02-27 17:36:54 -05:00
Sergei Golubchik
126523d190 MDEV-6703 Add "mysqlbinlog --binlog-row-event-max-size" support
partially cherry-pick from mysql/5.6.
No test case (mysql/5.6 test case is useless, the correct
test case uses too much memory)

commit e061985813db54948f99892d89f7e076242473a5
Author:  <Dao-Gang.Qu@sun.com>
Date:   Tue Jun 1 15:02:22 2010 +0800

    Bug #49931          Incorrect type in read_log_event error
    Bug #49932          mysqlbinlog max_allowed_packet hard coded to 1GB
2015-02-24 15:55:00 +01:00
Nirbhay Choubey
f68ce68604 MDEV-7615: Remove --galera-sst-mode option from mysqldump
Removed 'galera-sst-mode' option from mysqldump and added logic
in wsrep_sst_mysqldump script to retrieve gtid_binlog_state from
donor node and send it to the joiner node.
2015-02-20 17:51:33 -05:00