数据库中查出数据按时间排序_时间戳排序协议| 数据库管理系统

数据库中查出数据按时间排序

The Timestamp ordering protocol is a protocol used to sequence the transactions based on their Timestamps. The sequence of the transaction is all about the arising sequence of the transaction generation. The transactions take part in a schedule is subsequently Serializable and the transactions which are in the only corresponding serial schedule allowed in the sequence of their Timestamp Values. The schedule is corresponding to the particular Serial Order equivalent to the sequence of the Transaction timestamps.

时间戳排序协议是用于根据事务的时间戳对事务进行排序的协议 。 交易的顺序与交易产生的发生顺序有关。 参与计划的事务随后可序列化,并且在其时间戳值序列中所允许的唯一对应串行计划中的事务。 该时间表对应于特定的“串行订单”,等同于“事务”时间戳记的序列。

The importance of the previous transactions is much greater and this is the reason why they implemented before the next one. To determine the transaction's allotted timestamp, system time or logical counter is used in this sequencing protocol. At the Implementation time, the lock-based protocol is used amidst transactions to manage the sequence between the conflicting set. But Timestamp based protocols begin their functioning immediately when a transaction is generated.

以前的事务的重要性要大得多,这就是为什么它们在下一个事务之前实施的原因。 为了确定事务分配的时间戳,在此排序协议中使用系统时间或逻辑计数器。 在实现时,在事务之间使用基于锁的协议来管理冲突集之间的顺序。 但是,基于时间戳的协议在生成事务时立即开始运行。

The sequence for each item accessed by Conflicting action of functioning in the schedule does not break the sequencing which should be confirmed by the algorithm.

计划中的功能冲突动作所访问的每个项目的顺序都不会破坏应由算法确认的顺序。

Let's assume, we use two Timestamp ValueS (TS) associating to each database item Z to confirm the algorithm.

假设,我们使用两个与每个数据库项Z关联的时间戳记值TS(TS)来确认算法。

1) Read (Z): The read timestamp of item Z; This is the largest timestamp amidst all the timestamps of transactions that have successfully read item Z. Read (Z) = TS (T), where T is the first transaction that has read Z successfully.

1)读取(Z):项目Z读取时间戳 ; 这是已成功读取项目Z的所有事务时间戳中的最大时间戳。 读取(Z)= TS(T) ,其中T是成功读取Z的第一个事务。

2) Write (Z): The write timestamp of item Z; This is the largest timestamp amidst all the timestamps of transactions that have successfully written item Z. Write (Z) = TS (T), where T is the first transaction that has written Z successfully.

2)写(Z):Z写时间戳 ; 在已成功写入项目Z的所有事务时间戳中,这是最大的时间戳。 Write(Z)= TS(T) ,其中T是成功写入Z的第一个事务。

基本时间戳排序 (Basic Timestamp Ordering )

Based on entering into the system, every transaction is provided a timestamp. The protocol handles simultaneous implementation such that the determination of serializability sequence is done by timestamp. The timestamp ordering protocol confirms that any conflicting the functioning of read and write are implemented in the timestamp sequence.

基于进入系统,为每个交易提供时间戳。 该协议处理同步实现,以便可序列化序列的确定由时间戳来完成。 时间戳排序协议确认在时间戳序列中实现了任何与读和写功能冲突的操作。

The timestamp of T with read (Z) and write (Z) is compared by the basic TO algorithm to confirm that the timestamp sequence of transaction implementation is not breached, anytime when some transaction T makes an attempt to issue a read_item (Z) or a write_item (Z) action of functioning. As a new functioning transaction with a new timestamp, the transaction T is terminated and reaccepted by the system, If this sequence is breached. Any transaction T1 with the timestamp that may have utilized a value written by T should also be moved back rolled; If T is terminated and moved back rolled. Correspondingly, any transaction T2 that may have utilized a value written by T1 must also be moved back rolled, and so on. This whole process is called cascading rollback. The cases going to define the basic TO algorithm in the following steps.

基本的TO算法将带有读取(Z)写入(Z)T的时间戳进行比较,以确认在任何事务T尝试发出read_item(Z)或一个write_item(Z)动作。 作为具有新时间戳记的新功能事务,如果违反了此序列,则事务T将终止并被系统重新接受。 具有时间戳的任何事务T1可能已经利用了T写入的值,也应该回滚; 如果T终止并回滚。 相应地,任何可能已经利用T1写入的值的事务T2也必须回滚,以此类推。 这整个过程称为级联回滚。 以下步骤将定义基本的TO算法。

In the following cases, the concurrency control algorithm should examine whether conflicting functioning of operations breaches the timestamp sequencing or not:

在以下情况下,并发控制算法应检查冲突的操作功能是否违反时间戳排序:

  1. Anytime when a Transaction T issues a Write(Z) operation, Examine the following condition which is given,

    每当事务T发出Write(Z)操作时,请检查给出的以下条件,

    1. If read timestamp of item Z is greater than timestamp value of Z, Read_TS (Z) > TS (T) or if write timestamp of item Z is greater than timestamp value of Z, Write_TS (Z) > TS (T), then terminate and move back roll T and dismiss the operation. else,
    2. 如果项的Z读取时间戳比Z,Read_TS(Z)> TS(T),或者如果产品的Z写入时间戳比Z,Write_TS(Z)的时间戳值> TS(T),然后终止的时间戳值大然后将卷轴T移回并取消操作。 其他,
    3. Implement W_item (Z) operation of T and set the operation of functioning Write_TS (Z) to TS (T).
    4. 实现T的 W_item(Z)操作,并将功能Write_TS(Z)的操作设置为TS(T)
  2. Anytime when a Transaction T issues a R_item (Z) operation, Examine the following conditions which are given,

    每当交易T发出R_item(Z)操作时,请检查以下给出的条件,

    1. Write_TS (Z) > TS (T), then terminate and dismiss Write_TS(Z)> TS(T) ,则终止并关闭T and dismiss the operation of functioning, elseT并关闭运行功能,否则
    2. If Write_TS (Z) <= TS (T), then implement the Read_item (Z) operation of T and set the operation Read_TS (Z) to the larger of TS (T) and current Read_TS (Z).
    3. 如果Write_TS(Z)<= TS(T) ,则执行TRead_item(Z)操作,并将操作Read_TS(Z)设置为TS(T)和当前Read_TS(Z)中的较大者。

The Basic TO algorithm anytime when detects two conflicting operations of functioning, it dismisses the later of the two operations by terminating the transaction that issued it because that happens in a sequence which is not correct.

Basic TO算法在任何时候检测到两个功能冲突的操作时,都会通过终止发出该事务的事务来终止这两个操作中的后一个操作,因为这是不正确的顺序。

严格的时间戳排序 (Strict Timestamp Ordering )

A distinct form of Basic TO is called Strict TO confirm that the schedules have both the properties Strict and Conflict Serializable.

Basic TO的一种独特形式称为Strict TO ,以确认计划具有Strict和Conflict Serializable属性。

In these changes, a Transaction T that provides a Read_item (Z) or Write_item (Z) in such a way that TS (T) > Write_TS (Z) has its read or write operation of functioning delayed up to the point when the Transaction T from which the values of Z wrote down has committed or terminated.

在这些更改中,事务T以以下方式提供Read_item(Z)Write_item(Z)TS(T)> Write_TS(Z)的读取或写入操作被延迟到事务T时写下的Z值已提交或终止。

翻译自: https://www.includehelp.com/dbms/timestamp-ordering-protocol.aspx

数据库中查出数据按时间排序

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值