External locking is the use of file system locking to manage contention for
MyISAM
database
tables by multiple processes. External locking is used in situations where a
single process such as the MySQL server cannot be assumed to be the only process
that requires access to tables. Here are some examples:
-
If you run multiple servers that use the same database directory (not
recommended), each server must have external locking enabled.
-
If you use myisamchk
to perform table maintenance operations on MyISAM
tables, you must either ensure that the server
is not running, or that the server has external locking enabled so that it locks
table files as necessary to coordinate with myisamchk
for access to the tables. The same is true for use of myisampack
to pack MyISAM
tables.
If the server is run with external locking enabled, you can use myisamchk
at any time for read operations such a checking tables. In this case, if the
server tries to update a table that myisamchk
is using, the server will wait for myisamchk
to finish before it continues.
If you use myisamchk
for write operations such as repairing or optimizing tables, or if you use myisampack
to pack tables, you must
always ensure that the mysqld
server is not using the table. If you
don't stop mysqld
, you
should at least do a mysqladmin
flush-tables
before you run myisamchk
.
Your tables may become corrupted
if the
server and myisamchk
access the tables simultaneously.
With external locking in effect, each process that requires access to a table
acquires a file system lock for the table files before proceeding to access the
table. If all necessary locks cannot be acquired, the process is blocked from
accessing the table until the locks can be obtained (after the process that
currently holds the locks releases them).
External locking affects server performance because the server must sometimes
wait for other processes before it can access tables.
外部锁定会影响系统性能
默认情况下,是不需要外部锁定的,
External locking is unnecessary if you run a single server to access a given
data directory (which is the usual case) and if no other programs such as myisamchk
need to modify tables while the server is running. If you only read
tables with other programs, external locking
is not required, although myisamchk
might report warnings if the server changes tables while myisamchk
is reading them.
With external locking disabled, to use myisamchk
,
you must either stop the server while myisamchk
executes or else lock and flush the tables before running myisamchk
.
(See Section 7.9.1, “System Factors and Startup
Parameter Tuning”
.) To avoid this requirement, use the CHECK TABLE
and REPAIR TABLE
statements to check and repair MyISAM
tables.
For mysqld
,
external locking is controlled by the value of the skip_external_locking
system variable. When this
variable is enabled, external locking is disabled, and vice versa. From MySQL
4.0 on, external locking is disabled by default.
Use of external locking can be controlled at server startup by using the --external-locking
or --skip-external-locking
option.
If you do use external locking option to enable updates to MyISAM
tables from many MySQL processes, you must
ensure that the following conditions are satisfied:
-
You should not use the query cache for queries that use tables that are
updated by another process.
-
You should not start the server with the --delay-key-write=ALL
option or use the DELAY_KEY_WRITE=1
table option for any shared tables.
Otherwise, index corruption can occur.
The easiest way to satisfy these conditions is to always use --external-locking
together with --delay-key-write=OFF
and --query-cache-size=0
. (This is not done by default
because in many setups it is useful to have a mixture of the preceding options.)
分享到:
相关推荐
MySQL的配置文件my.cnf中默认存在一行skip-external-locking的参数,即“跳过外部锁定”。根据MySQL开发网站的官方解释,External-locking用于多进程条件下为MyISAM数据表进行锁定。 如果你有多台服务器使用同一个...
Table Stripes and Row Locking.-(checkbox)
最近网站访问量大增,可能有些频道程序也有一些问题,...注意:在新版本的mysql中,skip-locking已经被换成了skip-external-locking,如果使用skip-locking,可能会报如下错误: [Warning] ‘–skip-locking’ is depr
skip-external-locking #External-locking用于多进程条件下为MyISAM数据表进行锁定。如果你有多台服务器使用同一个数据库目录(不建议),那么每台服务器都必须开启external locking; skip-name-resolve #禁止MySQL...
锁机制的论文,在jdk1.6以后引入的偏向锁技术大大增加了以往重锁sychronized的性能
JSSC 关于电荷泵锁相环的JSSC论文
Unreliable Guide to Locking -by Rusty Russell-中文版 .pdf
资源来自pypi官网。 资源全名:django-db-locking-2.0.0.tar.gz
We report on a 980 nm all-fiber passively, mode-locking Yb-doped phosphate fiber oscillator with the nonlinear polarization rotation (NPR) technique and its amplifier. In order to obtaining the stable...
ANSI IES LM-48-20 Testing the Calibration of Locking-Type Photoelectric Control Devices Used in Outdoor Applications.pdf
一本面向想要了解SQL Server并发性以及如何解决过多的阻塞或死锁问题的DBA和开发人员的书。
资源来自pypi官网。 资源全名:plone.locking-2.0.6.tar.gz
资源分类:Python库 所属语言:Python 资源全名:locking-1.1.4.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
TI AR7 flash partition table.
provide all the vectors, so that EQ creation response can decide which one to use.
Asus Eee PC extras for Linux v2.13.6.
32-bit compatibility support for ELF format executables and core dumps.
The order of these masks is important. Matching masks will be seen first and the left over flags will end up showing by themselves.
C++ and the Perils of Double-Checked Locking 关于单例模式C++实现的一些问题