mirror of
https://github.com/MariaDB/server.git
synced 2025-01-20 14:02:32 +01:00
bae0e81310
------------------------------------------------------------- revno: 2877 committer: Davi Arnaut <Davi.Arnaut@Sun.COM> branch nick: 35164-6.0 timestamp: Wed 2008-10-15 19:53:18 -0300 message: Bug#35164: Large number of invalid pthread_attr_setschedparam calls Bug#37536: Thread scheduling causes performance degradation at low thread count Bug#12702: Long queries take 100% of CPU and freeze other applications under Windows The problem is that although having threads with different priorities yields marginal improvements [1] in some platforms [2], relying on some statically defined priorities (QUERY_PRIOR and WAIT_PRIOR) to play well (or to work at all) with different scheduling practices and disciplines is, at best, a shot in the dark as the meaning of priority values may change depending on the scheduling policy set for the process. Another problem is that increasing priorities can hurt other concurrent (running on the same hardware) applications (such as AMP) by causing starvation problems as MySQL threads will successively preempt lower priority processes. This can be evidenced by Bug#12702. The solution is to not change the threads priorities and rely on the system scheduler to perform its job. This also enables a system admin to increase or decrease the scheduling priority of the MySQL process, if intended. Furthermore, the internal wrappers and code for changing the priority of threads is being removed as they are now unused and ancient. 1. Due to unintentional side effects. On Solaris this could artificially help benchmarks as calling the priority changing syscall millions of times is more beneficial than the actual setting of the priority. 2. Where it actually works. It has never worked on Linux as the default scheduling policy SCHED_OTHER only accepts the static priority 0. configure.in: Remove checks for functions that are not used anymore. include/config-netware.h: Remove unused define. include/my_pthread.h: Remove thread priority changing wrappers. mysys/my_pthread.c: Remove thread priority changing wrappers. They do not work properly and their implementations were incorrectly protected by a check for HAVE_PTHREAD_SETSCHEDPARAM. mysys/thr_alarm.c: Remove meaningless (100) increase of a thread priority. sql/mysql_priv.h: Remove meaningless thread priority values. sql/mysqld.cc: Don't change thread priorities. sql/slave.cc: Don't change thread priorities. sql/slave.h: Update function prototype. sql/sql_parse.cc: Don't change thread priorities. sql/sql_prepare.cc: Don't change thread priorities. sql/unireg.h: Mark flag as obsolete. storage/innobase/handler/ha_innodb.cc: Remove use of obsolete flag and associated behavior. storage/innobase/include/srv0srv.h: Remove use of obsolete flag and associated variables. storage/innobase/os/os0thread.c: Remove use of obsolete flag and associated behavior. storage/innobase/srv/srv0srv.c: Remove use of obsolete flag and associated variables.
161 lines
4.1 KiB
C
161 lines
4.1 KiB
C
/* Copyright (C) 2000 MySQL AB
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; version 2 of the License.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
|
|
/* Header for NetWare compatible with MySQL */
|
|
|
|
#ifndef _config_netware_h
|
|
#define _config_netware_h
|
|
|
|
#define __event_h__
|
|
#define _EVENT_H_
|
|
/*
|
|
These two #define(s) are needed as both libc of NetWare and MySQL have
|
|
files named event.h which causes compilation errors.
|
|
*/
|
|
|
|
|
|
/* required headers */
|
|
#include <unistd.h>
|
|
#include <stdio.h>
|
|
#include <errno.h>
|
|
#include <screen.h>
|
|
#include <limits.h>
|
|
#include <signal.h>
|
|
#include <errno.h>
|
|
#include <stdbool.h>
|
|
#include <stdlib.h>
|
|
#include <sys/types.h>
|
|
#include <time.h>
|
|
#include <sys/time.h>
|
|
#include <pthread.h>
|
|
#include <termios.h>
|
|
|
|
#undef _EVENT_H_
|
|
/*
|
|
This #undef exists here because both libc of NetWare and MySQL have
|
|
files named event.h which causes compilation errors.
|
|
*/
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* required adjustments */
|
|
#undef HAVE_READDIR_R
|
|
#undef HAVE_RWLOCK_INIT
|
|
#undef HAVE_SCHED_H
|
|
#undef HAVE_SYS_MMAN_H
|
|
#undef HAVE_SYNCH_H
|
|
#undef HAVE_MMAP
|
|
#undef HAVE_RINT
|
|
|
|
#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
|
|
#define HAVE_PTHREAD_SIGMASK 1
|
|
#define HAVE_PTHREAD_YIELD_ZERO_ARG 1
|
|
#define HAVE_BROKEN_REALPATH 1
|
|
|
|
/* changes made to make use of LibC-June-2004 for building purpose */
|
|
#undef HAVE_POSIX_SIGNALS
|
|
#undef HAVE_PTHREAD_ATTR_SETSCOPE
|
|
#undef HAVE_ALLOC_A
|
|
#undef HAVE_FINITE
|
|
#undef HAVE_GETPWNAM
|
|
#undef HAVE_GETPWUID
|
|
#undef HAVE_READLINK
|
|
#undef HAVE_STPCPY
|
|
/* changes end */
|
|
|
|
/* Changes made to make use of LibC-June-2005 for building purpose */
|
|
#undef HAVE_GETPASS
|
|
#undef HAVE_GETRLIMIT
|
|
#undef HAVE_GETRUSAGE
|
|
#undef HAVE_INITGROUPS
|
|
/* Changes end - LibC-June-2005 */
|
|
|
|
/* no libc crypt() function */
|
|
#ifdef HAVE_OPENSSL
|
|
#define HAVE_CRYPT 1
|
|
#else
|
|
#undef HAVE_CRYPT
|
|
#endif /* HAVE_OPENSSL */
|
|
|
|
/* Netware has an ancient zlib */
|
|
#undef HAVE_COMPRESS
|
|
#define HAVE_COMPRESS
|
|
#undef HAVE_ARCHIVE_DB
|
|
|
|
/* include the old function apis */
|
|
#define USE_OLD_FUNCTIONS 1
|
|
|
|
/* no case sensitivity */
|
|
#define FN_NO_CASE_SENCE 1
|
|
|
|
/* the thread alarm is not used */
|
|
#define DONT_USE_THR_ALARM 1
|
|
|
|
/* signals do not interrupt sockets */
|
|
#define SIGNALS_DONT_BREAK_READ 1
|
|
|
|
/* signal by closing the sockets */
|
|
#define SIGNAL_WITH_VIO_CLOSE 1
|
|
|
|
/* On NetWare, stack grows towards lower address */
|
|
#define STACK_DIRECTION -1
|
|
|
|
/* On NetWare, we need to set stack size for threads, otherwise default 16K is used */
|
|
#define NW_THD_STACKSIZE 65536
|
|
|
|
/* On NetWare, to fix the problem with the deletion of open files */
|
|
#define CANT_DELETE_OPEN_FILES 1
|
|
|
|
#define FN_LIBCHAR '\\'
|
|
#define FN_ROOTDIR "\\"
|
|
#define FN_DEVCHAR ':'
|
|
|
|
/* default directory information */
|
|
#define DEFAULT_MYSQL_HOME "sys:/mysql"
|
|
#define PACKAGE "mysql"
|
|
#define DEFAULT_BASEDIR "sys:/"
|
|
#define SHAREDIR "share/"
|
|
#define DEFAULT_CHARSET_HOME "sys:/mysql/"
|
|
#define MYSQL_DATADIR "data/"
|
|
|
|
/* 64-bit file system calls */
|
|
#define SIZEOF_OFF_T 8
|
|
#define off_t off64_t
|
|
#define chsize chsize64
|
|
#define ftruncate ftruncate64
|
|
#define lseek lseek64
|
|
#define pread pread64
|
|
#define pwrite pwrite64
|
|
#define tell tell64
|
|
|
|
/* do not use the extended time in LibC sys\stat.h */
|
|
#define _POSIX_SOURCE
|
|
|
|
/* Some macros for portability */
|
|
|
|
#define set_timespec(ABSTIME,SEC) { (ABSTIME).tv_sec=time(NULL)+(SEC); (ABSTIME).tv_nsec=0; }
|
|
|
|
/* extra protection against CPU Hogs on NetWare */
|
|
#define NETWARE_YIELD pthread_yield()
|
|
/* Screen mode for help texts */
|
|
#define NETWARE_SET_SCREEN_MODE(A) setscreenmode(A)
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* _config_netware_h */
|