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
b8847967
Commit
b8847967
authored
Oct 22, 2004
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.0
into sanja.is.com.ua:/home/bell/mysql/bk/work-4.0
parents
43245198
ec8779e9
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
128 additions
and
29 deletions
+128
-29
innobase/trx/trx0rec.c
innobase/trx/trx0rec.c
+1
-1
libmysql/libmysql.c
libmysql/libmysql.c
+7
-6
myisam/myisampack.c
myisam/myisampack.c
+5
-7
mysql-test/r/innodb-lock.result
mysql-test/r/innodb-lock.result
+34
-0
mysql-test/t/innodb-lock-master.opt
mysql-test/t/innodb-lock-master.opt
+1
-0
mysql-test/t/innodb-lock.test
mysql-test/t/innodb-lock.test
+56
-1
mysys/thr_lock.c
mysys/thr_lock.c
+10
-2
sql/ha_innodb.cc
sql/ha_innodb.cc
+1
-1
sql/mysqld.cc
sql/mysqld.cc
+6
-6
sql/set_var.cc
sql/set_var.cc
+4
-4
sql/sql_base.cc
sql/sql_base.cc
+2
-0
sql/sql_class.h
sql/sql_class.h
+1
-1
No files found.
innobase/trx/trx0rec.c
View file @
b8847967
libmysql/libmysql.c
View file @
b8847967
...
@@ -3168,22 +3168,23 @@ void my_net_local_init(NET *net)
...
@@ -3168,22 +3168,23 @@ void my_net_local_init(NET *net)
null byte. When mysql_hex_string() returns, the contents of "to" will
null byte. When mysql_hex_string() returns, the contents of "to" will
be a null-terminated string. The return value is the length of the
be a null-terminated string. The return value is the length of the
encoded string, not including the terminating null character.
encoded string, not including the terminating null character.
The return value does not contain any leading 0x or a leading X' and
trailing '. The caller must supply whichever of those is desired.
*/
*/
unsigned
long
ulong
mysql_hex_string
(
char
*
to
,
const
char
*
from
,
ulong
length
)
mysql_hex_string
(
char
*
to
,
const
char
*
from
,
unsigned
long
length
)
{
{
char
*
to0
=
to
;
char
*
to0
=
to
;
const
char
*
end
;
const
char
*
end
;
static
char
hex
[]
=
"0123456789ABCDEF"
;
for
(
end
=
from
+
length
;
from
<
end
;
from
++
)
for
(
end
=
from
+
length
;
from
<
end
;
from
++
)
{
{
*
to
++=
hex
[((
unsigned
char
)
*
from
)
>>
4
];
*
to
++=
_dig_vec
[((
unsigned
char
)
*
from
)
>>
4
];
*
to
++=
hex
[((
unsigned
char
)
*
from
)
&
0x0F
];
*
to
++=
_dig_vec
[((
unsigned
char
)
*
from
)
&
0x0F
];
}
}
*
to
=
'\0'
;
*
to
=
'\0'
;
return
to
-
to0
;
return
(
ulong
)
(
to
-
to0
)
;
}
}
/*
/*
...
...
myisam/myisampack.c
View file @
b8847967
...
@@ -418,14 +418,12 @@ static bool open_isam_files(PACK_MRG_INFO *mrg,char **names,uint count)
...
@@ -418,14 +418,12 @@ static bool open_isam_files(PACK_MRG_INFO *mrg,char **names,uint count)
mrg
->
src_file_has_indexes_disabled
=
0
;
mrg
->
src_file_has_indexes_disabled
=
0
;
for
(
i
=
0
;
i
<
count
;
i
++
)
for
(
i
=
0
;
i
<
count
;
i
++
)
{
{
if
((
mrg
->
file
[
i
]
=
open_isam_file
(
names
[
i
],
O_RDONLY
)))
if
(
!
(
mrg
->
file
[
i
]
=
open_isam_file
(
names
[
i
],
O_RDONLY
)))
{
mrg
->
src_file_has_indexes_disabled
|=
(
mrg
->
file
[
i
]
->
s
->
state
.
key_map
!=
(
1ULL
<<
mrg
->
file
[
i
]
->
s
->
base
.
keys
)
-
1
);
}
else
goto
error
;
goto
error
;
mrg
->
src_file_has_indexes_disabled
|=
((
mrg
->
file
[
i
]
->
s
->
state
.
key_map
!=
(((
ulonglong
)
1
)
<<
mrg
->
file
[
i
]
->
s
->
base
.
keys
)
-
1
));
}
}
/* Check that files are identical */
/* Check that files are identical */
for
(
j
=
0
;
j
<
count
-
1
;
j
++
)
for
(
j
=
0
;
j
<
count
-
1
;
j
++
)
...
...
mysql-test/r/innodb-lock.result
View file @
b8847967
select @@innodb_table_locks;
@@innodb_table_locks
1
drop table if exists t1;
drop table if exists t1;
set @@innodb_table_locks=1;
create table t1 (id integer, x integer) engine=INNODB;
create table t1 (id integer, x integer) engine=INNODB;
insert into t1 values(0, 0);
insert into t1 values(0, 0);
set autocommit=0;
set autocommit=0;
...
@@ -20,3 +24,33 @@ id x
...
@@ -20,3 +24,33 @@ id x
0 2
0 2
commit;
commit;
drop table t1;
drop table t1;
set @@innodb_table_locks=0;
create table t1 (id integer primary key, x integer) engine=INNODB;
insert into t1 values(0, 0),(1,1),(2,2);
commit;
SELECT * from t1 where id = 0 FOR UPDATE;
id x
0 0
set autocommit=0;
set @@innodb_table_locks=0;
lock table t1 write;
update t1 set x=10 where id = 2;
SELECT * from t1 where id = 2;
id x
2 2
UPDATE t1 set x=3 where id = 2;
commit;
SELECT * from t1;
id x
0 0
1 1
2 3
commit;
unlock tables;
commit;
select * from t1;
id x
0 0
1 1
2 10
drop table t1;
mysql-test/t/innodb-lock-master.opt
0 → 100644
View file @
b8847967
--innodb-table-lock=1
mysql-test/t/innodb-lock.test
View file @
b8847967
--
source
include
/
have_innodb
.
inc
--
source
include
/
have_innodb
.
inc
#
# Check and select innodb lock type
#
select
@@
innodb_table_locks
;
#
# Testing of explicit table locks with enforced table locks
#
connect
(
con1
,
localhost
,
root
,,);
connect
(
con1
,
localhost
,
root
,,);
connect
(
con2
,
localhost
,
root
,,);
connect
(
con2
,
localhost
,
root
,,);
drop
table
if
exists
t1
;
drop
table
if
exists
t1
;
#
#
# Testing of explicit table locks
# Testing of explicit table locks
with enforced table locks
#
#
set
@@
innodb_table_locks
=
1
;
connection
con1
;
connection
con1
;
create
table
t1
(
id
integer
,
x
integer
)
engine
=
INNODB
;
create
table
t1
(
id
integer
,
x
integer
)
engine
=
INNODB
;
insert
into
t1
values
(
0
,
0
);
insert
into
t1
values
(
0
,
0
);
...
@@ -38,3 +50,46 @@ select * from t1;
...
@@ -38,3 +50,46 @@ select * from t1;
commit
;
commit
;
drop
table
t1
;
drop
table
t1
;
#
# Try with old lock method (where LOCK TABLE is ignored by InnoDB)
#
set
@@
innodb_table_locks
=
0
;
create
table
t1
(
id
integer
primary
key
,
x
integer
)
engine
=
INNODB
;
insert
into
t1
values
(
0
,
0
),(
1
,
1
),(
2
,
2
);
commit
;
SELECT
*
from
t1
where
id
=
0
FOR
UPDATE
;
connection
con2
;
set
autocommit
=
0
;
set
@@
innodb_table_locks
=
0
;
# The following statement should work becase innodb doesn't check table locks
lock
table
t1
write
;
connection
con1
;
# This will be locked by MySQL
--
send
update
t1
set
x
=
10
where
id
=
2
;
--
sleep
2
connection
con2
;
# Note that we will get a deadlock if we try to select any rows marked
# for update by con1 !
SELECT
*
from
t1
where
id
=
2
;
UPDATE
t1
set
x
=
3
where
id
=
2
;
commit
;
SELECT
*
from
t1
;
commit
;
unlock
tables
;
connection
con1
;
reap
;
commit
;
select
*
from
t1
;
drop
table
t1
;
mysys/thr_lock.c
View file @
b8847967
...
@@ -552,8 +552,14 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type)
...
@@ -552,8 +552,14 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type)
!
lock
->
write_wait
.
data
&&
!
lock
->
write_wait
.
data
&&
lock
->
write
.
data
->
type
==
TL_WRITE_ALLOW_WRITE
))
lock
->
write
.
data
->
type
==
TL_WRITE_ALLOW_WRITE
))
{
{
/* We have already got a write lock or all locks are
/*
TL_WRITE_ALLOW_WRITE */
We have already got a write lock or all locks are
TL_WRITE_ALLOW_WRITE
*/
DBUG_PRINT
(
"info"
,
(
"write_wait.data: 0x%lx old_type: %d"
,
(
ulong
)
lock
->
write_wait
.
data
,
lock
->
write
.
data
->
type
));
(
*
lock
->
write
.
last
)
=
data
;
/* Add to running fifo */
(
*
lock
->
write
.
last
)
=
data
;
/* Add to running fifo */
data
->
prev
=
lock
->
write
.
last
;
data
->
prev
=
lock
->
write
.
last
;
lock
->
write
.
last
=
&
data
->
next
;
lock
->
write
.
last
=
&
data
->
next
;
...
@@ -568,6 +574,8 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type)
...
@@ -568,6 +574,8 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type)
}
}
else
else
{
{
DBUG_PRINT
(
"info"
,
(
"write_wait.data: 0x%lx"
,
(
ulong
)
lock
->
write_wait
.
data
));
if
(
!
lock
->
write_wait
.
data
)
if
(
!
lock
->
write_wait
.
data
)
{
/* no scheduled write locks */
{
/* no scheduled write locks */
if
(
lock_type
==
TL_WRITE_CONCURRENT_INSERT
&&
if
(
lock_type
==
TL_WRITE_CONCURRENT_INSERT
&&
...
...
sql/ha_innodb.cc
View file @
b8847967
...
@@ -4694,7 +4694,7 @@ ha_innobase::external_lock(
...
@@ -4694,7 +4694,7 @@ ha_innobase::external_lock(
if
(
prebuilt
->
select_lock_type
!=
LOCK_NONE
)
{
if
(
prebuilt
->
select_lock_type
!=
LOCK_NONE
)
{
if
(
thd
->
in_lock_tables
&&
if
(
thd
->
in_lock_tables
&&
!
thd
->
variables
.
innodb_table_locks_old_behavior
)
{
thd
->
variables
.
innodb_table_locks
)
{
ulint
error
;
ulint
error
;
error
=
row_lock_table_for_mysql
(
prebuilt
);
error
=
row_lock_table_for_mysql
(
prebuilt
);
...
...
sql/mysqld.cc
View file @
b8847967
...
@@ -3526,7 +3526,7 @@ enum options_mysqld {
...
@@ -3526,7 +3526,7 @@ enum options_mysqld {
OPT_INNODB_FORCE_RECOVERY
,
OPT_INNODB_FORCE_RECOVERY
,
OPT_INNODB_STATUS_FILE
,
OPT_INNODB_STATUS_FILE
,
OPT_INNODB_MAX_DIRTY_PAGES_PCT
,
OPT_INNODB_MAX_DIRTY_PAGES_PCT
,
OPT_INNODB_TABLE_LOCKS
_OLD_BEHAVIOR
,
OPT_INNODB_TABLE_LOCKS
,
OPT_BDB_CACHE_SIZE
,
OPT_BDB_CACHE_SIZE
,
OPT_BDB_LOG_BUFFER_SIZE
,
OPT_BDB_LOG_BUFFER_SIZE
,
OPT_BDB_MAX_LOCK
,
OPT_BDB_MAX_LOCK
,
...
@@ -3700,11 +3700,11 @@ struct my_option my_long_options[] =
...
@@ -3700,11 +3700,11 @@ struct my_option my_long_options[] =
{
"innodb_max_dirty_pages_pct"
,
OPT_INNODB_MAX_DIRTY_PAGES_PCT
,
{
"innodb_max_dirty_pages_pct"
,
OPT_INNODB_MAX_DIRTY_PAGES_PCT
,
"Percentage of dirty pages allowed in bufferpool"
,
(
gptr
*
)
&
srv_max_buf_pool_modified_pct
,
"Percentage of dirty pages allowed in bufferpool"
,
(
gptr
*
)
&
srv_max_buf_pool_modified_pct
,
(
gptr
*
)
&
srv_max_buf_pool_modified_pct
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
90
,
0
,
100
,
0
,
0
,
0
},
(
gptr
*
)
&
srv_max_buf_pool_modified_pct
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
90
,
0
,
100
,
0
,
0
,
0
},
{
"innodb_table_locks
_old_behavior"
,
OPT_INNODB_TABLE_LOCKS_OLD_BEHAVIOR
,
{
"innodb_table_locks
"
,
OPT_INNODB_TABLE_LOCKS
,
"
Disable InnoDB locking in LOCK TABLES
"
,
"
If Innodb should enforce LOCK TABLE
"
,
(
gptr
*
)
&
global_system_variables
.
innodb_table_locks
_old_behavior
,
(
gptr
*
)
&
global_system_variables
.
innodb_table_locks
,
(
gptr
*
)
&
global_system_variables
.
innodb_table_locks
_old_behavior
,
(
gptr
*
)
&
global_system_variables
.
innodb_table_locks
,
0
,
GET_BOOL
,
OPT_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
0
,
GET_BOOL
,
OPT_ARG
,
1
,
0
,
0
,
0
,
0
,
0
},
#endif
/* End HAVE_INNOBASE_DB */
#endif
/* End HAVE_INNOBASE_DB */
{
"help"
,
'?'
,
"Display this help and exit"
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
{
"help"
,
'?'
,
"Display this help and exit"
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
0
,
0
,
0
,
0
,
0
},
...
...
sql/set_var.cc
View file @
b8847967
...
@@ -263,8 +263,8 @@ sys_var_thd_ulong sys_net_wait_timeout("wait_timeout",
...
@@ -263,8 +263,8 @@ sys_var_thd_ulong sys_net_wait_timeout("wait_timeout",
#ifdef HAVE_INNOBASE_DB
#ifdef HAVE_INNOBASE_DB
sys_var_long_ptr
sys_innodb_max_dirty_pages_pct
(
"innodb_max_dirty_pages_pct"
,
sys_var_long_ptr
sys_innodb_max_dirty_pages_pct
(
"innodb_max_dirty_pages_pct"
,
&
srv_max_buf_pool_modified_pct
);
&
srv_max_buf_pool_modified_pct
);
sys_var_thd_bool
sys_innodb_table_locks
_old_behavior
(
"innodb_table_locks_old_behavior
"
,
sys_var_thd_bool
sys_innodb_table_locks
(
"innodb_table_locks
"
,
&
SV
::
innodb_table_locks_old_behavior
);
&
SV
::
innodb_table_locks
);
#endif
#endif
...
@@ -451,7 +451,7 @@ sys_var *sys_variables[]=
...
@@ -451,7 +451,7 @@ sys_var *sys_variables[]=
&
sys_os
,
&
sys_os
,
#ifdef HAVE_INNOBASE_DB
#ifdef HAVE_INNOBASE_DB
&
sys_innodb_max_dirty_pages_pct
,
&
sys_innodb_max_dirty_pages_pct
,
&
sys_innodb_table_locks
_old_behavior
,
&
sys_innodb_table_locks
,
#endif
#endif
&
sys_unique_checks
&
sys_unique_checks
};
};
...
@@ -523,7 +523,7 @@ struct show_var_st init_vars[]= {
...
@@ -523,7 +523,7 @@ struct show_var_st init_vars[]= {
{
"innodb_log_group_home_dir"
,
(
char
*
)
&
innobase_log_group_home_dir
,
SHOW_CHAR_PTR
},
{
"innodb_log_group_home_dir"
,
(
char
*
)
&
innobase_log_group_home_dir
,
SHOW_CHAR_PTR
},
{
"innodb_mirrored_log_groups"
,
(
char
*
)
&
innobase_mirrored_log_groups
,
SHOW_LONG
},
{
"innodb_mirrored_log_groups"
,
(
char
*
)
&
innobase_mirrored_log_groups
,
SHOW_LONG
},
{
sys_innodb_max_dirty_pages_pct
.
name
,
(
char
*
)
&
sys_innodb_max_dirty_pages_pct
,
SHOW_SYS
},
{
sys_innodb_max_dirty_pages_pct
.
name
,
(
char
*
)
&
sys_innodb_max_dirty_pages_pct
,
SHOW_SYS
},
{
sys_innodb_table_locks
_old_behavior
.
name
,
(
char
*
)
&
sys_innodb_table_locks_old_behavior
,
SHOW_SYS
},
{
sys_innodb_table_locks
.
name
,
(
char
*
)
&
sys_innodb_table_locks
,
SHOW_SYS
},
#endif
#endif
{
sys_interactive_timeout
.
name
,(
char
*
)
&
sys_interactive_timeout
,
SHOW_SYS
},
{
sys_interactive_timeout
.
name
,(
char
*
)
&
sys_interactive_timeout
,
SHOW_SYS
},
{
sys_join_buffer_size
.
name
,
(
char
*
)
&
sys_join_buffer_size
,
SHOW_SYS
},
{
sys_join_buffer_size
.
name
,
(
char
*
)
&
sys_join_buffer_size
,
SHOW_SYS
},
...
...
sql/sql_base.cc
View file @
b8847967
...
@@ -826,6 +826,7 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name,
...
@@ -826,6 +826,7 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name,
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
table
->
query_id
=
thd
->
query_id
;
table
->
query_id
=
thd
->
query_id
;
DBUG_PRINT
(
"info"
,(
"Using temporary table"
));
goto
reset
;
goto
reset
;
}
}
}
}
...
@@ -840,6 +841,7 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name,
...
@@ -840,6 +841,7 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name,
table
->
query_id
!=
thd
->
query_id
)
table
->
query_id
!=
thd
->
query_id
)
{
{
table
->
query_id
=
thd
->
query_id
;
table
->
query_id
=
thd
->
query_id
;
DBUG_PRINT
(
"info"
,(
"Using locked table"
));
goto
reset
;
goto
reset
;
}
}
}
}
...
...
sql/sql_class.h
View file @
b8847967
...
@@ -339,7 +339,7 @@ struct system_variables
...
@@ -339,7 +339,7 @@ struct system_variables
my_bool
new_mode
;
my_bool
new_mode
;
my_bool
query_cache_wlock_invalidate
;
my_bool
query_cache_wlock_invalidate
;
#ifdef HAVE_INNOBASE_DB
#ifdef HAVE_INNOBASE_DB
my_bool
innodb_table_locks
_old_behavior
;
my_bool
innodb_table_locks
;
#endif
/* HAVE_INNOBASE_DB */
#endif
/* HAVE_INNOBASE_DB */
CONVERT
*
convert_set
;
CONVERT
*
convert_set
;
...
...
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