JPH03118645A - Exclusive control method for data base - Google Patents

Exclusive control method for data base

Info

Publication number
JPH03118645A
JPH03118645A JP1257238A JP25723889A JPH03118645A JP H03118645 A JPH03118645 A JP H03118645A JP 1257238 A JP1257238 A JP 1257238A JP 25723889 A JP25723889 A JP 25723889A JP H03118645 A JPH03118645 A JP H03118645A
Authority
JP
Japan
Prior art keywords
data
transaction
exclusive control
database
record
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP1257238A
Other languages
Japanese (ja)
Inventor
Ryoji Kataoka
良治 片岡
Tetsuji Sato
哲司 佐藤
Hideaki Takeda
武田 英昭
Ushio Inoue
潮 井上
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nippon Telegraph and Telephone Corp
Original Assignee
Nippon Telegraph and Telephone Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nippon Telegraph and Telephone Corp filed Critical Nippon Telegraph and Telephone Corp
Priority to JP1257238A priority Critical patent/JPH03118645A/en
Publication of JPH03118645A publication Critical patent/JPH03118645A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To attain a consistent transaction process by registering previously the data identifiers into a data base information table and using these identifiers to register data into an exclusive control information table to perform simultaneously the addition of data to the table and the retrieval of the table. CONSTITUTION:The record identifiers R1 - R4 correspond to the records 1 - 4 respectively and an identifier R5 is prepared for the records to be added to a table A. A transaction executing part 13 obtains a record identifier out of a data base information table 14 to use the identifier for process of data when a transaction is inputted from a terminal 17. The inquiries are given to an exclusive control part 11 to decide whether the reference, the update and the addition are possible or not to secure the consistency of the transaction. The part 11 searches both tables 12 and 14 based on the transaction identifier, a table identifier, a record identifier, and the process type received from the part 13. At the same time, the part 11 performs the deciding operations based on a flow and informs the part 13 of these deciding results. Thus it is possible to attain a data base process that has high performance for simultaneous execution of transactions.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は、データベース処理装置に関し、特に、同一の
データベースを複数のトランザクションで頻繁に使用す
る業務、特にデータベースへデータの追加を頻繁に行い
ながらトランザクションの一貫性を保証しなければなら
ない業務において、トランザクションの同時実行性の高
める排他制御方法に関するものである。
[Detailed Description of the Invention] [Field of Industrial Application] The present invention relates to a database processing device, and in particular, to a database processing device that is used for operations that frequently use the same database in multiple transactions, and in particular for operations that frequently involve adding data to the database. This invention relates to an exclusive control method that increases the concurrency of transactions in business operations where transaction consistency must be guaranteed.

〔従来の技術〕[Conventional technology]

データベース処理装置において、同一のデータベースを
複数のトランザクションで同時に処理しながら、全ての
トランザクションの一貫性を保証する排他制御技術は、
トランザクションの同時実行性を高め、トランザクショ
ン処理能力の高いデータベース処理を実現する上で重要
な技術である。
In a database processing device, exclusive control technology guarantees the consistency of all transactions while simultaneously processing the same database with multiple transactions.
It is an important technology for increasing transaction concurrency and realizing database processing with high transaction processing capacity.

第4図に従来のデータベース処理装置の一例の概略構成
を示す1図において、31は排他制御部、32は排他制
御情報表、33はトランザクション実行部、34はデー
タベース情報表、35はアドレス変換表、36はデータ
ベース格納部、37は端末である。
FIG. 4 shows a schematic configuration of an example of a conventional database processing device, in which 31 is an exclusive control section, 32 is an exclusive control information table, 33 is a transaction execution section, 34 is a database information table, and 35 is an address conversion table. , 36 is a database storage unit, and 37 is a terminal.

第4図を用いて、従来の排他制御方式を説明する。以降
の説明において、データの参照とはデータをデータベー
ス格納部36から読み出す処理であり、データの更新と
はデータベース格納部36のデータの内容を更新条件に
従って書き換える処理である。また、表の検索とは表を
構成するデータを参照して一定の条件を満たすものを選
択する処理であり、データの追加とはデータを表の一部
となるようにデータベース格納部36へ書き込む処理で
ある。
A conventional exclusive control method will be explained using FIG. 4. In the following description, referring to data is a process of reading data from the database storage unit 36, and updating data is a process of rewriting the contents of data in the database storage unit 36 according to update conditions. Furthermore, table search is a process of referring to the data that constitutes a table and selecting data that satisfies certain conditions, and data addition is a process of writing data to the database storage unit 36 so that it becomes part of the table. It is processing.

第4図において、複数のトランザクションが同一のデー
タベースを同時に参照、更新するときにリードロックと
ライトロックによりトランザクションの一貫性を保証す
る方法■を説明する。トランザクション実行部33は、
トランザクションが端末37から入力されると、データ
ベース情報表34を基にトランザクションで参照、更新
するデータを求め、トランザクションの一貫性を保証す
る参照。
Referring to FIG. 4, a method (2) for ensuring transaction consistency using read locks and write locks when multiple transactions simultaneously refer to and update the same database will be described. The transaction execution unit 33
When a transaction is input from the terminal 37, data to be referenced or updated by the transaction is determined based on the database information table 34, and reference is made to ensure consistency of the transaction.

更新が可能かどうかを排他制御部31に問い合わせる。The exclusive control unit 31 is inquired as to whether updating is possible.

排他制御情報表32には、データがトランザクションに
より参照されているとき、該トランザクシコンが該デー
タをリードロックしていることを示す情報を登録し、デ
ータがトランザクションにより更新されているとき、該
トランザクションが該データをライトロックしているこ
とを示す情報を登録する。排他制御部31はデータをリ
ードロックしているトランザクション以外のトランザク
ションが該データをライトロックできない規則と、デー
タをライトロックしているトランザクション以外のトラ
ンザクションが該データをリードロックもライトロック
もできない規則に従い、排他制御情報表32を探索しな
がらトランザクション実行部33の問い合わせに応じた
リードロック、ライトロックが可能かどうかを判定し、
ロック可能な場合は実行可能、ロック不可能な場合は実
行不可能という通知をトランザクション実行部33に返
す。トランザクション実行部33は、排他制御部31か
らの通知が実行可能であるとき、アドレス変換表35で
データのデータベース格納部36でアドレスを求め、該
データを参照または更新し、排他制御部31からの通知
が実行不可能であるとき、データの参照または更新を実
行待ちとするか、もしくはトランザクションを中止する
。以上の方法■により、あるトランザクションが参照中
のデータを他のトランザクションが更新すること、及び
あるトランザクションが更新中のデータを他のトランザ
クションが参照、更新することがなくなり、複数のトラ
ンザクションを同時に処理してもトランザクションの一
貫性を保証できる。なお、ロックを用いたトランザクシ
ョンの一貫性の保証については1文献「データベース・
システムの原理」第11章(J。
In the exclusive control information table 32, when data is referenced by a transaction, information indicating that the transaction controller has read-locked the data is registered, and when data is updated by a transaction, the transaction registers information indicating that the data is write-locked. The exclusive control unit 31 follows the rules that transactions other than the transaction that has read-locked the data cannot write-lock the data, and the rules that transactions other than the transaction that has write-locked the data cannot read-lock or write-lock the data. , while searching the exclusive control information table 32, determine whether read lock and write lock are possible in response to the inquiry from the transaction execution unit 33;
A notification is returned to the transaction execution unit 33 that if locking is possible, execution is possible, and if locking is not possible, execution is not possible. When the notification from the exclusive control unit 31 is executable, the transaction execution unit 33 obtains an address in the data database storage unit 36 using the address conversion table 35, references or updates the data, and executes the notification from the exclusive control unit 31. When the notification cannot be executed, the data reference or update is made to wait for execution, or the transaction is aborted. By using the above method ■, data that is being referenced by one transaction will not be updated by another transaction, and data that is being updated by one transaction will not be referenced or updated by another transaction, and multiple transactions can be processed simultaneously. transaction consistency can be guaranteed. For guaranteeing transaction consistency using locks, see the document ``Database
Principles of Systems” Chapter 11 (J.

D、υLLMAN著、國井、大保訳)に詳しく説明され
ている。
It is explained in detail in D.

しかし、方法Iでは、トランザクションが表へデータを
追加するとき、該データが他のトランザクションにより
ロックされていることはないため、排他制御部31は該
データの追加を必ず実行可能と判定する。同一の表の検
索を複数回行うトランザクションとその表へデータを追
加する他のトランザクションが同時に処理されている状
況を考える。
However, in method I, when a transaction adds data to a table, the data is not locked by another transaction, so the exclusive control unit 31 determines that the data addition can definitely be executed. Consider a situation where a transaction that searches the same table multiple times and another transaction that adds data to that table are being processed at the same time.

このとき表を検索するトランザクションは、その処理過
程で他のトランザクションによるデータの追加が行われ
ると、表のデータ構成が変化するため、データが追加さ
れる前に行われた表の検索結果とデータが追加された後
に行われた同一の表の検索結果が異なるという問題が生
じる。
At this time, the table search results and the table search results that were performed before the data was added and the data The problem arises that the search results for the same table performed after the table is added are different.

この現象の発生例を第5図に示す。第5図において、ト
ランザクションAは時刻aと時刻dで表41の検索を同
一条件で行うものであり、トランザクションBは時刻す
でデータ42を表41へ追加するものである。トランザ
クションBは、時刻すでデータ42をライトロックし、
他のトランザクションによるデータ42の参照と更新を
禁止するが、時刻CでトランザクションBが終了すると
データ42に対するライトロックが解除されるため、時
刻dでデータ42は、トランザクションAにより参照可
能である。従って、トランザクションAにおいて、時刻
dの検索の結果には時刻aの検索で得られなかったデー
タが含まれる可能性がある。
An example of the occurrence of this phenomenon is shown in FIG. In FIG. 5, transaction A searches the table 41 at times a and d under the same conditions, and transaction B adds data 42 to the table 41 at times already present. Transaction B has already write-locked data 42,
Reference and update of data 42 by other transactions is prohibited, but when transaction B ends at time C, the write lock on data 42 is released, so data 42 can be referenced by transaction A at time d. Therefore, in transaction A, the results of the search at time d may include data that was not obtained by the search at time a.

このような問題を防止する方法■として1表にその終端
を識別するためのデータ(終端識別データ)を予め設け
ておき、表の検索時は終端識別データをリードロックし
、表へのデータ追加時は終端識別データをライトロック
することとし、終端識別データに対しても方法■と同様
にロック管理を行う方法が提案されている(文献Ber
nstein、P。
A method to prevent such problems is to provide data (terminus identification data) in advance for identifying the end of a table, read-lock the end identification data when searching the table, and add data to the table. A method has been proposed in which the terminal identification data is write-locked, and the lock management is performed for the terminal identification data in the same manner as method (2) (Reference Ber.
Stein, P.

A 、 、 Hadzilacos 、 V 、 、 
Goodman 、 N 、 ”Concurrenc
y Control and Recovery in
 Database Systems”(ADDISO
N−WESLEY PUBLESHENG COMPA
NY、1987))。
A., Hadzilacos, V.,
Goodman, N., “Concurrenc.
y Control and Recovery in
Database Systems” (ADDISO
N-WESLEY PUBLESHENG COMPA
NY, 1987)).

前記方法■によれば、あるトランザクションにより検索
が行われている表では、終端識別データがリードロック
されているため、他のトランザクションがデータの追加
を試みても、終端識別データをライトロックできず、デ
ータの追加は終端識別データのリードロックが解除され
るまで、つまり表を検索しているトランザクションが終
了するまで実行できない、従って1表の検索を1つのト
ランザクションで複数回行っても、異なる検索結果が得
られることはない。
According to the above method (■), in the table being searched by a certain transaction, the end identification data is read-locked, so even if another transaction attempts to add data, the end identification data cannot be write-locked. , data cannot be added until the read lock on the terminal identification data is released, that is, until the transaction searching the table ends. Therefore, even if one table is searched multiple times in one transaction, different searches will occur. You will never get results.

〔発明が解決しようとする課題〕[Problem to be solved by the invention]

しかしながら、前記方法■では、終端識別データのリー
ドロックとライトロックが同時にできないため、関係デ
ータベースの同一の表に対して、表の検索を行うトラン
ザクションと該表へデータを追加するトランザクション
が待つことになり、実質上、これら2つのトランザクシ
ョンを同時に処理できないという問題があった。
However, in the above method (2), it is not possible to read and write lock the terminal identification data at the same time, so a transaction that searches for the same table in a relational database and a transaction that adds data to the table end up waiting. Therefore, there was a problem in that these two transactions could not be processed simultaneously.

本発明は、前記問題点を解決するためになされたもので
ある。
The present invention has been made to solve the above problems.

本発明の目的は、関係データベースの同一の表に対する
検索とデータの追加を同時に処理し、かつ1つのトラン
ザクションで行われる複数回の検索結果の一貫性を保証
する方法を提供することにある。
An object of the present invention is to provide a method that simultaneously processes searches and data additions to the same table in a relational database and guarantees consistency of search results performed multiple times in one transaction.

本発明の前記ならびにその他の目的と新規な特徴は、本
明細書の記述及び添付図面によって明らかになるであろ
う。
The above and other objects and novel features of the present invention will become apparent from the description of this specification and the accompanying drawings.

〔課題を解決するための手段〕[Means to solve the problem]

前記目的を達成するために、本発明は、データを人出す
る入出力装置と、関係データベースの表を構成するデー
タに対するトランザクション処理を実行するトランザク
ション実行部と、複数のトランザクションを同時に実行
する際のトランザクションの一貫性を保証する排他制御
部と、前記関係データベースの表を構成するデータを格
納する、データベース格納部と、前記関係データベース
の表を構成するデータを識別するためのデータ識別子登
録するデータベース情報表と、データ識別子に対応する
前記関係データベースの表を構成するデータの前記デー
タベース格納部における格納アドレスを登録するアドレ
ス変換表と、トランザクションがデータを参照中である
ことを示すリードロック、トランザクションがデータを
更新であることを示すライトロック、及びトランザクシ
ョンがデータを追加中であることを示す追加ロックから
なる排他制御情報を登録する排他制御情報表とを具備す
るデータベース処理装置であって、前記関係データベー
スの表にデータを追加する際に該データに割り当てる1
つのデータ識別子を前記データベース情報表に予め登録
しておき、前記排他制御部において、排他制御情報表へ
のデータ追加時には、該レコードの追加ロックを、予め
登録しておいた前記データ識別子を用いて前記排他制御
情報表に登録するとともに、次回の追加データのための
新たなデータ識別子を前記データベース情報表に登録し
、該新たなデータ識別子に対するリードロックの情報が
前記追加ロックを登録したデータ識別子の情報と同一に
なるように排他制御情報を前記排他制御情報表に登録し
、該排他制御情報表へ該データを追加することを前記ト
ランザクション実行部に許可し、 他トランザクションによって追加ロックされたデータの
参照時には、該データに対するリードロックを前記排他
制御情報表に登録し、該データの参照を省略するように
前記トランザクション実行部に指示することで、 関係データベースの同一の表に対して、該表へのデータ
の追加と該表の検索を同時に行いながら、トランザクシ
ョンの一貫性を保証することを最も主要な特徴とする。
To achieve the above object, the present invention provides an input/output device that outputs data, a transaction execution unit that executes transaction processing on data forming tables of a relational database, and a an exclusive control unit that guarantees transaction consistency; a database storage unit that stores data forming tables of the relational database; and database information for registering data identifiers for identifying data forming tables of the relational database. a table, an address conversion table that registers the storage address in the database storage section of data constituting the table of the relational database corresponding to the data identifier; a read lock indicating that a transaction is referencing the data; and an exclusive control information table that registers exclusive control information consisting of a write lock indicating that the transaction is updating, and an additional lock indicating that the transaction is adding data, the database processing device comprising: 1 assigned to the data when adding data to the table of
One data identifier is registered in the database information table in advance, and when data is added to the exclusive control information table, the exclusive control unit locks the addition of the record using the data identifier registered in advance. At the same time as registering in the exclusive control information table, a new data identifier for the next additional data is registered in the database information table, and the read lock information for the new data identifier is the same as the data identifier for which the additional lock was registered. The exclusive control information is registered in the exclusive control information table so that it is the same as the data, the transaction execution unit is permitted to add the data to the exclusive control information table, and the data that has been additionally locked by another transaction is registered. At the time of reference, by registering a read lock for the data in the exclusive control information table and instructing the transaction execution unit to omit reference to the data, The most important feature is that it guarantees transaction consistency while simultaneously adding data to the table and searching the table.

〔作用〕[Effect]

前述の手段によれば、データベース情報表に関係データ
ベースの表へ追加するデータに割り当てるデータ識別子
を予め登録しておく。排他制御部は、トランザクション
実行部から表へのデータ追加について一貫性保証の判定
を要求されると、該データの追加ロックを該データ識別
子を用いて排他制御情報表に登録し、該データが追加可
能であることをトランザクション実行部に通知する。更
に、排他制御部は、該表への追加データに割り当てる新
たなデータ識別子をデータベース情報表に登録し、前記
追加ロックの登録に用いたデータ識別子に対するリード
ロックと該データ識別子に対するリードロックが同一と
なるように排他制御情報表へ排他制御情報を登録する。
According to the above-described means, a data identifier to be assigned to data to be added to a table of a relational database is registered in the database information table in advance. When the exclusive control unit is requested by the transaction execution unit to determine the consistency guarantee for data added to a table, the exclusive control unit registers an additional lock for the data in the exclusive control information table using the data identifier, and when the data is added. Notify the transaction execution unit that it is possible. Furthermore, the exclusive control unit registers in the database information table a new data identifier to be assigned to data added to the table, and determines that the read lock for the data identifier used to register the additional lock is the same as the read lock for the data identifier. Register exclusive control information in the exclusive control information table so that

また、排他制御部は、トランザクション実行部から追加
ロックされているデータの参照について一貫性保証の判
定を要求されると、排他制御情報表に該データのリード
ロックを登録し、トランザクション実行部に該データの
参照を省略するように通知する。
Furthermore, when the exclusive control unit is requested by the transaction execution unit to determine the consistency guarantee regarding the reference of additionally locked data, the exclusive control unit registers the read lock of the data in the exclusive control information table, and the transaction execution unit registers the read lock of the data. Notify to omit data reference.

すなわち、本発明では、従来技術の終端識別データに相
当するデータ識別子に対してリードロックと追加ロック
を同時に可能として、あるトランザクションにより検索
中の表に他のトランザクションがレコードを追加可能と
し、あるトランザクションの表の検索で他のトランザク
ションに追加ロックされたデータが検出されたときは、
該データの参照を省略して、追加過程のレコードにより
表を検索するトランザクションの一貫性が損なわれない
ようにし、表の検索と表へのデータの追加を同時に行い
ながら一貫性のあるトランザクション処理を実現可能と
している。
That is, in the present invention, it is possible to simultaneously perform a read lock and an add lock on a data identifier corresponding to the terminal identification data of the prior art, thereby allowing another transaction to add a record to the table being searched by a certain transaction. When a table search finds data that is additionally locked by another transaction,
By omitting the reference to this data, the consistency of the transaction that searches the table is not compromised due to records in the adding process, and consistent transaction processing can be performed while searching the table and adding data to the table at the same time. It is considered to be achievable.

〔発明の実施例〕[Embodiments of the invention]

以下、本発明の一実施例を図面を用いて具体的に説明す
る。
Hereinafter, one embodiment of the present invention will be specifically described using the drawings.

第1図は、本発明を適用したデータベース処理装置の一
実施例の概略構成を示すブロック図である。
FIG. 1 is a block diagram showing a schematic configuration of an embodiment of a database processing device to which the present invention is applied.

第1図において、構成要素11〜17は、第3図の構成
要素31〜37に各々に対応し、11は排他制御部、1
2は排他制御情報表、13はトランザクション実行部、
14はデータベース情報表、15はアドレス変換表、1
6はデータベース格納部、17は端末である。
In FIG. 1, components 11 to 17 correspond to components 31 to 37 in FIG. 3, respectively, and 11 is an exclusive control section;
2 is an exclusive control information table, 13 is a transaction execution unit,
14 is a database information table, 15 is an address conversion table, 1
6 is a database storage unit, and 17 is a terminal.

また、第1図の実施例では、参照、更新、追加を行うデ
ータの大きさとしてレコードを選択し、レコード1〜3
で構成された表AをトランザクションT1が検索し、次
にトランザクションT2が表Aにレコード4を追加し、
更にトランザクションT1が再び表Aを検索した状態を
示している。
In the embodiment shown in FIG. 1, records are selected as the size of data to be referenced, updated, and added, and records 1 to 3 are
Transaction T1 searches table A consisting of , then transaction T2 adds record 4 to table A,
Furthermore, a state in which transaction T1 has searched table A again is shown.

レコード1〜4に対応するレコード識別子がR1−R4
であり、表Aへ追加するレコードのために予め用意した
レコード識別子がR5である。
The record identifiers corresponding to records 1 to 4 are R1-R4
, and the record identifier prepared in advance for the record to be added to table A is R5.

前記トランザクション実行部13は、トランザクション
が端末17から入力されると、データベース情報表14
から処理に使用するレコードのレコード識別子を求め、
トランザクションの一貫性を保証する参照、更新、追加
が可能であるかどうかを排他制御部11へ問い合わせる
。排他制御部11は、トランザクション実行部13から
受は取ったトランザクション識別子、表識別子、レコー
ド識別子及び処理の種別(参照/更新/追加コミットに
伴うロック解除/アボートに伴うロック解除)を基に、
排他制御情報表12とデータベース情報表14を探索し
ながら、第2図(a)〜(d)のフローに従い判定を行
い、結果をトランザクション実行部13に通知する。
When a transaction is input from the terminal 17, the transaction execution unit 13 executes the database information table 14.
Find the record identifier of the record to be used for processing from
The exclusive control unit 11 is inquired as to whether references, updates, and additions that guarantee transaction consistency are possible. The exclusive control unit 11 uses the transaction identifier, table identifier, record identifier, and processing type (reference/update/additional commit release/lock release due to abort) received from the transaction execution unit 13.
While searching the exclusive control information table 12 and the database information table 14, determination is made according to the flowcharts in FIGS. 2(a) to 2(d), and the results are notified to the transaction execution unit 13.

前記排他制御情報表12は、トランザクションがロック
しているレコードのレコード識別子を格納するロックレ
コードリスト18とレコードをロックしているトランザ
クションのトランザクション識別子とロックモードを格
納するロックトランザクションリスト19からなる。前
記ロックレコードリスト18は、レコード識別子を格納
するレコード識別子フィールドと、対応するロックトラ
ンザクションリスト19を指すポインタを格納するリス
トポインタフィールドから構成される。前記ロックトラ
ンザクションリスト19は、レコードをロックしている
トランザクションのトランザクション識別子を格納する
トランザクション識別子フィールドとリードロック、ラ
イトロック、追加ロックの種別を示すロックモードフィ
ールドから構成される。
The exclusive control information table 12 includes a lock record list 18 that stores record identifiers of records locked by transactions, and a lock transaction list 19 that stores transaction identifiers and lock modes of transactions that lock records. The lock record list 18 is composed of a record identifier field that stores a record identifier, and a list pointer field that stores a pointer pointing to the corresponding lock transaction list 19. The lock transaction list 19 includes a transaction identifier field that stores a transaction identifier of a transaction that is locking a record, and a lock mode field that indicates the type of read lock, write lock, or additional lock.

前記データベース情報表14は1表識別子を格納する表
識別子フィールドと表を構成するレコードのレコード識
別子を格納する構成レコードリストフィールドから構成
される。構成レコードリストの先頭のレコード識別子が
表へ追加するレコードに割り当てるレコード識別子に対
応する。
The database information table 14 is composed of a table identifier field for storing a table identifier and a constituent record list field for storing record identifiers of records forming the table. The record identifier at the beginning of the configuration record list corresponds to the record identifier assigned to the record added to the table.

第2図(a)は、排他制御部11がトランザクション実
行部13からレコードの参照について一貫性保証の判定
を要求されたときの処理の流れである。
FIG. 2(a) shows the flow of processing when the exclusive control unit 11 is requested by the transaction execution unit 13 to determine consistency guarantee regarding record reference.

本発明では、追加レコードに対して追加ロックとリード
ロックが同時に可能であり、レコード追加が完了したと
きに該レコードかリードロックされていると該追加ロッ
クをライトロックに変更する操作を行うため、参照する
データにリードロックとライトロックが同時に行われて
いる場合がある。参照を要求しているトランザクション
が該レコードをリードロックしておらず、かつ該レコー
ドが参照を要求しているトランザクション以外のトラン
ザクションによりライトロックされているときは該レコ
ードをリードロックできないので、このとき、排他制御
部11は、該レコードが参照不可能であることと該レコ
ードをライトロックしているトランザクションのトラン
ザクション識別子をトランザクション実行部13へ通知
する。参照を要求しているトランザクションが該レコー
ドをリードロックしており、かつ該レコードが参照を要
求しているトランザクション以外のトランザクションに
よりライトロックされているときは該トランザクション
により該レコードの前回の参照を省略しているので、こ
のとき、排他制御部11は、該レコードの参照を省略す
るようにトランザクション実行部13へ通知する。該レ
コードが参照を要求しているトランザクション以外のト
ランザクションにより追加ロックされているときは、該
レコードが表の構成レコードとしてまだ有効でないので
、このとき排他制御部11は、排他制御情報表12に該
レコードのリードロックを登録し、該レコードの参照を
省略するようにトランザクション実行部13八通知する
。上記3つの場合以外で該レコードのレコード識別子が
追加レコードに割り当てるために用意したものであると
きは、該レコードの実体がデータベース格納部16に存
在しないので、このとき、排他制御部11は、排他制御
情報表12に該レコードのリードロックを登録し、該レ
コードの参照を省略するように、トランザクション実行
部13へ通知する。上記4つの場合以外は、トランザク
ションの一貫性を損なわせる処理が該レコードに施され
ていないので、このとき、排他制御部11は、排他制御
情報表12に該レコードのリードロックを登録し、該レ
コードが参照可能であることをトランザクション実行部
13へ通知する。
In the present invention, an additional lock and a read lock can be simultaneously applied to an additional record, and when the record addition is completed, if the record is read-locked, the additional lock is changed to a write lock. The referenced data may be read-locked and write-locked at the same time. If the transaction requesting the reference does not have a read lock on the record, and the record is write-locked by a transaction other than the transaction requesting the reference, the record cannot be read-locked. , the exclusive control unit 11 notifies the transaction execution unit 13 that the record cannot be referenced and the transaction identifier of the transaction that has write-locked the record. If the transaction requesting the reference has a read lock on the record, and the record is write-locked by a transaction other than the transaction requesting the reference, the previous reference to the record is omitted by the transaction. Therefore, at this time, the exclusive control unit 11 notifies the transaction execution unit 13 to omit reference to the record. If the record is additionally locked by a transaction other than the transaction requesting the reference, the record is not yet valid as a constituent record of the table, so at this time the exclusive control unit 11 adds the relevant information to the exclusive control information table 12. A read lock for the record is registered and the transaction execution unit 138 is notified to omit reference to the record. If the record identifier of the record is prepared to be assigned to an additional record in cases other than the above three cases, the entity of the record does not exist in the database storage unit 16, so in this case, the exclusive control unit 11 A read lock for the record is registered in the control information table 12, and the transaction execution unit 13 is notified to omit reference to the record. Except for the above four cases, the record has not been subjected to any processing that would impair the consistency of the transaction. At this time, the exclusive control unit 11 registers a read lock for the record in the exclusive control information table 12, and The transaction execution unit 13 is notified that the record can be referenced.

第2図(b)は、排他制御部11がトランザクション実
行部13からレコードの更新について一貫性の保証の判
定を要求されたときの処理の流れである。該レコードが
更新を要求しているトランザクション以外のトランザク
ションによりロックされているときは該レコードをライ
トロックできないので、このとき、排他制御部11は、
該レコードが更新不可能であることと該レコードをロッ
クしているトランザクションのトランザクション識別子
をトランザクション実行部13へ通知する。上記以外の
場合は、トランザクションの一貫性を損なわせる処理が
該レコードに施されていないので、このとき排他制御部
11は、排他制御情報表12に該レコードのライトロッ
クを登録し、該レコードが更新可能であることをトラン
ザクション実行部13へ通知する。但し、更新を要求し
ているトランザクションが、該レコードをリードロック
しているときは該排他制御情報のロックモードをライト
ロックに書き換えることで該登録を行い、該レコードを
追加ロックしているときは該登録を行わない。
FIG. 2(b) shows the flow of processing when the exclusive control unit 11 is requested by the transaction execution unit 13 to determine whether consistency is guaranteed for updating a record. If the record is locked by a transaction other than the transaction requesting the update, the record cannot be write-locked, so at this time, the exclusive control unit 11
The transaction execution unit 13 is notified that the record cannot be updated and the transaction identifier of the transaction that is locking the record. In cases other than the above, the record has not been subjected to any processing that would impair transaction consistency, so at this time the exclusive control unit 11 registers a write lock for the record in the exclusive control information table 12, and the record is The transaction execution unit 13 is notified that the update is possible. However, if the transaction requesting the update has read-locked the record, the registration is performed by rewriting the lock mode of the exclusive control information to write lock, and if the transaction has additionally locked the record, This registration will not be performed.

第2図(C)は、排他制御部11がトランザクション実
行部13からレコードの追加について一貫性保証の判定
を要求されたときの処理の流れである。
FIG. 2(C) shows the flow of processing when the exclusive control unit 11 is requested by the transaction execution unit 13 to determine consistency guarantee regarding record addition.

排他制御部11は、該レコードを追加する表に予め登録
しておいた追加レコードへ割り当てるレコード識別子を
データベース情報表14から求め、該レコードの追加ロ
ックを排他制御情報表12に登録する。更に、該表へ追
加するレコードへ割り当てる新たなレコード識別子をデ
ータベース情報表14に登録し、追加ロックしたデータ
のデータ識別子に対するリードロックの情報を新たに登
録したレコード識別子に対する情報として複写して排他
制御情報表12へ登録する。その後、該レコードが追加
可能であることをデータベース実行部13へ通知する。
The exclusive control unit 11 obtains from the database information table 14 a record identifier to be assigned to an additional record registered in advance in the table to which the record is added, and registers an additional lock for the record in the exclusive control information table 12. Furthermore, a new record identifier to be assigned to the record to be added to the table is registered in the database information table 14, and read lock information for the data identifier of the additionally locked data is copied as information for the newly registered record identifier for exclusive control. Register in information table 12. Thereafter, the database execution unit 13 is notified that the record can be added.

第2図(d)は、排他制御部11がトランザクション実
行部13からコミットに伴うロック解除またはアボート
に伴うロック解除を要求されたときの処理の流れである
FIG. 2(d) shows the flow of processing when the exclusive control unit 11 receives a request from the transaction execution unit 13 to release a lock associated with a commit or to release a lock associated with an abort.

排他制御部11は、ロック解除を要求するトランザクシ
ョンに関する排他制御情報を排他制御情報表12から全
てを削除する。但し、コミットに伴うロック解除のとき
、該トランザクションが追加ロックしているレコードを
他のトランザクションが同時にリードロックしている場
合は、該排他制御情報のロックモードを追加ロックから
ライトロックへ変更し、リードロックしているトランザ
クションが完了するまで、追加レコードが参照、更新さ
れないようにして、トランザクションの一貫性を保証す
る。該ライトロックは、該レコードに対する全てのリー
ドロックが解除されるときに同時に解除する。また、ア
ボートに伴うロック解除のとき、該トランザクションが
追加ロックしているレコードのレコード識別子をデータ
ベース情報表14から削除し、他のトランザクションに
よる該レコードのリードロックも同時に解除する。更に
、排他制御部11は、ロックを解除したレコードのレコ
ード識別子をトランザクション実行部13へ通知する。
The exclusive control unit 11 deletes all exclusive control information related to the transaction requesting lock release from the exclusive control information table 12. However, when releasing a lock associated with a commit, if another transaction is simultaneously holding a read lock on a record that has been additionally locked by this transaction, the lock mode of the exclusive control information is changed from additional lock to write lock, Guarantees transactional consistency by preventing additional records from being referenced or updated until the read-locked transaction is completed. The write lock is released simultaneously when all read locks for the record are released. Furthermore, when a lock is released due to an abort, the record identifier of the record additionally locked by the transaction is deleted from the database information table 14, and read locks of the record by other transactions are also released at the same time. Further, the exclusive control unit 11 notifies the transaction execution unit 13 of the record identifier of the record for which the lock has been released.

トランザクション実行部13は、排他制御部11から参
照可能または更新可能の通知を得たとき、アドレス変換
表15からレコード識別子に対応するレコードのデータ
ベース格納部16でのアドレスを求め、該レコードの参
照または更新を行う。排他制御部11から追加可能の通
知を得たときは、データベース格納部16の空きアドレ
スを追加レコードのレコード識別子に対応付けてアドレ
ス変換表16に登録し、該アドレスを用いて該レコード
の追加を行う。排他制御部11から参照不可能または更
新不可能の通知を得たときは、同時に通知されるトラン
ザクション識別子と1通知された時点で実行待ちとなっ
ているトランザクションのリストを基に、参照不可能ま
たは更新不可能と判定されたトランザクションを実行待
ちとすることでデッドロックが発生するかどうかを判定
する。デッドロックが発生しないと判定されたときは、
該トランザクションを実行待ちとし、実行待ち処理リス
トに追加する。プツトロックが発生すると判定されたと
きは、該トランザクションをアボートし、排他制御部1
1にアボートに伴うロック解除を要求する。
When the transaction execution unit 13 receives a notification from the exclusive control unit 11 that the record can be referenced or updated, the transaction execution unit 13 obtains the address in the database storage unit 16 of the record corresponding to the record identifier from the address conversion table 15, and refers to or updates the record. Perform updates. When a notification that addition is possible is obtained from the exclusive control unit 11, an empty address in the database storage unit 16 is registered in the address conversion table 16 in association with the record identifier of the added record, and the record is added using the address. conduct. When receiving a notification from the exclusive control unit 11 that it cannot be referenced or updated, it is determined based on the transaction identifier notified at the same time and the list of transactions waiting to be executed at the time of the notification. Determine whether a deadlock will occur by placing a transaction determined to be unupdatable in a waiting state. When it is determined that no deadlock will occur,
The transaction is set to be pending and added to the pending processing list. When it is determined that a putlock has occurred, the transaction is aborted and the exclusive control unit 1
1 to request unlocking due to abort.

尚、本発明において、参照、更新、追加を行うデータの
大きさは、上記説明で用いたレコードに限らず、ページ
等、任意の大きさでよい。
In the present invention, the size of the data to be referenced, updated, or added is not limited to the record used in the above explanation, but may be any size such as a page.

第3図は、本発明を用いたトランザクション処理の一実
施例を示す説明図である。第3図において、点線矢印で
記述したリードロックは、点線矢印の指すデータの参照
を省略したことを示す。第3図に示すように1本実施例
では、トランザクションCの時間gplにおける表51
の検索では、第2図(a)の処理の流れに基づき、トラ
ンザクションDにより時間fで追加されてデータ52の
参照が省略され、トランザクションCの時間eにおける
表51の検索と同一のデータが参照される。従って、ト
ランザクションCの時間8pgtlにおける表51の検
索結果は全て同一となる。
FIG. 3 is an explanatory diagram showing an example of transaction processing using the present invention. In FIG. 3, a read lock described by a dotted arrow indicates that reference to the data pointed to by the dotted arrow is omitted. As shown in FIG. 3, in this embodiment, table 51 at time gpl of transaction C
In the search for Table 51, the reference to data 52 added by transaction D at time f is omitted, and the same data as in the search for table 51 at time e of transaction C is referenced, based on the processing flow in FIG. 2(a). be done. Therefore, all the search results in Table 51 at time 8 pgtl of transaction C are the same.

以上の説明で明らかなように、本実施例によれば、ある
トランザクションが検索中の表に他のトランザクション
がデータを追加しても1表を検索しているトランザクシ
ョンは、追加されるデータの影響を受けずに処理を進め
ることができるので、表へのデータ追加と表の検索を同
時に処理しながらトランザクションの一貫性を保証する
ことができ、トランザクションの同時実行性の高いデー
タベース処理装置が実現できる。
As is clear from the above explanation, according to this embodiment, even if another transaction adds data to the table that is being searched by a certain transaction, the transaction that is searching for one table will not be affected by the added data. Since processing can proceed without any processing, it is possible to guarantee transaction consistency while simultaneously processing data addition to a table and table retrieval, making it possible to realize a database processing device with high transaction concurrency. .

以上、本発明を実施例にもとづき具体的に説明したが、
本発明は、前記実施例に限定されるものではなく、その
要旨を逸脱しない範囲において種々変更可能であること
は言うまでもない。
The present invention has been specifically explained above based on examples, but
It goes without saying that the present invention is not limited to the embodiments described above, and can be modified in various ways without departing from the spirit thereof.

〔発明の効果〕〔Effect of the invention〕

以上、説明したように、本発明によれば、表へのデータ
追加と表の検索を同時に処理しながらトランザクション
の一貫性を保証することができ、トランザクションの同
時実行性の高いデータベース処理装置が実現できる。
As described above, according to the present invention, it is possible to guarantee transaction consistency while simultaneously processing data addition to a table and table search, thereby realizing a database processing device with high transaction concurrency. can.

【図面の簡単な説明】[Brief explanation of drawings]

第1図は、本発明を用いたデータベース処理装置の一実
施例の概略構成を示すブロック図、第2図(a)〜(d
)は、第1図の実施例における排他制御部の処理の流れ
を示す図、第3図は、本発明を用いて表へのデータの追
加と表の検索を同時に処理した一実施例を示す説明図、 第4図は、一般的なデータベース処理装置の一例の概略
構成を示すブロック図、 第5図は、表へのデータの追加と表の検索の同時処理を
終端識別データを用いずに行った例を示す説明図である
。 図中、11.31・・・排他制御部、12.32・・・
排他制御情報表、13.33・・・トランザクション実
行部、14゜34・・・データベース情報表、15.3
5・・・アドレス変換表、16.36・・・データベー
ス格納部、17.37・・・端末、18・・・ロックレ
コードリスト、19・・・ロックトランザクションリス
ト、41.51・・・表、42.52・・・データ。 第2図(C)
FIG. 1 is a block diagram showing a schematic configuration of an embodiment of a database processing device using the present invention, and FIG.
) is a diagram showing the processing flow of the exclusive control unit in the embodiment of FIG. 1, and FIG. 3 shows an embodiment in which adding data to a table and searching the table are simultaneously processed using the present invention. Fig. 4 is a block diagram showing a schematic configuration of an example of a general database processing device, and Fig. 5 is a block diagram showing a schematic configuration of an example of a general database processing device. FIG. In the figure, 11.31...exclusive control section, 12.32...
Exclusive control information table, 13.33...Transaction execution unit, 14゜34...Database information table, 15.3
5...Address conversion table, 16.36...Database storage unit, 17.37...Terminal, 18...Lock record list, 19...Lock transaction list, 41.51...Table, 42.52...Data. Figure 2 (C)

Claims (1)

【特許請求の範囲】[Claims] (1)データを入出する入出力装置と、関係データベー
スの表を構成するデータに対するトランザクション処理
を実行するトランザクション実行部と、複数のトランザ
クションを同時に実行する際のトランザクションの一貫
性を保証する排他制御部と、前記関係データベースの表
を構成するデータを格納するデータベース格納部と、前
記関係データベースの表を構成するデータを識別するた
めのデータ識別子を登録するデータベース情報表と、デ
ータ識別子に対応する前記関係データベースの表を構成
するデータの前記データベース格納部における格納アド
レスを登録するアドレス変換表と、トランザクションが
データを参照中であることを示すリードロック、トラン
ザクションがデータを更新中であることを示すライトロ
ック、及びトランザクションがデータを追加中であるこ
とを示す追加ロックからなる排他制御情報を登録する排
他制御情報表とを具備するデータベース処理装置であっ
て、 前記関係データベースの表にデータを追加する際に該デ
ータに割り当てる1つのデータ識別子を前記データベー
ス情報表に予め登録しておき、前記排他制御部において
、表へのデータ追加時には、該レコードの追加ロックを
、予め登録しておいた前記データ識別子を用いて前記排
他制御情報表に登録するとともに、次回の追加データの
ための新たなデータ識別子を前記データベース情報表に
登録し、該新たなデータ識別子に対するリードロックの
情報が前記追加ロックを登録したデータ識別子の情報と
同一になるように排他制御情報を前記排他制御情報表に
登録し、表へ該データを追加することを前記トランザク
ション実行部に許可し、 他トランザクションによって追加ロックされたデータの
参照時には、該データに対するリードロックを前記排他
制御情報表に登録し、該データの参照を省略するように
前記トランザクション実行部に指示することで、 関係データベースの同一の表に対して、該表へのデータ
の追加と該表の検索を同時に行いながら、トランザクシ
ョンの一貫性を保証することを特徴とするデータベース
の排他制御方法。
(1) An input/output device that inputs and outputs data, a transaction execution unit that executes transaction processing on the data that makes up the tables of the relational database, and an exclusive control unit that guarantees transaction consistency when multiple transactions are executed simultaneously. a database storage unit that stores data that constitutes the tables of the relational database; a database information table that registers data identifiers for identifying data that constitutes the tables of the relational database; and the relationships that correspond to the data identifiers. An address conversion table that registers the storage address in the database storage section of data that makes up a database table, a read lock that indicates that a transaction is referencing data, and a write lock that indicates that a transaction is updating data. and an exclusive control information table that registers exclusive control information consisting of an additional lock indicating that a transaction is adding data, the database processing device comprising: One data identifier assigned to the data is registered in advance in the database information table, and when data is added to the table, the exclusive control unit locks the addition of the record using the previously registered data identifier. At the same time, a new data identifier for the next additional data is registered in the database information table, and the read lock information for the new data identifier is the data for which the additional lock was registered. Register exclusive control information in the exclusive control information table so that it is the same as the identifier information, permit the transaction execution unit to add the data to the table, and when referencing data that has been additionally locked by another transaction. , by registering a read lock for the data in the exclusive control information table and instructing the transaction execution unit to omit reference to the data, 1. A method for exclusive control of a database, which guarantees transaction consistency while simultaneously adding a table and searching the table.
JP1257238A 1989-10-02 1989-10-02 Exclusive control method for data base Pending JPH03118645A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP1257238A JPH03118645A (en) 1989-10-02 1989-10-02 Exclusive control method for data base

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP1257238A JPH03118645A (en) 1989-10-02 1989-10-02 Exclusive control method for data base

Publications (1)

Publication Number Publication Date
JPH03118645A true JPH03118645A (en) 1991-05-21

Family

ID=17303607

Family Applications (1)

Application Number Title Priority Date Filing Date
JP1257238A Pending JPH03118645A (en) 1989-10-02 1989-10-02 Exclusive control method for data base

Country Status (1)

Country Link
JP (1) JPH03118645A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5809503A (en) * 1993-07-08 1998-09-15 Fujitsu Limited Locking mechanism for check in/check out model which maintains data consistency amongst transactions

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5809503A (en) * 1993-07-08 1998-09-15 Fujitsu Limited Locking mechanism for check in/check out model which maintains data consistency amongst transactions

Similar Documents

Publication Publication Date Title
US7243088B2 (en) Database management system with efficient version control
US10585873B2 (en) Atomic processing of compound database transactions that modify a metadata entity
US6772155B1 (en) Looking data in a database system
US7260578B2 (en) Database-file link system and method therefor
US8745707B2 (en) Method and apparatus providing optimistic locking of shared computer resources
US9336258B2 (en) Reducing database locking contention using multi-version data record concurrency control
US6339772B1 (en) System and method for performing database operations on a continuous stream of tuples
US8407195B2 (en) Efficient multi-version locking for main memory databases
US7600063B2 (en) Techniques for improved read-write concurrency
KR0126245B1 (en) Locking mechanism for check in/check out model
JP2001523367A (en) Database management system and method for combining metadata for conditional contention serializability of transactions and varying degrees of reliability
EP3824397B1 (en) Version-based table locking
CN109800062B (en) Distributed database transaction processing system
JPH03118645A (en) Exclusive control method for data base
JPH05307478A (en) Constituting method for data base management system
JPH03123946A (en) Exclusive control method for data base
US20230394028A1 (en) Method and system for lock after qualification for update queries
JPH1049420A (en) Data base managing method
US20150310033A1 (en) Information processing apparatus, control method, and storage medium storing program
JPS63196956A (en) File exclusion system
JP4245282B2 (en) Write delay database management method, apparatus, program, and recording medium
JPH05216728A (en) Data base managing system
JPH04282733A (en) Method for managing data base
JP2600800B2 (en) Exclusive control of buffer table and deadlock detection method
JPH07141243A (en) Lock management device