EP0458564A2

System and method for consistent timestamping in distributed computer databases.

Abstract

A distributed database system has a plurality of databases located at distinct nodes, at least one of the databases comprising a timestamping database. Distributed transactions are committed using a two phase protocol. During the first phase, each cohort to the transaction votes to commit or abort the transaction, and also votes an earliest time and a latest time at which the transaction is to be committed. If all the cohorts vote to commit the transaction and the intersection of the voted time ranges is not empty, then the transaction is committed during the second phase of the protocol. A transaction time is selected from the intersection of the voted time ranges and is used to timestamp all updated data that is durably stored when the transaction is committed. Before the first phase of the two phase commit protocol, each transaction read or write locks data at each node for which it needs read or write access. Whenever a transaction enters the first phase of the commit protocol, read locks for that transaction can be converted into delay locks. Any transaction which obtains a write lock on delay locked data is a "delayed transaction". The delayed transaction votes a time range which guarantees that it will commit at a time which is later than the time at which the transactions with the delay locks commit. This combination of time range voting and delay locking ensures that the timestamp order of transactions is consistent throughout the distributed database and is consistent with a valid serialization order of the transactions.

EP0458564A2, drawing sheet 1
Sheet 1 of 3

Term

Term ended

Projected expiry passed 20 May 2011, 15.3 years ago.

  1. Priority
  2. Filed
  3. Published
  4. Projected expiry
  5. Today

8 claims: 8 independent, 0 dependent

  1. 1
    In a distributed database system having a plurality of databases at distinct interconnected nodes, at least one of said databases comprising a timestamping database, a method of selecting transaction times to be timestamped with data durably stored whenever a distributed transaction commits, the steps of the method comprising:(a) transmitting a prepare-to-commit message to each node in said system which is a cohort of a distributed transaction;(b) each cohort of said distributed transaction voting on a disposition of said distributed transaction, said disposition being selected from the set consisting of aborting said transaction and committing said transaction;(c) each cohort voting to commit said transaction also voting a commit time range including an earliest time acceptable to said cohort for committing said transaction and a latest time acceptable to said cohort for committing said transaction;(d) whenever said cohorts all vote to commit said transaction and said time ranges voted by said cohorts have a non-empty intersection, committing said transaction and selecting a transaction time for said transaction from the intersection of said time ranges voted by said cohorts;(e) aborting said transaction whenever any of said cohorts vote to abort said transaction;(f) aborting said transaction whenever said time ranges voted by said cohorts do not intersect;and(g) repeating said steps (a) through (f) for a multiplicity of subsequent distributed transactions;(h) denoting in each cohort a LAST transaction time comprising a latest one of said transaction times for distributed transactions involving said cohort;wherein said earliest time voted by each said cohort to each said distributed transaction is later than said LAST transaction time.
  2. 2
    A method of selecting transaction times for distributed transactions in a distributed database system, as set forth in Claim 1,    at at least one of said cohorts, before said cohorts vote on a disposition of a first distributed transaction, read locking at least one datum accessed while performing said distributed transaction;at each cohort which has read locked at least one datum, between said step of voting on a disposition of said first distributed transaction and said step of committing said first distributed transaction, delay locking said at least one datum which was read locked while performing said first distributed transaction;allowing cohorts of distributed transactions subsequent to said first distributed transaction to write lock data which was delay locked by said first distributed transaction;and    constraining said earliest time voted by said cohort of a subsequent distributed transaction which write locked said delay locked data so that said voted earliest time is later than said transaction time of first distributed transaction.
  3. 3
    A method of selecting transaction times for distributed transactions in a distributed database system, as set forth in Claim 1, further including the steps of:maintaining at each said node of said system a local clock time;wherein said earliest time voted by each said cohort to each said distributed transaction is not earlier than said cohort's local clock time.
  4. 4
    In a distributed database system having a plurality of databases at distinct interconnected nodes, at least one of said databases comprising a timestamping database, a transaction manager at each said node which performs a two phase protocol commit with transaction managers at other nodes which are cohorts of a distributed transaction, said transaction manager comprising:prepare means for transmitting a prepare-to-commit message to each node in said system which is a cohort of a first distributed transaction, and for receiving prepare-to-commit messages transmitted by transaction managers for other distributed transactions;voting means, for responding to receipt of a prepare-to-commit message by said prepare means by voting on a disposition of said distributed transaction, said disposition being selected from the set consisting of aborting said transaction and committing said transaction;said voting means also voting on a commit time range including an earliest acceptable time for committing said transaction and a latest acceptable time for committing said transaction;commit means for transmitting a commit message to each node in said system which is a cohort of said first distributed transaction whenever said cohorts of said first distributed transaction all vote to commit said first distributed transaction and said time ranges voted by said cohorts have a non-empty intersection, and for receiving commit messages transmitted by transaction managers for other distributed transactions;said commit means including means for selecting and transmitting with said commit message a transaction time for said distributed transaction from the intersection of said time ranges voted by said cohorts;said commit means including means for aborting said transaction whenever any of said cohorts vote to abort said transaction, and means for aborting said transaction whenever said time ranges voted by said cohorts do not intersect;and    last time means, coupled to said voting means and said commit means, for denoting a LAST transaction time comprising a latest one of said transaction times for distributed transactions involving said cohort;wherein said voting means votes an earliest time which is later than said LAST transaction time.
  5. 5
    A transaction manager as set forth in Claim 4, including clock means, coupled to said voting means, for denoting a local clock time;wherein said earliest acceptable time voted by said voting means is no earlier than said local clock time.
  6. 6
    Adistributed database system, comprising:a plurality of databases at distinct interconnected nodes, at least one of said databases comprising a timestamping database;each said database including:        a lock manager for locking data used by transactions, including means for          read locking data for which read access has been requested by at least a first transaction, and          allowing write access by a second transaction to data read locked by said first transaction after said first transaction has prepared for committing said first transaction, denoting said second transaction as a delayed transaction, and denoting with respect to said delayed transaction a set of delaying transactions comprising transactions which have read locked data to which said delayed transaction has been allowed write access;and       two phase commit means for committing distributed transactions in which said database is a cohort and for selecting a transaction time for each committed transaction;said two phase commit means including voting means for selecting an earliest acceptable time for committing transactions;said voting means constraining said earliest acceptable time for committing a delayed transaction so that said selected earliest acceptable time for said delayed transaction is later than said transaction time of each said delaying transaction.
  7. 7
    A distributed database system as set forth in Claim 6, said two phase commit means including:prepare means for transmitting a prepare-to-commit message to each node in said system which is a cohort of a first distributed transaction, and for receiving prepare-to-commit messages transmitted by other databases for other distributed transactions;said voting means responding to receipt of a prepare-to-commit message by said prepare means by voting on a disposition of said distributed transaction, said disposition being selected from the set consisting of aborting said transaction and committing said transaction;said voting means also voting on a commit time range including an earliest acceptable time for committing said transaction and a latest acceptable time for committing said transaction;commit means for transmitting a commit message to each node in said system which is a cohort of said first distributed transaction whenever said cohorts of said first distributed transaction all vote to commit said first distributed transaction and said time ranges voted by said cohorts have a non-empty intersection, and for receiving commit messages transmitted by transaction managers for other distributed transactions;said commit means including means for selecting and transmitting with said commit message a transaction time for said distributed transaction from the intersection of said time ranges voted by said cohorts;said commit means including means for aborting said transaction whenever any of said cohorts vote to abort said transaction, and means for aborting said transaction whenever said time ranges voted by said cohorts do not intersect;and    last time means, coupled to said voting means and said commit means, for denoting a LAST transaction time comprising a latest one of said transaction times for distributed transactions involving said cohort;wherein said voting means votes an earliest time which is later than said LAST transaction time;said voting means including means for constraining said earliest time voted for a delayed transaction so that said voted earliest time is later than said transaction time of each said delaying transaction.
  8. 8
    A distributed database system as set forth in Claim 6, including clock means, coupled to said voting means, for denoting a local clock time;wherein said earliest acceptable time voted by said voting means is no earlier than said local clock time.