MySQL 包含版本令牌(Version Tokens),这是一项功能,可用于创建和围绕服务器令牌进行同步,应用程序可以使用这些令牌来防止访问错误或过时的数据。MySQL includes Version Tokens, a feature that enables creation of and synchronization around server tokens that applications can use to prevent accessing incorrect or out-of-date data.
版本令牌接口具有以下特性:The Version Tokens interface has these characteristics:
版本令牌是由名称和值组成的对,其中名称用作键或标识符,值用作对应的数据。Version tokens are pairs consisting of a name that serves as a key or identifier, plus a value.
版本令牌可以被锁定。应用程序可以使用令牌锁向其他合作应用程序指示令牌正在使用中,不应被修改。Version tokens can be locked. An application can use token locks to indicate to other cooperating applications that tokens are in use and should not be modified.
版本令牌列表是为每个服务器建立的(例如,用于指定服务器分配或操作状态)。此外,与服务器通信的应用程序可以注册自己的令牌列表,以指示它所要求服务器处于的状态。应用程序发送到不处于所需状态的服务器的 SQL 语句会产生错误。这向应用程序发出信号,提示其应寻找处于所需状态的其他服务器以接收 SQL 语句。Version token lists are established per server (for example, to specify the server assignment or operational state). In addition, an application that communicates with a server can register its own list of tokens that indicate the state it requires the server to be in. An SQL statement sent by the application to a server not in the required state produces an error. This is a signal to the application that it should seek a different server in the required state to receive the SQL statement.
以下各节描述了版本令牌的要素,讨论了如何安装和使用它,并提供了其要素的参考信息。The following sections describe the elements of Version Tokens, discuss how to install and use it, and provide reference information for its elements.