Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
3fffea42
Commit
3fffea42
authored
Oct 17, 2003
by
heikki@hundin.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
thr0loc.c, srv0start.c, srv0srv.c, srv0srv.h, os0thread.h:
Reduce InnoDB memory allocation if buffer pool < 8 MB
parent
2586a56b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
12 deletions
+41
-12
innobase/include/os0thread.h
innobase/include/os0thread.h
+3
-8
innobase/include/srv0srv.h
innobase/include/srv0srv.h
+2
-0
innobase/srv/srv0srv.c
innobase/srv/srv0srv.c
+11
-2
innobase/srv/srv0start.c
innobase/srv/srv0start.c
+24
-2
innobase/thr/thr0loc.c
innobase/thr/thr0loc.c
+1
-0
No files found.
innobase/include/os0thread.h
View file @
3fffea42
...
@@ -15,14 +15,9 @@ Created 9/8/1995 Heikki Tuuri
...
@@ -15,14 +15,9 @@ Created 9/8/1995 Heikki Tuuri
/* Maximum number of threads which can be created in the program;
/* Maximum number of threads which can be created in the program;
this is also the size of the wait slot array for MySQL threads which
this is also the size of the wait slot array for MySQL threads which
can wait inside InnoDB */
can wait inside InnoDB */
#if defined(__WIN__) || defined(__NETWARE__)
/* Create less event semaphores because Win 98/ME had difficult creating
#define OS_THREAD_MAX_N srv_max_n_threads
40000 event semaphores */
/* TODO: these just take a lot of memory on NetWare. should netware move up? */
#define OS_THREAD_MAX_N 1000
#else
#define OS_THREAD_MAX_N 10000
#endif
/* Possible fixed priorities for threads */
/* Possible fixed priorities for threads */
#define OS_THREAD_PRIORITY_NONE 100
#define OS_THREAD_PRIORITY_NONE 100
...
...
innobase/include/srv0srv.h
View file @
3fffea42
...
@@ -87,6 +87,8 @@ extern ulint srv_max_dirty_pages_pct;
...
@@ -87,6 +87,8 @@ extern ulint srv_max_dirty_pages_pct;
extern
ulint
srv_force_recovery
;
extern
ulint
srv_force_recovery
;
extern
ulint
srv_thread_concurrency
;
extern
ulint
srv_thread_concurrency
;
extern
ulint
srv_max_n_threads
;
extern
lint
srv_conc_n_threads
;
extern
lint
srv_conc_n_threads
;
extern
ibool
srv_fast_shutdown
;
extern
ibool
srv_fast_shutdown
;
...
...
innobase/srv/srv0srv.c
View file @
3fffea42
...
@@ -180,6 +180,12 @@ the user from forgetting the innodb_force_recovery keyword to my.cnf */
...
@@ -180,6 +180,12 @@ the user from forgetting the innodb_force_recovery keyword to my.cnf */
ulint
srv_force_recovery
=
0
;
ulint
srv_force_recovery
=
0
;
/*-----------------------*/
/*-----------------------*/
/* We are prepared for a situation that we have this many threads waiting for
a semaphore inside InnoDB. innobase_start_or_create_for_mysql() sets the
value. */
ulint
srv_max_n_threads
=
0
;
/* The following controls how many threads we let inside InnoDB concurrently:
/* The following controls how many threads we let inside InnoDB concurrently:
threads waiting for locks are not counted into the number because otherwise
threads waiting for locks are not counted into the number because otherwise
we could get a deadlock. MySQL creates a thread for each user session, and
we could get a deadlock. MySQL creates a thread for each user session, and
...
@@ -219,7 +225,7 @@ struct srv_conc_slot_struct{
...
@@ -219,7 +225,7 @@ struct srv_conc_slot_struct{
UT_LIST_BASE_NODE_T
(
srv_conc_slot_t
)
srv_conc_queue
;
/* queue of threads
UT_LIST_BASE_NODE_T
(
srv_conc_slot_t
)
srv_conc_queue
;
/* queue of threads
waiting to get in */
waiting to get in */
srv_conc_slot_t
srv_conc_slots
[
OS_THREAD_MAX_N
];
/* array of wait
srv_conc_slot_t
*
srv_conc_slots
;
/* array of wait
slots */
slots */
/* Number of times a thread is allowed to enter InnoDB within the same
/* Number of times a thread is allowed to enter InnoDB within the same
...
@@ -1712,6 +1718,8 @@ srv_init(void)
...
@@ -1712,6 +1718,8 @@ srv_init(void)
UT_LIST_INIT
(
srv_conc_queue
);
UT_LIST_INIT
(
srv_conc_queue
);
srv_conc_slots
=
mem_alloc
(
OS_THREAD_MAX_N
*
sizeof
(
srv_conc_slot_t
));
for
(
i
=
0
;
i
<
OS_THREAD_MAX_N
;
i
++
)
{
for
(
i
=
0
;
i
<
OS_THREAD_MAX_N
;
i
++
)
{
conc_slot
=
srv_conc_slots
+
i
;
conc_slot
=
srv_conc_slots
+
i
;
conc_slot
->
reserved
=
FALSE
;
conc_slot
->
reserved
=
FALSE
;
...
@@ -1758,7 +1766,7 @@ srv_conc_enter_innodb(
...
@@ -1758,7 +1766,7 @@ srv_conc_enter_innodb(
thread */
thread */
{
{
ibool
has_slept
=
FALSE
;
ibool
has_slept
=
FALSE
;
srv_conc_slot_t
*
slot
;
srv_conc_slot_t
*
slot
=
NULL
;
ulint
i
;
ulint
i
;
char
err_buf
[
1000
];
char
err_buf
[
1000
];
...
@@ -1835,6 +1843,7 @@ srv_conc_enter_innodb(
...
@@ -1835,6 +1843,7 @@ srv_conc_enter_innodb(
slot
=
srv_conc_slots
+
i
;
slot
=
srv_conc_slots
+
i
;
if
(
!
slot
->
reserved
)
{
if
(
!
slot
->
reserved
)
{
break
;
break
;
}
}
}
}
...
...
innobase/srv/srv0start.c
View file @
3fffea42
...
@@ -1138,10 +1138,32 @@ innobase_start_or_create_for_mysql(void)
...
@@ -1138,10 +1138,32 @@ innobase_start_or_create_for_mysql(void)
srv_file_flush_method_str
);
srv_file_flush_method_str
);
return
(
DB_ERROR
);
return
(
DB_ERROR
);
}
}
/* Set the maximum number of threads which can wait for a semaphore
inside InnoDB */
#if defined(__WIN__) || defined(__NETWARE__)
/* Create less event semaphores because Win 98/ME had difficulty creating
40000 event semaphores.
Comment from Novell, Inc.: also, these just take a lot of memory on
NetWare. */
srv_max_n_threads
=
1000
;
#else
if
(
srv_pool_size
>=
8
*
1024
)
{
/* Here we still have srv_pool_size counted
in kilobytes, srv_boot converts the value to
pages; if buffer pool is less than 8 MB,
assume fewer threads. */
srv_max_n_threads
=
10000
;
}
else
{
srv_max_n_threads
=
1000
;
/* saves several MB of memory,
especially in 64-bit
computers */
}
#endif
/* Note that the call srv_boot() also changes the values of
/* Note that the call srv_boot() also changes the values of
srv_pool_size etc. to the units used by InnoDB internally */
srv_pool_size etc. to the units used by InnoDB internally */
err
=
srv_boot
();
err
=
srv_boot
();
if
(
err
!=
DB_SUCCESS
)
{
if
(
err
!=
DB_SUCCESS
)
{
...
...
innobase/thr/thr0loc.c
View file @
3fffea42
...
@@ -14,6 +14,7 @@ Created 10/5/1995 Heikki Tuuri
...
@@ -14,6 +14,7 @@ Created 10/5/1995 Heikki Tuuri
#include "sync0sync.h"
#include "sync0sync.h"
#include "hash0hash.h"
#include "hash0hash.h"
#include "mem0mem.h"
#include "mem0mem.h"
#include "srv0srv.h"
/*
/*
IMPLEMENTATION OF THREAD LOCAL STORAGE
IMPLEMENTATION OF THREAD LOCAL STORAGE
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment