JP5224928B2 - Database consistency check device and method, program, and computer-readable recording medium - Google Patents

Database consistency check device and method, program, and computer-readable recording medium Download PDF

Info

Publication number
JP5224928B2
JP5224928B2 JP2008163767A JP2008163767A JP5224928B2 JP 5224928 B2 JP5224928 B2 JP 5224928B2 JP 2008163767 A JP2008163767 A JP 2008163767A JP 2008163767 A JP2008163767 A JP 2008163767A JP 5224928 B2 JP5224928 B2 JP 5224928B2
Authority
JP
Japan
Prior art keywords
database
lock
consistency
exclusive
resource management
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.)
Active
Application number
JP2008163767A
Other languages
Japanese (ja)
Other versions
JP2010003265A (en
Inventor
正樹 久田
啓敏 須賀
史和 小西
清次 冨田
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 JP2008163767A priority Critical patent/JP5224928B2/en
Publication of JP2010003265A publication Critical patent/JP2010003265A/en
Application granted granted Critical
Publication of JP5224928B2 publication Critical patent/JP5224928B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Description

本発明は、データベース整合性チェック装置及び方法及びプログラム及びコンピュータ読取可能な記録媒体に係り、特に、メモリ上に展開されたデータベースの整合性をチェックするためのデータベース整合性チェック装置及び方法及びプログラム及びコンピュータ読取可能な記録媒体に関する。   The present invention relates to a database consistency check apparatus, method and program, and a computer-readable recording medium, and more particularly to a database consistency check apparatus, method and program for checking the consistency of a database developed on a memory, and The present invention relates to a computer-readable recording medium.

データベースの更新トランザクションの実行を停止することなく、整合性のチェックを行うことが可能な技術として、あるインデックスに対応したあるブロックを起点として、リレーション順に各データブロックを読み出し、次のデータブロックへのチェーンが途切れた場合、途切れたチェーンの前後のデータブロックのうち、少なくとも一方のデータブロックを以上であると判定するものがある(例えば、特許文献1参照)。   As a technology that can check consistency without stopping execution of database update transactions, starting from a block corresponding to a certain index, each data block is read in the order of relation, and the next data block is read. When the chain is interrupted, there is one that determines that at least one of the data blocks before and after the interrupted chain is the above (for example, see Patent Document 1).

しかし、データベースの更新と整合性のチェックを同時に行うと、更新中の不完全な情報データベースが更新トランザクション処理途中の不整合な状態(原始性が保たれていない状態)で整合性を判断することになり、不整合であると誤診断する可能性がある。このため、図9(A),(B)に示すように、データベースの更新または整合性チェックのいずれかが排他ロックを取得し、排他区間内で処理を行うことにより、データベースの更新と整合性チェックが同時に行われないようにする必要がある。このようなデータベースの更新と整合性チェックが同時に行われないように、チェック対象のフィールドまたはフィールドの組み合わせに対する他の処理のアクセスを規制するための参照ロックをかけながら、チェック対象のフィールドまたはフィールドの組み合わせ整合性のチェックを行う方法がある(例えば、特許文献2参照)。
特開平6−4588号公報 特開平8−249222号公報
However, if the database update and the consistency check are performed at the same time, the incomplete information database being updated is judged to be consistent in an inconsistent state (a state in which the originality is not maintained) during the update transaction process. And there is a possibility of misdiagnosis as inconsistent. Therefore, as shown in FIGS. 9A and 9B, either the database update or the consistency check acquires an exclusive lock, and performs processing within the exclusive section, whereby the database update and consistency are performed. Checks should not be made at the same time. To prevent such a database update and consistency check from being performed at the same time, a check lock is applied to restrict the access of other processes to the field or field combination being checked, and the field or field being checked is checked. There is a method of checking combination consistency (for example, see Patent Document 2).
JP-A-6-4588 JP-A-8-249222

しかしながら、上記の技術では、データベースの更新処理と整合性チェックとが競合した場合に、図9(A),(B)に示すように、データベースの更新処理、または、整合性チェックのいずれか一方が、排他ロックを取得した場合、残りの一方が、排他ロックの取得待ちを行う必要があり、当該処理の応答が遅延してしまうという問題がある。   However, in the above technique, when the database update process and the consistency check conflict, as shown in FIGS. 9A and 9B, either the database update process or the consistency check is performed. However, when an exclusive lock is acquired, the remaining one needs to wait for acquisition of an exclusive lock, resulting in a delay in the response of the process.

本発明は、上記の点に鑑みなされたもので、データベースの更新処理を行っている場合であっても、整合性チェックの応答時間の遅延を抑制することが可能なデータベース整合性チェック装置及び方法及びプログラム及びコンピュータ読取可能な記録媒体を提供することを目的とする。   The present invention has been made in view of the above points, and a database consistency check apparatus and method capable of suppressing a delay in response time of a consistency check even when a database update process is performed. It is another object of the present invention to provide a program and a computer-readable recording medium.

図1は、本発明の原理構成図である。   FIG. 1 is a principle configuration diagram of the present invention.

本発明(請求項1)は、データベースの整合性をチェックするためのデータベース整合性チェック装置であって、
アクセス及び整合性チェックの対象のデータベース130と、
データベース130中のデータにある処理がアクセスしている間に、他の処理が該データベース130の同データにアクセスしないように排他制御を行うロック資源管理手段110と、
データベース130内のデータの更新処理及び参照処理を開始する際に、ロック資源管理手段110に排他ロックを要求し、排他ロックが可能な旨が通知されると、該データベースの更新処理または参照処理を行うデータベース処理手段100と、
ロック資源管理手段110に対する排他ロック要求を行なわずに、データベース130内のデータの整合性のチェックを行い、予め設定された回数を上限として、不整合ありと判定されたならば再度データベース130の整合性のチェックを行い、該予め設定された回数に達しても不整合ありの場合には、ロック資源管理手段110に排他ロックを要求し、排他ロックを取得すると、データベース130のチェック対象区間をキャッシュへコピーし、該排他ロックの解除要求を該ロック資源管理手段110に出力し、該キャッシュ内の整合性をチェックし、整合結果を出力し、一方、排他ロックを取得できなかった場合は、排他ロックを再要求するデータベース整合性チェック手段120と、を有する。
The present invention (Claim 1) is a database consistency checking device for checking the consistency of a database,
A database 130 to be accessed and checked for consistency;
A lock resource management unit 110 that performs exclusive control so that other processes do not access the data in the database 130 while a process in the data in the database 130 is accessing;
When starting update processing and reference processing of data in the database 130, when an exclusive lock is requested to the lock resource management means 110 and notification that an exclusive lock is possible is made, the update processing or reference processing of the database is performed. Database processing means 100 to perform;
The consistency of the data in the database 130 is checked without making an exclusive lock request to the lock resource management means 110, and if it is determined that there is an inconsistency up to a preset number of times , the consistency of the database 130 is checked again. If there is inconsistency even if the preset number of times is reached, the lock resource management unit 110 is requested to obtain an exclusive lock, and when the exclusive lock is acquired, the check target section of the database 130 is cached. The exclusive lock release request is output to the lock resource management unit 110, the consistency in the cache is checked, and the consistency result is output. On the other hand, if the exclusive lock cannot be acquired, the exclusive lock is output. Database consistency checking means 120 for re-requesting the lock.

また、本発明(請求項)は、ロック資源管理手段110において、
データベースの排他制御の対象となるデータ区間が、データベース処理手段100とデータベース整合性チェック手段120とで競合する場合には、先に受け付けた方の排他ロック要求を優先する手段を含む。
Further, the present invention (Claim 2 ) is provided in the lock resource management means 110.
In the case where the data section subject to exclusive control of the database competes between the database processing unit 100 and the database consistency checking unit 120, a unit that prioritizes the exclusive lock request that has been received first is included.

図2は、本発明の原理を説明するための図である。   FIG. 2 is a diagram for explaining the principle of the present invention.

本発明(請求項3)は、データベースの整合性をチェックするためのデータベース整合性チェック方法であって、
アクセス及び整合性チェックの対象のデータベース中のデータにある処理がアクセスしている間に、他の処理が該データベースの同データにアクセスしないように排他制御を行うロック資源管理手段と、データベース処理手段と、データベース整合性チェック手段と、を有する装置において、
データベース処理手段が、ロック資源管理手段から排他ロックを取得すると、該データベースの更新処理または参照処理を行うデータベース処理ステップと、
データベース整合性チェック手段が、ロック資源管理手段に対する排他ロック要求を行なわずに、データベース内のデータの整合性のチェックを行い(ステップ1)、予め設定された回数を上限として、不整合ありと判定されたならば(ステップ2、Yes)再度データベースの整合性のチェックを行い(ステップ)、該予め設定された回数に達しても不整合ありの場合には(ステップ2、Yes,ステップ3、Yes)、ロック資源管理手段に排他ロックを要求し、排他ロックを取得すると(ステップ4、OK)、データベースのチェック対象区間をキャッシュへコピーし(ステップ5)、該排他ロックの解除要求を該ロック資源管理手段に出力し(ステップ6)、該キャッシュ内の整合性をチェックし(ステップ7、8)、整合結果を出力し(ステップ9)、一方、排他ロックを取得できなかった場合は(ステップ4、NG)、排他ロックを再要求するデータベース整合性チェックステップと、を行う。
The present invention (Claim 3) is a database consistency check method for checking the consistency of a database,
Lock resource management means for performing exclusive control so that other processes do not access the data in the database while a process in the data in the database of the access and consistency check is accessing ; and database processing means And a database consistency check means ,
When the database processing means acquires an exclusive lock from the lock resource management means, a database processing step for performing update processing or reference processing of the database; and
The database consistency check means checks the consistency of data in the database without making an exclusive lock request to the lock resource management means (step 1), and determines that there is inconsistency up to a preset number of times. If yes (Step 2, Yes), the database consistency is checked again (Step 1 ). If there is inconsistency even if the preset number of times is reached (Step 2, Yes, Step 3, Yes) When an exclusive lock is requested to the lock resource management means and the exclusive lock is acquired (step 4, OK ), the check target section of the database is copied to the cache ( step 5 ), and the exclusive lock release request is transferred to the lock. output to the resource management unit (step 6), checks the integrity of the cache (step 7,8), and outputs the matching result (scan Step 9 ) On the other hand, if the exclusive lock could not be acquired ( step 4, NG ), a database consistency check step for re-requesting the exclusive lock is performed.

また、本発明(請求項)は、ロック資源管理手段において、
データベースの排他制御の対象となるデータ区間が、データベース処理ステップとデータベース整合性チェックステップとで競合する場合には、先に受け付けた方の排他ロック要求を優先する。
Further, the present invention (Claim 4 ) is provided in the lock resource management means.
When the data section subject to exclusive control of the database competes between the database processing step and the database consistency check step , the exclusive lock request that has been received first is given priority.

本発明(請求項)は、請求項1または2に記載のデータベース整合性チェック装置を構成する各手段としてコンピュータを機能させるためのデータベース整合性チェックプログラムである。 The present invention (Claim 5 ) is a database consistency check program for causing a computer to function as each means constituting the database consistency check apparatus according to Claim 1 or 2 .

本発明(請求項)は、請求項記載のデータベース整合性チェックプログラムを格納したことを特徴とするコンピュータ読み取り可能な記録媒体である。 The present invention (Claim 6 ) is a computer-readable recording medium in which the database consistency check program according to claim 5 is stored.

上記のように、本発明によれば、データベースの最初の整合性のチェックを、排他ロックを取得せずに実行することにより、整合性チェック自体も、データベースの更新処理も、排他ロックの取得に失敗することなく、同時に実行が可能である。これにより、データベースの更新を行っている場合であっても、整合性チェックの応答時間の遅延を抑制することができる。また、整合性のチェック実施中であっても、データベースの更新処理の遅延を抑制することができる。   As described above, according to the present invention, by executing the initial consistency check of the database without acquiring the exclusive lock, the consistency check itself and the database update processing can be performed by acquiring the exclusive lock. It is possible to run at the same time without failure. Thereby, even if it is a case where the update of a database is performed, the delay of the response time of a consistency check can be suppressed. Further, even when the consistency check is being performed, the delay of the database update process can be suppressed.

また、初回の整合性に失敗した場合に、再試行することにより、不整合と誤判定される可能性が低くなり、データベースの更新処理の応答時間の遅延を抑制することができる。   In addition, if the initial consistency fails, the possibility of misjudgment as inconsistency is reduced by retrying, and a delay in the response time of the database update process can be suppressed.

また、排他ロックを取得し、キャッシュへのコピーを行い、排他ロックを解放し、整合性チェックを行うことで、排他ロック期間が短縮されデータベースの応答時間の遅延を抑制することが可能となる。   Further, by acquiring the exclusive lock, copying to the cache, releasing the exclusive lock, and performing the consistency check, it is possible to shorten the exclusive lock period and suppress the delay in the response time of the database.

以下、図面と共に本発明の実施の形態を説明する。   Hereinafter, embodiments of the present invention will be described with reference to the drawings.

[第1の実施の形態]
図3は、本発明の第1の実施の形態におけるデータベース整合性チェック装置の構成図である。
[First Embodiment]
FIG. 3 is a configuration diagram of the database consistency check device according to the first embodiment of the present invention.

同図に示すデータベース整合性チェック装置は、データベース処理部100、ロック資源管理部110、整合性チェック部120、及びデータベース130から構成される。   The database consistency check apparatus shown in FIG. 1 includes a database processing unit 100, a lock resource management unit 110, a consistency check unit 120, and a database 130.

データベース処理部100は、データベース130の更新処理及び参照処理を行う。更新処理を行う場合には、ロック資源管理部110より排他ロックを取得する。   The database processing unit 100 performs update processing and reference processing of the database 130. When performing update processing, an exclusive lock is acquired from the lock resource management unit 110.

ロック資源管理部110は、メモリ(図示せず)内に、データベース130内のインデックス毎に、インデックス及びデータの更新ロックテーブル115を有している。データベース処理部100または、整合性チェック部120からデータベース130中のデータのインデックスを含む排他ロック要求を取得すると、当該インデックスに基づいて当該テーブル115を参照することにより、現在排他ロック中でないデータについては排他ロックを許可し、テーブル115に排他ロックを示すフラグを立て(ONにする)、当該データに対して排他制御を行う。また、排他ロックが解除された場合には、テーブル115の当該フラグにOFFを設定し、排他制御を解除する。ロック資源管理部110は、データベース処理部100と整合性チェック部120に対して、更新ロックテーブル115の整合性チェック対象のデータ区間のフラグが「OFF」であれば、排他ロックを許可する「OK」を返却し、フラグが「ON」であれば、排他ロックを不許可とする「NG」を返却する。また、データベース処理部100と整合性チェック120の双方から排他ロック取得要求を受け付けた場合には、先に当該要求を受け付けた方について、優先的に排他ロックを許可するものとする。   The lock resource management unit 110 has an index and data update lock table 115 for each index in the database 130 in a memory (not shown). When an exclusive lock request including an index of data in the database 130 is acquired from the database processing unit 100 or the consistency check unit 120, by referring to the table 115 based on the index, data that is not currently in an exclusive lock is obtained. An exclusive lock is permitted, a flag indicating the exclusive lock is set in the table 115 (turned ON), and exclusive control is performed on the data. When the exclusive lock is released, the flag in the table 115 is set to OFF, and the exclusive control is released. The lock resource management unit 110 permits the exclusive lock to the database processing unit 100 and the consistency check unit 120 when the flag of the data section subject to the consistency check in the update lock table 115 is “OFF”. "Is returned, and if the flag is" ON "," NG "that does not permit exclusive lock is returned. Further, when an exclusive lock acquisition request is received from both the database processing unit 100 and the consistency check 120, the exclusive lock is preferentially granted to the one that has received the request first.

整合性チェック部120は、まず、排他ロックをせずに整合性チェックを行い、不整合であると診断された場合には、ロック資源管理部110に排他ロックを要求し、排他ロックを取得する。なお、整合性チェック部120では、整合性チェックは、データベース制御表チェック、インデックス・データベース相関チェック、データベースのデータ構造チェック等を用いるものとする。   The consistency check unit 120 first performs a consistency check without performing an exclusive lock, and when it is diagnosed as inconsistent, requests an exclusive lock from the lock resource management unit 110 and acquires an exclusive lock. . The consistency check unit 120 uses a database control table check, an index / database correlation check, a database data structure check, and the like for the consistency check.

以下に上記の構成における動作を説明する。   The operation in the above configuration will be described below.

最初に、データベース処理部110の動作について説明する。   First, the operation of the database processing unit 110 will be described.

図4は、本発明の第1の実施の形態におけるデータベース処理のフローチャートである。   FIG. 4 is a flowchart of database processing according to the first embodiment of this invention.

データベース処理部100は、データベース処理を開始すると、ロック資源管理部110から排他ロックを取得し(ステップ101)、成功した場合(ロック資源管理部110からOKを取得した場合)は、データベース130のインデックス、ローの更新を行い(ステップ102)、当該更新処理が終了したら排他ロック解除の解除要求をロック資源管理部110に出力し(ステップ103)、当該処理を終了する。   When the database processing unit 100 starts database processing, the database processing unit 100 acquires an exclusive lock from the lock resource management unit 110 (step 101), and when successful (when OK is acquired from the lock resource management unit 110), the index of the database 130 is acquired. Then, the row is updated (step 102), and when the update process is completed, an exclusive lock release release request is output to the lock resource management unit 110 (step 103), and the process ends.

次に、整合性チェック部120の動作について説明する。   Next, the operation of the consistency check unit 120 will be described.

以下に示す動作の特徴は、データベース130の整合性の初回のチェック処理において、排他ロックの取得を行わず、処理時間を短縮するものである。   The feature of the operation described below is that the exclusive lock is not acquired and the processing time is shortened in the initial check process of the consistency of the database 130.

図5は、本発明の第1の実施の形態におけるデータベース整合性チェックのフローチャート(その1)である。   FIG. 5 is a flowchart (part 1) of the database consistency check according to the first embodiment of this invention.

データベース整合性チェック部120において、整合性チェックを開始すると、初回は排他ロックを取得せずに整合性チェックを行い(ステップ201)、不整合であるかを判定し、不整合なしと判定された場合には(ステップ202、なし)、「不整合性なし」の判定結果を出力し(ステップ208)、処理を終了する。一方、「不整合あり」と診断された場合には、ロック資源管理部110に対して排他ロック要求を行い、成功した場合は(ステップ203、OK)、整合性チェックを行い(ステップ204)、ロック資源管理部110に対して排他ロックの解除要求を行う(ステップ205)。排他ロックに失敗した場合は(ステップ203、NG)、再度排他ロック要求を行う(ステップ203)。整合性チェックの結果が不整合であるかを判定し、不整合がある場合は(ステップ206、あり)、「不整合あり」の判定結果を出力し、処理を終了する(ステップ207)。不整合なし場合は(ステップ206、なし)、「不整合なし」を判定として出力し、処理を終了する(ステップ208)。   When the consistency check is started in the database consistency check unit 120, the consistency check is performed without acquiring an exclusive lock for the first time (step 201), it is determined whether there is inconsistency, and it is determined that there is no inconsistency. In this case (step 202, none), the determination result of “no inconsistency” is output (step 208), and the process is terminated. On the other hand, if it is diagnosed as “inconsistent”, an exclusive lock request is made to the lock resource management unit 110, and if successful (step 203, OK), a consistency check is performed (step 204). An exclusive lock release request is issued to the lock resource management unit 110 (step 205). If the exclusive lock fails (step 203, NG), an exclusive lock request is made again (step 203). It is determined whether or not the result of the consistency check is inconsistent. If there is an inconsistency (Yes in Step 206), the determination result of “inconsistent” is output, and the process ends (Step 207). If there is no inconsistency (step 206, none), “no inconsistency” is output as a determination, and the process ends (step 208).

上記の図4のデータベース処理の排他区間(ステップ102〜104)と、データベース整合性チェック処理の排他区間(ステップ203〜205)が競合した場合は、ロック資源管理部110の制御により、いずれか先に排他ロックを取得した処理が実行される。   When the exclusive section of the database processing (steps 102 to 104) in FIG. 4 and the exclusive section of the database consistency check process (steps 203 to 205) conflict with each other, the lock resource management unit 110 controls whichever The process that acquired the exclusive lock is executed.

整合性チェック処理の初回の整合性チェック(ステップ201)、は、データベース処理の排他区間(ステップ102〜104)であっても実行可能である。   The initial consistency check (step 201) of the consistency check process can be executed even in the exclusive section (steps 102 to 104) of the database process.

図6は、本発明の第1の実施の形態におけるデータベース整合性チェックを説明するための図である。   FIG. 6 is a diagram for explaining the database consistency check according to the first embodiment of this invention.

上記の処理により、図6(A)に示すように、整合性チェックをはじめに排他ロックを取得せずに実行するため、整合性チェック自体も、データベースの更新処理も排他ロック取得に失敗することなく、同時に実行が可能である。この際、不整合であると誤診断する可能性があるが、再度排他ロックを取得し、データベースの更新処理が同時行われない状態で、再度整合性の判定を行うことにより(図6(B))、初回の診断が誤診断であったか、診断が正しく不整合であったかが判断できる。   With the above processing, as shown in FIG. 6A, since the consistency check is executed without acquiring the exclusive lock at the beginning, neither the consistency check itself nor the database update process fails to acquire the exclusive lock. Can be executed simultaneously. At this time, there is a possibility of misdiagnosis as inconsistent. However, by acquiring the exclusive lock again and performing the consistency determination again in a state where the database update processing is not performed simultaneously (FIG. 6B )), It can be judged whether the initial diagnosis was a misdiagnosis or whether the diagnosis was correct and inconsistent.

誤診断による不整合となる確率は、更新処理が行われる時間区間のうち、整合性チェックにより不整合であると誤診断される処理区間は、同じか、短いため、少なくとも、同時もしくは低くなる。一般的には、トランザクション処理等の不整合と判定されない処理が含まれているため、誤診断による不整合となる確率は低くなる。これにより、データベース130の更新処理、もしくは、整合性チェックの応答時間の遅延が抑制されることとなる。   The probability of inconsistency due to misdiagnosis is at least simultaneous or low because the processing sections misdiagnosed as inconsistent by the consistency check among the time sections in which update processing is performed are the same or short. In general, since processing that is not determined to be inconsistent, such as transaction processing, is included, the probability of inconsistency due to misdiagnosis is low. As a result, a delay in response time of the update process of the database 130 or the consistency check is suppressed.

[第2の実施の形態]
本実施の形態では、上記の図5の初回の整合性チェック(ステップ201)において、「不整合あり」と判定された場合(ステップ202、あり)の追加処理について説明する。
[Second Embodiment]
In the present embodiment, an additional process when it is determined that “there is inconsistency” in the initial consistency check (step 201) in FIG. 5 described above (step 202 is present) will be described.

図7は、本発明の第2の実施の形態におけるデータベース整合性チェックのフローチャートである。同図において、図5と同一動作については同一ステップ番号を付し、その説明を省略する。なお、装置構成は図3と同様である。   FIG. 7 is a flowchart of database consistency check according to the second embodiment of this invention. In the figure, the same operations as those in FIG. 5 are denoted by the same step numbers, and the description thereof is omitted. The apparatus configuration is the same as that shown in FIG.

図5のステップ201の処理を行う前に、再試行回数カウンタiの初期値を設定し(i=0)、上記のステップ202において、「不整合あり」と判定された場合は、所定の再試行回数を超過しているかを判定し、超過している場合には(ステップ302、Yes)、ステップ203に移行する。超過していない場合は(ステップ302、No)、再試行回数のカウンタiに1加算し(i=i+1)、ステップ201に移行する(ステップ303)。   Before performing the process of step 201 in FIG. 5, the initial value of the retry counter i is set (i = 0). If it is determined in step 202 that “there is inconsistency”, a predetermined retry is performed. It is determined whether or not the number of trials has been exceeded. If the number has been exceeded (Yes at Step 302), the process proceeds to Step 203. If not exceeded (No at step 302), 1 is added to the counter i of the number of retries (i = i + 1), and the process proceeds to step 201 (step 303).

これにより、初回の整合性チェック(ステップ201)が不整合となった場合でも、再試行回数が所定の再試行回数を超過するまで、再試行を行うことにより、誤診断となる確率が1未満であれば、p(n)>p(n+1)であるため、上記の処理を繰り返すことにより、排他ロックを取得せずに誤診断の確率を下げることができる。これにより、排他ロックの抑制が可能となる。 As a result, even if the first consistency check (step 201) becomes inconsistent, the probability of misdiagnosis is less than 1 by performing retry until the number of retries exceeds the predetermined number of retries. Then, since p (n) > p (n + 1), it is possible to reduce the probability of misdiagnosis without acquiring an exclusive lock by repeating the above processing. As a result, exclusive lock can be suppressed.

[第3の実施の形態]
本実施の形態では、第1の実施の形態における図5のステップ204の整合性のチェックを行わずにキャッシュへコピーする場合について説明する。
[Third Embodiment]
In the present embodiment, a case will be described in which copying is performed to the cache without performing the consistency check in step 204 of FIG. 5 in the first embodiment.

図8は、本発明の第3の実施の形態におけるデータベース整合性チェックのフローチャートである。同図において、図5と同一動作については同一ステップ番号を付し、その説明を省略する。なお、装置構成は図3と同様である。   FIG. 8 is a flowchart of database consistency check according to the third embodiment of the present invention. In the figure, the same operations as those in FIG. 5 are denoted by the same step numbers, and the description thereof is omitted. The apparatus configuration is the same as that shown in FIG.

排他ロックを取得した後(ステップ203、OK)、整合性チェックを行わずに、チェック区間のキャッシュへコピーし(ステップ401)、排他ロックを解除し(ステップ204)、キャッシュ内の整合性のチェックを行い(ステップ402)、整合性があるかを判定する(ステップ206)。   After acquiring the exclusive lock (step 203, OK), without checking the consistency, copy to the cache in the check section (step 401), release the exclusive lock (step 204), and check the consistency in the cache (Step 402) and it is determined whether there is consistency (step 206).

これにより、排他ロックを取得し、キャッシュへのコピーを行い、その後で排他ロックを解放し、排他ロック区間外(キャッシュ内)で整合性のチェックを行い、整合性チェックを行うことで、整合性のチェックよりキャッシュコピー時間が短い場合には、排他ロック期間が短縮され、データベース130の応答時間の遅延を抑制することが可能となる。   As a result, the exclusive lock is acquired, copied to the cache, then the exclusive lock is released, the consistency check is performed outside the exclusive lock section (in the cache), and the consistency check is performed. When the cache copy time is shorter than the above check, the exclusive lock period is shortened, and the delay of the response time of the database 130 can be suppressed.

なお、上記の図3に示すデータベース整合性チェック装置の各構成要素について、第1〜第3の実施の形態に示す動作をプログラムとして構築し、データベース整合性チェック装置として利用されるコンピュータにインストールして実行させる、または、ネットワークを介して流通させることが可能である。   For each component of the database consistency check device shown in FIG. 3, the operations shown in the first to third embodiments are constructed as a program and installed in a computer used as the database consistency check device. Or can be distributed via a network.

また、構築されたプログラムをハードディスクや、フレキシブルディスク・CD−ROM等の可搬記憶媒体に格納し、コンピュータにインストールする、または、配布することが可能である。   Further, the constructed program can be stored in a portable storage medium such as a hard disk, a flexible disk, or a CD-ROM, and can be installed or distributed in a computer.

なお、本発明は、上記の実施の形態及び実施例に限定されることなく、特許請求の範囲内において種々変更・応用が可能である。   The present invention is not limited to the above-described embodiments and examples, and various modifications and applications can be made within the scope of the claims.

本発明は、データベースの整合性チェック技術に適用可能である。   The present invention is applicable to a database consistency check technique.

本発明の原理構成図である。It is a principle block diagram of this invention. 本発明の原理を説明するための図である。It is a figure for demonstrating the principle of this invention. 本発明の第1の実施の形態におけるデータベース整合性チェックの構成図である。It is a block diagram of the database consistency check in the 1st Embodiment of this invention. 本発明の第1の実施の形態におけるデータベース処理のフローチャートである。It is a flowchart of the database process in the 1st Embodiment of this invention. 本発明の第1の実施の形態におけるデータベース整合性チェックのフローチャートである。It is a flowchart of the database consistency check in the 1st Embodiment of this invention. 本発明の第1の実施の形態におけるデータベース整合性チェックの説明図である。It is explanatory drawing of the database consistency check in the 1st Embodiment of this invention. 本発明の第2の実施の形態におけるデータベース整合性チェックのフローチャートである。It is a flowchart of the database consistency check in the 2nd Embodiment of this invention. 本発明の第3の実施の形態におけるデータベース整合性チェックのフローチャートである。It is a flowchart of the database consistency check in the 3rd Embodiment of this invention. 従来のデータベース整合性チェック方法を示す図である。It is a figure which shows the conventional database consistency check method.

符号の説明Explanation of symbols

100 データベース処理手段、データベース処理部
110 ロック資源管理手段、ロック資源管理部
115 更新ロックテーブル
120 データベース整合性チェック手段、整合性チェック部
130 データベース
100 Database processing unit, database processing unit 110 Lock resource management unit, lock resource management unit 115 Update lock table 120 Database consistency check unit, consistency check unit 130 Database

Claims (6)

データベースの整合性をチェックするためのデータベース整合性チェック装置であって、
アクセス及び整合性チェックの対象のデータベースと、
前記データベース中のデータにある処理がアクセスしている間に、他の処理が該データベースの同データにアクセスしないように排他制御を行うロック資源管理手段と、
前記データベース内のデータの更新処理及び参照処理を開始する際に、前記ロック資源管理手段に排他ロックを要求し、排他ロックが可能な旨が通知されると、該データベースの更新処理または参照処理を行うデータベース処理手段と、
前記ロック資源管理手段に対する排他ロック要求を行なわずに、前記データベース内のデータの整合性のチェックを行い、予め設定された回数を上限として、不整合ありと判定されたならば再度前記データベースの整合性のチェックを行い、該予め設定された回数に達しても不整合ありの場合には、前記ロック資源管理手段に排他ロックを要求し、排他ロックを取得すると、前記データベースのチェック対象区間をキャッシュへコピーし、該排他ロックの解除要求を該ロック資源管理手段に出力し、該キャッシュ内の整合性をチェックし、整合結果を出力し、一方、排他ロックを取得できなかった場合は、排他ロックを再要求するデータベース整合性チェック手段と、
を有することを特徴とするデータベース整合性チェック装置。
A database consistency check device for checking database consistency,
A database subject to access and consistency checks; and
Lock resource management means for performing exclusive control so that other processes do not access the data in the database while a process in the data in the database is accessing;
When starting update processing and reference processing of the data in the database, if an exclusive lock is requested to the lock resource management means and it is notified that the exclusive lock is possible, the update processing or reference processing of the database is performed. Database processing means to perform;
Without making an exclusive lock request to the lock resource management means, the consistency of the data in the database is checked, and if it is determined that there is inconsistency up to a preset number of times, the consistency of the database is again performed. If there is inconsistency even if the preset number of times is reached, the lock resource management means requests the exclusive lock, and when the exclusive lock is acquired, the check target section of the database is cached. The exclusive lock release request is output to the lock resource management means, the consistency in the cache is checked, and the consistency result is output. On the other hand, if the exclusive lock cannot be acquired, the exclusive lock Database integrity check means to re-request
A database consistency checking device comprising:
前記ロック資源管理手段は、
前記データベースの排他制御の対象となるデータ区間が、前記データベース処理手段と前記データベース整合性チェック手段とで競合する場合には、先に受け付けた方の排他ロック要求を優先する手段を含む
請求項1記載のデータベース整合性チェック装置。
The lock resource management means includes
2. A means for giving priority to an exclusive lock request received earlier when a data section subject to exclusive control of the database conflicts between the database processing means and the database consistency check means. The database consistency check device described.
データベースの整合性をチェックするためのデータベース整合性チェック方法であって、
アクセス及び整合性チェックの対象のデータベース中のデータにある処理がアクセスしている間に、他の処理が該データベースの同データにアクセスしないように排他制御を行うロック資源管理手段と、データベース処理手段と、データベース整合性チェック手段と、を有する装置において、
前記データベース処理手段が、前記ロック資源管理手段から排他ロックを取得すると、該データベースの更新処理または参照処理を行うデータベース処理ステップと、
前記データベース整合性チェック手段が、前記ロック資源管理手段に対する排他ロック要求を行なわずに、前記データベース内のデータの整合性のチェックを行い、予め設定された回数を上限として、不整合ありと判定されたならば再度前記データベースの整合性のチェックを行い、該予め設定された回数に達しても不整合ありの場合には、前記ロック資源管理手段に排他ロックを要求し、排他ロックを取得すると、前記データベースのチェック対象区間をキャッシュへコピーし、該排他ロックの解除要求を該ロック資源管理手段に出力し、該キャッシュ内の整合性をチェックし、整合結果を出力し、一方、排他ロックを取得できなかった場合は、排他ロックを再要求するデータベース整合性チェックステップと、
を行うことを特徴とするデータベース整合性チェック方法。
A database integrity check method for checking the integrity of a database,
Lock resource management means for performing exclusive control so that other processes do not access the data in the database while a process in the data in the database of the access and consistency check is accessing ; and database processing means And a database consistency check means ,
When the database processing means acquires an exclusive lock from the lock resource management means, a database processing step for performing update processing or reference processing of the database;
The database consistency check means checks the consistency of data in the database without making an exclusive lock request to the lock resource management means, and determines that there is inconsistency up to a preset number of times. If the consistency of the database is checked again and there is inconsistency even if the preset number of times is reached, an exclusive lock is requested to the lock resource management means, and an exclusive lock is acquired. The check target section of the database is copied to the cache, the exclusive lock release request is output to the lock resource management means, the consistency in the cache is checked, the consistency result is output, and the exclusive lock is acquired. If not, a database integrity check step that re-requests an exclusive lock;
A database consistency check method characterized by:
前記ロック資源管理手段において、
前記データベースの排他制御の対象となるデータ区間が、前記データベース処理ステップと前記データベース整合性チェックステップとで競合する場合には、先に受け付けた方の排他ロック要求を優先する
請求項3記載のデータベース整合性チェック方法。
In the lock resource management means,
4. The database according to claim 3, wherein when a data section subject to exclusive control of the database competes between the database processing step and the database consistency check step, the exclusive lock request received earlier is given priority. Consistency check method.
請求項1または2に記載のデータベース整合性チェック装置を構成する各手段としてコンピュータを機能させるためのデータベース整合性チェックプログラム。   A database consistency check program for causing a computer to function as each means constituting the database consistency check device according to claim 1. 請求項5記載のデータベース整合性チェックプログラムを格納したことを特徴とするコンピュータ読み取り可能な記録媒体。   A computer-readable recording medium storing the database consistency check program according to claim 5.
JP2008163767A 2008-06-23 2008-06-23 Database consistency check device and method, program, and computer-readable recording medium Active JP5224928B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008163767A JP5224928B2 (en) 2008-06-23 2008-06-23 Database consistency check device and method, program, and computer-readable recording medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008163767A JP5224928B2 (en) 2008-06-23 2008-06-23 Database consistency check device and method, program, and computer-readable recording medium

Publications (2)

Publication Number Publication Date
JP2010003265A JP2010003265A (en) 2010-01-07
JP5224928B2 true JP5224928B2 (en) 2013-07-03

Family

ID=41584907

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008163767A Active JP5224928B2 (en) 2008-06-23 2008-06-23 Database consistency check device and method, program, and computer-readable recording medium

Country Status (1)

Country Link
JP (1) JP5224928B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6245700B2 (en) * 2014-04-11 2017-12-13 国立大学法人 東京大学 Computer system, data inspection method and computer
US9847000B2 (en) 2015-10-29 2017-12-19 Immersion Corporation Ambient triggered notifications for rendering haptic effects

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5372428A (en) * 1976-12-10 1978-06-27 Hitachi Ltd Data renewal system
JP3222125B2 (en) * 1990-01-29 2001-10-22 株式会社日立製作所 Database sharing method between systems
JPH08249222A (en) * 1995-03-14 1996-09-27 Nippon Telegr & Teleph Corp <Ntt> Method and device for checking data base consistency
JP2001142765A (en) * 1999-11-17 2001-05-25 Nec Corp Method and device for examining compatibility in data base and recording medium
JP3884049B1 (en) * 2005-08-17 2007-02-21 インターナショナル・ビジネス・マシーンズ・コーポレーション System, determination method and program

Also Published As

Publication number Publication date
JP2010003265A (en) 2010-01-07

Similar Documents

Publication Publication Date Title
JP4738413B2 (en) Method and system for migrating source data to target data
US9208090B2 (en) Transactional memory proxy
US20090094478A1 (en) Recovery of application faults in a mirrored application environment
JP2010539609A (en) Parallel nested transactions in transactional memory
JP5012628B2 (en) Memory database, memory database system, and memory database update method
US20120150811A1 (en) Flash-copying within asynchronous mirroring environment
CN111797172B (en) Data migration method, device, equipment, distributed system and storage medium
CN111813792A (en) Method and equipment for updating cache data in distributed cache system
CN110675255A (en) Method and apparatus for concurrently executing transactions in a blockchain
JP2004334434A (en) Storage device system with two-way copying control function
CN110807062A (en) Data synchronization method and device and database host
JP2007018407A (en) Data replication system
US20060085672A1 (en) Method and program for creating determinate backup data in a database backup system
JP5224928B2 (en) Database consistency check device and method, program, and computer-readable recording medium
US8234243B2 (en) Third tier transactional commit for asynchronous replication
CN113056734A (en) System and method for managing shared database
US10303676B2 (en) Transaction processing apparatus, transaction processing method, and computer-readable recording medium
US8086580B2 (en) Handling access requests to a page while copying an updated page of data to storage
EP3183675B1 (en) Systems and methods for highly-available file storage with fast online recovery
CN113254536A (en) Database transaction processing method, system, electronic device and storage medium
US7490327B1 (en) System and method for programmatic distributed transaction commit prioritization mechanism
CN110689344B (en) Method and apparatus for concurrently executing transactions in a blockchain
CN113704026B (en) Distributed financial memory database security synchronization method, device and medium
US9323476B2 (en) Hardware based cache scan with divert node handling
CN103001995B (en) The method and apparatus of cache coherence is improved in cluster file system

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20100817

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20120712

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20120724

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20120924

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20121113

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20121217

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20130305

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20130312

R150 Certificate of patent or registration of utility model

Ref document number: 5224928

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20160322

Year of fee payment: 3

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350