Home Database Mysql Tutorial Mysql处理未被适当关闭的表的问题_MySQL

Mysql处理未被适当关闭的表的问题_MySQL

Jun 01, 2016 pm 01:55 PM
surface counter

  每个MyISAM索引文件(.MYI)在头有一个计数器,它可以被用来检查一个表是否被恰当地关闭。如果你从CHECK TABLE或myisamchk得到下列警告,意味着这个计数器已经不同步了:

clients are using or haven't closed the table proPerly

  这个警告并不是完全意味着表已被破坏,但你至少应该检查表。

  计数器的工作方式如下:

  ? 表在MySQL中第一次被更新,索引文件头的计数器加一。

  ? 在未来的更新中,计数器不被改变。

  ? 当表的最后实例被关闭(因为一个操作FLUSH TABLE或因为在表缓冲区中没有空间)之时,若表已经在任何点被更新,则计数器减一。

  ? 当你修理或检查表并且发现表完好之时,计数器被重置为零。

  ? 要避免与其它可能检查表的进程进行事务的问题,若计数器为零,在关闭时计数器不减一。

  换句话来说,计数器只有在下列情况会不同步:

  ? MyISAM表不随第一次发出的LOCK TABLES和FLUSH TABLES被复制。

  ? MySQL在一次更新和最后关闭之间崩溃(注意,表可能依然完好,因为MySQL总是在每个语句之间为每件事发出写操作)。

  ? 一个表被myisamchk --recover或myisamchk --update-state修改,同时被mysqld使用。

  ? 多个mysqld服务器正使用表,并且一个服务器在一个表上执行REPAIR TABLE或CHECK TABLE,同时该表也被另一个服务器使用。在这个结构中,使用CHECK TABLE是安全的,虽然你可能从其它服务器上得到警告。尽管如此,REPAIR TABLE应该被避免,因为当一个服务器用一个新的数据文件替代旧的之时,这并没有发送信号到其它服务器上。

  总的来说,在多服务器之间分享一个数据目录是一个坏主意。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Implementing distributed counters using Redis Implementing distributed counters using Redis May 11, 2023 am 08:06 AM

What is a distributed counter? In a distributed system, multiple nodes need to update and read a common state, and counters are one of the most widely used states. In layman's terms, a counter is a variable whose value is incremented or decremented by 1 every time it is accessed. It is an indicator used to track the progress of a certain system. Distributed counters refer to the operation and management of counters in a distributed environment. Why use Redis to implement distributed counters? With the popularity of distributed computing, many detailed issues in distributed systems have also

How to implement the statement to view table data in MySQL? How to implement the statement to view table data in MySQL? Nov 08, 2023 pm 01:40 PM

Title: Statements and specific code examples for viewing table data in MySQL MySQL is an open source relational database management system that is widely used in applications of all sizes. In MySQL, viewing table data is a very basic operation. The following will introduce how to implement this operation through specific statements and code examples. First, we will introduce the statements and specific code examples for viewing table data through the MySQL command line tool. Suppose we have a table named "employees", the following is the pass

Detailed explanation of distributed counter implementation in Redis Detailed explanation of distributed counter implementation in Redis Jun 20, 2023 pm 03:07 PM

With the rapid development of the Internet, the number of concurrent visits to Web applications is also increasing. How to quickly respond to concurrent requests has become an important issue in Web application design. Among them, distributed counters are widely used in scenarios such as flow control and current limiting. This article will introduce in detail how Redis implements distributed counters. Introduction to Redis Redis is a high-performance cache database that supports rich data structures, such as strings, hash tables, lists, sets, etc. At the same time, Redis also provides some advanced features such as publish/subscribe

How to implement distributed counters using Redis How to implement distributed counters using Redis Nov 07, 2023 am 09:02 AM

Redis is a high-performance cache database that is widely used in web applications. Among them, a common scenario is to use Redis to implement distributed counters. In this article, we will introduce how to implement distributed counters using Redis and provide specific code examples. 1. What is a distributed counter? A distributed counter is a shared resource used for counting, which is characterized by being accessed by multiple clients at the same time. In a traditional stand-alone environment, counters can be implemented through simple variables or files. But in a distributed ring

How to implement a counter using built-in functions and closures in Python How to implement a counter using built-in functions and closures in Python Oct 18, 2023 am 11:31 AM

How to implement a counter using built-in functions and closures in Python. As a powerful programming language, Python provides many flexible tools and technologies to make the development process simple and efficient. Among them, embedded functions and closures are one of the very important concepts in Python. In this article, we will explore how to implement a simple counter using these two concepts. In Python, an inline function refers to a function defined inside a function. Inline functions can access variables of external functions and have

How to write a simple counter function using JavaScript? How to write a simple counter function using JavaScript? Oct 19, 2023 am 09:34 AM

How to write a simple counter function using JavaScript? Counter is a common function. It can be used to count the number of times an event occurs on a page, or to perform simple counting operations. Using JavaScript, we can easily implement a simple counter function. This article will introduce how to write a simple counter using JavaScript and provide specific code examples. First, we need to create a counter container in the HTML page. Can

How to implement the statement of renaming table in MySQL? How to implement the statement of renaming table in MySQL? Nov 08, 2023 pm 12:11 PM

MySQL is a commonly used relational database management system that supports the operation of renaming tables. Normally, renaming a table carries certain risks, so you should be very careful when performing this operation. In this article, we will explore how to implement the rename table statement in MySQL and provide detailed code examples. In MySQL, you can use the ALTERTABLE statement to rename a table. The following is the basic syntax of the ALTERTABLE rename statement: ALTERTABLEo

How to set read-only permissions on a table in Oracle database? How to set read-only permissions on a table in Oracle database? Mar 06, 2024 pm 03:03 PM

In the Oracle database, setting read-only permissions on tables is a very important operation, which can protect data security and prevent misoperations. The following will introduce how to set read-only permissions on tables in an Oracle database and provide specific code examples. First, we need to understand that in the Oracle database, users obtain permissions on tables through authorization. Table permissions include SELECT (query), INSERT (insert), UPDATE (update) and DELETE (delete) operations. Here we will introduce

See all articles