JP4139613B2 - Data processing method - Google Patents

Data processing method Download PDF

Info

Publication number
JP4139613B2
JP4139613B2 JP2002073540A JP2002073540A JP4139613B2 JP 4139613 B2 JP4139613 B2 JP 4139613B2 JP 2002073540 A JP2002073540 A JP 2002073540A JP 2002073540 A JP2002073540 A JP 2002073540A JP 4139613 B2 JP4139613 B2 JP 4139613B2
Authority
JP
Japan
Prior art keywords
lock
page
data
deletion
executed
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 - Lifetime
Application number
JP2002073540A
Other languages
Japanese (ja)
Other versions
JP2003271436A (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.)
Hitachi Ltd
Original Assignee
Hitachi Ltd
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 Hitachi Ltd filed Critical Hitachi Ltd
Priority to JP2002073540A priority Critical patent/JP4139613B2/en
Priority to US10/152,439 priority patent/US20030177131A1/en
Publication of JP2003271436A publication Critical patent/JP2003271436A/en
Priority to US12/192,947 priority patent/US7818749B2/en
Application granted granted Critical
Publication of JP4139613B2 publication Critical patent/JP4139613B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/526Mutual exclusion algorithms

Description

【0001】
【発明の属する技術分野】
本発明は、ポインタにより複数のオブジェクトが関連づけられるデータ構造を持ち、オブジェクトの参照、更新、挿入および削除を行なう処理が複数並行して動作するシステムのデータ処理に関する。
【0002】
【従来の技術】
(従来技術1)
本発明に関するインデックスにより高速にデータにアクセスする機能を持ったデータ管理システムは基本的なデータへのアクセス方法として次の4つの機能を提供するものとする;
(1)参照機能:指定したキー値に関連するデータの参照
(2)挿入機能:指定したキー値およびそれに関連する指定したデータの挿入
(3)削除機能:指定したキー値およびそれに関連するデータの削除
(4)更新機能:指定したキー値に関連するデータを指定したデータへの更新
これらの機能は、複数並列して処理要求されるものとする。以下、それぞれの機能を実現する処理方法を参照処理、挿入処理、削除処理そして更新処理と呼ぶものとする。
【0003】
これらの機能を実現する従来技術を図1および図2を用いて説明する。
図1、101にデータ構造の一例を示す。3つのオブジェクトA、BおよびCから構成されるオブジェクトグループTを示す。オブジェクトはデータの単位であり、領域の確保および解放はオブジェクト単位で行なわれるものとする。またひとつのデータはひとつのオブジェクトに格納されるものとする。
【0004】
オブジェクトBにはキー値10とそれに関連するデータが格納されているものとする。同様にオブジェクトCにはキー値20とそれに関連するデータが格納されているものとする。オブジェクトAには、オブジェクトBが保持するキー(すなわちキー値10)とオブジェクトBの格納位置情報(以下、ポインタと呼ぶ)およびオブジェクトCが保持するキー(すなわちキー値20)とオブジェクトCのポインタが格納されている。
【0005】
ここで、前記の4機能の実現方法について説明する。以上の機能を複数の処理が並列実行することを可能とするため、ロックの設定・解除が必要となる。ロックについては例えば、「Gray, J., Reuter, A., TRANSACTION PROCESSING:CONCEPTS AND TECHNIQUES, Morgan Kaufmann Publishers, Inc., 1993, p449-484」に実現方法が述べられている。ここでは前記文献にある、S、X、IS、IX各モードのロックを利用する。SモードのロックはSおよびISモードのロックと並列実行可能であり、Xモードはすべてのモードのロックと並列実行はできず、ISモードのロックはS、ISおよびIXモードのロックと並列実行可能であり、IXモードのロックはISおよびIXモードのロックと並列実行可能である。ロック設定の方針は、参照処理の場合はオブジェクトグループTにISモードのロックを、挿入、削除および更新処理の場合はオブジェクトグループTにIXモードのロックを設定し、その後アクセスするオブジェクトに対し、参照する場合はSモード、更新する(可能性がある)場合はXモードでロックを設定するといったように階層的にロックを設定するものである。即ち、オブジェクトグループに対してロックを設定した後、特定のオブジェクトにロックを設定する。
【0006】
オブジェクトグループに対しロックを設定する場合のリソース名称は、各処理が共通して知っている名称を指定するものとする。また、オブジェクトに対しロックを設定する場合、オブジェクトの格納位置に対応するリソース名称(リソース名称をオブジェクトが格納されている位置情報、例えば、ポインタの値とする)を指定するものとする。つまり、格納位置がわかればオブジェクトにロックを設定可能である。また、オブジェクトグループ内の基点となるオブジェクト(図1ではオブジェクトA)の格納位置はすべての処理が知っており、かつ格納位置が移動したりしないものとする。
【0007】
各処理のタイムチャートを図2に示す。タイムチャートにおける時間は左から右方向に流れるものとする。両端が黒丸で示される線分は、線分の左側に示されるオブジェクトにロックを設定している期間を表し、線分の上にロックのモードを示し、線分の下に処理を示す。両端が白丸で示される線分は、線分の左側に示されるオブジェクトに対し(ロックを設定せずに)アクセスを行なっていることを表し、線分の下に処理を示す。図2(a)は参照処理のフローチャートを示す。ここでは、キー値が10のオブジェクトを参照する例を示している。図2(b)は挿入処理のフローチャートを示す。ここでは、キー値が30のオブジェクトをグループTに挿入する例を示している。図2(c)は削除処理のフローチャートを示す。ここでは、キー値が20のオブジェクトを削除する例を示している。図2(d)は更新処理のフローチャートを示す。ここでは、キー値が10のオブジェクトを更新する例を示している。
【0008】
並列処理での状況を示すために、仮にキー値30の挿入処理と、キー値20の削除処理が、ほぼ同時に動作している状況での場合について説明する。挿入処理202は、まずオブジェクトグループTに対し、IXモードでロックを設定する。そして新規のデータを格納するためのオブジェクト領域を確保(オブジェクトDとする)して、その領域にキー値30および関連するデータを設定する。一方、削除処理203も、同様にオブジェクトグループTに対し、IXモードでロックを設定するが、このロックは挿入処理におけるIXと競合しても並列実行可能であり、いずれかが待たされることはない。次は、挿入処理202、削除処理203ともにオブジェクトAに対してXモードのロックを設定する処理であり、先行してロック設定した処理がロックを解除するまで他方は待たされることになる。
【0009】
まず、削除処理203が挿入処理202に先立ってロックの設定に成功した場合について説明する。挿入処理202は削除処理203がオブジェクトAのロックを解除するまで待たされることになる。削除処理203はオブジェクトAをアクセスしてキー値20に対応するオブジェクトBへのポインタを取得して、オブジェクトCに対しXモードでロックを設定し、オブジェクトA内のキー値20およびオブジェクトCへのポインタを削除(以下、ポインタの切り離しと呼ぶ)して、オブジェクトAに対するロックを解除して(この時点で挿入処理202の待ちは解除される)、オブジェクトCを格納していたオブジェクト領域を解放し、オブジェクトCのロックを解除し、最後にオブジェクトグループTのロックを解除する。この状態を図1の102に示す。
【0010】
削除処理203によるオブジェクトAのロックの解除を受けて、挿入処理202はオブジェクトAへのロックの設定に成功する。挿入処理202では、オブジェクトAにアクセスして、オブジェクトAにキー値30とオブジェクトDの格納位置を設定し、オブジェクトAに設定したロックを解除し、オブジェクトグループTに設定したロックを解除する。この状態を図1、104に示す。
【0011】
一方、挿入処理202が削除処理203に先立ってロックの設定に成功した場合は、削除処理203は挿入処理202がオブジェクトAのロックを解除するまで待たされることになる。挿入処理202は前記同様に処理を行い、図1、103の状態となる。その後、削除処理203が実行され、図1、104に示す状態となる。
【0012】
参照処理(キー値10)については図2、201に、更新処理(キー値10)については図2、204に示す。参照処理201や更新処理204でオブジェクトAに対するロックを解除する前にオブジェクトBのロックを設定しているのは、並列してオブジェクトBの削除処理が動作していた場合に、誤動作を防止するためである。つまり、仮に、オブジェクトAに対するロックを解除した後にオブジェクトBのロックを設定するようになっていると、その間に削除処理によってオブジェクトBの領域解放が可能であり、さらにこの解放領域が別用途に再割当てされて設定されたデータをオブジェクトBのデータと見てしまい誤動作する可能性がある。
【0013】
また、より平易な方法として、参照処理の場合はオブジェクトグループTにSモードのロックを、挿入、削除および更新処理の場合はオブジェクトグループTにXモードのロックを設定するという方法もある。この方法では参照処理同士以外は、並列処理実行はできないため、上記の例より更にディスクやプロセッサといった資源を有効に活用できず、スループットおよびレスポンスタイムが低くなる。
【0014】
このように、従来技術1では、オブジェクトAに対してロックをかけた状態でオブジェクトBにもロックをかけるなど同時に2つのオブジェクトにかける。このことによりオブジェクトの削除処理で削除したオブジェクトの領域を解放することが出来るという利点があるが、並列実行性能がやや低いという特性がある。
【0015】
(従来技術2)
DB管理システムにおける、Bツリーインデクスは、従来技術1を拡張したデータ構造になっている。図7、701にその一例として、7つのページ(従来技術1のオブジェクトに相当)からなる3段のBツリーインデクスを示す。図7、701の下方に位置するページP4、P5、P6およびP7はリーフページと呼ばれ、それぞれ1個以上のキー(ページ内の下方に記した値。例えばページP6ではキー値50およびキー値70)とそれに対応するデータの格納位置情報の組、右側のページのポインタ(一番右側のページP7は除く)、ページ内MAXキー値(リーフページ内の右上に記した値。ページ内に格納されているデータが持つ最大のキー値。例えばページP4ではキー値20がページ内Maxキー値である)が格納されている。各リーフページは格納を担当するキーの範囲が設定されており、該当ページおよびその左側に位置するページのページ内Maxキー値によって示される。例えばページP5が格納を担当するキーの範囲は、ページP5の左側のページP4のページ内Maxキー値20より大きく、ページP5のページ内Maxキー値40以下のキーである。同様にページP6、P7が担当するキーの範囲はそれぞれ40より大きく70以下のキー、および70より大きいキーである。左側に位置するページがないページP4は、ページ内Maxキー値以下(20以下)のキーを担当する。
【0016】
リーフページの上方には上位ページ(図7,701のページP1、ページP2およびページP3、ノードとも呼ばれる)と呼ばれるページが配置される。上位ページには、1個以上の直下のページへのポインタおよびキー値の組、(存在すれば)右側のページへのポインタが格納される。ここでのキー値は組になっているポインタで指されるページのページ内Maxキー値と一致する。特にページP1はルートページと呼ばれる。あるキー値が格納されているリーフページをサーチするためには、ルートページからアクセスして目的のキー値以上の最小のキー値と組になるポインタを辿っていけばよい。領域の確保はページ単位で行なわれる。
【0017】
ここで、キー値20〜40の範囲のキー値を指定した削除処理について図8、801を用いて説明する。まずBツリーインデクス全体Tに対し、IXモードのロックを設定して、ルートページP1に対し、Sモードでロックを設定して、指定範囲の下限であるキー値20以上であってページP1内の最小のキー値であるキー値40と組になっているページP2へのポインタを取得して、ページP1のロックを解除する。ページP2に対しSモードでロックを設定し、同様にキー値20以上であってページP2内の最小のキー値であるキー値20と組になっているページP4へのポインタを取得して、ページP2のロックを解除する。そしてページP4に対しXモードでロックを設定し、ページP4内の削除対象であるキー値20〜40の範囲にあるキー値すべて削除する。
【0018】
このときページP4には、キー値20しか存在しないため、ページ内にキー値が残らなくなるが、ページP4の領域解放は行なわない。その大きな理由は、領域解放するには、解放対象ページへのポインタを適当なロックを設定しながら、設定し直す必要があり、並列実行性の劣化につながるからである。
【0019】
またページP4のページ内Maxキー値が20であることから、削除対象であるキー値20〜40の範囲のうち、20より大きいキー値は右側のページに格納されていることがわかるので、右ページへのポインタ(ページP5へのポインタ)を取得して、ページP4のロックを解除する。ページP5に対するXモードのロックを設定して、ページP5内の削除対象であるキー値20〜40の範囲にあるキー値すべて削除する。このときページP5には、キー値40しか存在しないため、ページ内にキー値が残らなくなるが、ページP5の領域解放は行なわない。ページP5のページ内Maxキー値が40であることよりキー値20〜40の範囲のキーすべてを削除できたことになる。ページP5のロックを解除し、最後にBツリーインデクス全体Tのロックを解除し削除処理を完了する。削除処理が完了した状態を図7、702に示す。
【0020】
また、図7、702の状態から、挿入処理(キー値60)を行なう手順について図8、802を用いて説明する。Bツリーインデクス全体Tに対し、IXモードのロックを設定して、前記記述の手順と同様にページP1、ページP3とページをアクセスしていき、ページP6に対してXモードのロックを設定してページP6にアクセスする。ページP6には既にキー値50および70のデータが格納されており、キー値60のデータを格納するのに十分なスペースがないものとする。この場合スプリット呼ばれる、ページ分割処理を行なう。まず、新規にページを確保(ページP8とする)する。ここでは分割キー値が50であったものとする。つまり、キー値50のデータをページP6に残し、キー値70のデータおよび挿入するキー値60のデータを新規に確保するページ領域に移動するものとする。ページP8に必要な設定を行い、ページP6のページ内Maxキー値を50に設定し直し、右ページのポインタをページP8に設定し直すなどの処理を行なった後、ページP6のロックを解除して、ページP3に対しXモードでロックを設定して、ポインタを設定し直し、ページP3のロックを解除し、最後にBツリーインデクス全体Tのロックを解除し挿入処理を完了する。挿入処理が完了した状態を図7、703に示す。
【0021】
前述したように、Bツリーインデクスにおいて、並列実行性を高く保つために、データの削除によりページ内にデータが一件もない状態になっても、ページの領域解放を行なわない。そのため、一般にデータの挿入・削除を繰り返すうちに格納効率が低下し、それに伴いアクセス性能が劣化していく。その性能劣化を抑えるために、適当な時期にインデクスのアクセスを禁止して、インデクスに格納されたデータを一時領域に出力して、データを詰め込み直す処理(再編成処理)が一般に行なわれている。
【0022】
このように、従来技術2では同時に2つのページにロックをかけることがない。従って、並行実行可能性は高い。一方、従来技術1で述べたような誤ったページの参照が生じる可能性があるので、データを削除しても引き続いてその領域を解放することが出来ない。
【0023】
【発明が解決しようとする課題】
以上のような従来技術1、従来技術2の説明から分かるように、データの削除処理でのその領域の解放処理が可能であることと、並列実行性が高いことはトレードオフの関係にあるものと考えられていた。
【0024】
本発明の目的は、ポインタにより複数のオブジェクトが関連づけられるデータ構造を持ち、オブジェクトの参照、更新、挿入および削除を行なう処理が複数並行して動作するシステムにおいて、参照、更新および挿入の並列実行性が高く、かつ削除処理を参照、更新および挿入処理と並列実行可能とすることである。
【0025】
さらに、データの挿入および削除の繰り返しにより格納効率・アクセス効率が低下(削除されたがその領域が解放されないオブジェクトが増えることや、目的のオブジェクトにアクセスするために不必要なオブジェクトを経由することになること)したBトリーインデクスに対し、データ参照、更新および挿入を抑止することなく空きとなっているオブジェクトの領域の回収し、格納効率、アクセス効率を向上させることである。
【0026】
【課題を解決するための手段】
参照、更新および挿入処理において、ポインタを辿ってのオブジェクト間の移動に際し、移動前のオブジェクトに対するロックを解除した後に、移動後のオブジェクトに対するロックを設定することにより、参照、更新および挿入の並列実行性を高くする。この際、処理の始めにオブジェクトグループに対しISモード(参照処理の場合)またはIXモード(更新および挿入処理の場合)を設定し、処理完了時にロックを解除する。
一方、削除処理において、削除対象へのポインタを切り離し、あるいは付け替えた後、オブジェクトグループに対してロックを取得している全処理が完了した後に、削除対象オブジェクトの領域を解放する。
【0027】
【発明の実施の形態】
(実施の形態1)
本発明を実現するシステム構成例を図9に示す。ここに示すシステム構成例は実施の形態1〜3において共通である。本システムは、プロセッサ2とメモリ3とを有するコンピュータシステム1と、それに接続された外部記憶装置4と、コンピュータシステム1にネットワーク6を介して接続された複数の端末7を備えている。
【0028】
メモリ3内にはプロセッサ2で解釈可能なプログラムの形で表現されたデータ管理システム10が配置され、プロセッサ2によって命令が読み込まれ演算処理がなされる。データ管理システム10は、システム制御部11、オブジェクト管理部12、ロック管理部13から構成される。システム制御部11は、端末7からの参照、挿入、更新および削除要求を受け取り、要求内容を解析してオブジェクト管理部12に制御を渡し、処理結果をネットワーク6を通じて端末7へ応答する。オブジェクト管理部12はシステム制御部11から渡された指示に従って、外部記憶装置4内に格納されたオブジェクト5の管理を行なう。ロック管理部12は、指定されたリソースに対するロック機能をオブジェクト管理部12に提供する。
【0029】
従来技術1における説明に使用した図1において、参照、更新および挿入の並列実行性がより高く、かつ削除処理を参照、更新および挿入処理と並列実行可能な方法の例を図3および図4により開示する。
【0030】
図3、301は本実施形態における参照処理を示すタイムチャートである。図2、201と比較して、オブジェクトAに対するロックの解除時期とオブジェクトBに対するSモードのロックの設定時期が入れ替わっている。即ち、従来はオブジェクトAについてロックを設定して、オブジェクトBへのポインタの値を記憶し、その後、オブジェクトBについてロックを設定し、それからオブジェクトAについてのロックを解放していた。これに対し本実施形態ではオブジェクトAについてロックを設定し、オブジェクトBへのポインタの値を記憶したならば、オブジェクトAについてのロックを解放する。それからオブジェクトBについてロックを設定する。図3、302は本実施形態における挿入処理を示すタイムチャートである。これは図2、201と同じものである。
【0031】
図3、304は本発明における更新処理を示すタイムチャートである。図2、204と比較して、オブジェクトAに対するロックの解除時期とオブジェクトBに対するXモードのロックの設定時期が入れ替わっている。
【0032】
図3、303は本発明における削除処理を示すタイムチャートである。図2、204とは、大きく変わっており、比較しながら説明する。オブジェクトグループTに対するIXモードのロックの設定およびオブジェクトAに対するXモードのロックの設定は同様であるが、その後オブジェクトグループTに対してロックを取得している全処理を記憶する。その後、オブジェクトAから削除対象のオブジェクトCに対するポインタを切り離すが、この実施形態ではここで前記記憶した全処理の完了を待つ。完了の待ち方として、ロックの解除時点でオブジェクトグループTに対してロックを設定している処理側から削除処理へ完了を通知する方法と、削除処理が一定間隔で他の処理の処理完了をチェックする方法とがある。いずれかの方法を用いて前記記憶した全処理の完了を検知できた後、オブジェクトCの領域を解放する。
【0033】
解放した領域に他処理がアクセスする可能性はないので、オブジェクトCに対するロックを設定する必要はない。その理由について、図4に例で説明する。図4では、削除処理401、参照処理402、挿入処理403、更新処理404および更新処理405が並列して処理が行なわれていることを示す。406時点、つまり削除処理401においてオブジェクトAに対しXモードでロックを設定した直後の時点でオブジェクトグループTに対しロックを設定していない処理(ここでは更新処理404および更新処理405)は、オブジェクトCにアクセスし得ない。なぜならばオブジェクトCにアクセスする前にオブジェクトCへのポインタを設定してある時点でのオブジェクトAにアクセスする必要があるが削除処理401がXモードで押さえているため、更新処理404および更新処理405でオブジェクトAを見られるときにはオブジェクトCへのポインタは切り離されている。また、参照処理402や更新処理403はオブジェクトCを見てデータを取得することがあるが、それらの処理はすべてが完了したことを検知できているからである。
【0034】
前記ISモードおよびIXモードは例であって、その代わりに、それらの組と等価な、あるいはより並列実行性の低いロックモードを用いることも出来る。
【0035】
前記処理方法により、従来処理に比べ、参照、挿入および更新処理の並列実行性を高くして、かつ削除処理によって解放された領域を誤って他処理がアクセスすることも回避している。更に詳しくは、上記実施形態では参照、挿入および更新処理において、一つの処理が同時に2つのオブジェクトをロックすることがないため、従来技術と同等の高い並列実行性を実現出来る。また、削除処理において、ポインタを切り離した後、削除処理の対象となっているオブジェクトグループにロックをかけている他の処理の完了を待って削除されたオブジェクトの領域を解放することにより、安全かつ他の処理の実行を阻害することなく領域の解放も実行出来る。
【0036】
(実施の形態2)
図5および図6を用いて第2の実施の形態を開示する。
図5、501はあるハッシュ値に対応するデータをチェーンにより管理する場合などに典型的に用いられるデータ構造である(ここでは、ハッシュ関数がキー値を10で割った余りと定義されていて、ハッシュ値=2のキーおよびデータを管理する部分であると想定している)。この状態のデータ構造に対し、キー値32の削除処理とキー値12の挿入処理が要求された場合の手順について、図6に示す各処理のタイムチャートと合わせ説明する。
【0037】
図6の削除処理601では、オブジェクトBについて削除要求がなされる。まずオブジェクトグループTに対し、IXモードのロックを設定し、オブジェクトAに対しXモードでロックが設定する。オブジェクトAに格納されているオブジェクトBへのポインタを取得して、(オブジェクトAに対するロックを保持したまま)オブジェクトBに対しXモードのロックを設定し、オブジェクトBをアクセスする。オブジェクトB、即ち、キー値が32のオブジェクトがあったことを確認し、この時点でオブジェクトグループTに対しロックを設定しているすべての処理を記憶する(この時点で挿入処理602も並行して処理していてオブジェクトグループTに対しロックを設定しているものとする)。オブジェクトAに格納されているオブジェクトBへのポインタをオブジェクトBに格納されているポインタ(オブジェクトCへのポインタ)に設定し直して(ポインタの付け替え)、オブジェクトAおよびBのロックを解除し(図5、502)、記憶した処理の完了待ちとなる。
【0038】
一方、挿入処理602ではオブジェクトグループTに対し、IXモードのロックを設定し、挿入用のオブジェクト領域確保を行い(オブジェクトDとする)、キー値12および関連するデータの設定を行なう。続いてオブジェクトAに対しXモードでロックを設定(削除処理がロック保持中であれば、解除まで待つことになる)し、オブジェクトAに格納されているポインタをオブジェクトDへのポインタに設定し、オブジェクトAからのポインタを、オブジェクトDを指すように付け替え、オブジェクトAのロックを解除し、最後にオブジェクトグループTのロックを解除し、挿入処理を完了する(図5、503)。
【0039】
挿入処理602のオブジェクトグループTのロックを解除により、削除処理601はオブジェクトBの領域を(ロックを設定することなく)解放し、オブジェクトグループTのロックを解除して、削除処理を完了する(図5、504)。
【0040】
次に、参照処理(キー値62)603の処理手順について説明する。まず、オブジェクトグループTに対しISモードのロックを設定し、オブジェクトAから順にポインタを辿っていってキー値が62であるオブジェクトを探す。オブジェクト間を移動する際には、移動元のオブジェクトのロックを解除してから移動先のオブジェクトに対し、Sモードでロックを設定するものとする。なお、前記の削除処理601と並行して動作している場合は、オブジェクトAにアクセスした際の状態が図5、502の状態であれば、オブジェクトBへアクセスすることはなくポインタはオブジェクトCへのものが記憶される。従って、図6、603の点線に囲まれた処理は行なわれない。603の点線で囲まれた処理はオブジェクトBがまだ501の状態にあるときに実行される。このとき、オブジェクトAのアクセスでオブジェクトBへのポインタが記憶され、点線で囲まれた処理でオブジェクトCへのポインタが記憶される。このように参照のタイミングにより処理が変わって来る。
【0041】
続いて、更新処理(キー値62)604の処理手順について説明する。まず、オブジェクトグループTに対しIXモードのロックを設定し、オブジェクトAから順にポインタを辿っていってキー値が62であるオブジェクトを探し、見つけたら関連付けられているデータを更新する。オブジェクト間を移動する際には、移動元のオブジェクトのロックを解除してから移動先のオブジェクトに対し、Xモードでロックを設定するものとする。なお、前記の削除処理601と並行して動作している場合、オブジェクトAにアクセスした際の状態が図5、502の状態あれば、オブジェクトBへアクセスすることはなく、図6、604の点線に囲まれた処理は行なわれない。
【0042】
前記処理方法により、削除処理によって解放された領域を誤ってアクセスすることなく、参照、挿入および更新処理の高い並列実行性を実現できる。更に述べれば、ハッシュ関数を用いたデータの管理においても実施の形態1と同様に、参照、挿入、および更新処理において、1つの処理が同時に2つのオブジェクトのロックを設定することがなく高い並列実行性を持つと共に、削除処理において、削除対象となるオブジェクトへのポインタを切り離した後にそのオブジェクトグループにロックをかけている他の処理の完了を待って領域の解放を実行することにより他の処理の実行を阻害することなく、かつ誤ったデータが使われることなく領域の解放が出来る。
【0043】
(実施の形態3)
従来技術2で説明したBツリーインデクスにおいて、データ削除やデータ挿入処理と並列実行可能な空きページ回収処理方法を図7および図8を用いて開示する。空きページ回収処理は、データの挿入・削除を繰り返すうちに格納効率が低下し、それに伴いアクセス性能が劣化している適当な時期に再編成に代わり実行することを想定している。
【0044】
図7、703の状態において、空きページ回収処理が実行された場合の処理手順を図8、803に示す。まず、Bツリーインデクス全体Tに対しIXモードでロックを設定する。以降の説明において、ページに対するロックのモードについては[]内に記すものとする。次にルートページから一番左のリーフページに向かってページを辿る(ページP1[S]、P2[S]およびP4[X])。リーフページP4においてデータ件数が0件であることを確認し、回収予定であることを示すフラグ(図7、704 ページP4内の丸枠に「回」を記した記号)を設定する。続いてページP4の上位ページであるページP2にアクセス[X]して、ページP4へのポインタを切り離す(図7、704)。そして、ページP4の右側のページであるページP5にアクセス[X]して、データ件数が0件であることを確認し、回収予定であることを示すフラグを設定する。次に、上位ページであるページP2にアクセス[X]して、ページP5へのポインタを切り離すとページP2内にはキーが残らないことを確認して、ページ2に回収予定であることを示すフラグを設定する。続いてページP2の上位ページであるページP1にアクセス[X]して、ページP2へのポインタを切り離す(図7、705)。ページP5の右側のページであるページP6にアクセス[X]してデータ件数が1件以上であることを確認しページP6の右側のページであるページP8にアクセス[X]してデータ件数が1件以上であることを確認し、ページP8の右側のページであるページP7にアクセス[X]してデータ件数が1件以上であることを確認し、回収可能なページのフラグ設定およびポインタの切り離しが完了する。この時点でBツリーインデクス全体Tに対しロックを設定している処理を記憶し、それらの処理の完了を待つ。記憶した処理がすべて完了したら、回収予定としたページP2、P4およびP5の領域を解放し、最後にBツリーインデクス全体Tのロックを解除して空きページ回収処理を完了する(図7、706)。
【0045】
前述した空き回収処理方法で得られた最終的な形では、領域解放を行なったページが格納を担当していたキーは、その右側のページが担当を引き継ぐ形となる。例えば、ページP6はキー値が50以下のデータを担当する。それに伴い、参照、挿入および更新処理において、アクセスしたページに回収予定フラグが設定されているのを検知した場合、右側のページへ移動してアクセスするように処理を一部変更する。
【0046】
ここまでに示した処理方法により、Bツリーインデクスにおいても参照、挿入および更新処理の並列実行性を大きく損なうことなく、かつデータ参照、更新および挿入を抑止することなく空きとなっているページの領域を回収し、格納効率、アクセス効率を向上させることが可能である。
【0047】
以上述べた実施の形態で説明したように、ポインタにより複数のオブジェクトが関連づけられるデータ構造を持ち、オブジェクトの参照、更新、挿入および削除を行なう処理が複数並行して動作するシステムにおいて、参照、更新および挿入の並列実行性が高く、かつ削除処理を参照、更新および挿入処理と並列実行可能な処理が可能である。
【0048】
さらに、データの挿入および削除の繰り返しにより格納効率・アクセス効率が低下したBトリーインデクスに対し、データ参照、更新および挿入を抑止したり、一時リソースを使用したりすることなく空きとなっているページの領域の回収し、格納効率、アクセス効率を向上させることが可能である。
【0049】
【発明の効果】
本発明によれば、参照、挿入および更新処理の並列実行性を持ち、かつ削除処理によって解放された領域を誤って他処理がアクセスすることも回避して削除処理後の解放(回収)も可能としている。
【図面の簡単な説明】
【図1】従来技術1および実施の形態1におけるデータ構造を示す図である。
【図2】従来技術1におけるタイムチャートを示す図である。
【図3】本発明の実施の形態1におけるタイムチャートを示す図である。
【図4】本発明の実施の形態1における並列処理の様子を示す図である。
【図5】本発明の実施の形態2におけるデータ構造を示す図である。
【図6】本発明の実施の形態2におけるタイムチャートを示す図である。
【図7】従来技術2および本発明の実施の形態3におけるデータ構造を示す図である。
【図8】従来技術2および本発明の実施の形態3におけるタイムチャートを示す図である。
【図9】本発明を実現するシステム構成の例を示す図である。
【符号の説明】
1…コンピュータシステム、2…プロセッサ、3…メモリ、4…外部記憶装置、5…オブジェクト、6…ネットワーク、7…端末、10…データ管理システム、11…システム制御部、12…オブジェクト管理部、13…ロック管理部
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to data processing of a system having a data structure in which a plurality of objects are associated with each other by a pointer, and a plurality of processes for referencing, updating, inserting and deleting objects operate in parallel.
[0002]
[Prior art]
(Prior art 1)
A data management system having a function of accessing data at high speed by the index according to the present invention shall provide the following four functions as a basic data access method;
(1) Reference function: Reference data related to the specified key value
(2) Insert function: Insert specified key value and specified data related to it
(3) Delete function: Delete specified key value and related data
(4) Update function: Updates the data related to the specified key value to the specified data.
A plurality of these functions are requested to be processed in parallel. Hereinafter, processing methods for realizing the respective functions are referred to as reference processing, insertion processing, deletion processing, and update processing.
[0003]
A conventional technique for realizing these functions will be described with reference to FIGS.
An example of the data structure is shown in FIGS. An object group T composed of three objects A, B and C is shown. An object is a unit of data, and an area is secured and released on an object basis. One data is stored in one object.
[0004]
It is assumed that the object B stores a key value 10 and related data. Similarly, it is assumed that the key value 20 and data related thereto are stored in the object C. The object A includes a key held by the object B (ie, key value 10), storage position information of the object B (hereinafter referred to as a pointer), a key held by the object C (ie, the key value 20), and a pointer of the object C. Stored.
[0005]
Here, a method of realizing the above four functions will be described. In order to enable a plurality of processes to execute the above functions in parallel, it is necessary to set / release a lock. As for the lock, for example, “Gray, J., Reuter, A., TRANSACTION PROCESSING: CONCEPTS AND TECHNIQUES, Morgan Kaufmann Publishers, Inc., 1993, p449-484” is described. Here, the locks in the S, X, IS, and IX modes described in the above-mentioned document are used. S mode locks can be executed in parallel with S and IS mode locks, X mode cannot be executed in parallel with all mode locks, IS mode locks can be executed in parallel with S, IS and IX mode locks IX mode locks can be executed in parallel with IS and IX mode locks. The lock setting policy is that the IS mode lock is set for the object group T for the reference processing, the IX mode lock is set for the object group T for the insertion, deletion and update processing, and then the object to be accessed is referenced. In this case, the lock is set hierarchically such that the lock is set in the S mode if it is to be performed, and the lock is set in the X mode if there is a possibility of updating. That is, after setting a lock on an object group, a lock is set on a specific object.
[0006]
As a resource name for setting a lock for an object group, a name that is commonly known by each process is specified. In addition, when a lock is set for an object, a resource name corresponding to the storage position of the object (a resource name is used as position information where the object is stored, for example, a pointer value) is specified. That is, if the storage position is known, the lock can be set on the object. In addition, it is assumed that the storage position of the object (object A in FIG. 1) serving as the base point in the object group is known by all the processes, and the storage position does not move.
[0007]
A time chart of each process is shown in FIG. The time in the time chart flows from left to right. A line segment indicated by black circles at both ends represents a period during which the object shown on the left side of the line segment is locked, the lock mode is indicated above the line segment, and processing is indicated below the line segment. A line segment indicated by white circles at both ends indicates that the object shown on the left side of the line segment is being accessed (without setting a lock), and processing is shown below the line segment. FIG. 2A shows a flowchart of the reference process. Here, an example is shown in which an object having a key value of 10 is referred to. FIG. 2B shows a flowchart of the insertion process. Here, an example in which an object having a key value of 30 is inserted into the group T is shown. FIG. 2C shows a flowchart of the deletion process. Here, an example of deleting an object having a key value of 20 is shown. FIG. 2D shows a flowchart of the update process. Here, an example in which an object having a key value of 10 is updated is shown.
[0008]
In order to show the situation in parallel processing, a case will be described in which the insertion process of the key value 30 and the deletion process of the key value 20 are operating almost simultaneously. The insertion process 202 first sets a lock for the object group T in the IX mode. An object area for storing new data is secured (referred to as object D), and a key value 30 and related data are set in the area. On the other hand, the deletion process 203 similarly sets a lock on the object group T in the IX mode, but this lock can be executed in parallel even if it conflicts with IX in the insertion process, and one of them does not wait. . Next, both the insertion process 202 and the deletion process 203 are processes for setting the X mode lock for the object A, and the other is kept waiting until the process that has previously set the lock releases the lock.
[0009]
First, a case where the deletion process 203 succeeds in setting a lock prior to the insertion process 202 will be described. The insertion process 202 is waited until the deletion process 203 unlocks the object A. The deletion process 203 accesses the object A, acquires a pointer to the object B corresponding to the key value 20, sets a lock in the X mode for the object C, and sets the key value 20 and the object C in the object A to the lock. The pointer is deleted (hereinafter referred to as “detaching the pointer”), the lock on the object A is released (at this time, the waiting for the insertion process 202 is released), and the object area storing the object C is released. The object C is unlocked, and finally the object group T is unlocked. This state is shown at 102 in FIG.
[0010]
Upon receiving the unlocking of the object A by the deleting process 203, the inserting process 202 succeeds in setting the lock on the object A. In the insertion process 202, the object A is accessed, the storage position of the key value 30 and the object D is set in the object A, the lock set in the object A is released, and the lock set in the object group T is released. This state is shown in FIGS.
[0011]
On the other hand, if the insertion process 202 succeeds in setting the lock prior to the deletion process 203, the deletion process 203 waits until the insertion process 202 unlocks the object A. The insertion process 202 performs the same process as described above, resulting in the state shown in FIGS. Thereafter, the deletion process 203 is executed, and the state shown in FIGS.
[0012]
The reference process (key value 10) is shown in FIGS. 2 and 201, and the update process (key value 10) is shown in FIGS. The reason why the lock of the object B is set before the lock on the object A is released in the reference process 201 and the update process 204 is to prevent a malfunction when the deletion process of the object B is operating in parallel. It is. In other words, if the lock of the object B is set after the lock on the object A is released, the area of the object B can be released by the deletion process during that time, and the released area can be reused for another purpose. There is a possibility that the data set and assigned is regarded as the data of the object B and malfunctions.
[0013]
Further, as a simpler method, there is a method of setting an S mode lock on the object group T in the case of reference processing, and setting an X mode lock on the object group T in the case of insertion, deletion and update processing. Since this method cannot execute parallel processing except for reference processing, resources such as disks and processors cannot be used more effectively than in the above example, and throughput and response time are reduced.
[0014]
As described above, in the related art 1, the object A is locked on the object A while the object A is locked. This has the advantage that the area of the object deleted by the object deletion process can be released, but has a characteristic that the parallel execution performance is slightly low.
[0015]
(Prior art 2)
The B-tree index in the DB management system has a data structure that is an extension of prior art 1. As an example, FIGS. 7 and 701 show a three-stage B-tree index composed of seven pages (corresponding to objects of the prior art 1). Pages P4, P5, P6, and P7 located in the lower part of FIG. 7 and 701 are called leaf pages, and each has one or more keys (values shown in the lower part of the page. For example, in page P6, key value 50 and key value 70) and a set of storage position information of the corresponding data, a pointer on the right page (excluding the rightmost page P7), a MAX key value in the page (value shown at the upper right in the leaf page, stored in the page) The maximum key value of the stored data (for example, the key value 20 in the page P4 is the in-page Max key value) is stored. Each leaf page has a range of keys in charge of storage, and is indicated by the in-page Max key value of the corresponding page and the page located on the left side thereof. For example, the range of keys that the page P5 is responsible for storing is a key that is greater than the in-page Max key value 20 of the page P4 on the left side of the page P5 and less than or equal to the in-page Max key value 40 of the page P5. Similarly, the ranges of keys assigned to pages P6 and P7 are keys greater than 40 and less than 70, and keys greater than 70, respectively. The page P4 having no page located on the left side is in charge of a key equal to or less than the Max key value in the page (20 or less).
[0016]
Above the leaf page, a page called an upper page (page P1, page P2 and page P3 in FIG. 7, 701, also called a node) is arranged. The upper page stores a pair of pointers and key values to one or more immediately below pages, and a pointer to the right page (if any). The key value here matches the in-page Max key value of the page pointed to by the paired pointer. In particular, the page P1 is called a root page. In order to search for a leaf page in which a certain key value is stored, it is only necessary to access from the root page and trace a pointer paired with a minimum key value equal to or greater than the target key value. The area is secured on a page basis.
[0017]
Here, a deletion process in which a key value in the range of key values 20 to 40 is designated will be described with reference to FIG. First, the IX mode lock is set for the entire B-tree index T, the lock is set for the root page P1 in the S mode, and the key value is 20 or more, which is the lower limit of the specified range, in the page P1. A pointer to the page P2 paired with the key value 40 that is the minimum key value is acquired, and the lock of the page P1 is released. A lock is set for the page P2 in the S mode, and similarly, a pointer to the page P4 that is paired with the key value 20 that is the key value 20 or more and is the minimum key value in the page P2, The lock of page P2 is released. Then, the lock is set for the page P4 in the X mode, and all the key values in the range of the key values 20 to 40 to be deleted in the page P4 are deleted.
[0018]
At this time, since only the key value 20 exists in the page P4, no key value remains in the page, but the area of the page P4 is not released. The main reason is that in order to release the area, it is necessary to reset the pointer to the page to be released while setting an appropriate lock, which leads to deterioration of parallel execution.
[0019]
Further, since the Max key value in the page of page P4 is 20, it can be seen that a key value larger than 20 is stored in the right page in the range of key values 20 to 40 to be deleted. A pointer to the page (pointer to page P5) is acquired, and the lock of page P4 is released. An X mode lock is set for page P5, and all key values in the range of key values 20 to 40 to be deleted in page P5 are deleted. At this time, since only the key value 40 exists in the page P5, no key value remains in the page, but the area of the page P5 is not released. Since the Max key value in the page of page P5 is 40, all the keys in the range of key values 20 to 40 can be deleted. The page P5 is unlocked, and finally the entire B-tree index T is unlocked to complete the deletion process. A state where the deletion process is completed is shown in FIGS.
[0020]
A procedure for performing the insertion process (key value 60) from the state of FIGS. 7 and 702 will be described with reference to FIGS. Set the IX mode lock for the entire B-tree index T, access the pages P1 and P3 and the page in the same way as described above, and set the X mode lock for the page P6. Access page P6. It is assumed that the data of the key values 50 and 70 are already stored in the page P6 and there is not enough space for storing the data of the key value 60. In this case, page division processing called split is performed. First, a new page is secured (referred to as page P8). Here, it is assumed that the division key value is 50. In other words, the data of the key value 50 is left on the page P6, and the data of the key value 70 and the data of the key value 60 to be inserted are moved to a newly reserved page area. Make necessary settings for page P8, reset the Max key value in page P6 to 50, reset the right page pointer to page P8, etc., and then unlock page P6. The page P3 is locked in the X mode, the pointer is reset, the page P3 is unlocked, and finally the entire B-tree index T is unlocked to complete the insertion process. A state where the insertion processing is completed is shown in FIGS.
[0021]
As described above, in the B-tree index, in order to maintain high parallel executability, even if there is no data in the page due to data deletion, the page area is not released. For this reason, the storage efficiency generally decreases as data insertion / deletion is repeated, and the access performance deteriorates accordingly. In order to suppress the performance degradation, generally, a process (reorganization process) is performed in which index access is prohibited at an appropriate time, the data stored in the index is output to a temporary area, and the data is repacked. .
[0022]
As described above, the conventional technique 2 does not lock two pages at the same time. Therefore, the possibility of parallel execution is high. On the other hand, there is a possibility that an erroneous page reference as described in the prior art 1 may occur. Therefore, even if data is deleted, the area cannot be subsequently released.
[0023]
[Problems to be solved by the invention]
As can be seen from the description of the prior art 1 and the prior art 2 as described above, there is a trade-off between the ability to release the area in the data deletion process and the high parallel execution performance. It was thought.
[0024]
An object of the present invention is to have a data structure in which a plurality of objects are associated with each other by a pointer, and in a system in which a plurality of processes for referencing, updating, inserting and deleting objects operate in parallel, the parallel execution of reference, update and insertion And deletion processing can be executed in parallel with reference, update, and insertion processing.
[0025]
Furthermore, storage efficiency and access efficiency decrease due to repeated insertion and deletion of data (the number of objects that have been deleted but the area is not released increases, or the object passes through an object that is unnecessary to access the target object. In other words, a free object area is recovered without inhibiting data reference, update, and insertion, and storage efficiency and access efficiency are improved.
[0026]
[Means for Solving the Problems]
In reference, update, and insert processing, when moving between objects by following the pointer, the lock on the object before the movement is released, and then the reference, update, and insertion are executed in parallel by releasing the lock on the object after the movement. Increase sex. At this time, the IS mode (in the case of reference processing) or the IX mode (in the case of update and insertion processing) is set for the object group at the beginning of the processing, and the lock is released when the processing is completed.
On the other hand, in the deletion process, after the pointer to the deletion target is separated or replaced, the area of the deletion target object is released after all the processes for acquiring the lock on the object group are completed.
[0027]
DETAILED DESCRIPTION OF THE INVENTION
(Embodiment 1)
An example of a system configuration for realizing the present invention is shown in FIG. The system configuration example shown here is common to the first to third embodiments. This system includes a computer system 1 having a processor 2 and a memory 3, an external storage device 4 connected thereto, and a plurality of terminals 7 connected to the computer system 1 via a network 6.
[0028]
A data management system 10 expressed in the form of a program that can be interpreted by the processor 2 is arranged in the memory 3, and instructions are read and processed by the processor 2. The data management system 10 includes a system control unit 11, an object management unit 12, and a lock management unit 13. The system control unit 11 receives a reference, insertion, update, and deletion request from the terminal 7, analyzes the request content, passes control to the object management unit 12, and returns a processing result to the terminal 7 through the network 6. The object management unit 12 manages the object 5 stored in the external storage device 4 in accordance with the instruction given from the system control unit 11. The lock manager 12 provides the object manager 12 with a lock function for the specified resource.
[0029]
In FIG. 1 used for the description in the prior art 1, an example of a method in which parallel execution of reference, update, and insertion is higher, and deletion processing can be referred to, updated, and inserted can be executed in parallel with FIG. 3 and FIG. 4. Disclose.
[0030]
3 and 301 are time charts showing reference processing in the present embodiment. Compared to FIGS. 2 and 201, the unlocking timing of the object A and the S mode locking timing of the object B are switched. That is, conventionally, the lock is set for the object A, the value of the pointer to the object B is stored, the lock is set for the object B, and then the lock for the object A is released. On the other hand, in this embodiment, if the lock is set for the object A and the value of the pointer to the object B is stored, the lock for the object A is released. Then, lock is set for the object B. 3 and 302 are time charts showing the insertion processing in the present embodiment. This is the same as FIG.
[0031]
3 and 304 are time charts showing the update processing in the present invention. Compared to FIGS. 2 and 204, the unlocking timing of the object A and the X mode locking timing of the object B are switched.
[0032]
3 and 303 are time charts showing the deletion processing in the present invention. 2 and 204 are significantly different, and will be described with comparison. The setting of the IX mode lock for the object group T and the setting of the X mode lock for the object A are the same, but thereafter, all processes that have acquired the lock for the object group T are stored. Thereafter, the pointer to the object C to be deleted is separated from the object A, but in this embodiment, the completion of all the stored processes is awaited here. As a method of waiting for completion, a method of notifying the deletion processing of completion from the processing side that has set the lock on the object group T at the time of releasing the lock, and checking the completion of processing of other processing at regular intervals There is a way to do it. After the completion of all the stored processes can be detected using any method, the area of the object C is released.
[0033]
Since there is no possibility that another process accesses the released area, there is no need to set a lock on the object C. The reason will be described with reference to FIG. FIG. 4 shows that the deletion process 401, the reference process 402, the insertion process 403, the update process 404, and the update process 405 are performed in parallel. At 406, that is, immediately after setting the lock on the object A in the X mode in the deletion process 401, the process that does not set the lock on the object group T (in this case, the update process 404 and the update process 405) Inaccessible. This is because it is necessary to access the object A at the time when the pointer to the object C is set before accessing the object C, but the deletion process 401 is held in the X mode, so the update process 404 and the update process 405 are performed. When the object A can be seen, the pointer to the object C is cut off. The reference process 402 and the update process 403 may acquire data by looking at the object C because it is possible to detect that these processes have been completed.
[0034]
The IS mode and the IX mode are examples, and a lock mode equivalent to the set or a lower parallel execution capability can be used instead.
[0035]
By the above processing method, the parallel execution performance of the reference, insertion and update processing is enhanced as compared with the conventional processing, and other processes are prevented from erroneously accessing the area released by the deletion processing. More specifically, in the above embodiment, in the reference, insertion, and update processes, one process does not lock two objects at the same time, so that high parallel execution performance equivalent to that of the prior art can be realized. In the deletion process, after detaching the pointer, the area of the deleted object is released after waiting for the completion of other processes that lock the object group that is the target of the deletion process. The area can be released without obstructing the execution of other processes.
[0036]
(Embodiment 2)
A second embodiment will be disclosed with reference to FIGS. 5 and 6.
5 and 501 are data structures typically used in the case where data corresponding to a certain hash value is managed by a chain (here, the hash function is defined as a remainder obtained by dividing the key value by 10; It is assumed that this is the part that manages the key and data with hash value = 2). A procedure when a deletion process of the key value 32 and an insertion process of the key value 12 are requested for the data structure in this state will be described with reference to a time chart of each process shown in FIG.
[0037]
In the deletion process 601 in FIG. 6, a deletion request is made for the object B. First, the IX mode lock is set for the object group T, and the lock is set for the object A in the X mode. A pointer to the object B stored in the object A is acquired, an X mode lock is set for the object B (while holding the lock for the object A), and the object B is accessed. Confirm that there is an object B, that is, an object with a key value of 32, and store all the processes that have set the lock for the object group T at this time (the insertion process 602 is also executed in parallel at this time). It is assumed that a lock is set for the object group T). The pointer to the object B stored in the object A is reset to the pointer stored in the object B (pointer to the object C) (pointer replacement), and the locks of the objects A and B are released (see FIG. 5, 502), waiting for completion of the stored processing.
[0038]
On the other hand, in the insertion process 602, the lock of the IX mode is set for the object group T, the object area for insertion is secured (object D), and the key value 12 and related data are set. Subsequently, a lock is set for the object A in the X mode (if the deletion process is in the lock state, it will wait until the release), the pointer stored in the object A is set as a pointer to the object D, The pointer from the object A is changed to point to the object D, the lock of the object A is released, and finally the lock of the object group T is released, and the insertion process is completed (503 in FIG. 5).
[0039]
By releasing the lock of the object group T in the insert process 602, the delete process 601 releases the area of the object B (without setting the lock), releases the lock of the object group T, and completes the delete process (see FIG. 5, 504).
[0040]
Next, the processing procedure of the reference process (key value 62) 603 will be described. First, the IS mode lock is set for the object group T, and the object whose key value is 62 is searched by following the pointer sequentially from the object A. When moving between objects, the lock of the movement source object is released, and then the movement destination object is locked in the S mode. When operating in parallel with the deletion process 601, if the state when the object A is accessed is the state shown in FIGS. 5 and 502, the object B is not accessed and the pointer points to the object C. Is remembered. Therefore, the process surrounded by the dotted line in FIG. The process surrounded by the dotted line 603 is executed when the object B is still in the state 501. At this time, the pointer to the object B is stored by accessing the object A, and the pointer to the object C is stored by the process surrounded by the dotted line. In this way, the processing changes depending on the reference timing.
[0041]
Next, the processing procedure of the update process (key value 62) 604 will be described. First, the lock of the IX mode is set for the object group T, the object whose key value is 62 is searched in order from the object A, and when it is found, the associated data is updated. When moving between objects, the lock of the movement source object is released, and then the lock of the movement destination object is set in the X mode. When operating in parallel with the deletion process 601 described above, if the state when the object A is accessed is the state shown in FIGS. 5 and 502, the object B is not accessed, and the dotted line in FIGS. The process surrounded by is not performed.
[0042]
According to the processing method, high parallel execution of reference, insertion, and update processing can be realized without erroneously accessing the area released by the deletion processing. Furthermore, in the data management using the hash function, as in the first embodiment, in the reference, insertion, and update processes, one process does not set locks on two objects at the same time and is highly parallel. In the deletion process, after detaching the pointer to the object to be deleted, waiting for the completion of the other process that locks the object group and releasing the area, the other process is executed. The area can be released without impeding execution and without using wrong data.
[0043]
(Embodiment 3)
A free page collection processing method that can be executed in parallel with data deletion and data insertion processing in the B-tree index described in the prior art 2 will be disclosed with reference to FIGS. It is assumed that the free page collection process is executed instead of reorganization at an appropriate time when the storage efficiency is lowered while the data insertion / deletion is repeated and the access performance is deteriorated accordingly.
[0044]
FIG. 8 and 803 show the processing procedure when the empty page collection processing is executed in the state of FIGS. First, a lock is set in the IX mode for the entire B-tree index T. In the following description, the mode for locking the page is described in []. Next, the page is traced from the root page toward the leftmost leaf page (pages P1 [S], P2 [S] and P4 [X]). After confirming that the number of data items is 0 on the leaf page P4, a flag indicating that the data is scheduled to be collected (FIG. 7, 704, a symbol with “times” in a round frame in the page P4) is set. Subsequently, the page P2, which is the upper page of the page P4, is accessed [X], and the pointer to the page P4 is separated (704 in FIG. 7). Then, the page P5 which is the page on the right side of the page P4 is accessed [X], it is confirmed that the number of data is 0, and a flag indicating that the data is scheduled to be collected is set. Next, it accesses [X] the page P2, which is the upper page, and confirms that no key remains in the page P2 when the pointer to the page P5 is cut off. Set the flag. Subsequently, the page P1, which is the upper page of the page P2, is accessed [X], and the pointer to the page P2 is disconnected (705 in FIG. 7). The page P6 which is the page on the right side of the page P5 is accessed [X] to confirm that the number of data is one or more, and the page P8 which is the page on the right side of the page P6 is accessed [X] and the number of data is 1 Confirm that the number is more than the number, access page X7 on the right side of page P8 and check that the number of data is one or more, set flag of recoverable page and detach the pointer Is completed. At this time, the process that sets the lock for the entire B-tree index T is stored, and the completion of those processes is awaited. When all the stored processes are completed, the areas of the pages P2, P4, and P5 that are scheduled to be collected are released, and finally the entire B-tree index T is unlocked to complete the free page collection process (FIGS. 7 and 706). .
[0045]
In the final form obtained by the above-described empty collection processing method, the right page takes over the key for which the area released page is responsible for storage. For example, page P6 is responsible for data with a key value of 50 or less. Accordingly, in the reference, insertion, and update processing, when it is detected that the collection schedule flag is set for the accessed page, the processing is partially changed so that the page is moved to the right side and accessed.
[0046]
By the processing method described so far, even in the B-tree index, the page area that is free without significantly impairing the parallel execution of reference, insertion, and update processing and without inhibiting data reference, update, and insertion It is possible to improve storage efficiency and access efficiency.
[0047]
As described in the above-described embodiment, in a system having a data structure in which a plurality of objects are associated by pointers and a plurality of processes for referencing, updating, inserting and deleting objects operate in parallel, referencing and updating In addition, it is possible to perform parallel processing of insertion and parallel execution with reference to the update processing, insertion processing, and insertion processing.
[0048]
In addition, for B-tree indexes whose storage and access efficiencies have decreased due to repeated insertion and deletion of data, pages that are empty without inhibiting data reference, updating, and insertion, or using temporary resources It is possible to improve the storage efficiency and the access efficiency.
[0049]
【The invention's effect】
According to the present invention, parallel execution of reference, insertion, and update processing is possible, and it is possible to release (recover) after deletion processing by avoiding other processing from accidentally accessing an area released by deletion processing. It is said.
[Brief description of the drawings]
FIG. 1 is a diagram showing a data structure in Conventional Technology 1 and Embodiment 1. FIG.
FIG. 2 is a diagram showing a time chart in prior art 1;
FIG. 3 is a diagram showing a time chart in the first embodiment of the present invention.
FIG. 4 is a diagram showing a state of parallel processing in Embodiment 1 of the present invention.
FIG. 5 is a diagram showing a data structure in Embodiment 2 of the present invention.
FIG. 6 is a diagram showing a time chart in the second embodiment of the present invention.
FIG. 7 is a diagram showing a data structure in the prior art 2 and the third embodiment of the present invention.
FIG. 8 is a time chart in the related art 2 and Embodiment 3 of the present invention.
FIG. 9 is a diagram showing an example of a system configuration for realizing the present invention.
[Explanation of symbols]
DESCRIPTION OF SYMBOLS 1 ... Computer system, 2 ... Processor, 3 ... Memory, 4 ... External storage device, 5 ... Object, 6 ... Network, 7 ... Terminal, 10 ... Data management system, 11 ... System control part, 12 ... Object management part, 13 ... lock management department

Claims (3)

コンピュータシステムのメモリ内にプログラムとして保持され、プロセッサにより実行されるデータ管理システムを演算処理するデータ処理方法において
前記データ管理システムは、
オブジェクト管理部と、
ロック管理部とを有し、
領域の確保および開放が一つのものとしておこなわれるデータ単位であるオブジェクトと、複数のオブジェクトより構成されるオブジェクトグループと、あるオブジェクトと次のオブジェクトを指し示し、あるオブジェクトから次のオブジェクトをアクセスすることができるようにするポインタとよりなるデータ構造を有し、
オブジェクトの参照、更新、挿入および削除の処理をおこなうときに、前記オブジェクトグループに対して、ロックを設定し、その後に、前記オブジェクトグループ内の特定のオブジェクトから、処理対象のオブジェクトまでの前記ポインタによって関連付けられたオブジェクトに対して、前記オブジェクトのロックを設定して、オブジェクトの参照、更新、挿入および削除の処理を複数並行して、前記データ管理システムにより動作させるデータ処理方法であって、
前記ロック管理部のプログラムが前記プロセッサにより演算処理されることによって実行されて、削除処理をおこなうときに、前記オブジェクトグループに第1のロックを設定する第1のステップと、
前記ロック管理部のプログラムが前記プロセッサにより演算処理されることによって実行されて、前記オブジェクトグループ内の特定のオブジェクトから、削除処理をおこなう削除対象オブジェクトまでの前記ポインタによって関連付けられたオブジェクトに対して、第2のロックを設定する第2のステップと、
前記オブジェクト管理部のプログラムが前記プロセッサにより演算処理されることによって実行されて、削除処理をおこなう削除対象オブジェクトの属する前記オブジェクトグループのオブジェクトにロックを取得している前記削除処理以外の全ての処理の情報を記憶する第3のステップと、
前記オブジェクト管理部のプログラムが前記プロセッサにより演算処理されることによって実行されて、削除処理をおこなう削除対象オブジェクトをポインタするオブジェクトから、前記削除対象オブジェクトをポイントしないようにする第4のステップと、
前記オブジェクト管理部のプログラムが前記プロセッサにより演算処理されることによって実行されて、前記オブジェクトグループに対してロックを取得している前記削除処理以外の全ての処理が完了したことを判断する第5のステップと、
前記オブジェクト管理部のプログラムが前記プロセッサにより演算処理されることによって実行されて、前記全ての処理が完了したと判断したときに、前記削除対象オブジェクトの領域を解放する第6のステップとを具備することを特徴とするデータ処理方法。
In a data processing method for performing arithmetic processing on a data management system held as a program in a memory of a computer system and executed by a processor,
The data management system includes:
An object manager,
A lock management unit,
It is possible to access the next object from one object by pointing to one object and the next object, an object group consisting of multiple objects, an object that is a data unit in which the area is secured and released as one thing Has a data structure consisting of a pointer that allows
When performing object reference, update, insertion, and deletion processing, a lock is set for the object group, and thereafter, a specific object in the object group is moved to the object to be processed by the pointer. A data processing method for setting an object lock on an associated object and causing the data management system to operate a plurality of object reference, update, insertion, and deletion processes in parallel.
A first step of setting a first lock on the object group when the program of the lock management unit is executed by the arithmetic processing by the processor and performing a deletion process;
For the object associated with the pointer from the specific object in the object group to the object to be deleted to be deleted, the program of the lock management unit is executed by being processed by the processor . A second step of setting a second lock;
All processes other than the deletion process that are executed when the program of the object management unit is arithmetically processed by the processor to acquire the lock on the object of the object group to which the deletion target object that performs the deletion process belongs. A third step of storing information;
A fourth step in which the program of the object management unit is executed by an arithmetic processing performed by the processor and prevents the deletion target object from being pointed to from the object that points to the deletion target object to be deleted;
The object management unit program is executed as a result of arithmetic processing by the processor, and it is determined that all processes other than the deletion process for acquiring a lock on the object group have been completed. Steps,
And a sixth step of releasing the area of the object to be deleted when the program of the object management unit is executed by arithmetic processing by the processor and it is determined that all the processes are completed. A data processing method.
前記第5のステップにおいて、前記オブジェクト管理部のプログラムが、前記オブジェクトグループにロックを取得している前記削除処理以外の処理から処理完了通知を受けることを特徴とする請求項1記載のデータ処理方法。The data processing method according to claim 1, wherein in the fifth step, the program of the object management unit receives a process completion notification from a process other than the deletion process that has acquired a lock on the object group. . 前記オブジェクト管理部のプログラムが前記プロセッサにより演算処理されることによって実行されて、あるオブジェクトに対して、参照、更新、挿入および削除の処理を実行する場合に、前記オブジェクトグループの基点となる特定のオブジェクトから、前記ポインタを順次たどって、処理を実行するオブジェクトを検索することを特徴とする請求項1記載のデータ処理方法。When the program of the object management unit is executed by the arithmetic processing by the processor , and a reference, update, insertion and deletion process is executed for a certain object, a specific point serving as a base point of the object group 2. The data processing method according to claim 1, wherein the object to be processed is searched by sequentially tracing the pointer from the object.
JP2002073540A 2002-03-18 2002-03-18 Data processing method Expired - Lifetime JP4139613B2 (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
JP2002073540A JP4139613B2 (en) 2002-03-18 2002-03-18 Data processing method
US10/152,439 US20030177131A1 (en) 2002-03-18 2002-05-20 Data processing method, data processing apparatus, and data processing program
US12/192,947 US7818749B2 (en) 2002-03-18 2008-08-15 Data processing method, data processing apparatus, and data processing program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2002073540A JP4139613B2 (en) 2002-03-18 2002-03-18 Data processing method

Publications (2)

Publication Number Publication Date
JP2003271436A JP2003271436A (en) 2003-09-26
JP4139613B2 true JP4139613B2 (en) 2008-08-27

Family

ID=28035249

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002073540A Expired - Lifetime JP4139613B2 (en) 2002-03-18 2002-03-18 Data processing method

Country Status (2)

Country Link
US (2) US20030177131A1 (en)
JP (1) JP4139613B2 (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7321898B1 (en) * 2002-04-04 2008-01-22 Ncr Corp. Locking mechanism for materialized views in a database system
JP5007176B2 (en) * 2007-08-09 2012-08-22 ボッシュ株式会社 Data update processing method and vehicle motion control device
JP5343399B2 (en) * 2008-05-22 2013-11-13 富士通株式会社 Management program, management method, and management apparatus
WO2012111119A1 (en) * 2011-02-17 2012-08-23 株式会社 日立製作所 Information processing method, information processing device, and program recording medium
JP6036692B2 (en) * 2011-07-29 2016-11-30 日本電気株式会社 Information processing apparatus, information processing system, information processing method, and control program recording medium
CN102495753B (en) * 2011-10-21 2013-10-23 江苏省交通科学研究院股份有限公司 Interactive computer-aided design (CAD) engineering drawing batch processing method
JP6680871B2 (en) * 2016-04-13 2020-04-15 株式会社日立製作所 Computer and database management method
US20180260255A1 (en) * 2017-03-10 2018-09-13 Futurewei Technologies, Inc. Lock-free reference counting
KR102105687B1 (en) * 2018-01-31 2020-04-28 울산과학기술원 Apparatus and method of providing lock-free reading

Family Cites Families (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5551028A (en) * 1991-02-28 1996-08-27 Mentor Graphics Corporation Design data management system and associated method
US5553267A (en) * 1992-07-01 1996-09-03 Digital Equipment Corporation Method and apparatus for coordinating access to and modifying multiple element data objects in a shared memory
US5551025A (en) * 1994-11-30 1996-08-27 Mci Communications Corporation Relational database system for storing different types of data
US6973656B1 (en) * 1995-08-16 2005-12-06 International Business Machines Corporation Method and apparatus for linking data in a distributed data processing system
US6574654B1 (en) * 1996-06-24 2003-06-03 Oracle Corporation Method and apparatus for lock caching
US5832484A (en) * 1996-07-02 1998-11-03 Sybase, Inc. Database system with methods for parallel lock management
US5949083A (en) * 1997-03-18 1999-09-07 Transnucleaire Container comprising a forged steel body of non-circular cross-section for nuclear fuel assemblies
US5940083A (en) * 1997-04-01 1999-08-17 Novell, Inc. Multi-curve rendering modification apparatus and method
JPH1196159A (en) * 1997-09-22 1999-04-09 Matsushita Electric Ind Co Ltd Hypertext editing device
US6026401A (en) * 1997-10-14 2000-02-15 International Business Machines Corporation Locking tool data objects in a framework environment
US5995998A (en) * 1998-01-23 1999-11-30 Sun Microsystems, Inc. Method, apparatus and computer program product for locking interrelated data structures in a multi-threaded computing environment
US6272491B1 (en) * 1998-08-24 2001-08-07 Oracle Corporation Method and system for mastering locks in a multiple server database system
GB2342198B (en) * 1998-10-02 2003-10-22 Ibm Composite locking of objects in a database
US6343296B1 (en) * 1999-09-03 2002-01-29 Lucent Technologies Inc. On-line reorganization in object-oriented databases
US6792601B1 (en) * 2000-05-18 2004-09-14 International Business Machines Corporation Multiple mode object locking method and system
US6735760B1 (en) * 2000-11-08 2004-05-11 Sun Microsystems, Inc. Relaxed lock protocol
US8032886B2 (en) * 2000-11-22 2011-10-04 Microsoft Corporation Tracking asynchronous execution of program using hierarchical structure of objects

Also Published As

Publication number Publication date
US7818749B2 (en) 2010-10-19
US20030177131A1 (en) 2003-09-18
US20080320494A1 (en) 2008-12-25
JP2003271436A (en) 2003-09-26

Similar Documents

Publication Publication Date Title
US11429641B2 (en) Copying data changes to a target database
KR102450281B1 (en) Assignment and reallocation of unique identifiers for synchronization of content items
US9953051B2 (en) Multi-version concurrency control method in database and database system
KR100862661B1 (en) Method for deferred logging and apparatus thereof
US7702660B2 (en) I/O free recovery set determination
US9881041B2 (en) Multiple RID spaces in a delta-store-based database to support long running transactions
US9367346B2 (en) Accelerating distributed transactions on key-value stores through dynamic lock localization
US10990628B2 (en) Systems and methods for performing a range query on a skiplist data structure
US9020916B2 (en) Database server apparatus, method for updating database, and recording medium for database update program
US20080071809A1 (en) Concurrency control for b-trees with node deletion
EP3754517A1 (en) Cross-acl multi-master replication
US20090183159A1 (en) Managing concurrent transactions using bloom filters
WO2006127402A1 (en) Version-controlled cached data store
US9460144B2 (en) Lock acceleration
US8954407B2 (en) System and method for partially deferred index maintenance
US20150142749A1 (en) Method and system for a safe archiving of data
JP3611295B2 (en) Computer system, memory management method, and storage medium
US7818749B2 (en) Data processing method, data processing apparatus, and data processing program
US8458511B2 (en) Fault isolation using code paths
Basin et al. KiWi: A key-value map for scalable real-time analytics
JPH08328933A (en) File access control system for parallel processing system
JP4126843B2 (en) Data management method and apparatus, and recording medium storing data management program
US11243882B2 (en) In-array linked list identifier pool scheme
JP2004341926A (en) Database management system and database management program
CN114328591A (en) Transaction execution method, device, equipment and storage medium

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20040720

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20071204

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20080204

RD02 Notification of acceptance of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7422

Effective date: 20080204

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20080226

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20080417

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

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20080609

R150 Certificate of patent or registration of utility model

Ref document number: 4139613

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

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20110613

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20120613

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20120613

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20130613

Year of fee payment: 5

EXPY Cancellation because of completion of term