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
55a6911b
Commit
55a6911b
authored
23 years ago
by
monty@hundin.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Portability fixes.
parent
193ae61f
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
70 additions
and
65 deletions
+70
-65
Build-tools/Do-compile
Build-tools/Do-compile
+1
-1
Docs/manual.texi
Docs/manual.texi
+44
-3
mysql-test/t/rpl000017.test
mysql-test/t/rpl000017.test
+1
-0
mysys/mf_iocache2.c
mysys/mf_iocache2.c
+1
-0
sql/item_sum.cc
sql/item_sum.cc
+1
-1
sql/log_event.cc
sql/log_event.cc
+2
-2
sql/mysqld.cc
sql/mysqld.cc
+7
-7
sql/sql_base.cc
sql/sql_base.cc
+0
-1
sql/sql_delete.cc
sql/sql_delete.cc
+0
-2
sql/sql_select.cc
sql/sql_select.cc
+0
-34
sql/uniques.cc
sql/uniques.cc
+13
-14
No files found.
Build-tools/Do-compile
View file @
55a6911b
...
@@ -143,7 +143,7 @@ if ($opt_stage <= 1)
...
@@ -143,7 +143,7 @@ if ($opt_stage <= 1)
if
(
$opt_stage
<=
2
)
if
(
$opt_stage
<=
2
)
{
{
unlink
(
$opt_distribution
)
if
(
!
$opt_delete
&&
!
$opt_use_old_distribution
);
unlink
(
$opt_distribution
)
if
(
$opt_delete
&&
!
$opt_use_old_distribution
);
safe_system
("
$make
");
safe_system
("
$make
");
}
}
...
...
This diff is collapsed.
Click to expand it.
Docs/manual.texi
View file @
55a6911b
...
@@ -770,9 +770,11 @@ databases that contain 50,000,000 records and we know of users that
...
@@ -770,9 +770,11 @@ databases that contain 50,000,000 records and we know of users that
uses MySQL with 60,000 tables and about 5,000,000,000 rows
uses MySQL with 60,000 tables and about 5,000,000,000 rows
@item
@item
All columns have default values. You can use @code{INSERT} to insert a
@cindex default values
subset of a table's columns; those columns that are not explicitly given
All columns have default values.
values are set to their default values.
You can use @code{INSERT} to insert a subset of a table's columns; those
columns that are not explicitly given values are set to their default
values.
@item
@item
Uses GNU Automake, Autoconf, and Libtool for portability.
Uses GNU Automake, Autoconf, and Libtool for portability.
...
@@ -24297,6 +24299,37 @@ takes more effort and hardware.
...
@@ -24297,6 +24299,37 @@ takes more effort and hardware.
We are also working on some extensions to solve this problem for some
We are also working on some extensions to solve this problem for some
common application niches.
common application niches.
MySQL can work with both transactional and not transactional tables. To
be able to work smoothly with not transactional tables (which can't
rollback if something goes wrong), MySQL has the following rules:
@cindex default values
@itemize @bullet
@item
All columns has default values.
@item
If you insert a 'wrong' value in a column like a @code{NULL} in a
@code{NOT NULL} column or a too big numerical value in a numerical
column, MySQL will instead of giving an error instead set the column to
the 'best possible value'. For numerical values this is 0, the smallest
possible values or the largest possible value. For strings this is
either the empty string or the longest possible string that can be in
the column.
@item
All calculated expressions returns a value that can be used instead of
signaling an error condition. For example 1/0 returns @code{NULL}
@end itemize
The reason for the above rules is that we can't check these conditions
before the query starts to execute. If we encounter a problem after
updating a few rows, we can't just rollback as the table type may not
support this. We can't stop because in that case the update would be
'half done' which is probably the worst possible scenario. In this case
it's better to 'do the best you can' and then continue as if nothing
happened.
The above means that one should not use MySQL to check fields content,
but one should do this in the application.
@node Portability, Internal use, Design Limitations, Optimize Overview
@node Portability, Internal use, Design Limitations, Optimize Overview
@subsection Portability
@subsection Portability
...
@@ -32569,11 +32602,18 @@ If you specify no column list for @code{INSERT ... VALUES} or @code{INSERT
...
@@ -32569,11 +32602,18 @@ If you specify no column list for @code{INSERT ... VALUES} or @code{INSERT
the columns in the table, use @code{DESCRIBE tbl_name} to find out.
the columns in the table, use @code{DESCRIBE tbl_name} to find out.
@item
@item
@cindex default values
Any column not explicitly given a value is set to its default value. For
Any column not explicitly given a value is set to its default value. For
example, if you specify a column list that doesn't name all the columns in
example, if you specify a column list that doesn't name all the columns in
the table, unnamed columns are set to their default values. Default value
the table, unnamed columns are set to their default values. Default value
assignment is described in @ref{CREATE TABLE, , @code{CREATE TABLE}}.
assignment is described in @ref{CREATE TABLE, , @code{CREATE TABLE}}.
MySQL always has a default value for all fields. This is something
that is imposed on MySQL to be able to work with both transactional
and not transactional tables.
Our view is that checking of fields content should be done in the
application and not in the database server.
@item
@item
An @code{expression} may refer to any column that was set earlier in a value
An @code{expression} may refer to any column that was set earlier in a value
list. For example, you can say this:
list. For example, you can say this:
...
@@ -33814,6 +33854,7 @@ as setting it to @code{NULL}, because @code{0} is a valid @code{TIMESTAMP}
...
@@ -33814,6 +33854,7 @@ as setting it to @code{NULL}, because @code{0} is a valid @code{TIMESTAMP}
value.
value.
@item
@item
@cindex default values
If no @code{DEFAULT} value is specified for a column, MySQL
If no @code{DEFAULT} value is specified for a column, MySQL
automatically assigns one.
automatically assigns one.
This diff is collapsed.
Click to expand it.
mysql-test/t/rpl000017.test
View file @
55a6911b
...
@@ -3,6 +3,7 @@ connect (slave,localhost,root,,test,0,mysql-slave.sock);
...
@@ -3,6 +3,7 @@ connect (slave,localhost,root,,test,0,mysql-slave.sock);
connection
master
;
connection
master
;
reset
master
;
reset
master
;
grant
file
on
*.*
to
replicate
@
localhost
identified
by
'aaaaaaaaaaaaaaab'
;
grant
file
on
*.*
to
replicate
@
localhost
identified
by
'aaaaaaaaaaaaaaab'
;
grant
file
on
*.*
to
replicate
@
127.0
.
0.1
identified
by
'aaaaaaaaaaaaaaab'
;
connection
slave
;
connection
slave
;
slave
start
;
slave
start
;
connection
master
;
connection
master
;
...
...
This diff is collapsed.
Click to expand it.
mysys/mf_iocache2.c
View file @
55a6911b
...
@@ -96,6 +96,7 @@ uint my_b_fill(IO_CACHE *info)
...
@@ -96,6 +96,7 @@ uint my_b_fill(IO_CACHE *info)
** Read a string ended by '\n' into a buffer of 'max_length' size.
** Read a string ended by '\n' into a buffer of 'max_length' size.
** Returns number of characters read, 0 on error.
** Returns number of characters read, 0 on error.
** last byte is set to '\0'
** last byte is set to '\0'
** If buffer is full then to[max_length-1] will be set to \0.
*/
*/
uint
my_b_gets
(
IO_CACHE
*
info
,
char
*
to
,
uint
max_length
)
uint
my_b_gets
(
IO_CACHE
*
info
,
char
*
to
,
uint
max_length
)
...
...
This diff is collapsed.
Click to expand it.
sql/item_sum.cc
View file @
55a6911b
...
@@ -745,7 +745,7 @@ Item_sum_hybrid::min_max_update_int_field(int offset)
...
@@ -745,7 +745,7 @@ Item_sum_hybrid::min_max_update_int_field(int offset)
(
ulonglong
)
old_nr
>
(
ulonglong
)
nr
:
(
ulonglong
)
old_nr
>
(
ulonglong
)
nr
:
old_nr
>
nr
);
old_nr
>
nr
);
/* (cmp_sign > 0 && res) || (!(cmp_sign > 0) && !res) */
/* (cmp_sign > 0 && res) || (!(cmp_sign > 0) && !res) */
if
(
cmp_sign
>
0
^
!
res
)
if
(
(
cmp_sign
>
0
)
^
(
!
res
)
)
old_nr
=
nr
;
old_nr
=
nr
;
}
}
result_field
->
set_notnull
();
result_field
->
set_notnull
();
...
...
This diff is collapsed.
Click to expand it.
sql/log_event.cc
View file @
55a6911b
...
@@ -1493,10 +1493,10 @@ int Query_log_event::exec_event(struct st_master_info* mi)
...
@@ -1493,10 +1493,10 @@ int Query_log_event::exec_event(struct st_master_info* mi)
(
actual_error
=
thd
->
net
.
last_errno
)
&&
expected_error
)
(
actual_error
=
thd
->
net
.
last_errno
)
&&
expected_error
)
{
{
const
char
*
errmsg
=
"Slave: did not get the expected error\
const
char
*
errmsg
=
"Slave: did not get the expected error\
running query from master - expected: '%s'
(%d), got '%s'
(%d)"
;
running query from master - expected: '%s'
(%d), got '%s'
(%d)"
;
sql_print_error
(
errmsg
,
ER_SAFE
(
expected_error
),
sql_print_error
(
errmsg
,
ER_SAFE
(
expected_error
),
expected_error
,
expected_error
,
actual_error
?
thd
->
net
.
last_error
:
"no error"
,
actual_error
?
thd
->
net
.
last_error
:
"no error"
,
actual_error
);
actual_error
);
thd
->
query_error
=
1
;
thd
->
query_error
=
1
;
}
}
...
...
This diff is collapsed.
Click to expand it.
sql/mysqld.cc
View file @
55a6911b
...
@@ -1202,13 +1202,13 @@ static sig_handler handle_segfault(int sig)
...
@@ -1202,13 +1202,13 @@ static sig_handler handle_segfault(int sig)
fprintf
(
stderr
,
"\
fprintf
(
stderr
,
"\
mysqld got signal %d;
\n
\
mysqld got signal %d;
\n
\
This could be because you hit a bug. It is also possible that this binary
\n
\
This could be because you hit a bug. It is also possible that this binary
\n
\
or one of the libraries it was linked agaist is corrupt, improperly built,
\n
\
or one of the libraries it was linked agai
n
st is corrupt, improperly built,
\n
\
or misconfigured. This error can also be caused by malfunctioning hardware.
\n
"
,
or misconfigured. This error can also be caused by malfunctioning hardware.
\n
"
,
sig
);
sig
);
fprintf
(
stderr
,
"\
fprintf
(
stderr
,
"\
We will try our best to scrape up some info that will hopefully help diagnose
\n
\
We will try our best to scrape up some info that will hopefully help diagnose
\n
\
the problem, but since we have already crashed, something is definitely wrong
\n
\
the problem, but since we have already crashed, something is definitely wrong
\n
\
and this may fail
\n\n
"
);
and this may fail
.
\n\n
"
);
fprintf
(
stderr
,
"key_buffer_size=%ld
\n
"
,
keybuff_size
);
fprintf
(
stderr
,
"key_buffer_size=%ld
\n
"
,
keybuff_size
);
fprintf
(
stderr
,
"record_buffer=%ld
\n
"
,
my_default_record_cache_size
);
fprintf
(
stderr
,
"record_buffer=%ld
\n
"
,
my_default_record_cache_size
);
fprintf
(
stderr
,
"sort_buffer=%ld
\n
"
,
sortbuff_size
);
fprintf
(
stderr
,
"sort_buffer=%ld
\n
"
,
sortbuff_size
);
...
@@ -1219,15 +1219,15 @@ and this may fail\n\n");
...
@@ -1219,15 +1219,15 @@ and this may fail\n\n");
key_buffer_size + (record_buffer + sort_buffer)*max_connections = %ld K
\n
\
key_buffer_size + (record_buffer + sort_buffer)*max_connections = %ld K
\n
\
bytes of memory
\n
"
,
(
keybuff_size
+
(
my_default_record_cache_size
+
bytes of memory
\n
"
,
(
keybuff_size
+
(
my_default_record_cache_size
+
sortbuff_size
)
*
max_connections
)
/
1024
);
sortbuff_size
)
*
max_connections
)
/
1024
);
fprintf
(
stderr
,
"Hope that's ok
, if not, decrease some variables in the equation
\n\n
"
);
fprintf
(
stderr
,
"Hope that's ok
; if not, decrease some variables in the equation.
\n\n
"
);
#if defined(HAVE_LINUXTHREADS)
#if defined(HAVE_LINUXTHREADS)
if
(
sizeof
(
char
*
)
==
4
&&
thread_count
>
UNSAFE_DEFAULT_LINUX_THREADS
)
if
(
sizeof
(
char
*
)
==
4
&&
thread_count
>
UNSAFE_DEFAULT_LINUX_THREADS
)
{
{
fprintf
(
stderr
,
"\
fprintf
(
stderr
,
"\
You seem to be running 32-bit Linux and have %d concurrent connections.
\n
\
You seem to be running 32-bit Linux and have %d concurrent connections.
\n
\
If you have not changed STACK_SIZE in LinuxThreads and buil
d
the binary
\n
\
If you have not changed STACK_SIZE in LinuxThreads and buil
t
the binary
\n
\
yourself, LinuxThreads is quite likely to steal a part of global heap for
\n
\
yourself, LinuxThreads is quite likely to steal a part of
the
global heap for
\n
\
the thread stack. Please read http://www.mysql.com/doc/L/i/Linux.html
\n\n
"
,
the thread stack. Please read http://www.mysql.com/doc/L/i/Linux.html
\n\n
"
,
thread_count
);
thread_count
);
}
}
...
@@ -1251,12 +1251,12 @@ Some pointers may be invalid and cause the dump to abort...\n");
...
@@ -1251,12 +1251,12 @@ Some pointers may be invalid and cause the dump to abort...\n");
fprintf
(
stderr
,
"
\n
fprintf
(
stderr
,
"
\n
Successfully dumped variables, if you ran with --log, take a look at the
\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
\
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
"
,
bad corruption, the values shown above may be invalid
.
\n\n
"
,
thd
->
thread_id
);
thd
->
thread_id
);
}
}
fprintf
(
stderr
,
"\
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/C/r/Crashing.html contains
\n
\
information that should help you find out what is causing the crash
\n
"
);
information that should help you find out what is causing the crash
.
\n
"
);
fflush
(
stderr
);
fflush
(
stderr
);
#endif
/* HAVE_STACKTRACE */
#endif
/* HAVE_STACKTRACE */
...
...
This diff is collapsed.
Click to expand it.
sql/sql_base.cc
View file @
55a6911b
...
@@ -1944,7 +1944,6 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
...
@@ -1944,7 +1944,6 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
// TODO: This could be optimized to use hashed names if t2 had a hash
// TODO: This could be optimized to use hashed names if t2 had a hash
for
(
j
=
0
;
j
<
t2
->
fields
;
j
++
)
for
(
j
=
0
;
j
<
t2
->
fields
;
j
++
)
{
{
key_map
tmp_map
;
if
(
!
my_strcasecmp
(
t1
->
field
[
i
]
->
field_name
,
if
(
!
my_strcasecmp
(
t1
->
field
[
i
]
->
field_name
,
t2
->
field
[
j
]
->
field_name
))
t2
->
field
[
j
]
->
field_name
))
{
{
...
...
This diff is collapsed.
Click to expand it.
sql/sql_delete.cc
View file @
55a6911b
...
@@ -309,7 +309,6 @@ bool multi_delete::send_data(List<Item> &values)
...
@@ -309,7 +309,6 @@ bool multi_delete::send_data(List<Item> &values)
continue
;
continue
;
table
->
file
->
position
(
table
->
record
[
0
]);
table
->
file
->
position
(
table
->
record
[
0
]);
int
rl
=
table
->
file
->
ref_length
;
if
(
secure_counter
<
0
)
if
(
secure_counter
<
0
)
{
{
...
@@ -397,7 +396,6 @@ int multi_delete::do_deletes (bool from_send_error)
...
@@ -397,7 +396,6 @@ int multi_delete::do_deletes (bool from_send_error)
table_being_deleted
=
table_being_deleted
->
next
,
counter
++
)
table_being_deleted
=
table_being_deleted
->
next
,
counter
++
)
{
{
TABLE
*
table
=
table_being_deleted
->
table
;
TABLE
*
table
=
table_being_deleted
->
table
;
int
rl
=
table
->
file
->
ref_length
;
if
(
tempfiles
[
counter
]
->
get
(
table
))
if
(
tempfiles
[
counter
]
->
get
(
table
))
{
{
error
=
1
;
error
=
1
;
...
...
This diff is collapsed.
Click to expand it.
sql/sql_select.cc
View file @
55a6911b
...
@@ -107,7 +107,6 @@ static uint find_shortest_key(TABLE *table, key_map usable_keys);
...
@@ -107,7 +107,6 @@ static uint find_shortest_key(TABLE *table, key_map usable_keys);
static
bool
test_if_skip_sort_order
(
JOIN_TAB
*
tab
,
ORDER
*
order
,
static
bool
test_if_skip_sort_order
(
JOIN_TAB
*
tab
,
ORDER
*
order
,
ha_rows
select_limit
,
bool
no_changes
);
ha_rows
select_limit
,
bool
no_changes
);
static
int
create_sort_index
(
JOIN_TAB
*
tab
,
ORDER
*
order
,
ha_rows
select_limit
);
static
int
create_sort_index
(
JOIN_TAB
*
tab
,
ORDER
*
order
,
ha_rows
select_limit
);
static
bool
fix_having
(
JOIN
*
join
,
Item
**
having
);
static
int
remove_duplicates
(
JOIN
*
join
,
TABLE
*
entry
,
List
<
Item
>
&
fields
,
static
int
remove_duplicates
(
JOIN
*
join
,
TABLE
*
entry
,
List
<
Item
>
&
fields
,
Item
*
having
);
Item
*
having
);
static
int
remove_dup_with_compare
(
THD
*
thd
,
TABLE
*
entry
,
Field
**
field
,
static
int
remove_dup_with_compare
(
THD
*
thd
,
TABLE
*
entry
,
Field
**
field
,
...
@@ -5443,39 +5442,6 @@ err:
...
@@ -5443,39 +5442,6 @@ err:
DBUG_RETURN
(
-
1
);
DBUG_RETURN
(
-
1
);
}
}
/*
** Add the HAVING criteria to table->select
*/
static
bool
fix_having
(
JOIN
*
join
,
Item
**
having
)
{
(
*
having
)
->
update_used_tables
();
// Some tables may have been const
JOIN_TAB
*
table
=&
join
->
join_tab
[
join
->
const_tables
];
table_map
used_tables
=
join
->
const_table_map
|
table
->
table
->
map
;
Item
*
sort_table_cond
=
make_cond_for_table
(
*
having
,
used_tables
,
used_tables
);
if
(
sort_table_cond
)
{
if
(
!
table
->
select
)
if
(
!
(
table
->
select
=
new
SQL_SELECT
))
return
1
;
if
(
!
table
->
select
->
cond
)
table
->
select
->
cond
=
sort_table_cond
;
else
// This should never happen
if
(
!
(
table
->
select
->
cond
=
new
Item_cond_and
(
table
->
select
->
cond
,
sort_table_cond
)))
return
1
;
table
->
select_cond
=
table
->
select
->
cond
;
DBUG_EXECUTE
(
"where"
,
print_where
(
table
->
select_cond
,
"select and having"
););
*
having
=
make_cond_for_table
(
*
having
,
~
(
table_map
)
0
,
~
used_tables
);
DBUG_EXECUTE
(
"where"
,
print_where
(
*
having
,
"having after make_cond"
););
}
return
0
;
}
/*****************************************************************************
/*****************************************************************************
** Remove duplicates from tmp table
** Remove duplicates from tmp table
** This should be recoded to add a uniuqe index to the table and remove
** This should be recoded to add a uniuqe index to the table and remove
...
...
This diff is collapsed.
Click to expand it.
sql/uniques.cc
View file @
55a6911b
...
@@ -35,6 +35,19 @@
...
@@ -35,6 +35,19 @@
#include "sql_sort.h"
#include "sql_sort.h"
int
unique_write_to_file
(
gptr
key
,
element_count
count
,
Unique
*
unique
)
{
return
my_b_write
(
&
unique
->
file
,
(
byte
*
)
key
,
unique
->
tree
.
size_of_element
)
?
1
:
0
;
}
int
unique_write_to_ptrs
(
gptr
key
,
element_count
count
,
Unique
*
unique
)
{
memcpy
(
unique
->
record_pointers
,
key
,
unique
->
tree
.
size_of_element
);
unique
->
record_pointers
+=
unique
->
tree
.
size_of_element
;
return
0
;
}
Unique
::
Unique
(
qsort_cmp2
comp_func
,
void
*
comp_func_fixed_arg
,
Unique
::
Unique
(
qsort_cmp2
comp_func
,
void
*
comp_func_fixed_arg
,
uint
size
,
ulong
max_in_memory_size_arg
)
uint
size
,
ulong
max_in_memory_size_arg
)
:
max_in_memory_size
(
max_in_memory_size_arg
),
elements
(
0
)
:
max_in_memory_size
(
max_in_memory_size_arg
),
elements
(
0
)
...
@@ -73,20 +86,6 @@ bool Unique::flush()
...
@@ -73,20 +86,6 @@ bool Unique::flush()
}
}
int
unique_write_to_file
(
gptr
key
,
element_count
count
,
Unique
*
unique
)
{
return
my_b_write
(
&
unique
->
file
,
(
byte
*
)
key
,
unique
->
tree
.
size_of_element
)
?
1
:
0
;
}
int
unique_write_to_ptrs
(
gptr
key
,
element_count
count
,
Unique
*
unique
)
{
memcpy
(
unique
->
record_pointers
,
key
,
unique
->
tree
.
size_of_element
);
unique
->
record_pointers
+=
unique
->
tree
.
size_of_element
;
return
0
;
}
/*
/*
Modify the TABLE element so that when one calls init_records()
Modify the TABLE element so that when one calls init_records()
the rows will be read in priority order.
the rows will be read in priority order.
...
...
This diff is collapsed.
Click to expand it.
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