Commit graph

335 commits

Author SHA1 Message Date
Eugene Kosov
89ff4176c1 MDEV-22437 make THR_THD* variable thread_local
Now all access goes through _current_thd() and set_current_thd()
functions.

Some functions like THD::store_globals() can not fail now.
2020-05-05 18:13:31 +03:00
Marko Mäkelä
496d0372ef Merge 10.4 into 10.5 2020-04-29 15:40:51 +03:00
Marko Mäkelä
b63446984c Merge 10.3 into 10.4 2020-04-27 17:38:17 +03:00
Marko Mäkelä
2e12d471ea Merge 10.2 into 10.3 2020-04-27 14:24:41 +03:00
Marko Mäkelä
fbe2712705 Merge 10.4 into 10.5
The functional changes of commit 5836191c8f
(MDEV-21168) are omitted due to MDEV-742 having addressed the issue.
2020-04-25 21:57:52 +03:00
Eugene Kosov
2c5067b689 cleanup THR_KEY_mysys
read TLS with my_thread_var
write TLS with set_mysys_var()

my_thread_var is no longer __attribute__ ((const)): this attribute
is simply incorrect here. Read gcc manual for more information.
sql/threadpool_generic.cc fails with that attribute.
2020-04-25 00:55:39 +03:00
Sergey Vojtovich
5679a2b6b3 Shrink my_atomic.h and my_cpu.h scope 2020-04-15 22:23:03 +04:00
Sergey Vojtovich
4bd9f82a8f slave_open_temp_tables to Atomic_counter 2020-04-15 21:05:21 +04:00
Sergey Vojtovich
5876ed9e5b Relay_log_info::executed_entries to Atomic_counter 2020-04-15 18:36:07 +04:00
Marko Mäkelä
37c14690fc Merge 10.4 into 10.5 2020-03-30 19:07:25 +03:00
Marko Mäkelä
e2f1f88fa6 Merge 10.3 into 10.4 2020-03-30 14:50:23 +03:00
Marko Mäkelä
1a9b6c4c7f Merge 10.2 into 10.3 2020-03-30 11:12:56 +03:00
Eugene Kosov
a7cbce06d4 unoptimized -fsanitize=undefined build on clang requires more stack space 2020-03-23 17:42:57 +03:00
Marko Mäkelä
d82ac8d374 MDEV-21907: Fix some -Wconversion outside InnoDB
Some .c and .cc files are compiled as part of Mariabackup.
Enabling -Wconversion for InnoDB would also enable it for
Mariabackup. The .h files are being included during
InnoDB or Mariabackup compilation.

Notably, GCC 5 (but not GCC 4 or 6 or later versions)
would report -Wconversion for x|=y when the type is
unsigned char. So, we will either write x=(uchar)(x|y)
or disable the -Wconversion warning for GCC 5.

bitmap_set_bit(), bitmap_flip_bit(), bitmap_clear_bit(), bitmap_is_set():
Always implement as inline functions.
2020-03-12 19:44:52 +02:00
Sergei Golubchik
7af733a5a2 perfschema compilation, test and misc fixes 2020-03-10 19:24:23 +01:00
Jon Olav Hauglid
52d7980753 Bug#18913935: REMOVE SUPPORT FOR LINUXTHREADS
This patch removes support for LinuxThreads.
It was superseded by NPTL in Linux 2.6 (2003).
2020-03-10 19:24:21 +01:00
Monty
6c50875a38 MDEV-20279 Increase Aria index length limit
Limit increased from 1000 to 2000.

Avoiding stack overflow by only storing keys and pages on the stack in
recursive functions if there is plenty of space on it.

Other things:
- Use less stack space for b-tree operations as we now only allocate as
  much space as needed instead of always allocating HA_MAX_KEY_LENGTH.
- Replaced most usage of my_safe_alloca() in Aria with the stack_alloc
  interface.
- Moved my_setstacksize() to mysys/my_pthread.c
2019-08-23 11:26:04 +02:00
Vladislav Vaintroub
73be875c8e MDEV-19773 : simplify implementation of Windows rwlock
No need to do dynamic loading and fallbacks anymore.
We can safely assume Windows 7, and availability of all SRWLock functions.
2019-06-18 00:37:09 +01:00
Marko Mäkelä
826f9d4f7e Merge 10.4 into 10.5 2019-05-23 10:32:21 +03:00
Monty
ab38b7511b MDEV-17841 S3 storage engine
A read-only storage engine that stores it's data in (aws) S3

To store data in S3 one could use ALTER TABLE:
ALTER TABLE table_name ENGINE=S3

libmarias3 integration done by Sergei Golubchik
libmarias3 created by Andrew Hutchings
2019-05-23 02:28:23 +03:00
Oleksandr Byelkin
c07325f932 Merge branch '10.3' into 10.4 2019-05-19 20:55:37 +02:00
Marko Mäkelä
be85d3e61b Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
Marko Mäkelä
26a14ee130 Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
Vicențiu Ciorbaru
cb248f8806 Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
Vicențiu Ciorbaru
5543b75550 Update FSF Address
* Update wrong zip-code
2019-05-11 21:29:06 +03:00
Sergei Golubchik
15c79c41e4 MDEV-17845 Extreme high open file limit used
SHOW STATUS LIKE 'Open_files' was showing 18446744073709551615

my_file_opened used statistic_increment/statistic_decrement,
so one-off errors were normal and expected. But they confused
monitoring tools, so let's move my_file_opened to use atomics.
2019-05-07 18:40:36 +02:00
Marko Mäkelä
c67b306e4f Merge 10.3 into 10.4 2019-03-08 11:19:48 +02:00
Marko Mäkelä
94eb56fb29 Give ASAN some more stack
When compiling CMAKE_BUILD_TYPE=Debug WITH_ASAN using clang-7 -O2
the following tests could fail due to insufficient stack size:
main.signal_demo3 sys_vars.max_sp_recursion_depth_func
2019-03-08 10:40:30 +02:00
Marko Mäkelä
2d0dd62cf7 Merge 10.2 into 10.3 2019-03-08 00:26:55 +02:00
Marko Mäkelä
913e33e423 Merge 10.1 into 10.2
Rewrite the MDEV-13818 fix to prevent heap-use-after-free.

Add a test case for MDEV-18272.
2019-03-07 17:52:27 +02:00
Sergei Golubchik
84645366c4 ASAN loves stack, give it some
fixes these test failures in ASAN builds (in 10.1 and 10.4):
* main.signal_demo3
* main.sp
* sys_vars.max_sp_recursion_depth_func
* mroonga/storage.foreign_key_delete_existent
* mroonga/storage.foreign_key_delete_nonexistent
* mroonga/storage.foreign_key_insert_existent
* mroonga/storage.foreign_key_update_existent
* mroonga/storage.foreign_key_update_nonexistent
* mroonga/storage.function_command_auto-escape
* mroonga/storage.function_command_select
* mroonga/storage.variable_enable_operations_recording_insert
2019-03-06 15:12:11 +01:00
Sergei Golubchik
07e9b13898 mysqld: ignore SIGHUP sent by the kernel
SIGHUP causes debug info in the error log and reload of
logs/privileges/tables/etc. The server should only do it when
a user intentionally sends SUGHUP, not when a parent terminal gets
disconnected or something.

In particular, not ignoring kernel SIGHUP causes FLUSH PRIVILEGES
at some random point during non-systemd Debian upgrades (Debian
restarts mysqld, debian-start script runs mysql_upgrade in the background,
postinit script ends and kernel sends SIGHUP to all background processes
it has started). And during mysql_upgrade privilege tables aren't
necessarily ready to be reloaded.
2018-12-12 00:31:04 +01:00
Marko Mäkelä
ae9d82c9f8 Merge 10.2 into 10.3 2018-10-11 08:22:08 +03:00
Marko Mäkelä
07815d9555 Merge 10.1 into 10.2 2018-10-11 08:16:08 +03:00
Sergey Vojtovich
1655053ac1 MDEV-17200 - pthread_detach called for already detached threads
pthread_detach_this_thread() was intended to be defined to something
meaningful only on some ancient unixes, which don't have
pthread_attr_setdetachstate() defined. Otherwise, on normal unixes,
threads are created detached in the first place.

This was broken in 0f01bf2676 so that
we started calling pthread_detach() for already detached threads.
Intention was to detach aria checkpoint thread.

However in 87007dc2f7 aria service threads
were made joinable with appropriate handling, which makes breaking
revision unneccessary.

Revert remnants of 0f01bf2676, so that
pthread_detach_this_thread() is meaningful only on some ancient unixes
again.
2018-10-05 14:37:15 +04:00
luz.paz
3dd01669b4 Misc. typos
Found via `codespell -i 3 -w --skip="./debian/po" -I ../mariadb-server-word-whitelist.txt  ./cmake/ ./debian/ ./Docs/ ./include/ ./man/ ./plugin/ ./strings/`
2018-04-05 15:26:57 +04:00
Vladislav Vaintroub
19bb7fdcd6 MDEV-15694 Windows : use GetSystemTimePreciseAsFileTime if available for high resolution time
Use high accuracy timer on Windows 8.1+ for system versioning,it needs
accurate high resoution start query time.

Continue to use the inaccurate (but much faster timer function)
GetSystemTimeAsFileTime() where accuracy does not matter, e.g in
set_timespec_time_nsec(),or my_time()
2018-04-01 14:38:45 +00:00
Vladislav Vaintroub
6c279ad6a7 MDEV-15091 : Windows, 64bit: reenable and fix warning C4267 (conversion from 'size_t' to 'type', possible loss of data)
Handle string length as size_t, consistently (almost always:))
Change function prototypes to accept size_t, where in the past
ulong or uint were used. change local/member variables to size_t
when appropriate.

This fix excludes rocksdb, spider,spider, sphinx and connect for now.
2018-02-06 12:55:58 +00:00
Otto Kekäläinen
c9c28bef3c Minor spelling fixes in code comments, docs and output
This commit does not touch any variable names or any other actual code,
and thus should not in any way affect how the code works.
2018-01-12 16:49:02 +02:00
Michael Widenius
4aaa38d26e Enusure that my_global.h is included first
- Added sql/mariadb.h file that should be included first by files in sql
  directory, if sql_plugin.h is not used (sql_plugin.h adds SHOW variables
  that must be done before my_global.h is included)
- Removed a lot of include my_global.h from include files
- Removed include's of some files that my_global.h automatically includes
- Removed duplicated include's of my_sys.h
- Replaced include my_config.h with my_global.h
2017-08-24 01:05:44 +02:00
Marko Mäkelä
14c6f00a9f Merge 10.1 into 10.2
Also, include fixes by Vladislav Vaintroub to the
aws_key_management plugin. The AWS C++ SDK specifically depends on
OPENSSL_LIBRARIES, not generic SSL_LIBRARIES (such as YaSSL).
2017-05-06 14:36:46 +03:00
Sergei Golubchik
99e1294c1e bugfix: federated/replication did not increment bytes_received status variable
because mysql->net.thd was reset to NULL in mysql_real_connect()
and thd_increment_bytes_received() didn't do anything.

Fix:
* set mysql->net.thd to current_thd instread.
* remove the test for non-null THD from a very often used
  function thd_increment_bytes_received().
2017-04-27 19:12:37 +02:00
Sergei Golubchik
2b4c485fea MDEV-11720 main.signal_demo3 fails in buildbot on labrador
increase stack size for labrador
2017-03-29 00:40:21 +02:00
Marko Mäkelä
89d80c1b0b Fix many -Wconversion warnings.
Define my_thread_id as an unsigned type, to avoid mismatch with
ulonglong.  Change some parameters to this type.

Use size_t in a few more places.

Declare many flag constants as unsigned to avoid sign mismatch
when shifting bits or applying the unary ~ operator.

When applying the unary ~ operator to enum constants, explictly
cast the result to an unsigned type, because enum constants can
be treated as signed.

In InnoDB, change the source code line number parameters from
ulint to unsigned type. Also, make some InnoDB functions return
a narrower type (unsigned or uint32_t instead of ulint;
bool instead of ibool).
2017-03-07 19:07:27 +02:00
Sergei Golubchik
4ba198c6e3 compiler warning 2016-09-12 17:51:48 +02:00
Sergei Golubchik
12d75e6121 increase stack size for labrador 2016-07-01 22:30:09 +02:00
Monty
89685d55d7 Reuse THD for new user connections
- To ensure that mallocs are marked for the correct THD, even if it's
  allocated in another thread, I added the thread_id to the THD constructor
- Added st_my_thread_var to thr_lock_info_init() to avoid a call to my_thread_var
- Moved things from THD::THD() to THD::init()
- Moved some things to THD::cleanup()
- Added THD::free_connection() and THD::reset_for_reuse()
- Added THD to CONNECT::create_thd()
- Added THD::thread_dbug_id and st_my_thread_var->dbug_id. These are needed
  to ensure that we have a constant thread_id used for debugging with a THD,
  even if it changes thread_id (=connection_id)
- Set variables.pseudo_thread_id in constructor. Removed not needed sets.
2016-06-04 09:06:00 +02:00
Vladislav Vaintroub
3a7bc23a16 MDEV-9154 : Remove workarounds (mainly dynamic function loading)
for running obsolete versions of Windows
2016-06-01 20:29:10 +02:00
Oleksandr Byelkin
aa77bc5c62 Make step bigger to reflect modern needs. 2016-03-23 09:21:37 +01:00
Monty
b3093073b1 Changed my_thread_id to int64 to fix compilation problem with
my_atomic_add32_explicit on windows
Fixed that server_audit.c also works if one compiles with safemalloc
Fixed compiler warnings
2016-02-08 22:34:41 +02:00