JP3845535B2 - Database system - Google Patents

Database system Download PDF

Info

Publication number
JP3845535B2
JP3845535B2 JP35155999A JP35155999A JP3845535B2 JP 3845535 B2 JP3845535 B2 JP 3845535B2 JP 35155999 A JP35155999 A JP 35155999A JP 35155999 A JP35155999 A JP 35155999A JP 3845535 B2 JP3845535 B2 JP 3845535B2
Authority
JP
Japan
Prior art keywords
database
station
data
change
transaction
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.)
Expired - Fee Related
Application number
JP35155999A
Other languages
Japanese (ja)
Other versions
JP2001166976A (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.)
Toshiba Corp
Original Assignee
Toshiba 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 Toshiba Corp filed Critical Toshiba Corp
Priority to JP35155999A priority Critical patent/JP3845535B2/en
Publication of JP2001166976A publication Critical patent/JP2001166976A/en
Application granted granted Critical
Publication of JP3845535B2 publication Critical patent/JP3845535B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

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

Description

【0001】
【発明の属する技術分野】
この発明は、複数のデータベースの内容に係るデータを一致させて運用を行う、例えば、ライトバック方式等のデータベースシステムに関する。
【0002】
【従来の技術】
従来、複数のデータベースが存在し、その間で同一のデータを保持する場合には、レプリケーション機能を用いて、テーブル間の同期をとるのが一般的である。図12には、2つのデータベースA,Bが存在する場合に、テーブル間の同期をとる際の処理手順が示されている。即ち、データベースA,Bが、通信回線100により接続されている。2つのデータベースA,Bは双方向からの更新が可能なレプリケーションとして定義されており、データベースAにおける更新はデータベースBへ伝播されて反映され、データベースBにおける更新はデータベースAへ播されて反映され、双方のテーブルの同期がとられる。
【0003】
このとき、同期をとるための動作を説明する。まず、図12の▲1▼に示される処理において、データベースAのテーブル003に対して更新がなされる。このときには、図5に示されるようなトランザクションが用いられる。
【0004】
次に、図12の▲2▼に示される処理において、データベースAのテーブル003に対する更新に使用したトランザクションを、データベースAに設定されているトランザクションのキューに保存する。
【0005】
一方、(1)に示す処理において、データベースBのテーブル002に対する更新が行われる。図6には、このときのトランザクションの例が示されている。更に、(2)に示す処理において、上記データベースBのテーブル002の更新に使用されたトランザクションは、データベースBに設定されているトランザクションのキューに保存される。
【0006】
以上の結果、それぞれのデータベースA,B上のテーブル002、003には、それぞれのデータベースで更新されたデータの差異が発生している。そこで、以下の様に伝播を行う必要がある。まず、▲3▼と(3)とにそれぞれ示されている処理において、トランザクションキューに保存されているトランザクションを、あるタイミングで相対するデータベースに対して実行し、テーブル間のデータの差異をなくする。
【0007】
データベースA,Bのトランザクションキューに保存されているトランザクションは、一般的に、なるべく正確なデータを参照したい要求に応じたタイミングで実行されるか、一定時間毎のタイミングで実行される。
【0008】
【発明が解決しようとする課題】
しかしながら、トランザクションキューに格納されているトランザクションの内容は、それが実行されない限り、どのテーブルのどのデータを更新しているかは不明である。つまり、データベースに対する参照の際に、参照しょうとしているデータが最新なのか、最新のデータと差分があるのか判らない。従って、最新のデータを参照しようとして伝播処理が完了するのを待っても、参照しようとするデータとは無関係なデータの伝播処理がなされる可能性があり、この伝播処理の完了を待ってアクセスするのは、効率的でない。
【0009】
例えば、図13に示されるように、▲1▼にて、データベースAのテーブル003に対して更新がなされ、▲2▼に示される処理において、データベースAのテーブル003に対する更新に使用したトランザクションを、データベースAに設定されているトランザクションのキューに保存する。このとき、▲3▼に示される処理においてデータベースBのテーブル002に対し参照要求が生じた場合、データベースAに設定されているトランザクションキューに格納されているトランザクションの伝播が▲4▼に示されるようになされた後に、▲5▼に示される参照を行っても、▲4▼で行う伝播処理はデータベースBのテーブル003に対する更新であり、参照するデータベースBのテーブル002に対する更新でないことから、無駄な処理待ちがなされたことになる。
【0010】
また、一定時間毎にトランザクションの伝播が実行される場合においては、待ち時間を要せぬものの、現在参照しているデータが最新のデータでない可能性があり、いつの時点のデータに対してアクセスしたかが不明確であるという問題があった。また、データベースA,Bで同時に同一テーブルの同一データに対し、異なる値への書き換えを実行した場合、伝播処理の競合が発生し、どちらかのデータを切り捨てる必要があり、データベースA,Bで適切なデータの更新が行われない事態が発生する。
【0011】
本発明は、このような問題点を解決せんとしてなされたもので、その目的は、常に最新のデータにアクセスできると共に、参照しようとするデータに差分が無い場合は伝播を実行せずにデータにアクセスできるデータベースシステムを提供することである。また、他の目的は、伝播処理の競合がを発生することなく、複数のデータベース間において適切にデータの同一性を確保することができるデータベースシステムを提供することである。
【0012】
【課題を解決するための手段】
本発明に係るデータベースシステムは、2つ以上の局が通信回路を介して結合されているデータベースシステムにおいて、各局は、複数のレコードにより構成されるテーブルを複数備えるデータベースと、前記レコード毎に設けられ、他局のデータベースにおいてデータ更新が行われた場合に当該レコードのデータに変更を行った他局の識別情報が記憶される記憶領域と、トランザクションに基づいて、自局のデータベースにおけるデータの更新を実行する変更手段と、この変更手段により変更が行われた場合に、他局のデータベースに対し、該当テーブルの該当レコードに設けられた記憶領域に自局の識別情報をセットする識別情報制御手段と、前記変更手段で用いられたトランザクションが蓄積されるトランザクションキューと、自局のデータベースに対して参照要求または変更要求があると、前記要求に係る範囲に対応するレコードにおける記憶領域を参照して他局の識別情報がセットされているか否かに基づき他局において変更がなされたか否かを検出する検出手段と、前記検出手段が他局において変更がなされたことを検出すると、該当他局のトランザクションキューから該当トランザクションを伝播して該当他局のデータベースの更新を自局データベースへ反映させると共に、対応する記憶領域にセットされている他局の識別情報を消去するデータ一致化手段と、自局のデータベースに対して参照要求があった場合に、前記検出手段により変更なしと判定されると直ちに自局のデータベースを参照し参照結果を参照要求元へ返送する、一方、前記検出手段により他局において変更がなされたことの検出がなされると前記データ一致化手段による反映処理の後に自局のデータベースを参照し参照結果を参照要求元へ返送するデータ返送手段とを具備することを特徴とする。
【0013】
また本発明に係るデータベースシステムは、検出手段は、自局のデータベースに対する変更要求を受けた場合にも、要求に係る範囲に対応するレコードにおける記憶領域を参照して他局において変更がなされたか否かを検出し、データ一致化手段は、上記検出手段により他局において変更がなされたことが検出された場合にも、該当他局のトランザクションキューから該当トランザクションを伝播して該当他局のデータベースの更新を自局データベースへ反映させ、変更手段は、自局のデータベースに対して変更要求があった場合に、前記検出手段により変更なしと判定されると直ちに自局のデータベースにおけるデータの更新を行う一方、前記検出手段により他局において変更がなされたことの検出がなされると上記データ一致化手段による反映処理の後に自局のデータベースにおけるデータの更新を行うことを特徴とする。
【0015】
【発明の実施の形態】
以下添付図面を参照して本発明に係るデータベースシステムの実施の形態を説明する。各図において同一の構成要素には、同一の符号を付して重複する説明を省略する。図1には、本発明に係るデータベースシステムの実施の形態の説明図が示されている。このシステムは、通信回線100を介して、図の上側に示される第1の局と図の下側に示される第2の局とが結合されている。
【0016】
上記2つの局におけるシステムの構成を図2に示す。この図2に示されるように、各局はワークステーション、パーソナルコンピュータ、その他の計算機として構築される。すなわち、図2の計算機は、装置を統括制御するCPU51を有し、このCPU51には上記CPU51が用いるプログラム及びデータ等の情報が記憶される主記憶装置52が接続されている。更に、CPU51にはシステムバス53を介して入力装置制御部54、通信インタフェース55、記憶装置制御部56が接続されている。キーボード制御部54には各種情報をキー入力可能なキーボード入力装置やポインティングディバイスであるマウス、磁気カード或いはICカードリーダ等の入力装置57が接続され、通信インタフェース55には通信回線100を介して通信を行うための通信処理部58が接続され、記憶装置制御部56には補助記憶装置である磁気ディスク装置、フロッピーディスクドライブ、MO(光磁気ディスク)ドライブ等による記憶装置59が接続されている。なお、表示装置及びその制御部等が必要に応じて設けられる。
【0017】
上記記憶装置59は、データベースA,Bとして機能する構成であり、「001」、「002」、「003」にて示されるテーブルが設けられている。ここでは、3つのテーブルであるが、この数に限られないのは当然である。各テーブルは、いくつかのレコードに分けられており、各レコードは図3に示されるように構成される。先頭にデータベースにて管理する行番号であるROWIDがセットされ、次に他局のデータベースにおいてデータの変更が生じた場合に、そのデータベース名(識別情報)を書き込むためのDartyBitが用意されている。複数の他局のデータベースにてデータの変更が生じた場合に、DartyBitには、それらのデータベース名が書き込まれる。
【0018】
上記DartyBitに次いで、ユーザに開放されたデータ領域で、主キー項目がセットされるKEYの領域が設けられ、このKEYの領域以降には、ユーザに開放されたデータ領域COLUMN001〜(図では、003までを示すが、これに限られない。)が設けられている。上記において、データの変更は、既にあるデータの更新と、新規なデータの挿入(追加)を含む概念である。従って、データの更新の場合には、データ領域COLUMN001〜にはデータが既に格納されているが、新規なデータの挿入の場合に、データ領域COLUMN001〜には有意なデータが未だ格納されておらず、図4に示すように「NULL」となっている。
【0019】
図1に示すように、データベースA,Bの内容の一致化を図るために、他のデータベースのデータを変更するためのトランザクションを蓄積するキュー10(10−A,10−B)が、主記憶装置52に設けられる。キュー10−Aは、データベースAでテーブル002、003等に対して、更新トランザクション、挿入トランザクションが発生した場合に、当該トランザクションを相手データベースに伝播するために格納するキューであり、キュー10−Bは、データベースBでテーブル002,003等に対して、更新トランザクション、挿入トランザクションが発生した場合に、当該トランザクションを相手データベースに伝播するために格納するキューである。ここにセットされるトランザクションは、図5〜図7に示すようである。図5には、テーブル003に対するデータ更新に用いられるトランザクションの例が示され、図6には、テーブル002に対するデータ更新に用いられるトランザクションの例が示され、図7には、テーブル003に対するデータ挿入に用いられるトランザクションの例が示されている。
【0020】
データベースA,Bを有するそれぞれの局の主記憶装置52には、図8に示されるフローチャートに対応するプログラムが備えられており、このプログラムを実行してデータベースA,Bにおけるテーブル003のデータの一致化がなされるので、これを説明する。この例は、キュー10−Aに格納のトランザクションが伝播される以前のテーブル003におけるデータに対し、検索が発生した場合を示すものである。
【0021】
図1の▲1▼に示される処理において、データベースAにおいてテーブル003に対してデータの更新がなされる(図8のS1(変更手段))。次に、図1の▲2▼に示される処理において、データベースBのテーブル003に対して、上記更新されたレコードについてDartyBit領域に当該データベース名「A」を書き込む(図8のS2(識別情報制御手段))。このとき対応のレコードには、図3に示されるように、DartyBitの領域に更新されたデータベース名である「A」が設定される。次に図1の▲3▼に示される処理において、更新に使用したトランザクションはデータベースAに設定されているトランザクションキュー10−Aに保存される(図8のS3(変更制御手段によるデータ一致化手段への要求セット))。
【0022】
次に、図1の(○4)に示される処理において、データベースBのテーブル003に対して参照のトランザクションが発生したとする(図8のS4)。この場合、参照範囲のレコードのDartyBit領域を検索して、更新されたデータベース名が存在するか否かを検出する(図8のS5(検出手段))。ここで更新されたデータベース名が存在すれば、このデータを伝播により更新する必要があるので、図1の(○5)に示すように、データベースAのトランザクションキュー10−Aの内容に係るトランザクションを伝播させる(図8のS6(データ一致化手段))。これにより、データベースAにおけるデータの更新がデータベースBに反映される。次に、上記の伝播に応じたデータの反映によりDartyBit領域の対応するデータベース名が消去され(図8のS7(識別情報制御手段))、図1の(○6)に示される処理において、上記で反映された最新のデータを参照結果として戻す(図8のS8(データ返送手段))。
【0023】
図9には、キュー10−Aに格納のトランザクションが伝播される以前のデータに対して、更新が発生した場合に処理が示されている。この場合に対応して、データベースA,Bを有するそれぞれの局の主記憶装置52には、図10に示されるフローチャートに対応するプログラムが備えられており、このプログラムを実行してデータベースA,Bにおけるテーブル003のデータの一致化がなされるので、これを説明する。
【0024】
図9の▲1▼に示される処理において、データベースAにおいてテーブル003に対してデータの更新がなされる(図10のS11(変更手段))。次に、図9の▲2▼に示される処理において、データベースBのテーブル003に対して、上記更新されたレコードについてDartyBit領域に当該データベース名「A」を書き込む(図10のS12(識別情報制御手段))。このとき対応のレコードには、図3に示されるように、DartyBitの領域に更新されたデータベース名である「A」が設定される。次に図9の▲3▼に示される処理において、更新に使用したトランザクションはデータベースAに設定されているトランザクションキュー10−Aに保存される(図10のS13(変更制御手段によるデータ一致化手段への要求セット))。
【0025】
次に図9の(○4)に示される処理において、データベースBのテーブル003に対して更新のトランザクションが発生したとする(図10のS14)。この場合、更新範囲のレコードのDartyBit領域を検索して、更新されたデータベース名が存在するか否かを検出する(図10のS15(検出手段))。ここで更新されたデータベース名が存在すれば、このデータは伝播により更新する必要があるので、図9の(○5)に示すように、データベースBのテーブル003への更新のトランザクションが待機とされる(変更制御手段)。
【0026】
この間に、図9の▲6▼に示すように、データベースAのトランザクションキュー10−Aの内容に係るトランザクションを伝播させる(図10のS16(データ一致化手段))。これにより、データベースAにおけるデータの更新がデータベースBに反映される。次に、上記の伝播に応じたデータの反映によりDartyBit領域の対応するデータベース名が消去される(図10のS17(識別情報制御手段))。
【0027】
このように伝播によりDartyBit領域の対応するデータベース名が消去され、図9の▲7▼に示される処理において、図9の▲5▼にて待機させられていたデータベースBのテーブル003への更新のトランザクションが実行される(図10のS18(変更手段、変更制御手段))。次に図9の▲8▼に示される処理において、データベースBのテーブル003に対して、更新されたレコードについてDartyBit領域に当該データベース名「B」を書き込む(図10のS19(識別情報制御手段))。次に図9の▲9▼に示される処理において、更新に使用したトランザクションはデータベースBに設定されているトランザクションキュー10−Bに保存される(図10のS20(変更制御手段))。
【0028】
尚、データベースのデータ変更には、前述の通り更新以外に挿入(トランザクションがINSERTの場合)がある。図7にトランザクションがINSERT文であるトランザクションを示す。このように、トランザクションがINSERT文のときには、相手側のデータベースにDartyBitを設定すべきレコードが存在しない場合が考えられる。係る場合は、相手側のデータベースに、KEYの領域に主キーの値のみ設定したレコードを挿入して、DartyBit領域に当該トランザクションに係るデータベース名を設定する。斯して挿入されたレコードには、図3に示されるようにDartyBit領域にデータベース名「A」が設定される。
【0029】
以上の実施の形態に示した如く、データベースの参照範囲(レコード)のDartyBitに変更を行ったデータベース名が存在しなければ、参照するデータが最新であることが保証され、図8のステップS5や図10のステップS15にてNOへ分岐するので、参照に前置して不要な伝播処理は実行されずに、最新のデータのアクセスがなされる。これとは逆に、データベースの参照範囲(レコード)のDartyBitに変更を行ったデータベース名が存在するときには、参照に前置して伝播処理が実行されテーブルの同期が取られてから参照される為、常に最新のデータへのアクセスが確保される。更に、データベースの変更の場合に、変更範囲(レコード)のDartyBitに変更を行ったデータベース名が存在するときには、変更に前置して伝播処理が実行されテーブルの同期が取られてから参照される為、競合の場合に適切な順による処理が確保されると共に、常に最新のデータに対しての変更がなされる。
【0030】
本発明は、3局以上のデータベースに対してレプリケーションが定義されている場合にも適用できる。図11は、本発明による3局のデータベースA,B,Cのレプリケーション構成を示したものである。この例では、図11の▲1▼に示される処理において、データベースAのテーブル003に対してデータ更新がなされる。次いで、同図の▲2▼に示される処理において、データベースBのテーブル003に対して、上記で更新されたレコードについてDartyBitにデータベース名「A」を書き込む。このとき同時に図11の▲3▼に示される処理において、データベースCのテーブル003に対しても、上記で更新されたレコードについてDartyBitにデータベース名「A」を書き込む。
【0031】
更に、図11の▲4▼に示される処理において、更新に使用したトランザクションをデータベースAに設定されているトランザクションキュー10−Aに保存される。上記で、DartyBitに設定される識別情報は、どのデータベースで更新が発生したか判別できるようにデータベース名(サイト名)が含まれる為、データベースB,Cにおいてテーブル003のにアクセスすると、DartyBit領域に識別情報がセットされているレコードである場合に、該当のデータベース名(サイト名)対応のトランザクションが存在するデータベースのトランザクションキューからのみ伝播を実行させることが可能であり効率的である。
【0032】
【発明の効果】
以上説明したように本発明に係るデータベースシステムによれば、自局のデータベースに対して参照要求があると、他局のデータベースに設けられている他局にて変更がなされたか否かを示す識別情報に基づき、他局にて変更がなされたか否かを検出し、他局にて変更がなされている場合には、データの一致化を待って、データベースの参照を行い、参照結果を参照要求元へ返送する処理を行うので、最新のデータの参照が確保される効果がある。
【0033】
また本発明に係るデータベースシステムによれば、自局のデータベースの内容に係るデータの変更要求を受け取ると、識別情報に基づき、他局にて変更がなされたか否かを検出し、他局にて変更がなされている場合には、他局における変更を受けたデータの一致化を待って、データの変更を行うので、競合の場合に適切な順による処理が確保されると共に、常に最新のデータに対しての変更がなされる効果がある。
【図面の簡単な説明】
【図1】本発明に係るデータベースシステムによるデータ参照の際におけるレプリケーション動作を示す図。
【図2】本発明に係るデータベースシステムにおける1局の具体的構成例を示すブロック図。
【図3】本発明に係るデータベースシステムにおけるデータベースのレコード構成を示す図。
【図4】本発明に係るデータベースシステムにおける挿入トランザクションの場合に対応したデータベースのレコード内容を示す図。
【図5】本発明に係るデータベースシステムにおけるテーブル003の更新トランザクション例を示す図。
【図6】本発明に係るデータベースシステムにおけるテーブル002の更新トランザクション例を示す図。
【図7】本発明に係るデータベースシステムにおけるテーブル003の挿入トランザクション例を示す図。
【図8】本発明に係るデータベースシステムにおける参照トランザクションの場合の処理を説明するためのフローチャート。
【図9】本発明に係るデータベースシステムによるデータ更新の際におけるレプリケーション動作を示す図。
【図10】本発明に係るデータベースシステムにおける更新トランザクションの場合の処理を説明するためのフローチャート。
【図11】本発明に係る3つのデータベースにより構成したベースシステムにおけるレプリケーション動作を示す図。
【図12】従来例に係るデータベースシステムによるレプリケーション動作を示す図。
【図13】従来例に係るデータベースシステムによるレプリケーション動作における処理の無駄を示す図。
【符号の説明】
A,B,C データベース
10−A,10−B,10−C トランザクションキュー
51 CPU
52 主記憶装置
54 入力装置制御部
55 通信インタフェース
56 記憶装置制御部
57 入力装置
58 通信処理部
59 記憶装置
100 通信回線
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a database system, for example, a write-back method, which operates by matching data related to the contents of a plurality of databases.
[0002]
[Prior art]
Conventionally, when a plurality of databases exist and the same data is held between them, it is common to synchronize between tables using a replication function. FIG. 12 shows a processing procedure for synchronizing tables when two databases A and B exist. That is, the databases A and B are connected by the communication line 100. The two databases A and B are defined as replications that can be updated from both directions. Updates in the database A are propagated and reflected in the database B, updates in the database B are propagated and reflected in the database A, Both tables are synchronized.
[0003]
At this time, an operation for synchronization will be described. First, in the process indicated by (1) in FIG. 12, the table 003 of the database A is updated. At this time, a transaction as shown in FIG. 5 is used.
[0004]
Next, in the process indicated by (2) in FIG. 12, the transaction used for updating the table 003 of the database A is stored in the transaction queue set in the database A.
[0005]
On the other hand, in the process shown in (1), the table 002 of the database B is updated. FIG. 6 shows an example of the transaction at this time. Further, in the processing shown in (2), the transaction used for updating the table 002 of the database B is stored in a transaction queue set in the database B.
[0006]
As a result, there is a difference between the data updated in the respective databases in the tables 002 and 003 on the respective databases A and B. Therefore, it is necessary to propagate as follows. First, in the processes shown in (3) and (3), transactions stored in the transaction queue are executed against the opposing database at a certain timing to eliminate the data difference between the tables. .
[0007]
Transactions stored in the transaction queues of the databases A and B are generally executed at a timing corresponding to a request for referring to as accurate data as possible, or at a fixed time interval.
[0008]
[Problems to be solved by the invention]
However, the content of the transaction stored in the transaction queue is unknown as to which data in which table is updated unless it is executed. That is, when referring to a database, it is not known whether the data to be referred to is the latest or whether there is a difference from the latest data. Therefore, even if it waits for the propagation process to be completed while trying to refer to the latest data, the data may be propagated regardless of the data to be referenced. It is not efficient to do.
[0009]
For example, as shown in FIG. 13, the table 003 of the database A is updated in (1), and the transaction used for updating the table 003 of the database A in the process shown in (2) is Save in the transaction queue set in database A. At this time, when a reference request is made to the table 002 of the database B in the process shown in (3), the propagation of the transaction stored in the transaction queue set in the database A is shown in (4). Even if the reference shown in (5) is performed, the propagation process performed in (4) is an update to the table 003 of the database B, and is not an update to the table 002 of the database B to be referenced. Waiting for processing has been made.
[0010]
In addition, when transaction propagation is executed at regular intervals, there is a possibility that the currently referenced data may not be the latest data, although the waiting time is not required. There was a problem that it was unclear. In addition, if the same data in the same table in the databases A and B is rewritten to a different value at the same time, a propagation process conflict occurs, and one of the data needs to be discarded. A situation occurs in which the data is not updated.
[0011]
The present invention has been made as a solution to such problems, and its purpose is to always access the latest data, and when there is no difference in the data to be referenced, the data is transmitted without executing propagation. To provide an accessible database system. Another object of the present invention is to provide a database system that can appropriately ensure the identity of data among a plurality of databases without causing a competition of propagation processing.
[0012]
[Means for Solving the Problems]
The database system according to the present invention is a database system in which two or more stations are connected via a communication circuit. Each station is provided with a database including a plurality of tables each including a plurality of records, and for each record. When the data is updated in the database of the other station, the data in the database of the own station is updated based on the storage area in which the identification information of the other station that has changed the data of the record is stored and the transaction. Change means to be executed, and identification information control means for setting the identification information of the own station in the storage area provided in the corresponding record of the corresponding table with respect to the database of the other station when the change is made by the change means , A transaction queue in which the transaction used in the changing means is accumulated, and the local station Reference request or if there is a change request to database, or changes in other stations based refers to the storage area in the record corresponding to the range according to the request whether the identification information of the other station is set is made Detecting means for detecting whether or not, and when the detecting means detects that a change has been made in the other station, the relevant transaction is propagated from the transaction queue of the relevant other station and the database of the relevant other station is updated to the local station database. and applied at both the data match means for erasing the identification information of other stations that are set in the corresponding storage area, when a reference request to the database of the station, and no change by the detector As soon as the determination is made, the database of the local station is referred to and the reference result is returned to the reference request source. And a data return means for referring to the local database and returning the reference result to the reference request source after the reflection process by the data matching means when it is detected that the change has been made. .
[0013]
Further, in the database system according to the present invention, even when the detecting means receives a change request for the database of the own station, whether or not the change is made in the other station with reference to the storage area in the record corresponding to the range related to the request. Even if it is detected by the detecting means that the change has been made in the other station, the data matching means propagates the relevant transaction from the transaction queue of the relevant other station and stores the data in the database of the relevant other station. The update is reflected in the own station database, and when there is a change request for the own station database, the changing means updates the data in the own station database as soon as it is determined that there is no change by the detecting means. On the other hand, when the detection means detects that a change has been made in another station, the data matching means And wherein the updating the data in the database of the local station after the reflection processing.
[0015]
DETAILED DESCRIPTION OF THE INVENTION
Embodiments of a database system according to the present invention will be described below with reference to the accompanying drawings. In the drawings, the same components are denoted by the same reference numerals and redundant description is omitted. FIG. 1 shows an explanatory diagram of an embodiment of a database system according to the present invention. In this system, a first station shown on the upper side of the figure and a second station shown on the lower side of the figure are coupled via a communication line 100.
[0016]
FIG. 2 shows the system configuration of the two stations. As shown in FIG. 2, each station is constructed as a workstation, personal computer, or other computer. That is, the computer shown in FIG. 2 has a CPU 51 that performs overall control of the apparatus, and a main storage device 52 that stores information such as programs and data used by the CPU 51 is connected to the CPU 51. Furthermore, an input device control unit 54, a communication interface 55, and a storage device control unit 56 are connected to the CPU 51 via a system bus 53. The keyboard controller 54 is connected to a keyboard input device capable of inputting various information and an input device 57 such as a mouse, magnetic card or IC card reader as a pointing device, and communicates via the communication line 100 to the communication interface 55. A communication processing unit 58 is connected to the storage device control unit 56, and a storage device 59 such as a magnetic disk device, floppy disk drive, or MO (magneto-optical disk) drive, which is an auxiliary storage device, is connected to the storage device control unit 56. A display device and its control unit are provided as necessary.
[0017]
The storage device 59 functions as the databases A and B, and is provided with tables indicated by “001”, “002”, and “003”. Here, there are three tables, but the number is naturally not limited to this. Each table is divided into several records, and each record is configured as shown in FIG. A ROWID, which is a row number managed in the database, is set at the top, and when data is changed in the database of another station, a DartyBit for writing the database name (identification information) is prepared. When data changes occur in a plurality of other station databases, their database names are written in DartyBit.
[0018]
Following the above-mentioned DartyBit, a KEY area in which a primary key item is set is provided in a data area released to the user, and after this KEY area, a data area COLUMN001 to 003 (003 in the figure) opened to the user. However, the present invention is not limited to this.). In the above description, data change is a concept including updating existing data and inserting (adding) new data. Therefore, in the case of data update, data is already stored in the data area COLUMN001, but in the case of insertion of new data, no significant data is yet stored in the data area COLUMN001. As shown in FIG. 4, “NULL” is set.
[0019]
As shown in FIG. 1, in order to match the contents of the databases A and B, a queue 10 (10-A, 10-B) that accumulates transactions for changing data in other databases is a main memory. Provided in the device 52. The queue 10-A is a queue that is stored in order to propagate the transaction to the partner database when an update transaction or an insertion transaction occurs in the database A with respect to the tables 002, 003, etc., and the queue 10-B In the database B, when an update transaction or an insertion transaction occurs for the table 002, 003, etc., the queue is stored to propagate the transaction to the partner database. The transactions set here are as shown in FIGS. FIG. 5 shows an example of a transaction used for data update on the table 003, FIG. 6 shows an example of a transaction used for data update on the table 002, and FIG. 7 shows data insertion on the table 003. An example of a transaction used in is shown.
[0020]
The main storage device 52 of each station having the databases A and B is provided with a program corresponding to the flowchart shown in FIG. 8, and this program is executed to match the data in the table 003 in the databases A and B. This will be explained. This example shows a case where a search has occurred for data in the table 003 before a transaction stored in the queue 10-A is propagated.
[0021]
In the process indicated by (1) in FIG. 1, data is updated to the table 003 in the database A (S1 (change means) in FIG. 8). Next, in the process indicated by (2) in FIG. 1, the database name “A” is written in the DartyBit area for the updated record in the table 003 of the database B (S2 in FIG. 8 (identification information control). means)). In the corresponding record at this time, as shown in FIG. 3, “A”, which is the updated database name, is set in the DartyBit area. Next, in the process indicated by (3) in FIG. 1, the transaction used for the update is stored in the transaction queue 10-A set in the database A (S3 in FIG. 8 (data matching means by change control means). Request set to)).
[0022]
Next, in the process indicated by (◯ 4) in FIG. 1, it is assumed that a reference transaction occurs for the table 003 in the database B (S4 in FIG. 8). In this case, the DartyBit area of the reference range record is searched to detect whether or not the updated database name exists (S5 (detection means) in FIG. 8). If the updated database name exists, this data needs to be updated by propagation. Therefore, as shown in FIG. 1 (○ 5), the transaction related to the contents of the transaction queue 10-A of the database A is processed. Propagate (S6 (data matching means) in FIG. 8). Thereby, the data update in the database A is reflected in the database B. Next, the corresponding database name in the DartyBit area is erased by reflecting the data according to the above propagation (S7 (identification information control means) in FIG. 8), and in the process shown in (◯ 6) in FIG. The latest data reflected in step S8 is returned as a reference result (S8 (data return means) in FIG. 8).
[0023]
FIG. 9 shows processing when data is updated before data stored in the queue 10-A is propagated. Corresponding to this case, the main storage device 52 of each station having the databases A and B is provided with a program corresponding to the flowchart shown in FIG. Since the data in the table 003 is matched, this will be described.
[0024]
In the process indicated by (1) in FIG. 9, data is updated to the table 003 in the database A (S11 (changing means) in FIG. 10). Next, in the process indicated by (2) in FIG. 9, the database name “A” is written in the DartyBit area for the updated record in the table 003 of the database B (S12 (identification information control in FIG. 10). means)). In the corresponding record at this time, as shown in FIG. 3, “A”, which is the updated database name, is set in the DartyBit area. Next, in the process indicated by (3) in FIG. 9, the transaction used for the update is stored in the transaction queue 10-A set in the database A (S13 in FIG. 10 (data matching means by the change control means). Request set to)).
[0025]
Next, in the process indicated by (◯ 4) in FIG. 9, it is assumed that an update transaction has occurred for the table 003 of the database B (S14 in FIG. 10). In this case, the DartyBit area of the record in the update range is searched to detect whether or not the updated database name exists (S15 (detection means) in FIG. 10). If there is an updated database name here, this data needs to be updated by propagation. Therefore, as shown in (○ 5) of FIG. 9, an update transaction to the table 003 of the database B is waited. (Change control means).
[0026]
During this time, as shown in (6) of FIG. 9, the transaction related to the contents of the transaction queue 10-A of the database A is propagated (S16 (data matching means) of FIG. 10). Thereby, the data update in the database A is reflected in the database B. Next, the corresponding database name in the DartyBit area is deleted by reflecting the data according to the propagation (S17 (identification information control means) in FIG. 10).
[0027]
As a result of the propagation, the corresponding database name in the DartyBit area is deleted, and in the process shown in (7) of FIG. 9, the update to the table 003 of the database B that was kept waiting in (5) of FIG. A transaction is executed (S18 in FIG. 10 (change means, change control means)). Next, in the process indicated by (8) in FIG. 9, the database name “B” is written in the DartyBit area for the updated record in the table 003 of the database B (S19 (identification information control means) in FIG. 10). ). Next, in the process indicated by (9) in FIG. 9, the transaction used for the update is stored in the transaction queue 10-B set in the database B (S20 (change control means) in FIG. 10).
[0028]
Note that the database data change includes insertion (in the case where the transaction is INSERT) in addition to the update as described above. FIG. 7 shows a transaction in which the transaction is an INSERT statement. As described above, when the transaction is an INSERT statement, there may be a case where there is no record in the partner database where DartyBit should be set. In such a case, a record in which only the primary key value is set in the KEY area is inserted into the counterpart database, and the database name related to the transaction is set in the DartyBit area. In the thus inserted record, the database name “A” is set in the DartyBit area as shown in FIG.
[0029]
As shown in the above embodiment, if there is no changed database name in the DartyBit of the reference range (record) of the database, it is guaranteed that the data to be referred to is the latest, and step S5 in FIG. Since the process branches to NO in step S15 in FIG. 10, the latest data is accessed without performing unnecessary propagation processing before the reference. On the other hand, when there is a changed database name in the DartyBit of the reference range (record) of the database, it is referenced after the propagation process is executed in front of the reference and the table is synchronized. , Always ensure access to the latest data. Furthermore, in the case of a database change, if there is a database name that has been changed in the DartyBit of the change range (record), it is referenced after the propagation process is executed in advance of the change and the table is synchronized. Therefore, in the case of a conflict, processing in an appropriate order is ensured, and the latest data is always changed.
[0030]
The present invention can also be applied when replication is defined for a database of three or more stations. FIG. 11 shows a replication configuration of databases A, B, and C of three stations according to the present invention. In this example, the data update is performed on the table 003 of the database A in the process indicated by (1) in FIG. Next, in the process indicated by (2) in the figure, the database name “A” is written to DartyBit for the record updated above in the table 003 of the database B. At the same time, in the process indicated by (3) in FIG. 11, the database name “A” is written into DartyBit for the updated record in the table 003 of the database C as well.
[0031]
Further, in the process indicated by (4) in FIG. 11, the transaction used for the update is stored in the transaction queue 10-A set in the database A. In the above, since the identification information set in DartyBit includes the database name (site name) so that it can be determined in which database the update has occurred, when accessing the table 003 in the databases B and C, the DartyBit area In the case of a record in which identification information is set, propagation can be executed only from a transaction queue of a database in which a transaction corresponding to the corresponding database name (site name) exists, which is efficient.
[0032]
【The invention's effect】
As described above, according to the database system of the present invention, when there is a reference request to the database of the local station, the identification indicating whether or not the change is made in the other station provided in the database of the other station Based on the information, it is detected whether or not the change has been made at the other station. If the change has been made at the other station, the data is matched, the database is referenced, and the reference result is requested. Since the process of returning to the original is performed, there is an effect of ensuring the reference of the latest data.
[0033]
Further, according to the database system of the present invention, upon receiving a data change request relating to the contents of the own station database, based on the identification information, it is detected whether or not the other station has changed, and the other station If there is a change, the data is changed after matching the changed data at the other station, so in the case of a conflict, processing in an appropriate order is ensured and the latest data is always updated. There is an effect that changes are made.
[Brief description of the drawings]
FIG. 1 is a diagram showing a replication operation when data is referenced by a database system according to the present invention.
FIG. 2 is a block diagram showing a specific configuration example of one station in the database system according to the present invention.
FIG. 3 is a diagram showing a record configuration of a database in the database system according to the present invention.
FIG. 4 is a view showing record contents of a database corresponding to an insertion transaction in the database system according to the present invention.
FIG. 5 is a view showing an example of an update transaction of a table 003 in the database system according to the present invention.
FIG. 6 is a view showing an example of an update transaction for a table 002 in the database system according to the present invention.
FIG. 7 is a view showing an example of an insertion transaction of a table 003 in the database system according to the present invention.
FIG. 8 is a flowchart for explaining processing in the case of a reference transaction in the database system according to the present invention.
FIG. 9 is a diagram showing a replication operation when data is updated by the database system according to the present invention.
FIG. 10 is a flowchart for explaining processing in the case of an update transaction in the database system according to the present invention.
FIG. 11 is a diagram showing a replication operation in a base system configured by three databases according to the present invention.
FIG. 12 is a diagram showing a replication operation by a database system according to a conventional example.
FIG. 13 is a diagram showing a waste of processing in a replication operation by a database system according to a conventional example.
[Explanation of symbols]
A, B, C Database 10-A, 10-B, 10-C Transaction queue 51 CPU
52 Main Storage Device 54 Input Device Control Unit 55 Communication Interface 56 Storage Device Control Unit 57 Input Device 58 Communication Processing Unit 59 Storage Device 100 Communication Line

Claims (2)

2つ以上の局が通信回路を介して結合されているデータベースシステムにおいて、
各局は、
複数のレコードにより構成されるテーブルを複数備えるデータベースと、
前記レコード毎に設けられ、他局のデータベースにおいてデータ更新が行われた場合に当該レコードのデータに変更を行った他局の識別情報が記憶される記憶領域と、
トランザクションに基づいて、自局のデータベースにおけるデータの更新を実行する変更手段と、
この変更手段により変更が行われた場合に、他局のデータベースに対し、該当テーブルの該当レコードに設けられた記憶領域に自局の識別情報をセットする識別情報制御手段と、
前記変更手段で用いられたトランザクションが蓄積されるトランザクションキューと、
自局のデータベースに対して参照要求または変更要求があると、前記要求に係る範囲に対応するレコードにおける記憶領域を参照して他局の識別情報がセットされているか否かに基づき他局において変更がなされたか否かを検出する検出手段と、
前記検出手段が他局において変更がなされたことを検出すると、該当他局のトランザクションキューから該当トランザクションを伝播して該当他局のデータベースの更新を自局データベースへ反映させると共に、対応する記憶領域にセットされている他局の識別情報を消去するデータ一致化手段と、
自局のデータベースに対して参照要求があった場合に、前記検出手段により変更なしと判定されると直ちに自局のデータベースを参照し参照結果を参照要求元へ返送する、一方、前記検出手段により他局において変更がなされたことの検出がなされると前記データ一致化手段による反映処理の後に自局のデータベースを参照し参照結果を参照要求元へ返送するデータ返送手段と
を具備することを特徴とするデータベースシステム。
In a database system in which two or more stations are coupled via a communication circuit,
Each station
A database comprising a plurality of tables composed of a plurality of records;
A storage area that is provided for each record and stores identification information of another station that has changed the data of the record when data update is performed in the database of the other station;
Based on the transaction, a changing means for performing data update in the local database,
An identification information control means for setting the identification information of the own station in the storage area provided in the corresponding record of the corresponding table with respect to the database of the other station when a change is made by the changing means;
A transaction queue in which transactions used in the changing means are accumulated;
When there is a reference request or a change request for the database of the own station, the change is made at the other station based on whether the identification information of the other station is set with reference to the storage area in the record corresponding to the range related to the request. Detecting means for detecting whether or not
When detecting that the detector is made of modifications in another station, both when to reflect the update of the database of the corresponding other station propagates the corresponding transaction from the transaction queue corresponding other station to own station database, the corresponding storage area Data matching means for erasing the identification information of other stations set in
When there is a reference request for the database of the own station, the detection unit immediately refers to the database of the local station and returns the reference result to the reference request source when it is determined that there is no change. A data return means for referring to the database of the local station after the reflection processing by the data matching means and detecting the reference result to the reference request source when it is detected that the change has been made in the other station. A database system.
自局のデータベースに対して変更要求があると、
前記検出手段は、前記要求に係る範囲に対応するレコードの記憶領域を参照して他局において変更がなされたか否かを検出し、
前記データ一致化手段は、前記検出手段が他局において変更がなされたことを検出すると、該当他局のトランザクションキューから該当トランザクションを伝播して該当他局のデータベースの更新を自局データベースへ反映させ、
前記変更手段は、前記検出手段により変更なしと判定されると直ちに自局のデータベースにおけるデータの更新を行う、一方、前記検出手段により他局において変更がなされたことの検出がなされると前記データ一致化手段による反映処理の後に自局のデータベースにおけるデータの更新を行うことを特徴とする請求項1に記載のデータベースシステム。
If there is a change request for your database,
The detection means detects whether or not a change has been made in another station with reference to a storage area of a record corresponding to the range related to the request,
When the data matching means detects that the detecting means has changed in another station, the data matching means propagates the relevant transaction from the transaction queue of the relevant other station and reflects the update of the database of the relevant other station in the local station database. ,
The change means updates the data in its own database as soon as it is determined by the detection means that there is no change. On the other hand, if the detection means detects that a change has been made in another station, the data 2. The database system according to claim 1, wherein the data in the local database is updated after the reflection processing by the matching means.
JP35155999A 1999-12-10 1999-12-10 Database system Expired - Fee Related JP3845535B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP35155999A JP3845535B2 (en) 1999-12-10 1999-12-10 Database system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP35155999A JP3845535B2 (en) 1999-12-10 1999-12-10 Database system

Publications (2)

Publication Number Publication Date
JP2001166976A JP2001166976A (en) 2001-06-22
JP3845535B2 true JP3845535B2 (en) 2006-11-15

Family

ID=18418110

Family Applications (1)

Application Number Title Priority Date Filing Date
JP35155999A Expired - Fee Related JP3845535B2 (en) 1999-12-10 1999-12-10 Database system

Country Status (1)

Country Link
JP (1) JP3845535B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101419616A (en) * 2008-12-10 2009-04-29 阿里巴巴集团控股有限公司 Data synchronization method and apparatus
JP5670935B2 (en) * 2012-02-27 2015-02-18 日本電信電話株式会社 Distributed data management system and operation method thereof

Also Published As

Publication number Publication date
JP2001166976A (en) 2001-06-22

Similar Documents

Publication Publication Date Title
US5613113A (en) Consistent recreation of events from activity logs
US5574902A (en) Efficient destaging of updated local cache pages for a transaction in a multisystem and multiprocess database management system with a high-speed shared electronic store
US9652519B2 (en) Replicating data across multiple copies of a table in a database system
JP2731375B2 (en) Data identification method
US6879981B2 (en) Sharing live data with a non cooperative DBMS
US7555489B2 (en) Generating a fingerprint for a document
JP2731374B2 (en) Write conflict resolution
JP2731373B2 (en) Write collision detection method
US6078930A (en) Multi-node fault-tolerant timestamp generation
US5664176A (en) Moving write lock for replicated objects
US5778388A (en) Method of processing a synchronization point in a database management system to assure a database version using update logs from accumulated transactions
JPH04255041A (en) Database controlling method
US20060161539A1 (en) Method and system of database management with shared area
CN102955792A (en) Method for implementing transaction processing for real-time full-text search engine
US8719313B2 (en) Distributed data store with a designated master to ensure consistency
Tait A file system for mobile computing
JP3845535B2 (en) Database system
Wu et al. Dynamic finite versioning: An effective versioning approach to concurrent transaction and query processing
US20120198456A1 (en) Reducing the number of operations performed by a persistence manager against a persistent store of data items
CN112800060B (en) Data processing method, data processing device, computer readable storage medium and electronic equipment
JP3330006B2 (en) Network system including information storage system, input system of the system, and
JP2004334460A (en) Method and system for database snapshot
JPH0628199A (en) Synchronizing method of parallel processing
Wu et al. Rapid transaction-undo recovery using twin-page storage management
CN112800060A (en) Data processing method and device, computer readable storage medium and electronic equipment

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20051027

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20051108

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20060110

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20060322

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20060522

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: 20060815

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20060821

LAPS Cancellation because of no payment of annual fees