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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
f6a365a5
Commit
f6a365a5
authored
Jun 01, 2003
by
monty@narttu.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small fixes (nothing nameworthy)
parent
f6579fd9
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
95 additions
and
53 deletions
+95
-53
include/my_global.h
include/my_global.h
+4
-1
innobase/os/os0file.c
innobase/os/os0file.c
+24
-13
mysql-test/r/errors.result
mysql-test/r/errors.result
+0
-0
mysql-test/t/err000001.test
mysql-test/t/err000001.test
+0
-19
mysql-test/t/errors.test
mysql-test/t/errors.test
+32
-0
mysys/thr_alarm.c
mysys/thr_alarm.c
+31
-10
sql/mysqld.cc
sql/mysqld.cc
+4
-10
No files found.
include/my_global.h
View file @
f6a365a5
/* Copyright (C) 2000 MySQL AB
/* Copyright (C) 2000
-2003
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
...
...
@@ -640,6 +640,9 @@ typedef long my_ptrdiff_t;
typedef
long
long
my_ptrdiff_t
;
#endif
/* typedef used for length of string; Should be unsigned! */
typedef
ulong
size_str
;
#define MY_ALIGN(A,L) (((A) + (L) - 1) & ~((L) - 1))
#define ALIGN_SIZE(A) MY_ALIGN((A),sizeof(double))
/* Size to make adressable obj. */
...
...
innobase/os/os0file.c
View file @
f6a365a5
...
...
@@ -295,7 +295,8 @@ os_file_handle_error(
/* out: TRUE if we should retry the
operation */
os_file_t
file
,
/* in: file pointer */
char
*
name
)
/* in: name of a file or NULL */
char
*
name
,
/* in: name of a file or NULL */
const
char
*
operation
)
/* in: type of operation */
{
ulint
err
;
...
...
@@ -337,6 +338,7 @@ os_file_handle_error(
if
(
name
)
{
fprintf
(
stderr
,
"InnoDB: File name %s
\n
"
,
name
);
}
fprintf
(
stderr
,
"InnoDB: system call %s
\n
"
,
operation
);
fprintf
(
stderr
,
"InnoDB: Cannot continue operation.
\n
"
);
...
...
@@ -419,7 +421,9 @@ try_again:
if
(
file
==
INVALID_HANDLE_VALUE
)
{
*
success
=
FALSE
;
retry
=
os_file_handle_error
(
file
,
name
);
retry
=
os_file_handle_error
(
file
,
name
,
create_mode
==
OS_FILE_OPEN
?
"open"
:
"create"
);
if
(
retry
)
{
goto
try_again
;
...
...
@@ -460,7 +464,10 @@ try_again:
if
(
file
==
-
1
)
{
*
success
=
FALSE
;
retry
=
os_file_handle_error
(
file
,
name
);
retry
=
os_file_handle_error
(
file
,
name
,
create_mode
==
OS_FILE_OPEN
?
"open"
:
"create"
);
if
(
retry
)
{
goto
try_again
;
...
...
@@ -568,7 +575,9 @@ try_again:
if
(
file
==
INVALID_HANDLE_VALUE
)
{
*
success
=
FALSE
;
retry
=
os_file_handle_error
(
file
,
name
);
retry
=
os_file_handle_error
(
file
,
name
,
create_mode
==
OS_FILE_OPEN
?
"open"
:
"create"
);
if
(
retry
)
{
goto
try_again
;
...
...
@@ -615,7 +624,9 @@ try_again:
if
(
file
==
-
1
)
{
*
success
=
FALSE
;
retry
=
os_file_handle_error
(
file
,
name
);
retry
=
os_file_handle_error
(
file
,
name
,
create_mode
==
OS_FILE_OPEN
?
"open"
:
"create"
);
if
(
retry
)
{
goto
try_again
;
...
...
@@ -649,7 +660,7 @@ os_file_close(
return
(
TRUE
);
}
os_file_handle_error
(
file
,
NULL
);
os_file_handle_error
(
file
,
NULL
,
"close"
);
return
(
FALSE
);
#else
int
ret
;
...
...
@@ -657,7 +668,7 @@ os_file_close(
ret
=
close
(
file
);
if
(
ret
==
-
1
)
{
os_file_handle_error
(
file
,
NULL
);
os_file_handle_error
(
file
,
NULL
,
"close"
);
return
(
FALSE
);
}
...
...
@@ -825,7 +836,7 @@ os_file_flush(
return
(
TRUE
);
}
os_file_handle_error
(
file
,
NULL
);
os_file_handle_error
(
file
,
NULL
,
"flush"
);
/* It is a fatal error if a file flush does not succeed, because then
the database can get corrupt on disk */
...
...
@@ -858,7 +869,7 @@ os_file_flush(
fprintf
(
stderr
,
" InnoDB: Error: the OS said file flush did not succeed
\n
"
);
os_file_handle_error
(
file
,
NULL
);
os_file_handle_error
(
file
,
NULL
,
"flush"
);
/* It is a fatal error if a file flush does not succeed, because then
the database can get corrupt on disk */
...
...
@@ -1099,7 +1110,7 @@ try_again:
#ifdef __WIN__
error_handling:
#endif
retry
=
os_file_handle_error
(
file
,
NULL
);
retry
=
os_file_handle_error
(
file
,
NULL
,
"read"
);
if
(
retry
)
{
goto
try_again
;
...
...
@@ -2014,7 +2025,7 @@ try_again:
os_aio_array_free_slot
(
array
,
slot
);
retry
=
os_file_handle_error
(
file
,
name
);
retry
=
os_file_handle_error
(
file
,
name
,
"aio"
);
if
(
retry
)
{
...
...
@@ -2113,7 +2124,7 @@ os_aio_windows_handle(
ut_a
(
TRUE
==
os_file_flush
(
slot
->
file
));
}
}
else
{
os_file_handle_error
(
slot
->
file
,
slot
->
name
);
os_file_handle_error
(
slot
->
file
,
slot
->
name
,
"aio"
);
ret_val
=
FALSE
;
}
...
...
mysql-test/r/err
000001
.result
→
mysql-test/r/err
ors
.result
View file @
f6a365a5
File moved
mysql-test/t/err000001.test
deleted
100644 → 0
View file @
f6579fd9
#
# Test some error conditions
#
drop
table
if
exists
t1
;
!
$
1146
insert
into
t1
values
(
1
);
!
$
1146
delete
from
t1
;
!
$
1146
update
t1
set
a
=
1
;
create
table
t1
(
a
int
);
!
$
1054
select
count
(
test
.
t1
.
b
)
from
t1
;
!
$
1109
select
count
(
not_existing_database
.
t1
)
from
t1
;
!
$
1109
select
count
(
not_existing_database
.
t1
.
a
)
from
t1
;
--
error
1044
,
1146
select
count
(
not_existing_database
.
t1
.
a
)
from
not_existing_database
.
t1
;
!
$
1054
select
1
from
t1
order
by
2
;
!
$
1054
select
1
from
t1
group
by
2
;
!
$
1054
select
1
from
t1
order
by
t1
.
b
;
!
$
1054
select
count
(
*
),
b
from
t1
;
drop
table
t1
;
mysql-test/t/errors.test
0 → 100644
View file @
f6a365a5
#
# Test some error conditions
#
drop
table
if
exists
t1
;
--
error
1146
insert
into
t1
values
(
1
);
--
error
1146
delete
from
t1
;
--
error
1146
update
t1
set
a
=
1
;
#
create
table
t1
(
a
int
);
--
error
1054
select
count
(
test
.
t1
.
b
)
from
t1
;
--
error
1109
select
count
(
not_existing_database
.
t1
)
from
t1
;
--
error
1109
select
count
(
not_existing_database
.
t1
.
a
)
from
t1
;
--
error
1044
,
1146
select
count
(
not_existing_database
.
t1
.
a
)
from
not_existing_database
.
t1
;
--
error
1054
select
1
from
t1
order
by
2
;
--
error
1054
select
1
from
t1
group
by
2
;
--
error
1054
select
1
from
t1
order
by
t1
.
b
;
--
error
1054
select
count
(
*
),
b
from
t1
;
drop
table
t1
;
mysys/thr_alarm.c
View file @
f6a365a5
...
...
@@ -38,20 +38,21 @@
#endif
static
int
alarm_aborted
=
1
;
/* No alarm thread */
my_bool
thr_alarm_inited
=
0
;
my_bool
thr_alarm_inited
=
0
;
volatile
my_bool
alarm_thread_running
=
0
;
static
sig_handler
process_alarm_part2
(
int
sig
);
#if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2)
static
pthread_mutex_t
LOCK_alarm
;
static
pthread_cond_t
COND_alarm
;
static
sigset_t
full_signal_set
;
static
QUEUE
alarm_queue
;
static
uint
max_used_alarms
=
0
;
pthread_t
alarm_thread
;
#ifdef USE_ALARM_THREAD
static
pthread_cond_t
COND_alarm
;
static
void
*
alarm_handler
(
void
*
arg
);
#define reschedule_alarms() pthread_cond_signal(&COND_alarm)
#else
...
...
@@ -78,6 +79,7 @@ void init_thr_alarm(uint max_alarms)
compare_ulong
,
NullS
);
sigfillset
(
&
full_signal_set
);
/* Neaded to block signals */
pthread_mutex_init
(
&
LOCK_alarm
,
MY_MUTEX_INIT_FAST
);
pthread_cond_init
(
&
COND_alarm
,
NULL
);
#if THR_CLIENT_ALARM != SIGALRM || defined(USE_ALARM_THREAD)
#if defined(HAVE_mit_thread)
sigset
(
THR_CLIENT_ALARM
,
thread_alarm
);
/* int. thread system calls */
...
...
@@ -97,7 +99,6 @@ void init_thr_alarm(uint max_alarms)
{
pthread_attr_t
thr_attr
;
pthread_attr_init
(
&
thr_attr
);
pthread_cond_init
(
&
COND_alarm
,
NULL
);
pthread_attr_setscope
(
&
thr_attr
,
PTHREAD_SCOPE_PROCESS
);
pthread_attr_setdetachstate
(
&
thr_attr
,
PTHREAD_CREATE_DETACHED
);
pthread_attr_setstacksize
(
&
thr_attr
,
8196
);
...
...
@@ -383,28 +384,45 @@ static sig_handler process_alarm_part2(int sig __attribute__((unused)))
void
end_thr_alarm
(
my_bool
free_structures
)
{
DBUG_ENTER
(
"end_thr_alarm"
);
if
(
alarm_aborted
!=
1
)
if
(
alarm_aborted
!=
1
)
/* If memory not freed */
{
pthread_mutex_lock
(
&
LOCK_alarm
);
DBUG_PRINT
(
"info"
,(
"Resheduling %d waiting alarms"
,
alarm_queue
.
elements
));
alarm_aborted
=
-
1
;
/* mark aborted */
if
(
alarm_queue
.
elements
||
(
alarm_thread_running
&&
free_structures
))
{
if
(
pthread_equal
(
pthread_self
(),
alarm_thread
))
alarm
(
1
);
/* Shut down everything soon */
else
reschedule_alarms
();
}
if
(
free_structures
)
{
struct
timespec
abstime
;
/*
The following test is just for safety, the caller should not
depend on this
*/
DBUG_ASSERT
(
!
alarm_queue
.
elements
);
/* Wait until alarm thread dies */
set_timespec
(
abstime
,
10
);
/* Wait up to 10 seconds */
while
(
alarm_thread_running
)
{
int
error
=
pthread_cond_timedwait
(
&
COND_alarm
,
&
LOCK_alarm
,
&
abstime
);
if
(
error
==
ETIME
||
error
==
ETIMEDOUT
)
break
;
/* Don't wait forever */
}
if
(
!
alarm_queue
.
elements
)
{
delete_queue
(
&
alarm_queue
);
alarm_aborted
=
1
;
pthread_mutex_unlock
(
&
LOCK_alarm
);
if
(
!
alarm_thread_running
)
/* Safety */
{
pthread_mutex_destroy
(
&
LOCK_alarm
);
pthread_cond_destroy
(
&
COND_alarm
);
}
}
}
else
...
...
@@ -490,6 +508,7 @@ static void *alarm_handler(void *arg __attribute__((unused)))
puts
(
"Starting alarm thread"
);
#endif
my_thread_init
();
alarm_thread_running
=
1
;
pthread_mutex_lock
(
&
LOCK_alarm
);
for
(;;)
{
...
...
@@ -514,7 +533,7 @@ static void *alarm_handler(void *arg __attribute__((unused)))
}
}
}
else
if
(
alarm_aborted
)
else
if
(
alarm_aborted
==
-
1
)
break
;
else
if
((
error
=
pthread_cond_wait
(
&
COND_alarm
,
&
LOCK_alarm
)))
{
...
...
@@ -526,6 +545,8 @@ static void *alarm_handler(void *arg __attribute__((unused)))
process_alarm
(
0
);
}
bzero
((
char
*
)
&
alarm_thread
,
sizeof
(
alarm_thread
));
/* For easy debugging */
alarm_thread_running
=
0
;
pthread_cond_signal
(
&
COND_alarm
);
pthread_mutex_unlock
(
&
LOCK_alarm
);
pthread_exit
(
0
);
return
0
;
/* Impossible */
...
...
sql/mysqld.cc
View file @
f6a365a5
...
...
@@ -1520,7 +1520,6 @@ the problem, but since we have already crashed, something is definitely wrong\n\
and this may fail.
\n\n
"
);
fprintf
(
stderr
,
"key_buffer_size=%lu
\n
"
,
(
ulong
)
keybuff_size
);
fprintf
(
stderr
,
"read_buffer_size=%ld
\n
"
,
global_system_variables
.
read_buff_size
);
fprintf
(
stderr
,
"sort_buffer_size=%ld
\n
"
,
thd
->
variables
.
sortbuff_size
);
fprintf
(
stderr
,
"max_used_connections=%ld
\n
"
,
max_used_connections
);
fprintf
(
stderr
,
"max_connections=%ld
\n
"
,
max_connections
);
fprintf
(
stderr
,
"threads_connected=%d
\n
"
,
thread_count
);
...
...
@@ -1528,7 +1527,7 @@ and this may fail.\n\n");
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = %ld K
\n
\
bytes of memory
\n
"
,
((
ulong
)
keybuff_size
+
(
global_system_variables
.
read_buff_size
+
thd
->
variables
.
sortbuff_size
)
*
global_system_
variables
.
sortbuff_size
)
*
max_connections
)
/
1024
);
fprintf
(
stderr
,
"Hope that's ok; if not, decrease some variables in the equation.
\n\n
"
);
...
...
@@ -1557,14 +1556,9 @@ the thread stack. Please read http://www.mysql.com/doc/L/i/Linux.html\n\n",
Some pointers may be invalid and cause the dump to abort...
\n
"
);
safe_print_str
(
"thd->query"
,
thd
->
query
,
1024
);
fprintf
(
stderr
,
"thd->thread_id=%ld
\n
"
,
thd
->
thread_id
);
fprintf
(
stderr
,
"
\n
\
Successfully dumped variables, if you ran with --log, take a look at the
\n
\
details of what thread %ld did to cause the crash. In some cases of really
\n
\
bad corruption, the values shown above may be invalid.
\n\n
"
,
thd
->
thread_id
);
}
fprintf
(
stderr
,
"\
The manual page at http://www.mysql.com/doc/
C/r
/Crashing.html contains
\n
\
The manual page at http://www.mysql.com/doc/
en
/Crashing.html contains
\n
\
information that should help you find out what is causing the crash.
\n
"
);
fflush
(
stderr
);
#endif
/* HAVE_STACKTRACE */
...
...
@@ -1639,6 +1633,7 @@ static void init_signals(void)
sigaddset
(
&
set
,
SIGHUP
);
/* Fix signals if blocked by parents (can happen on Mac OS X) */
sigemptyset
(
&
sa
.
sa_mask
);
sa
.
sa_flags
=
0
;
sa
.
sa_handler
=
print_signal_warning
;
sigaction
(
SIGTERM
,
&
sa
,
(
struct
sigaction
*
)
0
);
...
...
@@ -2307,7 +2302,6 @@ The server will not act as a slave.");
using_update_log
=
1
;
}
if
(
opt_bootstrap
)
{
int
error
=
bootstrap
(
stdin
);
...
...
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