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
2667d7f8
Commit
2667d7f8
authored
Oct 06, 2003
by
serg@serg.mylan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix_max_connections to resize alarm_queue (Bug #1435)
parent
0ce865b6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
13 deletions
+44
-13
include/queues.h
include/queues.h
+1
-0
include/thr_alarm.h
include/thr_alarm.h
+1
-0
mysys/queues.c
mysys/queues.c
+17
-7
mysys/thr_alarm.c
mysys/thr_alarm.c
+10
-0
sql/set_var.cc
sql/set_var.cc
+15
-6
No files found.
include/queues.h
View file @
2667d7f8
...
@@ -49,6 +49,7 @@ int init_queue(QUEUE *queue,uint max_elements,uint offset_to_key,
...
@@ -49,6 +49,7 @@ int init_queue(QUEUE *queue,uint max_elements,uint offset_to_key,
int
reinit_queue
(
QUEUE
*
queue
,
uint
max_elements
,
uint
offset_to_key
,
int
reinit_queue
(
QUEUE
*
queue
,
uint
max_elements
,
uint
offset_to_key
,
pbool
max_at_top
,
queue_compare
compare
,
pbool
max_at_top
,
queue_compare
compare
,
void
*
first_cmp_arg
);
void
*
first_cmp_arg
);
int
resize_queue
(
QUEUE
*
queue
,
uint
max_elements
);
void
delete_queue
(
QUEUE
*
queue
);
void
delete_queue
(
QUEUE
*
queue
);
void
queue_insert
(
QUEUE
*
queue
,
byte
*
element
);
void
queue_insert
(
QUEUE
*
queue
,
byte
*
element
);
byte
*
queue_remove
(
QUEUE
*
queue
,
uint
idx
);
byte
*
queue_remove
(
QUEUE
*
queue
,
uint
idx
);
...
...
include/thr_alarm.h
View file @
2667d7f8
...
@@ -100,6 +100,7 @@ typedef struct st_alarm {
...
@@ -100,6 +100,7 @@ typedef struct st_alarm {
#define thr_alarm_init(A) (*(A))=0
#define thr_alarm_init(A) (*(A))=0
#define thr_alarm_in_use(A) (*(A)!= 0)
#define thr_alarm_in_use(A) (*(A)!= 0)
void
init_thr_alarm
(
uint
max_alarm
);
void
init_thr_alarm
(
uint
max_alarm
);
void
resize_thr_alarm
(
uint
max_alarms
);
my_bool
thr_alarm
(
thr_alarm_t
*
alarmed
,
uint
sec
,
ALARM
*
buff
);
my_bool
thr_alarm
(
thr_alarm_t
*
alarmed
,
uint
sec
,
ALARM
*
buff
);
void
thr_alarm_kill
(
pthread_t
thread_id
);
void
thr_alarm_kill
(
pthread_t
thread_id
);
void
thr_end_alarm
(
thr_alarm_t
*
alarmed
);
void
thr_end_alarm
(
thr_alarm_t
*
alarmed
);
...
...
mysys/queues.c
View file @
2667d7f8
...
@@ -44,25 +44,35 @@ int init_queue(QUEUE *queue, uint max_elements, uint offset_to_key,
...
@@ -44,25 +44,35 @@ int init_queue(QUEUE *queue, uint max_elements, uint offset_to_key,
}
}
/*
/*
Reinitialize queue for new usage; Note that you can't currently resize
Reinitialize queue for new usage;
the number of elements! If you need this, fix it :)
*/
*/
int
reinit_queue
(
QUEUE
*
queue
,
uint
max_elements
,
uint
offset_to_key
,
int
reinit_queue
(
QUEUE
*
queue
,
uint
max_elements
,
uint
offset_to_key
,
pbool
max_at_top
,
int
(
*
compare
)
(
void
*
,
byte
*
,
byte
*
),
pbool
max_at_top
,
int
(
*
compare
)
(
void
*
,
byte
*
,
byte
*
),
void
*
first_cmp_arg
)
void
*
first_cmp_arg
)
{
{
DBUG_ENTER
(
"reinit_queue"
);
DBUG_ENTER
(
"reinit_queue"
);
if
(
queue
->
max_elements
<
max_elements
)
/* It's real easy to do realloc here, just don't want to bother */
DBUG_RETURN
(
my_errno
=
EE_OUTOFMEMORY
);
queue
->
elements
=
0
;
queue
->
elements
=
0
;
queue
->
compare
=
compare
;
queue
->
compare
=
compare
;
queue
->
first_cmp_arg
=
first_cmp_arg
;
queue
->
first_cmp_arg
=
first_cmp_arg
;
queue
->
offset_to_key
=
offset_to_key
;
queue
->
offset_to_key
=
offset_to_key
;
queue
->
max_at_top
=
max_at_top
?
(
-
1
^
1
)
:
0
;
queue
->
max_at_top
=
max_at_top
?
(
-
1
^
1
)
:
0
;
resize_queue
(
queue
,
max_elements
);
DBUG_RETURN
(
0
);
}
int
resize_queue
(
QUEUE
*
queue
,
uint
max_elements
)
{
byte
**
new_root
;
DBUG_ENTER
(
"resize_queue"
);
if
(
queue
->
max_elements
==
max_elements
)
DBUG_RETURN
(
0
);
if
((
new_root
=
(
byte
**
)
my_realloc
((
void
*
)
queue
->
root
,
(
max_elements
+
1
)
*
sizeof
(
void
*
),
MYF
(
MY_WME
)))
==
0
)
DBUG_RETURN
(
1
);
set_if_smaller
(
queue
->
elements
,
max_elements
);
queue
->
max_elements
=
max_elements
;
queue
->
root
=
new_root
;
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
...
...
mysys/thr_alarm.c
View file @
2667d7f8
...
@@ -120,6 +120,16 @@ void init_thr_alarm(uint max_alarms)
...
@@ -120,6 +120,16 @@ void init_thr_alarm(uint max_alarms)
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
void
resize_thr_alarm
(
uint
max_alarms
)
{
pthread_mutex_lock
(
&
LOCK_alarm
);
/* it's ok not to shrink the queue sometimes */
if
(
alarm_queue
.
elements
<
max_alarms
)
resize_queue
(
&
alarm_queue
,
max_alarms
+
1
);
pthread_mutex_unlock
(
&
LOCK_alarm
);
return
;
}
/*
/*
Request alarm after sec seconds.
Request alarm after sec seconds.
...
...
sql/set_var.cc
View file @
2667d7f8
...
@@ -86,6 +86,7 @@ static void fix_myisam_max_extra_sort_file_size(THD *thd, enum_var_type type);
...
@@ -86,6 +86,7 @@ static void fix_myisam_max_extra_sort_file_size(THD *thd, enum_var_type type);
static
void
fix_myisam_max_sort_file_size
(
THD
*
thd
,
enum_var_type
type
);
static
void
fix_myisam_max_sort_file_size
(
THD
*
thd
,
enum_var_type
type
);
static
void
fix_max_binlog_size
(
THD
*
thd
,
enum_var_type
type
);
static
void
fix_max_binlog_size
(
THD
*
thd
,
enum_var_type
type
);
static
void
fix_max_relay_log_size
(
THD
*
thd
,
enum_var_type
type
);
static
void
fix_max_relay_log_size
(
THD
*
thd
,
enum_var_type
type
);
static
void
fix_max_connections
(
THD
*
thd
,
enum_var_type
type
);
/*
/*
Variable definition list
Variable definition list
...
@@ -147,7 +148,8 @@ sys_var_long_ptr sys_max_binlog_size("max_binlog_size",
...
@@ -147,7 +148,8 @@ sys_var_long_ptr sys_max_binlog_size("max_binlog_size",
&
max_binlog_size
,
&
max_binlog_size
,
fix_max_binlog_size
);
fix_max_binlog_size
);
sys_var_long_ptr
sys_max_connections
(
"max_connections"
,
sys_var_long_ptr
sys_max_connections
(
"max_connections"
,
&
max_connections
);
&
max_connections
,
fix_max_connections
);
sys_var_long_ptr
sys_max_connect_errors
(
"max_connect_errors"
,
sys_var_long_ptr
sys_max_connect_errors
(
"max_connect_errors"
,
&
max_connect_errors
);
&
max_connect_errors
);
sys_var_long_ptr
sys_max_delayed_threads
(
"max_delayed_threads"
,
sys_var_long_ptr
sys_max_delayed_threads
(
"max_delayed_threads"
,
...
@@ -636,7 +638,7 @@ static void fix_max_join_size(THD *thd, enum_var_type type)
...
@@ -636,7 +638,7 @@ static void fix_max_join_size(THD *thd, enum_var_type type)
thd
->
options
&=
~
OPTION_BIG_SELECTS
;
thd
->
options
&=
~
OPTION_BIG_SELECTS
;
}
}
}
}
/*
/*
If one doesn't use the SESSION modifier, the isolation level
If one doesn't use the SESSION modifier, the isolation level
...
@@ -689,7 +691,7 @@ static void fix_key_buffer_size(THD *thd, enum_var_type type)
...
@@ -689,7 +691,7 @@ static void fix_key_buffer_size(THD *thd, enum_var_type type)
}
}
void
fix_delay_key_write
(
THD
*
thd
,
enum_var_type
type
)
extern
void
fix_delay_key_write
(
THD
*
thd
,
enum_var_type
type
)
{
{
switch
((
enum_delay_key_write
)
delay_key_write_options
)
{
switch
((
enum_delay_key_write
)
delay_key_write_options
)
{
case
DELAY_KEY_WRITE_NONE
:
case
DELAY_KEY_WRITE_NONE
:
...
@@ -705,7 +707,7 @@ void fix_delay_key_write(THD *thd, enum_var_type type)
...
@@ -705,7 +707,7 @@ void fix_delay_key_write(THD *thd, enum_var_type type)
}
}
}
}
void
fix_max_binlog_size
(
THD
*
thd
,
enum_var_type
type
)
static
void
fix_max_binlog_size
(
THD
*
thd
,
enum_var_type
type
)
{
{
DBUG_ENTER
(
"fix_max_binlog_size"
);
DBUG_ENTER
(
"fix_max_binlog_size"
);
DBUG_PRINT
(
"info"
,(
"max_binlog_size=%lu max_relay_log_size=%lu"
,
DBUG_PRINT
(
"info"
,(
"max_binlog_size=%lu max_relay_log_size=%lu"
,
...
@@ -716,7 +718,7 @@ void fix_max_binlog_size(THD *thd, enum_var_type type)
...
@@ -716,7 +718,7 @@ void fix_max_binlog_size(THD *thd, enum_var_type type)
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
void
fix_max_relay_log_size
(
THD
*
thd
,
enum_var_type
type
)
static
void
fix_max_relay_log_size
(
THD
*
thd
,
enum_var_type
type
)
{
{
DBUG_ENTER
(
"fix_max_relay_log_size"
);
DBUG_ENTER
(
"fix_max_relay_log_size"
);
DBUG_PRINT
(
"info"
,(
"max_binlog_size=%lu max_relay_log_size=%lu"
,
DBUG_PRINT
(
"info"
,(
"max_binlog_size=%lu max_relay_log_size=%lu"
,
...
@@ -726,6 +728,13 @@ void fix_max_relay_log_size(THD *thd, enum_var_type type)
...
@@ -726,6 +728,13 @@ void fix_max_relay_log_size(THD *thd, enum_var_type type)
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
#include <thr_alarm.h>
static
void
fix_max_connections
(
THD
*
thd
,
enum_var_type
type
)
{
resize_thr_alarm
(
max_connections
);
}
bool
sys_var_long_ptr
::
update
(
THD
*
thd
,
set_var
*
var
)
bool
sys_var_long_ptr
::
update
(
THD
*
thd
,
set_var
*
var
)
{
{
ulonglong
tmp
=
var
->
value
->
val_int
();
ulonglong
tmp
=
var
->
value
->
val_int
();
...
@@ -1478,7 +1487,7 @@ int set_var::check(THD *thd)
...
@@ -1478,7 +1487,7 @@ int set_var::check(THD *thd)
{
{
my_error
(
ER_WRONG_TYPE_FOR_VAR
,
MYF
(
0
),
var
->
name
);
my_error
(
ER_WRONG_TYPE_FOR_VAR
,
MYF
(
0
),
var
->
name
);
return
-
1
;
return
-
1
;
}
}
return
var
->
check
(
thd
,
this
)
?
-
1
:
0
;
return
var
->
check
(
thd
,
this
)
?
-
1
:
0
;
}
}
...
...
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