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
c44d4deb
Commit
c44d4deb
authored
Aug 24, 2004
by
monty@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Portablity fixes & simple optimizations
parent
3808e4a5
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
17 deletions
+31
-17
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+2
-1
sql/item.cc
sql/item.cc
+1
-1
sql/lock.cc
sql/lock.cc
+6
-2
sql/sql_class.cc
sql/sql_class.cc
+12
-7
sql/sql_select.cc
sql/sql_select.cc
+1
-1
sql/sql_table.cc
sql/sql_table.cc
+9
-5
No files found.
sql/ha_ndbcluster.cc
View file @
c44d4deb
...
@@ -1423,7 +1423,8 @@ int ha_ndbcluster::write_row(byte *record)
...
@@ -1423,7 +1423,8 @@ int ha_ndbcluster::write_row(byte *record)
{
{
Uint64
next_val
=
(
Uint64
)
table
->
next_number_field
->
val_int
()
+
1
;
Uint64
next_val
=
(
Uint64
)
table
->
next_number_field
->
val_int
()
+
1
;
DBUG_PRINT
(
"info"
,
DBUG_PRINT
(
"info"
,
(
"Trying to set next auto increment value to %u"
,
next_val
));
(
"Trying to set next auto increment value to %lu"
,
(
ulong
)
next_val
));
if
(
m_ndb
->
setAutoIncrementValue
((
NDBTAB
*
)
m_table
,
next_val
,
true
))
if
(
m_ndb
->
setAutoIncrementValue
((
NDBTAB
*
)
m_table
,
next_val
,
true
))
DBUG_PRINT
(
"info"
,
DBUG_PRINT
(
"info"
,
(
"Setting next auto increment value to %u"
,
next_val
));
(
"Setting next auto increment value to %u"
,
next_val
));
...
...
sql/item.cc
View file @
c44d4deb
...
@@ -919,7 +919,7 @@ double Item_param::val()
...
@@ -919,7 +919,7 @@ double Item_param::val()
This works for example when user says SELECT ?+0.0 and supplies
This works for example when user says SELECT ?+0.0 and supplies
time value for the placeholder.
time value for the placeholder.
*/
*/
return
(
double
)
TIME_to_ulonglong
(
&
value
.
time
);
return
ulonglong2double
(
TIME_to_ulonglong
(
&
value
.
time
)
);
case
NULL_VALUE
:
case
NULL_VALUE
:
return
0.0
;
return
0.0
;
default:
default:
...
...
sql/lock.cc
View file @
c44d4deb
...
@@ -787,7 +787,7 @@ bool wait_if_global_read_lock(THD *thd, bool abort_on_refresh, bool is_not_commi
...
@@ -787,7 +787,7 @@ bool wait_if_global_read_lock(THD *thd, bool abort_on_refresh, bool is_not_commi
LINT_INIT
(
old_message
);
LINT_INIT
(
old_message
);
(
void
)
pthread_mutex_lock
(
&
LOCK_open
);
(
void
)
pthread_mutex_lock
(
&
LOCK_open
);
if
(
need_exit_cond
=
must_wait
)
if
(
(
need_exit_cond
=
must_wait
)
)
{
{
if
(
thd
->
global_read_lock
)
// This thread had the read locks
if
(
thd
->
global_read_lock
)
// This thread had the read locks
{
{
...
@@ -805,7 +805,11 @@ bool wait_if_global_read_lock(THD *thd, bool abort_on_refresh, bool is_not_commi
...
@@ -805,7 +805,11 @@ bool wait_if_global_read_lock(THD *thd, bool abort_on_refresh, bool is_not_commi
}
}
if
(
!
abort_on_refresh
&&
!
result
)
if
(
!
abort_on_refresh
&&
!
result
)
protect_against_global_read_lock
++
;
protect_against_global_read_lock
++
;
if
(
unlikely
(
need_exit_cond
))
// global read locks are rare
/*
The following is only true in case of a global read locks (which is rare)
and if old_message is set
*/
if
(
unlikely
(
need_exit_cond
))
thd
->
exit_cond
(
old_message
);
thd
->
exit_cond
(
old_message
);
else
else
pthread_mutex_unlock
(
&
LOCK_open
);
pthread_mutex_unlock
(
&
LOCK_open
);
...
...
sql/sql_class.cc
View file @
c44d4deb
...
@@ -155,11 +155,13 @@ bool foreign_key_prefix(Key *a, Key *b)
...
@@ -155,11 +155,13 @@ bool foreign_key_prefix(Key *a, Key *b)
** Thread specific functions
** Thread specific functions
****************************************************************************/
****************************************************************************/
THD
::
THD
()
:
user_time
(
0
),
current_arena
(
this
),
is_fatal_error
(
0
),
THD
::
THD
()
:
user_time
(
0
),
global_read_lock
(
0
),
is_fatal_error
(
0
),
last_insert_id_used
(
0
),
last_insert_id_used
(
0
),
insert_id_used
(
0
),
rand_used
(
0
),
time_zone_used
(
0
),
insert_id_used
(
0
),
rand_used
(
0
),
time_zone_used
(
0
),
in_lock_tables
(
0
),
global_read_lock
(
0
),
bootstrap
(
0
)
in_lock_tables
(
0
),
bootstrap
(
0
)
{
{
current_arena
=
this
;
host
=
user
=
priv_user
=
db
=
ip
=
0
;
host
=
user
=
priv_user
=
db
=
ip
=
0
;
host_or_ip
=
"connecting host"
;
host_or_ip
=
"connecting host"
;
locked
=
some_tables_deleted
=
no_errors
=
password
=
0
;
locked
=
some_tables_deleted
=
no_errors
=
password
=
0
;
...
@@ -439,10 +441,13 @@ void THD::awake(bool prepare_to_die)
...
@@ -439,10 +441,13 @@ void THD::awake(bool prepare_to_die)
it is the true value but maybe current_mutex is not yet non-zero (we're
it is the true value but maybe current_mutex is not yet non-zero (we're
in the middle of enter_cond() and there is a "memory order
in the middle of enter_cond() and there is a "memory order
inversion"). So we test the mutex too to not lock 0.
inversion"). So we test the mutex too to not lock 0.
Note that there is a small chance we fail to kill. If victim has locked
Note that there is a small chance we fail to kill. If victim has locked
current_mutex, and hasn't entered enter_cond(), then we don't know it's
current_mutex, but hasn't yet entered enter_cond() (which means that
going to wait on cond. Then victim goes into its cond "forever" (until
current_cond and current_mutex are 0), then the victim will not get
we issue a second KILL). True we have set its thd->killed but it may not
a signal and it may wait "forever" on the cond (until
we issue a second KILL or the status it's waiting for happens).
It's true that we have set its thd->killed but it may not
see it immediately and so may have time to reach the cond_wait().
see it immediately and so may have time to reach the cond_wait().
*/
*/
if
(
mysys_var
->
current_cond
&&
mysys_var
->
current_mutex
)
if
(
mysys_var
->
current_cond
&&
mysys_var
->
current_mutex
)
...
...
sql/sql_select.cc
View file @
c44d4deb
...
@@ -8014,7 +8014,7 @@ find_order_in_list(THD *thd, Item **ref_pointer_array,
...
@@ -8014,7 +8014,7 @@ find_order_in_list(THD *thd, Item **ref_pointer_array,
Item
*
itemptr
=*
order
->
item
;
Item
*
itemptr
=*
order
->
item
;
if
(
itemptr
->
type
()
==
Item
::
INT_ITEM
)
if
(
itemptr
->
type
()
==
Item
::
INT_ITEM
)
{
/* Order by position */
{
/* Order by position */
uint
count
=
itemptr
->
val_int
();
uint
count
=
(
uint
)
itemptr
->
val_int
();
if
(
!
count
||
count
>
fields
.
elements
)
if
(
!
count
||
count
>
fields
.
elements
)
{
{
my_printf_error
(
ER_BAD_FIELD_ERROR
,
ER
(
ER_BAD_FIELD_ERROR
),
my_printf_error
(
ER_BAD_FIELD_ERROR
,
ER
(
ER_BAD_FIELD_ERROR
),
...
...
sql/sql_table.cc
View file @
c44d4deb
...
@@ -3281,7 +3281,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
...
@@ -3281,7 +3281,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
ha_rows
*
deleted
)
ha_rows
*
deleted
)
{
{
int
error
;
int
error
;
Copy_field
*
copy
,
*
copy_end
,
*
next_field
=
0
;
Copy_field
*
copy
,
*
copy_end
;
ulong
found_count
,
delete_count
;
ulong
found_count
,
delete_count
;
THD
*
thd
=
current_thd
;
THD
*
thd
=
current_thd
;
uint
length
;
uint
length
;
...
@@ -3291,6 +3291,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
...
@@ -3291,6 +3291,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
List
<
Item
>
fields
;
List
<
Item
>
fields
;
List
<
Item
>
all_fields
;
List
<
Item
>
all_fields
;
ha_rows
examined_rows
;
ha_rows
examined_rows
;
bool
auto_increment_field_copied
=
0
;
DBUG_ENTER
(
"copy_data_between_tables"
);
DBUG_ENTER
(
"copy_data_between_tables"
);
if
(
!
(
copy
=
new
Copy_field
[
to
->
fields
]))
if
(
!
(
copy
=
new
Copy_field
[
to
->
fields
]))
...
@@ -3309,7 +3310,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
...
@@ -3309,7 +3310,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
if
(
def
->
field
)
if
(
def
->
field
)
{
{
if
(
*
ptr
==
to
->
next_number_field
)
if
(
*
ptr
==
to
->
next_number_field
)
next_field
=
copy_end
;
auto_increment_field_copied
=
TRUE
;
(
copy_end
++
)
->
set
(
*
ptr
,
def
->
field
,
0
);
(
copy_end
++
)
->
set
(
*
ptr
,
def
->
field
,
0
);
}
}
...
@@ -3368,11 +3369,14 @@ copy_data_between_tables(TABLE *from,TABLE *to,
...
@@ -3368,11 +3369,14 @@ copy_data_between_tables(TABLE *from,TABLE *to,
}
}
thd
->
row_count
++
;
thd
->
row_count
++
;
if
(
to
->
next_number_field
)
if
(
to
->
next_number_field
)
{
if
(
auto_increment_field_copied
)
to
->
auto_increment_field_not_null
=
TRUE
;
else
to
->
next_number_field
->
reset
();
to
->
next_number_field
->
reset
();
}
for
(
Copy_field
*
copy_ptr
=
copy
;
copy_ptr
!=
copy_end
;
copy_ptr
++
)
for
(
Copy_field
*
copy_ptr
=
copy
;
copy_ptr
!=
copy_end
;
copy_ptr
++
)
{
{
if
(
copy_ptr
==
next_field
)
to
->
auto_increment_field_not_null
=
TRUE
;
copy_ptr
->
do_copy
(
copy_ptr
);
copy_ptr
->
do_copy
(
copy_ptr
);
}
}
if
((
error
=
to
->
file
->
write_row
((
byte
*
)
to
->
record
[
0
])))
if
((
error
=
to
->
file
->
write_row
((
byte
*
)
to
->
record
[
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