JP2002334004A - Transaction managing device - Google Patents

Transaction managing device

Info

Publication number
JP2002334004A
JP2002334004A JP2001138564A JP2001138564A JP2002334004A JP 2002334004 A JP2002334004 A JP 2002334004A JP 2001138564 A JP2001138564 A JP 2001138564A JP 2001138564 A JP2001138564 A JP 2001138564A JP 2002334004 A JP2002334004 A JP 2002334004A
Authority
JP
Japan
Prior art keywords
record
update
variable
contents
switch
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.)
Granted
Application number
JP2001138564A
Other languages
Japanese (ja)
Other versions
JP4027055B2 (en
Inventor
Hideo Yamamoto
英雄 山本
Masahiro Morita
昌宏 森田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nippon Telegraph and Telephone Corp
Original Assignee
Nippon Telegraph and Telephone Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nippon Telegraph and Telephone Corp filed Critical Nippon Telegraph and Telephone Corp
Priority to JP2001138564A priority Critical patent/JP4027055B2/en
Publication of JP2002334004A publication Critical patent/JP2002334004A/en
Application granted granted Critical
Publication of JP4027055B2 publication Critical patent/JP4027055B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

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

Abstract

PROBLEM TO BE SOLVED: To provide a transaction managing device which eliminates the need for a recovery process, conserves resources and energy, and can be actualized speedily. SOLUTION: A start request for update and the ID of a variable (i) are received from a host device and an update starting device confirms that no other devices is in updating operation by using an update counter C, copies variables 1 to (n) that a switch S indicates to a record saving area RS, and sends the contents of the variable (i) copied in the RS to the host device, but when some other host device is in updating operation, the contents of the variable (i) in the RS are sent to the host device; and an end request for the update and the contents M of the variable (i) having been updated are received from the host device. An update ending device stores the variable (i) stored in a record in the RS and confirms that no other host device is updating the variable by using the C, copies the contents of the record in the RS to the opposite record from the record that the S indicates, and changes the S so that the opposite record is indicated.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、複数のトランザク
ションを同時不可分に行うトランザクション管理装置に
関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a transaction management apparatus for simultaneously executing a plurality of transactions inseparably.

【0002】[0002]

【従来の技術】あるトランザクション処理が複数のトラ
ンザクションに跨って行われる場合がある。例えば、残
高を管理する変数を更新するトランザクション(以後、
「Tr1」という)があって、さらにポイント(例えば、
商品の購入額に応じたポイント)を管理する変数を更新
するトランザクション(以後、「Tr2」という)があっ
たとする。ある商品を購入するトランザクション(以
後、「Tr3」という)があったとすると、Tr3の中では、
購入代金をTr1によって行い、さらに、Tr2によってポイ
ントを更新するとする。
2. Description of the Related Art There is a case where a certain transaction process is performed over a plurality of transactions. For example, a transaction that updates a variable that manages the balance (hereafter,
"Tr1") and points (for example,
It is assumed that there is a transaction (hereinafter, referred to as “Tr2”) for updating a variable for managing points according to the purchase amount of a product. If there is a transaction to purchase a certain product (hereinafter “Tr3”),
Suppose that the purchase price is made by Tr1, and the points are updated by Tr2.

【0003】このとき、商品の購入処理(Tr3)は同時不
可分の処理でなくてはならない。つまり、Tr1〜Tr3のす
べてのトランザクションが完全に実行されるか全く実行
されないかということが保証される必要がある。なぜな
らば、Tr3の処理の中でTr1,Tr2が実行されたとき、その
うちどれかが失敗すると、代金を減額したにもかかわら
ずポイントが増えない事態や、代金を減額し、ポイント
も増加したのに商品は購入されていないといった事態が
生じるからである。つまり、商品を購入して、代金が
減額されて、ポイントが増加した状態か、商品が購入
されないで、代金も減額されず、ポイントも増加しない
という2つの状態のみが発生するように保証する必要が
ある。
At this time, the product purchase process (Tr3) must be a simultaneous inseparable process. That is, it is necessary to ensure that all the transactions of Tr1 to Tr3 are executed completely or not at all. Because, when Tr1 and Tr2 were executed during the processing of Tr3, if any of them failed, the point was not increased even though the price was reduced, or the price was reduced and the points increased. This is because a situation occurs in which the product is not purchased. In other words, it is necessary to guarantee that the product is purchased and the price is reduced and points are increased, or that there are only two states in which the product is not purchased, the price is not reduced and the points do not increase. There is.

【0004】従来の技術では、まず、Tr1〜Tr3の処理を
行う前に、更新される変数のすべてをバックアップ保存
し、その上で変数の更新を行うという手順が取られてい
る。この方法では、Tr1〜Tr3のうちの一つでも処理に失
敗した場合は、バックアップを変数に書き戻すという処
理(リカバリ処理)を行うことにより、処理を開始する
以前の状態に戻すことができ、これによりTr1〜Tr3のす
べての実行を同時不可分とすることができる。Tr1〜Tr3
の処理シーケンス例を図22に示し、上位装置と接続さ
れたトランザクション管理装置の構成図を図23に示
す。
[0004] In the prior art, first, before performing the processing of Tr1 to Tr3, all the updated variables are backed up and then the variables are updated. In this method, if even one of Tr1 to Tr3 fails, the backup can be written back to a variable (recovery process) to return to the state before the process was started. As a result, all executions of Tr1 to Tr3 can be made simultaneously inseparable. Tr1 to Tr3
FIG. 22 shows an example of the processing sequence of FIG. 22, and FIG. 23 shows a configuration diagram of the transaction management device connected to the higher-level device.

【0005】上位装置は各トランザクションを実行する
装置である。また、トランザクション管理装置はコミッ
トバッファモニタとコミットバッファとデータ記憶領域
から構成される。コミットバッファは変数のバックアッ
プを格納するために不揮発性記憶領域上に設けられる領
域である。コミットバッファモニタは、更新前に更新の
対象となるすべてのバックアップを作成するための機能
である。図22のシーケンスを図23の装置を用いて実
行すると以下のようになる。 1.Tr3を行う上位装置はトランザクション管理装置に
対してトランザクションを開始することを宣言する。 2.トランザクション管理装置ではTr3で更新される変
数のバックアップをコミットバッファ上に作成する。 3.Tr3を行う上位装置は購入履歴を更新し、支払を行
うためにTr1を実行する上位装置を呼び出す。購入履歴
の更新に失敗した場合は13.に移行する。 4.Tr1を実行する上位装置はトランザクション管理装
置に対してトランザクションを開始することを宣言す
る。 5.トランザクション管理装置ではTr1で更新される変
数のバックアップをコミットバッファ上に作成する。残
高の更新に失敗した場合は13.に移行する。 6.Tr1を実行する上位装置は残高を更新し、ポイント
を増やすためにTr2を実行する上位装置を呼び出す。 7.Tr2を実行する上位装置はトランザクション管理装
置に対してトランザクションを開始することを宣言す
る。 8.トランザクション管理装置ではTr2で更新される変
数のバックアップをコミットバッファ上に作成する。 9.Tr2を行う上位装置はポイントを増やし、更新が成
功したらトランザクション管理装置に対してトランザク
ションの完了を宣言し、Tr1を行う上位装置へ制御を戻
す。ポイントの更新に失敗した場合は13.に移行す
る。 10.Tr1では自分の処理とTr2が終了した、すなわち残
高の更新とポイントの更新が完了したので、トランザク
ション管理装置に対して自トランザクションTr1の完了
を宣言し、Tr3を実行する上位装置へ制御を戻す。 11.Tr3ではTr1が終了した、すなわち購入履歴の更新
と残高の更新とポイントの更新が完了したので、トラン
ザクション管理装置に対してトランザクションの完了を
宣言する。 12.トランザクション管理装置はすべてのトランザク
ションが終了した、すなわち、Tr1〜Tr3のすべてのトラ
ンザクションが完全に実行されたのですべてのバックア
ップを削除する。 13.1〜11のいずれかの処理で失敗した場合は、コ
ミットバッファ上のバックアップを書き戻すことによっ
てすべての変数の状態を以前の状態に戻す。 以上のような処理によって、すべてのトランザクション
が完全に実行されるか全く実行されないかということ、
つまり同時不可分の処理を実現する。
[0005] The host device is a device that executes each transaction. Further, the transaction management device includes a commit buffer monitor, a commit buffer, and a data storage area. The commit buffer is an area provided on a nonvolatile storage area for storing a backup of a variable. The commit buffer monitor is a function for creating all backups to be updated before updating. When the sequence in FIG. 22 is executed using the apparatus in FIG. 23, the following is performed. 1. The host device that performs Tr3 declares that a transaction is to be started to the transaction management device. 2. The transaction management device creates a backup of the variable updated in Tr3 on the commit buffer. 3. The upper device that performs Tr3 updates the purchase history and calls the upper device that performs Tr1 to make payment. If the update of the purchase history has failed, the procedure shifts to 13. 4. The host device that executes Tr1 declares that a transaction is to be started to the transaction management device. 5. The transaction management device creates a backup of the variable updated in Tr1 on the commit buffer. If the update of the balance has failed, the process proceeds to step 13. 6. The host device executing Tr1 updates the balance and calls the host device executing Tr2 to increase the points. 7. The host device executing Tr2 declares that a transaction is to be started to the transaction management device. 8. The transaction management device creates a backup of the variable updated in Tr2 on the commit buffer. 9. The higher-level device that performs Tr2 increases the points, and when the update is successful, declares the completion of the transaction to the transaction management device and returns control to the higher-level device that performs Tr1. If the point update has failed, the procedure moves to 13. 10. Tr1 completes its own processing and Tr2, that is, completes the update of the balance and the update of the points. Therefore, it declares the completion of its own transaction Tr1 to the transaction management apparatus, and returns control to the higher-level apparatus that executes Tr3. 11. In Tr3, since Tr1 has been completed, that is, the update of the purchase history, the update of the balance and the update of the points have been completed, the transaction management device is declared to have completed the transaction. 12. The transaction management device deletes all backups because all transactions have been completed, that is, all transactions of Tr1 to Tr3 have been completely executed. If any one of the processes from 13.1 to 11 fails, the state of all variables is returned to the previous state by writing back the backup on the commit buffer. Whether all transactions are executed completely or not at all,
That is, simultaneous inseparable processing is realized.

【0006】[0006]

【発明が解決しようとする課題】従来のトランザクショ
ン装置では更新の対象となる全ての変数のバックアップ
を取る必要があるため、その分の記憶領域が必要となり
更新対象の変数の数、組み合わせ・順序が複雑になる、
つまりトランザクションの数が多くなると、その分多く
の記憶領域を用意しておく必要がある。バックアップの
ためには少なくとも1回分の余分な記憶領域への書き込
みが必要となるが、一般的に不揮発性記憶領域への書き
込みには高い時間的コストが必要であるため高速な処理
を行うことが難しい。また、更新終了時にはバックアッ
プの削除も必要である。さらに、この装置で同時不可分
を可能とするためには、障害発生時にいずれかの更新が
失敗した際にすべてのバックアップを書き戻すリカバリ
機能が必須であるが、更新対象の変数の数、組み合わせ
・順序が複雑になると複雑なリカバリ処理が必要とな
る。従って、上記理由により従来技術による省資源での
実現、高速な処理は困難である。
In the conventional transaction apparatus, since it is necessary to back up all variables to be updated, a storage area for the variables is required, and the number, combination, and order of the variables to be updated are reduced. Become complicated,
That is, as the number of transactions increases, it is necessary to prepare more storage areas. At least one extra write to the storage area is required for backup, but writing to the non-volatile storage area generally requires a high time cost, so that high-speed processing can be performed. difficult. At the end of the update, it is necessary to delete the backup. Furthermore, in order to enable simultaneous inseparability with this device, a recovery function that writes back all backups when any update fails in the event of a failure is essential, but the number, combination, and If the order becomes complicated, complicated recovery processing is required. Therefore, it is difficult to realize resource saving and high-speed processing according to the conventional technology for the above-described reason.

【0007】[0007]

【課題を解決するための手段】上記課題を解決するため
に、請求項1の発明は、任意の上位装置より、変数1〜
n(nは任意の整数)のうち1つ以上の変数に対して任
意の組み合わせ・順序でその内容の更新を指示されたと
き、その更新を同時不可分の処理とすることを可能とす
るトランザクション管理装置において、トランザクショ
ン管理装置は、更新開始装置、更新カウンタ、更新終了
装置、2本の変数1〜nを格納するレコード記憶領域を
有するメモリ、変数1〜nを格納するポインタレコード
退避領域を有するメモリ、2本のレコード記憶領域のい
ずれかを指すスイッチを備え、上位装置が変数i(1≦
i≦n)の更新を開始しようとするとき、開始要求を受
信し、更新開始装置は、他の上位装置が変数を更新中で
あるか否かを更新カウンタを用いて確認し、他の更新が
行われていないならば、更新カウンタを増加させ、スイ
ッチが指すレコード記憶領域の内容をポインタレコード
退避領域へコピーし、レコード退避領域上のレコードに
格納されている変数iの内容を上位装置へ送り、他の更
新が行われている最中ならば、更新カウンタを増加さ
せ、ポインタレコード退避領域上のレコードに格納され
ている変数iの内容を上位装置へ送り、上位装置が変数
iの更新を終了しようとしているとき、上位装置より終
了要求と更新された変数iの内容Mを受信し、更新終了
装置は、レコード退避領域上のレコードに格納されてい
る変数iに格納し、更新カウンタを減じ、他の上位装置
が変数を更新中でないことを更新カウンタを用いて確認
し、他の更新が行われていないならば、レコード退避領
域上のレコードの内容をスイッチが指すレコード記憶領
域とは逆のレコード記憶領域にコピーし、スイッチが現
在とは反対側のレコード記憶領域を指すよう変更するこ
とを特徴とする。
In order to solve the above-mentioned problems, the present invention according to claim 1 is a method in which a variable 1 to 4
Transaction management that, when instructed to update the contents of one or more variables out of n (n is an arbitrary integer) in an arbitrary combination and order, makes the update an inseparable process. In the apparatus, the transaction management device includes an update start device, an update counter, an update end device, a memory having a record storage area for storing two variables 1 to n, and a memory having a pointer record save area for storing variables 1 to n. And a switch that points to one of the two record storage areas, and the higher-level device stores a variable i (1 ≦
When an update of i ≦ n) is to be started, a start request is received, and the update start device checks whether or not another higher-level device is updating a variable by using an update counter. Is not performed, the update counter is incremented, the contents of the record storage area pointed to by the switch are copied to the pointer record save area, and the contents of the variable i stored in the record in the record save area are transferred to the higher-level device. If another update is being performed, the update counter is incremented, the contents of the variable i stored in the record in the pointer record save area are sent to the higher-level device, and the higher-level device updates the variable i. , The update end device receives the end request and the updated content M of the variable i from the higher-level device, and stores it in the variable i stored in the record on the record save area. The new counter is decremented, the update counter is used to confirm that no other host device is updating the variable, and if no other update has been performed, the record storage pointed to by the switch points to the contents of the record in the record save area. The copy is made to the record storage area opposite to the area, and the switch is changed to point to the record storage area on the opposite side to the present.

【0008】請求項2の発明は、任意の上位装置より、
変数1〜n(nは任意の整数)のうち1つ以上の変数に
対して任意の組み合わせ・順序でその内容の更新を指示
されたとき、その更新を同時不可分の処理とすることを
可能とし、さらにロールバックの指示によって更新の履
歴を遡ることを可能とするトランザクション管理装置で
あって、トランザクション管理装置は、更新開始装置、
更新カウンタ、更新終了装置、2本以上の変数1〜nを
格納するレコード記憶領域を有するメモリ、変数1〜n
を格納するポインタレコード退避領域を有するメモリ、
2本以上のレコード記憶領域を指すスイッチ、ロールバ
ック装置を備え、上位装置が変数i(1≦i≦n)の更
新を開始しようとするとき、上位装置より開始要求を受
信し、更新開始装置へ渡し、更新開始装置は、他の上位
装置が変数を更新中であるか否かを更新カウンタを用い
て確認し、他の更新が行なわれていないならば、更新カ
ウンタを増加させ、スイッチが指す、変数1〜nを格納
したレコード記憶領域の内容をレコード退避領域へコピ
ーし、レコード退避領域上のレコードに格納されている
変数iの内容を上位装置へ送り、他の更新が行われてい
る最中ならば、更新カウンタを増加させ、レコード退避
領域上のレコードに記憶されている変数iの内容を上位
装置へ送り、上位装置が変数iの更新を終了とすると
き、上位装置より終了要求と更新された変数iの内容M
を受信し、更新終了装置へ渡し、更新終了装置は、レコ
ード退避領域上のレコードに格納されている変数iにM
を記憶し、更新カウンタを減じ、他の上位装置が変数を
更新中でないことを更新カウンタを用いて確認し、他の
更新が行われていないならば、レコード退避領域上のレ
コードの内容をスイッチが指すレコード記憶領域の次の
レコード記憶領域にコピーし、スイッチの値を1つ増
し、現在の次のレコード記憶領域を指すように変更し、
また、任意の上位装置より、変数1〜nのうち1つ以上
の変数に対して任意の組み合わせ・順序でその内容の更
新した後にロールバックを指示されたとき、上位装置よ
り段数r(rは1以上の整数)を受信し、ロールバック
装置へ渡し、ロールバック装置は、現在のスイッチの値
よりrを減じ、スイッチの指すレコード記憶領域を変更
することを特徴とする。
[0008] According to a second aspect of the present invention, an arbitrary higher-level device
When one or more variables of variables 1 to n (n is an arbitrary integer) are instructed to update their contents in an arbitrary combination and order, the update can be performed as an inseparable process. A transaction management device that enables the update history to be traced back by a rollback instruction, wherein the transaction management device includes an update start device,
Update counter, update end device, memory having record storage area for storing two or more variables 1 to n, variables 1 to n
A memory having a pointer record save area for storing
A switch pointing to two or more record storage areas, a rollback device, and when the higher-level device attempts to start updating the variable i (1 ≦ i ≦ n), it receives a start request from the higher-level device, The update start device checks using the update counter whether or not another higher-level device is updating the variable, and if no other update has been performed, increments the update counter, and the switch The contents of the record storage area storing the indicated variables 1 to n are copied to the record save area, the contents of the variable i stored in the record in the record save area are sent to the higher-level device, and another update is performed. If it is during the update, the update counter is incremented, and the contents of the variable i stored in the record in the record save area are sent to the higher-level device. The contents M of the request and the updated variable i
Is passed to the update end device, and the update end device stores M in the variable i stored in the record in the record save area.
The update counter is decremented, the update counter is used to confirm that no other host device is updating the variable, and if no other update has been performed, the contents of the record in the record save area are switched. Is copied to the record storage area next to the record storage area indicated by, the value of the switch is increased by one, and changed to point to the current next record storage area;
Also, when a higher-level device instructs a rollback after updating the contents of one or more of the variables 1 to n in any combination and order, the number of stages r (r is (An integer of 1 or more) is passed to the rollback device, and the rollback device changes r from the current switch value and changes the record storage area indicated by the switch.

【0009】請求項3の発明は、任意の上位装置より、
記憶領域上の構造体1〜n(nは任意の整数)のうち1
つ以上の構造体に対して任意の組み合わせ・順序でその
内容の更新を指示されたとき、その更新を同時不可分の
処理とすることを可能とするトランザクション管理装置
であって、トランザクション管理装置は、更新開始装
置、更新カウンタ、更新終了装置、2本のログインデッ
クス1〜nを格納するレコード記憶領域を有するメモ
リ、ログインデックス1〜nを格納するポインタレコー
ド退避領域を有するメモリ、n本のインデックスと内容
を格納した構造体記憶領域を有するメモリ、2本のレコ
ード記憶領域のいずれかを指すスイッチを備え、上位装
置が構造体i(1≦i≦n)の更新を開始しようとする
とき、上位装置より開始要求を受信し、更新開始装置へ
渡し、更新装置は、他の上位装置が構造体を更新中であ
るか否かを更新カウンタを用いて確認し、他の更新が行
われていないならば、更新カウンタを増加させ、スイッ
チが指す、ログインデックス1〜nを格納したレコード
記憶領域の内容をレコード退避領域へコピーし、レコー
ド退避領域上のレコードに格納されている構造体iに固
有のログインデックスの指すログの内容を上位装置へ渡
し、他の更新が行われている最中ならば、更新カウンタ
を増加させ、レコード退避領域上のレコードに記憶され
ている構造体iに固有のログインデックスの指すログの
内容を上位装置へ渡し、上位装置が変数i(1≦i≦
n)の更新を終了しようとするとき、上位装置より終了
要求を受信し、更新終了装置へ渡し、更新終了装置は、
更新カウンタを減じ、レコード退避領域上のレコードに
格納されている変数iに固有のログインデックスが指す
ログとは異なるログへ上位装置から渡された構造体iの
新しい内容をコピーし、その場所を指すようにレコード
退避領域上のレコードに格納されているログインデック
スを更新し、他の上位装置が変数を更新中でないことを
更新カウンタを用いて確認し、他の更新が行われていな
いならば、レコード退避領域上のレコードの内容をスイ
ッチが指すレコード記憶領域とは逆のレコード記憶領域
にコピーし、スイッチが現在とは反対側のレコード記憶
領域を指すように変更することを特徴とする。
According to a third aspect of the present invention, an arbitrary higher-level device
One of structures 1 to n (n is an arbitrary integer) on the storage area
A transaction management device that, when instructed to update the contents of one or more structures in an arbitrary combination and order, enables the update to be performed as an inseparable process. An update start device, an update counter, an update end device, a memory having a record storage area for storing two log indexes 1 to n, a memory having a pointer record save area for storing log indexes 1 to n, and n indexes A memory having a structure storage area storing the contents, a switch pointing to one of the two record storage areas is provided, and when the host device starts updating the structure i (1 ≦ i ≦ n), The update request is received from the device and passed to the update start device, and the update device determines whether or not another higher-level device is updating the structure. If no other update has been performed, the update counter is incremented, and the contents of the record storage area storing the log indexes 1 to n indicated by the switch are copied to the record save area, and the record is saved. The contents of the log pointed to by the log index unique to the structure i stored in the record in the area are passed to the upper-level device. If another update is being performed, the update counter is increased, and the record save area is increased. The contents of the log indicated by the log index unique to the structure i stored in the upper record are passed to the higher-level device, and the higher-level device transmits the variable i (1 ≦ i ≦
When the update of n) is to be terminated, a termination request is received from the higher-level device and passed to the update termination device.
The update counter is decremented, the new contents of the structure i passed from the higher-level device are copied to a log different from the log indicated by the log index unique to the variable i stored in the record in the record save area, and the location is changed. Updates the log index stored in the record in the record save area to point to, using the update counter to confirm that no other higher-level device is updating the variable, and if no other update has been performed The contents of the record in the record save area are copied to the record storage area opposite to the record storage area indicated by the switch, and the switch is changed to point to the record storage area on the opposite side from the current one.

【0010】本発明のトランザクション装置は、更新対
象のバックアップを不揮発性記憶装置上に持つ必要はな
く、更新はすべて揮発性記憶領域上で行うことができ
る。一般的に揮発性記憶領域への書き込みは不揮発性記
憶領域への書き込みに比べて非常に高速に行えるため、
不揮発性記憶領域への書き込みによる時間的コストを抑
えることができる。また、従来技術では更新時にオリジ
ナルの変数には手を加えないため、いずれの更新が失敗
した場合でも、自動的に全ての変数を更新前の状態に戻
すことができ、複雑なリカバリ機能の必要がなくなる。
また、1つ以上の変数に対する任意の組み合わせ・順序
の更新を同時不可分とするには、同時にすべての更新が
確定される必要があるが、従来の技術ではバックアップ
領域のクリアが必要なため、バックアップの数に比例し
て時間がかかるのに対し、本技術でレコードの切り換え
だけで行えるため、一定時間内で行うことができる。従
って、上記理由により本トランザクション管理装置は、
省資源かつ高速に実現可能である。
The transaction device of the present invention does not need to have a backup to be updated on a nonvolatile storage device, and all updates can be performed on a volatile storage area. Generally, writing to a volatile storage area can be performed much faster than writing to a non-volatile storage area.
The time cost due to writing to the nonvolatile storage area can be reduced. Also, with the conventional technology, the original variables are not modified at the time of updating, so if any update fails, all variables can be automatically returned to the state before the update, and a complicated recovery function is required Disappears.
In addition, in order to simultaneously update any combination or order of one or more variables, all updates must be confirmed at the same time. However, with the conventional technology, the backup area must be cleared, Although it takes time in proportion to the number of records, it can be performed within a fixed time because it can be performed only by switching records with the present technology. Therefore, for the above reasons, the transaction management device
Resource saving and high speed realization.

【0011】[0011]

【発明の実施の形態】本発明の実施の形態を説明する。 (実施例1)図1に実施例1のトランザクション管理装
置の構成を示す。トランザクション管理装置は、更新開
始装置、更新カウンタC(初期値を0とする)、更新終
了装置、参照装置、不揮発性メモリ上の2本(#0,#
1)の変数1〜nを格納するレコード記憶領域及び揮発
性メモリ上の変数1〜nを格納するポインタレコード退
避領域RS(ワークエリア)、レコード記憶領域の切り
換えを行うスイッチSから構成される。
Embodiments of the present invention will be described. (Embodiment 1) FIG. 1 shows the configuration of a transaction management apparatus of Embodiment 1. The transaction management device includes an update start device, an update counter C (initial value is set to 0), an update end device, a reference device, and two devices (# 0, #
1) A record storage area for storing the variables 1 to n of 1), a pointer record save area RS (work area) for storing the variables 1 to n on the volatile memory, and a switch S for switching the record storage area.

【0012】トランザクション管理装置の動作を説明す
る。上位装置が変数i(1≦i≦n、n:任意の整数)
の更新を開始しようとするとき、トランザクション管理
装置は上位装置より開始要求と変数iのID(識別子)を
受信し、更新開始装置に渡し、更新開始装置は、他の
上位装置が変数を更新中でないことを更新カウンタCを
用いて確認し、すなわち更新カウンタCが0であれば、
Cを1つ増し、スイッチSが指す変数1〜n(#0)を
格納したレコード(変数1〜変数n)の内容をポインタ
レコード退避領域RSにコピーし、レコード退避領域R
S上のレコードに格納されている変数iの内容を上位装
置へ送り、更新カウンタCが0以外、すなわち更新が
行われている最中ならば、更新カウンタCを1つ増し、
レコード退避領域RS上のレコードに格納されている変
数iの内容を上位装置へ送る。
The operation of the transaction management device will be described. The host device is a variable i (1 ≦ i ≦ n, n: any integer)
When the update is to be started, the transaction management device receives the start request and the ID (identifier) of the variable i from the higher-level device and passes it to the update start device, and the other upper-level device is updating the variable. Is confirmed using the update counter C, that is, if the update counter C is 0,
C is incremented by one, and the contents of the records (variables 1 to n) storing the variables 1 to n (# 0) indicated by the switch S are copied to the pointer record save area RS, and the record save area R
The content of the variable i stored in the record on S is sent to the host device, and if the update counter C is other than 0, that is, if the update is being performed, the update counter C is incremented by one.
The contents of the variable i stored in the record in the record save area RS are sent to the host device.

【0013】上位装置が変数iの更新を終了しようとす
るとき、トランザクション管理装置は上位装置より終了
要求と更新された変数iの内容Mを受信し、更新終了装
置に渡し、更新終了装置は、ポインタレコード退避領域
RS上のレコードに格納されている変数iにMを格納
し、更新カウンタCを1つ減じ、他の上位装置が変数を
更新中でないことを更新カウンタCを用いて確認し、更
新カウンタCが0、すなわち他の更新が行われていない
ならば、レコード退避領域RS上のレコードの内容をス
イッチSが指すレコード記憶領域とは逆のレコード記憶
領域(#1)にコピーし、スイッチSが現在とは反対側
のレコード記憶領域(#1)を指すように変更する。
When the higher-level device attempts to end the update of the variable i, the transaction management device receives a termination request and the updated content M of the variable i from the higher-level device and passes it to the update ending device. M is stored in the variable i stored in the record in the pointer record save area RS, the update counter C is decremented by 1, and it is confirmed using the update counter C that no other higher-level device is updating the variable, If the update counter C is 0, that is, if no other update has been performed, the contents of the record in the record save area RS are copied to the record storage area (# 1) opposite to the record storage area indicated by the switch S, The switch S is changed to point to the record storage area (# 1) on the opposite side from the current one.

【0014】参照装置は、上位装置からの参照要求と変
数iのIDを受信し、記憶している変数iの内容を上位装
置に送信する。
The reference device receives the reference request from the upper device and the ID of the variable i, and transmits the stored contents of the variable i to the higher device.

【0015】実施例1を詳細に説明する。図4は、本発
明が適用されるICカードの構成例を示す。このICカード
は、カードリーダ・ライタ(R/W)との間のデータ入出
力制御を行う入出力制御部(I/O)、マイクロプロセッ
サ(CPU)、ROM、RAM、EEPROMから構成される。RAMはCPU
がプログラムを実行するために利用する揮発性の記憶領
域であり、ROMはCPUが実行するプログラムを格納するメ
モリであり、EEPROMはプログラムがデータを格納するた
めにする不揮発性の記憶領域である。本発明は、CPU、R
OM、RAM、EEPROMによって更新手段を実現する。
Embodiment 1 will be described in detail. FIG. 4 shows a configuration example of an IC card to which the present invention is applied. This IC card includes an input / output control unit (I / O) for controlling data input / output with a card reader / writer (R / W), a microprocessor (CPU), a ROM, a RAM, and an EEPROM. RAM is CPU
Is a volatile storage area used for executing the program, ROM is a memory for storing the program executed by the CPU, and EEPROM is a non-volatile storage area for the program to store data. The present invention relates to a CPU, R
Update means is realized by OM, RAM, and EEPROM.

【0016】図5は、RAMとEEPROMの内容説明図であ
る。本実施形態では、EEPROMに、レコードのスイッチ
S、レコードのログ(2本)、変数のログ(2本×変数
の数)が用意される。ログは2つの領域により構成さ
れ、各変数(もしくはレコード)の現在の値と一つ前の
値をそれぞれ格納する。
FIG. 5 is an explanatory diagram of the contents of the RAM and the EEPROM. In the present embodiment, the switch S of the record, the log of the record (two), and the log of the variable (2 × the number of variables) are prepared in the EEPROM. The log is composed of two areas, and stores the current value and the previous value of each variable (or record), respectively.

【0017】レコードは、図6に示す構造をしており、
各フィールドで、各変数のログの2本(#0,#1)中
どちらが現在の変数の値を記憶しているのかを示す情報
が格納される。レコードのスイッチSは、2本のレコー
ドのログのどちらかが現在の値を記憶しているのかを示
す情報が格納される。RAMには各変数(レコード)のテ
ンポラリな値を格納するためのワークエリア(ポインタ
レコード退避領域RS)と実行中のトランザクションの
数をカウントする更新カウンタが用意される。
The record has the structure shown in FIG.
In each field, information indicating which of the two logs (# 0, # 1) of each variable stores the current variable value is stored. The switch S of the record stores information indicating which of the logs of the two records stores the current value. The RAM is provided with a work area (pointer record save area RS) for storing a temporary value of each variable (record) and an update counter for counting the number of transactions being executed.

【0018】図7は、ROMに格納された制御プログラム
に従ってCPUにより実現される本発明の機能ブロック図
である。トランザクション管理装置はEEPROMとRAMを
し、EEPROM上のログで管理された変数の複数のトランザ
クションに跨る更新を同時不可分に行なうものであり、
上位装置は変数の更新トランザクションを行う実体であ
り、トランザクションの前後に、開始要求と終了要求を
トランザクション管理装置へ行う。トランザクション管
理装置は開始要求を受けると、図8のシーケンスに従っ
て、更新対象となる変数の値をEEPROMのログからRAMの
ワークエリアへコピーし、上位装置はワークエリア上で
更新を行う。
FIG. 7 is a functional block diagram of the present invention realized by the CPU according to the control program stored in the ROM. The transaction management device performs EEPROM and RAM, and updates the variables managed by logs on the EEPROM across multiple transactions simultaneously and inseparably.
The higher-level device is an entity that performs a variable update transaction, and issues a start request and an end request to the transaction management device before and after the transaction. Upon receiving the start request, the transaction management device copies the value of the variable to be updated from the log of the EEPROM to the work area of the RAM according to the sequence of FIG. 8, and the host device updates the work area.

【0019】トランザクション開始シーケンスを以下に
示す。 1.上位装置からの開始要求を受けると、更新カウンタ
が0であるか否か判断する。0である場合は2.へ移行
し、0でない場合は3.へ移行する。 2.レコードスイッチSが指すレコードをRAM上のワーク
エリアへコピーする。 3.更新カウンタを1つ増す。 4.RAM上のレコード内の変数に対応するフィールドが示
すログのデータをRAM上のワークエリアへコピーして終
了する。トランザクション管理装置は終了要求を受ける
と、図9のシーケンスに従って、RAMのワークエリア上
のデータをEEPROMのログへ格納する。
The transaction start sequence is shown below. 1. When a start request is received from a higher-level device, it is determined whether or not the update counter is 0. If it is 0, the process proceeds to 2. If it is not 0, the process proceeds to 3. 2. Copy the record indicated by the record switch S to the work area on the RAM. 3. Increment the update counter by one. 4. Copy the log data indicated by the field corresponding to the variable in the record on the RAM to the work area on the RAM, and finish. When receiving the end request, the transaction management device stores the data in the work area of the RAM in the log of the EEPROM according to the sequence of FIG.

【0020】トランザクション終了シーケンスを以下に
示す。 1.上位装置からの終了要求を受けると、ワークエリア
上の変数の内容を変数ログの1つ前の状態を格納してい
る方へコピーする。 2.ワークエリア上のレコードの変数に対応するフィー
ルドの値をワークエリア上の変数の内容をコピーしたロ
グへの情報で更新する。 3.更新カウンタを1つ減らす。 4.更新カウンタが0であるか否か判断する。0である
場合には5.へ移行し、0でなければ終了する。 5.レコードスイッチの指すレコードとは逆のレコード
へワークエリア上のレコードをコピーする。 6.レコードスイッチSを切換えて終了する。
The transaction end sequence is shown below. 1. When a termination request is received from a higher-level device, the contents of the variables in the work area are copied to the one storing the previous state of the variable log. 2. Update the value of the field corresponding to the variable of the record in the work area with the information in the log in which the contents of the variable in the work area are copied. 3. Decrease the update counter by one. 4. Judge whether the update counter is 0 or not. If it is 0, the process proceeds to 5. If it is not 0, the process ends. 5. Copy the record in the work area to the record opposite to the record indicated by the record switch. 6. The record switch S is switched, and the process ends.

【0021】次に、この実施の形態を用いて図10のよ
うな処理を行う場合を説明する。図10の処理は、ある
トランザクション(Tr1)の中からさらにトランザクショ
ン(Tr2)が発生するような例を示している。図10のTR
1,TR2を実施する上位装置をそれぞれポイントAP、電子
現金APとする。ポイントAPはポイントを変数で管理し、
自トランザクション(Tr1)で更新を行うと共に、電子現
金APを使って支払処理を行う。電子現金APは残高を変数
で管理し、自トランザクション(Tr2)で更新を行う。こ
のときTr1とTr2の実行は同時不可分でなくてはならな
い。なぜならば、Tr1の中でTr2が行われたとき、どちら
かのトランザクションが失敗すると、支払を行っていな
いのにポイントを増加させたり、支払が完了したのにポ
イントが増加されないといった事態が生じるからであ
る。このとき、EEPROMには図11のように、レコードス
イッチ、2つのフィールドを持つレコードが2本(#
1,#2)、電子現金APで更新する変数のログ(残高ロ
グ)、ポイントAPで更新する変数のログ(ポイントログ)
がそれぞれ2本(#0,#1)用意される。RAMにはレコ
ードのワーク領域とそれぞれの変数のワーク領域、更新
カウンタが用意される。
Next, a case where the processing shown in FIG. 10 is performed using this embodiment will be described. The process of FIG. 10 shows an example in which a transaction (Tr2) is further generated from a certain transaction (Tr1). TR in FIG.
The higher-level devices that perform 1, TR2 are referred to as point AP and electronic cash AP, respectively. Point AP manages points with variables,
Update is performed in own transaction (Tr1), and payment processing is performed using the electronic cash AP. The electronic cash AP manages the balance with a variable and updates it with its own transaction (Tr2). At this time, the execution of Tr1 and Tr2 must be simultaneously inseparable. Because, when Tr2 is performed in Tr1, if either transaction fails, points will increase even though payment has not been made, or points will not increase even though payment is completed It is. At this time, as shown in FIG. 11, a record switch and two records having two fields (#
1, # 2), variable log updated with electronic cash AP (balance log), variable log updated with point AP (point log)
Are respectively prepared (# 0, # 1). The RAM has a work area for records, a work area for each variable, and an update counter.

【0022】図12に上位装置(電子現金AP、ポイントA
P)とトランザクション管理装置のトランザクションの
シーケンス、図13にトランザクション管理装置のEEPR
OMとRAMの内容説明図を示す。ここで、各ログの番号を
#で表すこととし、それぞれの初期値を以下のようにす
る(図13(初期)参照)。 ・更新カウンタ 0 ・レコードスイッチ 0 ・レコードログ#0 10 ・レコードログ#1 00 ・残高ログ#0 300 ・残高ログ#1 200 ・ポイントログ#0 40 ・ポイントログ#1 30 上記の初期値の意味は、更新カウンタが0なのでトラン
ザクションは行われていない。レコードスイッチが0な
ので、現在のレコードの値を記憶しているのはレコード
ログ#0である。レコードログの第1フィールドが残高
ログ、第2フィールドがポイントログの情報を格納して
いるとすれば、レコードログ#0の値は10なので現在
の残高の値を記憶しているのは残高ログ#1、すなわち
200円であり、現在のポイントの値を記憶しているの
はポイントログ#0、すなわち40ポイントである。
FIG. 12 shows a host device (electronic cash AP, point A).
P) and the transaction sequence of the transaction management device.
The figure explaining the contents of OM and RAM is shown. Here, the number of each log is represented by #, and the respective initial values are as follows (see FIG. 13 (initial)). -Update counter 0-Record switch 0-Record log # 0 10-Record log # 1 00-Balance log # 0 300-Balance log # 1 200-Point log # 0 40-Point log # 1 30 Meaning of the above initial values Has no transaction since the update counter is 0. Since the record switch is 0, the record log # 0 stores the value of the current record. If the first field of the record log stores the information of the balance log and the second field stores the information of the point log, the value of the record log # 0 is 10, so the current balance value is stored in the balance log. # 1, ie, 200 yen, and the point log # 0, ie, 40 points, which stores the current point value.

【0023】図12、図13を参照してシーケンスを説
明する。 (1)ポイントAPが自分のトランザクションTr1を開始する
ためにトランザクション管理装置に対して開始要求を出
す。トランザクション管理装置はこの要求を受信し、更
新開始装置は、更新カウンタを調べ、0であるのでカウ
ンタを1増し(更新カウンタ[1])、レコードスイッチ
が指すレコードログ[#0]の内容をレコードワークエリ
アへコピーする(レコードのワークエリア[10])
(i)。さらにワークエリア上のレコードログからポイン
トAPが更新する変数(ポイント)の現在の値を格納した
ログ(ポイントログ#0[40])の情報を得て、その値
をポイントのワークエリアへコピーする(ii)。 (2)ポイントAPは支払を行うために電子現金APを呼び出
す。 (3)電子現金APは自分のトランザクションTr2を開始する
ためにトランザクション管理装置に対して開始要求を出
す。トランザクション管理装置では、更新カウンタを調
べ、0ではないのでカウンタを1つ増し(更新カウンタ
[2])、ワークエリア上のレコードログ(#0[1])か
ら電子現金APが更新する変数(残高)の現在の値を格納
したログ(残高ログ#1[200])の情報を得て、その
値を残高のワークエリアへコピーする(iii)。 (4)電子現金APはワークエリア上の残高を減額(更新)
する(支払額[100]:残高のワークエリア[100])
(iv)。 (5)電子現金APは自分のトランザクションTr2を終了する
ためにトランザクション管理装置に対して終了要求を出
す。
The sequence will be described with reference to FIGS. (1) The point AP issues a start request to the transaction management device to start its own transaction Tr1. The transaction management device receives this request, and the update start device checks the update counter, and since it is 0, increments the counter by one (update counter [1]) and records the contents of the record log [# 0] indicated by the record switch as a record. Copy to work area (record work area [10])
(i). Further, information of a log (point log # 0 [40]) storing the current value of the variable (point) updated by the point AP is obtained from the record log on the work area, and the value is copied to the work area of the point. (ii). (2) Point AP calls electronic cash AP to make payment. (3) The electronic cash AP issues a start request to the transaction management device to start its own transaction Tr2. In the transaction management device, the update counter is checked, and since it is not 0, the counter is increased by one (update counter).
[2]), information of a log (balance log # 1 [200]) storing the current value of the variable (balance) updated by the electronic cash AP is obtained from the record log (# 0 [1]) on the work area. Then, the value is copied to the balance work area (iii). (4) Electronic cash AP reduces (updates) the balance on the work area
Yes (payment [100]: balance work area [100])
(Iv). (5) The electronic cash AP issues a termination request to the transaction management device to terminate its own transaction Tr2.

【0024】トランザクション管理装置は終了要求を受
信し、更新終了装置は、ワークエリア上の残高[100]
を残高ログの1つ前の値を格納しているログ(#0)へ
格納し、ワークエリア上のレコードの値を先ほど格納し
たログの情報へ更新し(#0[0])、さらに更新カウン
タを調べ、0ではないのでカウンタを1つ減じる(更新
カウンタ[1])(v)。 (6)電子現金APはポイントAPへ制御を戻す。 (7)ポイントAPは支払額[100]に応じたポイント数[1
0]を増やすために、ワークエリア上のポイント数を増
やす(ポイントのワークエリア[50])(vi)。 (8)ポイントAPは自分のトランザクションTr1を終了する
ためにトランザクション管理装置に対して終了要求を出
す。
The transaction management device receives the end request, and the update end device sets the balance [100] on the work area.
Is stored in the log (# 0) storing the value immediately before the balance log, the value of the record in the work area is updated to the information of the log stored earlier (# 0 [0]), and further updated The counter is checked, and since it is not 0, the counter is reduced by one (update counter [1]) (v). (6) The electronic cash AP returns control to the point AP. (7) Point AP is the number of points [1] according to the payment amount [100]
0], the number of points on the work area is increased (point work area [50]) (vi). (8) The point AP issues a termination request to the transaction management device to terminate its own transaction Tr1.

【0025】トランザクション管理装置は、ワークエリ
ア上のポイント数[50]をポイントログの1つ前の値を
格納しているログ(#1)へ格納し、ワークエリア上の
レコードの値を先ほど格納したログ(#1)の情報へ更
新し、さらに更新カウンタを調べ、0であるのでワーク
エリア上のレコードを、レコードスイッチが指すレコー
ドとは逆のレコード(レコードログ#1)へコピーし(v
ii)、さらにレコードスイッチを先ほどコピーしたレコ
ードを指すように切り換える(レコードスイッチ[1](v
iii)。この時点でTr1とTr2で行った更新が確定的なもの
となる。なぜなら、各変数の値が格納されたログの情報
を格納したレコードがスイッチによって切り換わったこ
とにより、それ以降は切り換わったレコードの情報を以
て各変数の値が決定されるからである。
The transaction management device stores the number of points [50] in the work area in the log (# 1) storing the value immediately before the point log, and stores the value of the record in the work area just before. The record is updated to the information of the log (# 1), and the update counter is checked. Since the value is 0, the record in the work area is copied to the record (record log # 1) opposite to the record indicated by the record switch (v
ii) Further, the record switch is switched so as to point to the record copied earlier (record switch [1] (v
iii). At this point, the updates performed on Tr1 and Tr2 are deterministic. This is because the switch storing the information of the log storing the value of each variable is switched by the switch, and thereafter, the value of each variable is determined based on the information of the switched record.

【0026】本実施例は3つの特徴がある。1つ目は、
本方式が非常に簡易な制御で実現でき、ほとんどの更新
はRAM上のワークエリア上で行えるため、高速に実現で
き、ICカードのような非常にリソースの限られた形態に
も適用できる。
This embodiment has three features. The first is
This method can be realized with very simple control, and most updates can be performed in the work area on the RAM, so that it can be realized at high speed and can be applied to a form with very limited resources such as an IC card.

【0027】2つ目は、従来技術と異なり障害発生時の
リカバリ処理の必要がない。なぜならば、本方式におい
て各変数の値を決定するのは、レコードスイッチが指す
レコードによって指されるログの値である。上記例では
各更新過程でオリジナルの値が一切変更されず、最後の
レコードスイッチを切り換えるまでの更新はすべて一時
的な更新として扱われるからである。つまり、障害が発
生してもレコードスイッチが切り換わっていない限り有
効なレコード上の各変数のログを指す情報は変更され
ず、すべての更新は自動的にキャンセルされ、処理開始
時点の状態に戻る。また、レコードスイッチの切り換え
には1ビットの更新で行えるため、更新の原子性が保証
される。
Second, unlike the prior art, there is no need for recovery processing when a failure occurs. The reason for determining the value of each variable in this method is the value of the log pointed to by the record indicated by the record switch. This is because, in the above example, the original value is not changed at all in each update process, and all updates until the last record switch is switched are treated as temporary updates. In other words, even if a failure occurs, the information indicating the log of each variable on the valid record is not changed unless the record switch is switched, all updates are automatically canceled, and the state returns to the state at the start of processing . In addition, since the switching of the record switch can be performed by updating one bit, the atomicity of the update is guaranteed.

【0028】3つ目は、本方式では各変数の値を現在と
1つ前の2つの状態を2本のログで管理しており、さら
に各変数のどちらのログが現在の状態かを示す情報を1
つのレコードにまとめ、さらにレコード自体も現在の状
態と1つ前の状態の2本のログで管理されている。従っ
て、レコードのログを切り換える1つの操作で、そのレ
コード内で管理されている全ての変数のログの状態を切
り換える、つまり値を同時更新することができ、これに
より複数のトランザクションの同時不可分を実現してい
る。また、同時不可分に実行したいトランザクションの
数が増加しても、変数のログの状態を管理するレコード
自体を長くすればよく、レコードスイッチを切り換える
一定時間で同時更新が可能である。
Third, in the present method, the value of each variable is managed by two logs of the current state and the previous two states, and further indicates which log of each variable is the current state. Information 1
One record is collected, and the record itself is managed by two logs of the current state and the previous state. Therefore, a single operation of switching the log of a record can switch the state of the log of all variables managed in the record, that is, update the values simultaneously, thereby realizing simultaneous inseparability of a plurality of transactions. are doing. Further, even if the number of transactions to be executed inseparably increases, the record itself for managing the state of the log of the variable may be lengthened, and the simultaneous update can be performed within a certain time when the record switch is switched.

【0029】(実施例2)実施例2は、ロールバック、
すなわちトランザクションがコミットせずに終了した場
合にデータベースの変更されたデータを元に戻す処理を
備える点で実施例1と相違する。図2に実施例2のトラ
ンザクション管理装置の構成を示す。トランザクション
管理装置は、更新開始装置、更新カウンタC(初期値を
0とする)、更新終了装置、参照装置、不揮発性メモリ
上の2本以上(#0,#1,・・・)の変数1〜n(nは
任意の整数)を格納するレコード記憶領域及び揮発性メ
モリ上の変数1〜nを格納するポインタレコード退避領
域RS(ワークエリア)、レコード記憶領域の切り換え
を行うスイッチS、ロールバック装置から構成される。
(Embodiment 2) In Embodiment 2, roll back
That is, the second embodiment is different from the first embodiment in that a process for restoring the changed data in the database when the transaction ends without committing is provided. FIG. 2 illustrates a configuration of the transaction management device according to the second embodiment. The transaction management device includes an update start device, an update counter C (initial value is 0), an update end device, a reference device, and two or more (# 0, # 1,...) Variables 1 in the nonvolatile memory. To n (n is an arbitrary integer), a pointer record save area RS (work area) for storing variables 1 to n on the volatile memory, a switch S for switching the record storage area, and rollback. It is composed of devices.

【0030】トランザクション管理装置の動作を説明す
る。上位装置が変数i(1≦i≦n)の更新を開始しよ
うとするとき、上位装置より開始要求を受信し、更新開
始装置へ渡し、更新開始装置は、他の上位装置が変数を
更新中でないことを更新カウンタを用いて確認し、更新
カウンタCが0、すなわち他の更新が行われていないな
らば、更新カウンタCを1つ増し、スイッチSが指す、
変数1〜nを記憶したレコード記憶領域(#0)の内容
をポインタレコード退避領域RSへコピーし、ポインタ
レコード退避領域RS上のレコードに格納されている変
数iの内容を上位装置へ送り、更新カウンタCが0以
外、すなわち他の更新が行われている最中ならば、更新
カウンタを1つ増し、ポインタレコード退避領域RS上
のレコードに記憶されている変数iの内容を上位装置へ
送り、上位装置が変数iの更新を終了しようとすると
き、上位装置より終了要求と更新された変数iの内容M
を受信し、更新終了装置へ渡し、更新終了装置は、レコ
ード退避領域RS上のレコードに格納されている変数i
に変数iの内容Mを記憶し、更新カウンタを1つ減じ、
他の上位装置が変数を更新中でないことを更新カウンタ
Cを用いて確認し、更新カウンタCが0、すなわち他の
更新が行われていないならば、ポインタレコード退避領
域RS上のレコードの内容をスイッチSが指すレコード
記憶領域の次のレコード記憶領域(#1)にコピーし、
スイッチSの値を1つ増し、現在の次のレコード記憶領
域(#1)を指すように変更し、順次、上記動作を繰り
返す。
The operation of the transaction management device will be described. When the higher-level device attempts to start updating the variable i (1 ≦ i ≦ n), it receives a start request from the higher-level device and passes it to the update start device. The other upper-level device is updating the variable. It is confirmed that the update counter C is not 0, and if the update counter C is 0, that is, if no other update has been performed, the update counter C is incremented by one and the switch S points to
The contents of the record storage area (# 0) storing the variables 1 to n are copied to the pointer record save area RS, and the contents of the variable i stored in the record in the pointer record save area RS are sent to the host device and updated. If the counter C is other than 0, that is, if another update is being performed, the update counter is incremented by one, and the contents of the variable i stored in the record in the pointer record save area RS are sent to the upper-level device. When the higher-level device attempts to end the update of the variable i, a termination request from the higher-level device and the content M of the updated variable i
Is passed to the update end device, and the update end device receives the variable i stored in the record in the record save area RS.
To store the content M of the variable i, decrement the update counter by one,
Using the update counter C, it is confirmed that the variable is not being updated by another host device. If the update counter C is 0, that is, if no other update has been performed, the contents of the record in the pointer record save area RS are deleted. Copy to the record storage area (# 1) next to the record storage area indicated by the switch S,
The value of the switch S is increased by one, changed to point to the current next record storage area (# 1), and the above operation is sequentially repeated.

【0031】また、任意の上位装置より、変数1〜nの
うち1つ以上の変数に対して任意の組み合わせ・順序で
その内容の更新した後にロールバックを指示されたと
き、上位装置より段数r(rは1以上の整数)を受信
し、ロールバック装置へ渡し、ロールバック装置は現在
のスイッチSの値よりrを減じ、スイッチSの指すレコ
ード記憶領域を変更する。
When a rollback is instructed after updating the contents of one or more of the variables 1 to n in an arbitrary combination and order from an arbitrary higher-level device, when the upper-level device specifies the number of steps r (R is an integer equal to or greater than 1) and passes it to the rollback device. The rollback device subtracts r from the current value of the switch S and changes the record storage area indicated by the switch S.

【0032】(実施例3)実施例3は、実施例1の2本
のレコード記憶領域に変数1〜nを記憶する代わりにロ
グインデックス1〜nを記憶し、また、それぞれにログ
1〜nを構成した構造体1〜nを備えた点で相違する。
(Embodiment 3) In Embodiment 3, instead of storing variables 1 to n in the two record storage areas of Embodiment 1, log indexes 1 to n are stored, and logs 1 to n are stored respectively. Is provided in that structures 1 to n are provided.

【0033】図3に実施例3のトランザクション管理装
置の構成を示す。トランザクション管理装置は、更新開
始装置、更新カウンタC(初期値を0とする)、更新終
了装置、参照装置、2本(#0,#1)のログインデッ
クス1〜nを記憶したレコード記憶領域を有するメモ
リ、ログインデックス1〜nを記憶するポインタレコー
ド退避領域RSを有するメモリ、レコード領域のレコー
ドの切り換えを行うスイッチS、それぞれにログを構成
したn本の構造体を備える。トランザクション管理装置
の動作を説明する。
FIG. 3 shows the configuration of the transaction management apparatus according to the third embodiment. The transaction management device stores a record storage area that stores the update start device, the update counter C (initial value is 0), the update end device, the reference device, and two (# 0, # 1) log indexes 1 to n. Memory, a memory having a pointer record save area RS for storing the log indexes 1 to n, a switch S for switching records in the record area, and n structures each constituting a log. The operation of the transaction management device will be described.

【0034】上位装置が構造体iの更新を開始しようと
するとき、トランザクション管理装置は上位装置より開
始要求を受信し、更新開始装置へ渡し、更新装置は、他
の上位装置が構造体を更新中でないことを更新カウンタ
Cを用いて確認し、Cが0、すなわち他の更新が行われ
ていないならば、Cを1つ増し、スイッチSが指す、ロ
グインデックス1〜nを格納したレコード記憶領域(#
0)の内容をポインタレコード退避領域RSへコピー
し、ポインタレコード退避領域RS上のレコードに格納
されている構造体iに固有のインデックスの指すログの
内容を上位装置へ渡し、更新カウンタCが0以外、すな
わち他の更新が行われている最中ならば、更新カウンタ
Cを1つ増し、ポインタレコード退避領域RS上のレコ
ードに格納されている構造体iに固有のログインデック
スの指すログの内容を上位装置へ渡す。
When the higher-level device attempts to start updating the structure i, the transaction management device receives a start request from the higher-level device and passes it to the update start device. It is confirmed by using the update counter C that it is not in the middle, and if C is 0, that is, if no other update has been performed, C is incremented by one and the record storage storing the log indexes 1 to n indicated by the switch S is stored. region(#
0) is copied to the pointer record save area RS, and the contents of the log pointed to by the index unique to the structure i stored in the record in the pointer record save area RS are passed to the host device. In other words, if another update is being performed, the update counter C is incremented by one, and the contents of the log indicated by the log index unique to the structure i stored in the record in the pointer record save area RS To the host device.

【0035】上位装置が変数iの更新を終了しようとす
るとき、トランザクション管理装置は上位装置より終了
要求を受信し、更新終了装置へ渡し、更新終了装置は、
更新カウンタCを1つ増し、ポインタレコード退避領域
RS上のレコードに格納されている変数iに固有のログ
インデックスが指すログとは異なるログへ上位装置から
渡された構造体iの新しい内容をコピーし、その場所を
指すようにポインタレコード退避領域RS上のレコード
に格納されているログインデックスを更新し、他の上位
装置が変数を更新中でないことを更新カウンタCを用い
て確認し、Cが0、すなわち他の更新が行われていない
ならば、ポインタレコード退避領域RS上のレコードの
内容をスイッチSが指すレコード記憶領域とは逆のレコ
ード記憶領域(#1)にコピーし、スイッチSが現在と
は反対側のレコード記憶領域を指すように変更する。
When the host device attempts to end the update of the variable i, the transaction management device receives a termination request from the host device and passes it to the update end device.
Increment the update counter C by one and copy the new contents of the structure i passed from the higher-level device to a log different from the log indicated by the log index unique to the variable i stored in the record in the pointer record save area RS Then, the log index stored in the record in the pointer record save area RS is updated so as to point to the location, and it is confirmed using the update counter C that no other higher-level device is updating the variable. 0, that is, if no other update has been performed, the contents of the record in the pointer record save area RS are copied to the record storage area (# 1) opposite to the record storage area indicated by the switch S, and the switch S Change to point to the record storage area on the opposite side from the current one.

【0036】実施例3を詳細に説明する。本発明が適用
されるICカードの構成例は実施例1のものと同一であ
る。本実施例の実施例1との違いは、主にEEPROMの内容
と実際の更新対象となるデータの更新手段を上位装置へ
委譲し、対象とする変数の種類、構造により自由度をも
たせた点である。図14は、トランザクション管理装置
のRAMとEEPROMの内容説明図である。本実施形態では、E
EPROMに、レコードのスイッチ、レコードのログ(2
本)、各上位装置が管理するデータベースDB(各DBの種
類・構造は上位装置に依る)、すなわち構造体が用意さ
れる。
Embodiment 3 will be described in detail. The configuration example of the IC card to which the present invention is applied is the same as that of the first embodiment. The difference between this embodiment and the first embodiment is that the means for updating the contents of the EEPROM and the data to be actually updated is delegated to a higher-level device, and the degree of freedom is increased depending on the type and structure of the target variable. It is. FIG. 14 is an explanatory diagram of the contents of the RAM and the EEPROM of the transaction management device. In the present embodiment, E
In EPROM, record switch, record log (2
Book), a database DB managed by each host device (the type and structure of each DB depends on the host device), that is, a structure is prepared.

【0037】レコードは、図15のような構造をしてお
り、各フィールドに格納されるデータの種類は特に規定
しない。レコードのスイッチは、2本のレコードのログ
のどちらかが現在の値を記憶しているのかを示す情報が
格納される。RAMにはレコードのテンポラリな値を格納
するためのワークエリアと実行中のトランザクションの
数をカウントする更新カウンタが用意される。図16は
ROMに格納された制御プログラムに従ってCPUにより実現
される本発明の機能ブロック図である。
The record has a structure as shown in FIG. 15, and the type of data stored in each field is not particularly defined. The record switch stores information indicating which of the logs of the two records stores the current value. The RAM is provided with a work area for storing a temporary value of the record and an update counter for counting the number of transactions being executed. FIG.
FIG. 3 is a functional block diagram of the present invention realized by a CPU according to a control program stored in a ROM.

【0038】トランザクション管理装置はEEPROMとRAM
を利用し、EEPROM上の各上位装置によって任意の順番で
実行されるDB更新トランザクションを同時不可分に行う
ものである。上位装置はEEPROM上のDB更新トランザクシ
ョンを行う実体であり、トランザクション開始時にトラ
ンザクション管理装置へ開始要求を出し、その応答でト
ランザクション管理装置のレコード中のフィールドに格
納されている情報を受け取る。そして、終了時に終了要
求をトランザクション管理装置へ行う。
The transaction management device is an EEPROM and a RAM.
The DB update transaction executed by each host device in the EEPROM in an arbitrary order is performed simultaneously and inseparably. The host device is an entity that performs a DB update transaction on the EEPROM, issues a start request to the transaction management device when the transaction starts, and receives information stored in a field in a record of the transaction management device in response to the request. Then, at the time of termination, a termination request is made to the transaction management device.

【0039】トランザクション管理装置は上位装置から
開始要求を受けると、図17のシーケンスに従って処理
を行う。トランザクション開始シーケンスを以下に示
す。 1.上位装置からの開始要求を受けると、更新カウンタ
が0であるか否か判断する。0である場合は2.へ移行
し、0でない場合は3.へ移行する。 2.レコードスイッチが指すレコードをRAM上のワークエ
リアへコピーする。 3.更新カウンタを1つ増やす。 4.RAM上のレコード内のフィールドに格納されている情
報を上位装置へ送り終了する。
When the transaction management device receives a start request from the host device, it performs processing according to the sequence shown in FIG. The transaction start sequence is shown below. 1. When a start request is received from a higher-level device, it is determined whether or not the update counter is 0. If it is 0, the process proceeds to 2. If it is not 0, the process proceeds to 3. 2. Copy the record indicated by the record switch to the work area on the RAM. 3. Increment the update counter by one. 4. The information stored in the field in the record on the RAM is sent to the higher-level device, and the process ends.

【0040】上位装置は、トランザクション管理装置の
レコード内のフィールドに格納された情報(インデック
ス)を受信し、DBの更新を行い、更新後のDB情報を終了
要求とともにトランザクション管理装置へ渡す。トラン
ザクション管理装置は、上位装置から受信したDB情報を
図18のシーケンスに従って処理する。トランザクショ
ン終了シーケンスを以下に示す。 1.上位装置からの終了要求を受けると、上位装置から
受信した情報をワークエリア上のレコードのフィールド
に格納する。 2.更新カウンタを1つ減らす。 3.更新カウンタが0であるか否か判断する。0である
場合には4.へ移行し、0でなければ終了する。 4.レコードスイッチの指すレコードとは逆のレコード
へワークエリア上のレコードをコピーする。 5.レコードスイッチを切り替えて終了する。
The host device receives the information (index) stored in the field in the record of the transaction management device, updates the DB, and passes the updated DB information together with the end request to the transaction management device. The transaction management device processes the DB information received from the host device according to the sequence shown in FIG. The transaction end sequence is shown below. 1. When a termination request is received from a higher-level device, information received from the higher-level device is stored in a field of a record in the work area. 2. Decrease the update counter by one. 3. Determine whether the update counter is 0 or not. If it is 0, the process proceeds to 4. If it is not 0, the process ends. 4. Copy the record in the work area to the record opposite to the record indicated by the record switch. 5. Switch the record switch and finish.

【0041】次に任意の複数個のデータベースの更新を
同時不可分に行う場合を説明する。この例では、2つの
データベース(チケットDB、ログDB)の場合を説明す
る。Tr1とTr2の2つのトランザクションを実行する機能
を持った上位装置(電子チケットAP)がある。Tr1,Tr2
それぞれは次に示すような処理を行うトランザクション
である。Tr1は外部からの要求によって電子チケットAP
内のチケットDBから該当するチケットを検索し、チケッ
トを更新(改札等)する。Tr2は電子チケットAP内の使
用ログDBにチケットの更新記録等の書き込みを行う。
Next, a case in which an arbitrary plurality of databases are simultaneously and indivisiblely updated will be described. In this example, the case of two databases (ticket DB and log DB) will be described. There is a higher-level device (electronic ticket AP) having a function of executing two transactions, Tr1 and Tr2. Tr1, Tr2
Each is a transaction that performs the following processing. Tr1 is an electronic ticket AP upon request from outside
Search the applicable ticket from the ticket DB in the, and update the ticket (gates etc.). Tr2 writes the update record of the ticket in the usage log DB in the electronic ticket AP.

【0042】このときEEPROM上にはレコードスイッチ、
2つのフィールドを持つレコード2本に加え、Tr1で使
用されるチケットDB、Tr2でされる使用ログDBが用意さ
れる。トランザクション管理装置のEEPROM上の各DBの構
造を図19に示す。RAMにはレコードのワーク領域とそ
れぞれの変数のワーク領域(ポインタレコード退避領域
RS)、更新カウンタが用意される。レコードのログ
は、図19のように2本(#0,#1)のレコード記憶
領域内に2つのフィールド(Tr1,Tr2)が用意されるもの
とし、それぞれのフィールドに次に書き込めるDB(構造
体)のアドレス(インデックス)を格納するものとす
る。
At this time, a record switch is provided on the EEPROM,
In addition to two records having two fields, a ticket DB used for Tr1 and a use log DB used for Tr2 are prepared. FIG. 19 shows the structure of each DB on the EEPROM of the transaction management device. The RAM has a work area for records, a work area for each variable (pointer record save area RS), and an update counter. As shown in FIG. 19, the record log is provided with two fields (Tr1, Tr2) in two (# 0, # 1) record storage areas, and a DB (structure) that can be written next to each field. Field (index).

【0043】このとき、電子チケットAPがTr1とTr2によ
り構成されるトランザクションの実行、すなわち電子チ
ケットをし(チケットDBの更新)、同時に履歴を残す
(使用ログの更新)ことを同時不可分に行う実施例を示
す。図20に上位装置(電子現金AP)とトランザクショ
ン管理装置のシーケンスを示し、図21にトランザクシ
ョン管理装置のEEPROMとRAMの内容説明図を示す。レコ
ードのスイッチ、レコードのログ、チケットDB、ログDB
の最初の状態は図21に示されたものとする。 (1)電子チケットAPは処理を開始するために、チケットD
Bの更新トランザクションTr1の開始をトランザクション
管理装置へ通知する。 (2)トランザクション管理装置では更新カウンタCを調
べ、0であるのでカウンタを1つ増し、さらにレコード
のスイッチが指すレコードログ(#0)の内容[24]を
レコードのワークエリアへコピーする。そしてワークエ
リア上のレコードログのTr1のフィールドに格納されて
いる値[2]を返す。ここで、トランザクション管理装置
から値を受け取った電子チケットAPは、その値をチケッ
トDB内で書き込み可能なアドレス[2]を指すものとして
扱う。 (3)電子チケットAPは該当するチケット(チケット5と
する)をチケットDBから検索し、そのアドレスを得る。 (4)(3)で得たアドレス[5]に格納されたデータ(チケッ
ト5)を(2)で得たアドレス[2]にコピーする(チケッ
ト5')。 (5)電子チケットAPは(3)でコピーした先のデータ(チケ
ット5)に対して更新(回数減)を行う。 (6)電子チケットAPはチケットの更新履歴を残すために
使用ログDBの更新トランザクションTr2の開始をトラン
ザクション管理装置へ通知する。 (7)トランザクション管理装置では更新カウンタを調
べ、0ではないのでカウンタを1つ増し、ワークエリア
上のレコードログのTr2のフィールドに格納されている
値[4]を返す。トランザクション管理装置から値を受け
取った電子チケットAPは、その値を使用ログDB内で書き
込み可能なアドレスを指すものとして扱う。 (8)電子チケットは(7)で得たアドレス[4]に履歴を書き
込む。 (9)電子チケットAPは((7)で得たアドレス[4]+1)mo
d Nという計算を行う。(Nはログの大きさであり、ログ
をリングバッファとしてするための計算) (10)電子チケットAPはTr2を終了させるためにトランザ
クション管理装置に対して(9)で計算した値[1]ととも
に終了要求を出す。トランザクション管理装置は渡され
た値をワークエリア上のレコードのTr2のフィールドに
格納し、さらに更新カウンタを調べ、0ではないのでカ
ウンタを1つ減じる。
At this time, the electronic ticket AP executes a transaction composed of Tr1 and Tr2, that is, executes an electronic ticket (updates the ticket DB) and simultaneously leaves a history (updates the use log) in an inseparable manner. Here is an example. FIG. 20 shows the sequence of the host device (electronic cash AP) and the transaction management device, and FIG. 21 shows the contents of the EEPROM and RAM of the transaction management device. Record switch, record log, ticket DB, log DB
Is assumed to be as shown in FIG. (1) The electronic ticket AP uses ticket D to start processing.
The start of the update transaction Tr1 of B is notified to the transaction management device. (2) In the transaction management device, the update counter C is checked, and since it is 0, the counter is incremented by one, and the contents [24] of the record log (# 0) indicated by the switch of the record are copied to the work area of the record. Then, the value [2] stored in the Tr1 field of the record log on the work area is returned. Here, the electronic ticket AP that has received the value from the transaction management device treats the value as indicating a writable address [2] in the ticket DB. (3) The electronic ticket AP searches the ticket DB for a corresponding ticket (referred to as ticket 5) and obtains its address. (4) The data (ticket 5) stored in the address [5] obtained in (3) is copied to the address [2] obtained in (2) (ticket 5 '). (5) The electronic ticket AP updates (reduces the number of times) the data (ticket 5) copied in (3). (6) The electronic ticket AP notifies the transaction management device of the start of the update transaction Tr2 of the usage log DB to leave an update history of the ticket. (7) The transaction management device checks the update counter, and since it is not 0, increments the counter by one and returns the value [4] stored in the Tr2 field of the record log on the work area. The electronic ticket AP that receives the value from the transaction management device treats the value as indicating a writable address in the usage log DB. (8) For the electronic ticket, write the history at the address [4] obtained in (7). (9) The electronic ticket AP is (address [4] +1) mo obtained in (7)
Calculate dN. (N is the size of the log, and is calculated to make the log a ring buffer.) (10) The electronic ticket AP sends the transaction management device with the value [1] calculated in (9) to the Tr to terminate Tr2. Issue a termination request. The transaction management device stores the passed value in the field Tr2 of the record in the work area, checks the update counter, and decrements the counter by one because it is not zero.

【0044】(11)電子チケットAPはTr1を終了させるた
めにトランザクション管理装置に対して(3)における検
索で得たアドレスの値[5]とともに終了要求を出す。ト
ランザクション管理装置は(11)で渡された値[5]をワー
クエリア上のレコードのTr1のフィールドに格納し((1
1)の後の状態 その1)、さらに更新カウンタを調べ、
0であるのでワークエリア上のレコードを、レコードス
イッチが指すレコード(#0)とは逆のレコード(#
1)へコピーし((11)の後の状態 その2)、さらにレ
コードスイッチを先ほどコピーしたレコードを指すよう
に切り換える((11)の後の状態 その3)。
(11) The electronic ticket AP issues a termination request to the transaction management apparatus together with the address value [5] obtained in the search in (3) in order to terminate Tr1. The transaction management device stores the value [5] passed in (11) in the Tr1 field of the record in the work area ((1
State after 1) 1), further check the update counter,
0, the record on the work area is replaced with the record (# 0) opposite to the record (# 0) indicated by the record switch.
Copy to 1) (state after (11), part 2), and switch the record switch to point to the record copied earlier (state after (11), part 3).

【0045】この時点でTr1とTr2で行った更新が確定的
なものとなる。なぜなら、スイッチが切り換わる直前の
チケットDBでは、(3)で検索したアドレスには更新前の
チケット、(2)で得たアドレスには更新後のチケットが
格納されており、使用ログDBでは、(7)で得たアドレス
には(4)におけるチケットの更新ログが残っている。し
かし、この時点で障害が発生したものとしてもトランザ
クション管理装置ではレコードが切り換わっていないた
め、再開後、再度(2)で得られる情報は更新後のチケッ
トが格納されるはずだった場所のアドレスであり、(7)
で得られるアドレスも以前と同じである。つまり、再度
同じ場所が上書きされる。しかし、レコードが切り換わ
るとそれ以降は(2)および(7)で得られる情報は、チケッ
トDBであれば更新前のチケットが格納されていたアドレ
スが返され、使用ログDBであれば(7)で書き込んだログ
の次のアドレスが返されるようになるからである。
At this point, the update performed on Tr1 and Tr2 is deterministic. Because, in the ticket DB just before the switch is switched, the address searched in (3) stores the ticket before update, and the address obtained in (2) stores the ticket after update, and in the usage log DB, The update log of the ticket in (4) remains in the address obtained in (7). However, even if a failure has occurred at this point, since the record has not been switched in the transaction management device, after resuming, the information obtained in (2) again will be the address of the place where the updated ticket was to be stored And (7)
Is the same as before. That is, the same location is overwritten again. However, when the record is switched, the information obtained in (2) and (7) thereafter returns the address where the ticket before the update was stored in the case of the ticket DB, and (7 This is because the next address of the log written in) is returned.

【0046】本実施形態は、実施例1の省リソース・高
速に実現可能という特徴とリカバリ処理が必要ないとい
う特徴に加えて、実際の更新対象となるデータへの操作
を上位装置へ委譲したことにより、同時不可分の更新が
行えるデータ構造に高い柔軟性を持たせることができる
という特徴がある。例えば上記の例では、Tr1とTr2にお
いて、トランザクション管理装置から受信する情報の意
味を上位装置内で解釈し、それぞれ更新の対象となるチ
ケットDBと使用ログDBとで別の更新方法を行っている。
実施例1の方法ではデータの更新をトランザクション管
理装置で行うため、実施例3のように複数のDBがあり、
1つは空き領域を検索して更新する方法、他方はサイク
リックレコードのように更新する方法といった、それぞ
れ別の更新方法を採ることができなかった。また、実施
例3では、トランザクション管理装置から受け取る情報
を現在有効な変数の値が格納されたアドレスと解釈する
ことで、実施例1のような使い方をすることも可能であ
る。つまり上位装置の解釈次第でどのような更新方法を
も取ることができる。
In this embodiment, in addition to the features of the first embodiment, which are resource-saving and can be realized at high speed, and that the recovery process is not required, the operation on the data to be actually updated is delegated to a higher-level device. Accordingly, there is a feature that a data structure which can be simultaneously and indivisiblely updated can have high flexibility. For example, in the above example, in Tr1 and Tr2, the meaning of the information received from the transaction management device is interpreted in the higher-level device, and different update methods are performed for the ticket DB and the usage log DB to be updated, respectively. .
In the method of the first embodiment, since the data is updated by the transaction management device, there are a plurality of DBs as in the third embodiment.
One method cannot be adopted, such as a method of searching and updating a free area and a method of updating like a cyclic record. In the third embodiment, by interpreting the information received from the transaction management device as the address at which the value of the currently valid variable is stored, it is possible to use the method as in the first embodiment. That is, any updating method can be adopted depending on the interpretation of the host device.

【0047】本発明のトランザクション管理装置は、CP
Uやメモリ等を有するコンピュータと、アクセス主体と
なるユーザが利用する利用者端末と、記録媒体から構成
することができる。記録媒体は、CD-ROM、磁気ディスク
装置、半導体メモリ等の機械読み取り可能な記録媒体で
あり、ここに記録されたプログラムは、コンピュータに
読み取られ、コンピュータの動作を制御し、コンピュー
タ上に前述した実施の形態における各構成要素、すなわ
ち更新開始装置、更新カウンタ、更新終了装置、参照装
置、ロールバック装置、スイッチS、メモリ上のレコー
ド記憶領域、ポインタレコード退避領域RS、構造体等
と各処理を実現する。
The transaction management device according to the present invention
It can be composed of a computer having a U, a memory, and the like, a user terminal used by a user serving as an access subject, and a recording medium. The recording medium is a machine-readable recording medium such as a CD-ROM, a magnetic disk device, and a semiconductor memory.The program recorded here is read by a computer, controls the operation of the computer, and is described above on the computer. Each component in the embodiment, that is, an update start device, an update counter, an update end device, a reference device, a rollback device, a switch S, a record storage area on a memory, a pointer record save area RS, a structure, etc. Realize.

【0048】[0048]

【発明の効果】以上説明したように、本発明は、1、ほ
とんどの更新はRAM上のワークエリア上で行えるため、
高速に実現でき、ICカードのような非常にリソースの限
られた形態にも適用できる、2、従来技術と異なり障害
発生時のリカバリ処理の必要がない、3、各変数の値を
現在と1つ前の2つの状態を2本のログで管理してお
り、さらに各変数のどちらかのログが現在の状態かを示
す情報を1つのレコードにまとめ、さらにレコード自体
も現在の状態と1つ前の状態の2本のログで管理され、
レコードのログを切り換える1つの操作で、そのレコー
ド内で管理されている全ての変数のログの状態を切り換
えることができ、値を同時更新することができ、これに
より複数のトランザクションの同時不可分を実現するこ
とができる、4、上位装置からのロールバック要求によ
りデータベースの変更されたデータを元に戻すことが可
能となる、5、実際の更新対象となるデータへの操作を
上位装置へ委譲したことにより、同時不可分の更新が行
えるデータ構造に高い柔軟性を持たせることができる。
As described above, according to the present invention, since 1, most of the updates can be performed on the work area on the RAM,
It can be realized at high speed and can be applied to a very limited form of resources such as an IC card. 2, There is no need for recovery processing when a failure occurs unlike the prior art. The two previous states are managed by two logs, and information indicating which log of each variable is the current state is collected into one record. It is managed by two logs of the previous state,
With one operation to switch the log of a record, the state of the log of all variables managed in the record can be switched, and the values can be updated simultaneously, thereby realizing simultaneous inseparability of multiple transactions. 4. Data that has been changed in the database can be restored by a rollback request from a higher-level device. 5. Operation of data to be actually updated is delegated to a higher-level device. Accordingly, a high flexibility can be given to a data structure that can be simultaneously updated inseparably.

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

【図1】本発明の実施例1のトランザクション管理装置
の構成図。
FIG. 1 is a configuration diagram of a transaction management device according to a first embodiment of the present invention.

【図2】本発明の実施例2のトランザクション管理装置
の構成図。
FIG. 2 is a configuration diagram of a transaction management device according to a second embodiment of the present invention.

【図3】本発明の実施例3のトランザクション管理装置
の構成図。
FIG. 3 is a configuration diagram of a transaction management device according to a third embodiment of the present invention.

【図4】本発明が適用されるICカードの構成例を示す
図。
FIG. 4 is a diagram showing a configuration example of an IC card to which the present invention is applied.

【図5】実施例1のトランザクション管理装置のEEPROM
とRAMの内容説明図。
FIG. 5 is an EEPROM of the transaction management device according to the first embodiment;
And a diagram for explaining the contents of RAM.

【図6】実施例1のレコードの構造を示す図。FIG. 6 is a diagram illustrating the structure of a record according to the first embodiment.

【図7】実施例1のトランザクション管理装置の機能ブ
ロック図。
FIG. 7 is a functional block diagram of the transaction management device according to the first embodiment.

【図8】実施例1のトランザクション開始シーケンス。FIG. 8 shows a transaction start sequence according to the first embodiment.

【図9】実施例1のトランザクション終了シーケンス。FIG. 9 illustrates a transaction end sequence according to the first embodiment.

【図10】実施例1のトランザクションのシーケンス。FIG. 10 illustrates a sequence of a transaction according to the first embodiment.

【図11】図10のシーケンスにおけるトランザクショ
ン管理装置のEEPROMとRAMの内容説明図。
11 is an explanatory diagram of the contents of an EEPROM and a RAM of the transaction management device in the sequence of FIG. 10;

【図12】実施例1のトランザクションの他のシーケン
ス。
FIG. 12 shows another sequence of the transaction according to the first embodiment.

【図13】図12のシーケンスにおけるトランザクショ
ン管理装置のEEPROMとRAMの内容説明図。
13 is an explanatory diagram of the contents of an EEPROM and a RAM of the transaction management device in the sequence of FIG. 12;

【図14】実施例3のトランザクション管理装置のEEPR
OMとRAMの内容説明図。
FIG. 14 illustrates an EEPROM of the transaction management device according to the third embodiment.
OM and RAM content explanatory view.

【図15】実施例3のレコードの構造を示す図。FIG. 15 is a diagram illustrating the structure of a record according to the third embodiment.

【図16】実施例3のトランザクション管理装置の機能
ブロック図。
FIG. 16 is a functional block diagram of a transaction management device according to a third embodiment.

【図17】実施例3のトランザクション開始シーケン
ス。
FIG. 17 shows a transaction start sequence according to the third embodiment.

【図18】実施例3のトランザクション終了シーケン
ス。
FIG. 18 illustrates a transaction end sequence according to the third embodiment.

【図19】実施例3のトランザクション管理装置のEEPR
OMとRAMの内容説明図。
FIG. 19 is a diagram illustrating an EEPROM of the transaction management apparatus according to the third embodiment.
OM and RAM content explanatory view.

【図20】実施例3のトランザクションのシーケンス。FIG. 20 illustrates a sequence of a transaction according to the third embodiment.

【図21】図20のシーケンスにおけるトランザクショ
ン管理装置のEEPROMとRAMの内容説明図。
FIG. 21 is an explanatory diagram of the contents of EEPROM and RAM of the transaction management device in the sequence of FIG. 20;

【図22】従来技術のトランザクションのシーケンス。FIG. 22 shows a sequence of a conventional transaction.

【図23】従来のトランザクション管理装置の構成図。FIG. 23 is a configuration diagram of a conventional transaction management device.

Claims (3)

【特許請求の範囲】[Claims] 【請求項1】任意の上位装置より、変数1〜n(nは任
意の整数)のうち1つ以上の変数に対して任意の組み合
わせ・順序でその内容の更新を指示されたとき、その更
新を同時不可分の処理とすることを可能とするトランザ
クション管理装置において、 トランザクション管理装置は、更新開始装置、更新カウ
ンタ、更新終了装置、2本の変数1〜nを格納するレコ
ード記憶領域を有するメモリ、変数1〜nを格納するポ
インタレコード退避領域を有するメモリ、2本のレコー
ド記憶領域のいずれかを指すスイッチを備え、 上位装置が変数i(1≦i≦n)の更新を開始しようと
するとき、開始要求を受信し、 更新開始装置は、他の上位装置が変数を更新中であるか
否かを更新カウンタを用いて確認し、他の更新が行われ
ていないならば、更新カウンタを増加させ、スイッチが
指すレコード記憶領域の内容をポインタレコード退避領
域へコピーし、レコード退避領域上のレコードに格納さ
れている変数iの内容を上位装置へ送り、他の更新が行
われている最中ならば、更新カウンタを増加させ、ポイ
ンタレコード退避領域上のレコードに格納されている変
数iの内容を上位装置へ送り、 上位装置が変数iの更新を終了しようとしているとき、
上位装置より終了要求と更新された変数iの内容Mを受
信し、 更新終了装置は、レコード退避領域上のレコードに格納
されている変数iに格納し、更新カウンタを減じ、他の
上位装置が変数を更新中でないことを更新カウンタを用
いて確認し、他の更新が行われていないならば、レコー
ド退避領域上のレコードの内容をスイッチが指すレコー
ド記憶領域とは逆のレコード記憶領域にコピーし、スイ
ッチが現在とは反対側のレコード記憶領域を指すよう変
更することを特徴とするトランザクション管理装置。
1. When an update of the contents of one or more of variables 1 to n (n is an arbitrary integer) is instructed in an arbitrary combination and order from an arbitrary higher-level device, the update is performed. In the transaction management device, the transaction management device includes an update start device, an update counter, an update end device, a memory having a record storage area for storing two variables 1 to n, A memory having a pointer record save area for storing variables 1 to n, a switch for pointing to one of two record storage areas, and a higher-level device intending to start updating a variable i (1 ≦ i ≦ n) Receiving the start request, the update start device checks whether or not another host device is updating the variable using the update counter, and if no other update has been performed, the update start device updates the variable. The counter is incremented, the contents of the record storage area pointed to by the switch are copied to the pointer record save area, the contents of the variable i stored in the record in the record save area are sent to the host device, and another update is performed. If the upper-level device is about to finish updating the variable i, the update counter is incremented and the contents of the variable i stored in the record in the pointer record save area are sent to the higher-level device.
The update end device receives the end request and the updated content M of the variable i from the higher-level device, stores it in the variable i stored in the record in the record save area, decrements the update counter, and the other higher-level device Check that the variable is not being updated using the update counter, and if no other update has been performed, copy the contents of the record in the record save area to the record storage area opposite to the record storage area indicated by the switch And a switch for changing the switch to point to a record storage area on the opposite side to the current one.
【請求項2】任意の上位装置より、変数1〜n(nは任
意の整数)のうち1つ以上の変数に対して任意の組み合
わせ・順序でその内容の更新を指示されたとき、その更
新を同時不可分の処理とすることを可能とし、さらにロ
ールバックの指示によって更新の履歴を遡ることを可能
とするトランザクション管理装置であって、 トランザクション管理装置は、更新開始装置、更新カウ
ンタ、更新終了装置、2本以上の変数1〜nを格納する
レコード記憶領域を有するメモリ、変数1〜nを格納す
るポインタレコード退避領域を有するメモリ、2本以上
のレコード記憶領域を指すスイッチ、ロールバック装置
を備え、 上位装置が変数i(1≦i≦n)の更新を開始しようと
するとき、上位装置より開始要求を受信し、更新開始装
置へ渡し、 更新開始装置は、他の上位装置が変数を更新中であるか
否かを更新カウンタを用いて確認し、他の更新が行なわ
れていないならば、更新カウンタを増加させ、スイッチ
が指す、変数1〜nを格納したレコード記憶領域の内容
をレコード退避領域へコピーし、レコード退避領域上の
レコードに格納されている変数iの内容を上位装置へ送
り、他の更新が行われている最中ならば、更新カウンタ
を増加させ、レコード退避領域上のレコードに記憶され
ている変数iの内容を上位装置へ送り、 上位装置が変数iの更新を終了しようとするとき、上位
装置より終了要求と更新された変数iの内容Mを受信
し、更新終了装置へ渡し、 更新終了装置は、レコード退避領域上のレコードに格納
されている変数iにMを記憶し、更新カウンタを減じ、
他の上位装置が変数を更新中でないことを更新カウンタ
を用いて確認し、他の更新が行われていないならば、レ
コード退避領域上のレコードの内容をスイッチが指すレ
コード記憶領域の次のレコード記憶領域にコピーし、ス
イッチの値を1つ増し、現在の次のレコード記憶領域を
指すように変更し、 また、任意の上位装置より、変数1〜nのうち1つ以上
の変数に対して任意の組み合わせ・順序でその内容の更
新した後にロールバックを指示されたとき、上位装置よ
り段数r(rは1以上の整数)を受信し、ロールバック
装置へ渡し、 ロールバック装置は、現在のスイッチの値よりrを減
じ、スイッチの指すレコード記憶領域を変更することを
特徴とするトランザクション管理装置。
2. When an upper device instructs at least one of variables 1 to n (n is an arbitrary integer) to update its contents in an arbitrary combination and order, the update is performed. A transaction management device that enables the process to be performed simultaneously inseparably and further allows the update history to be traced back by a rollback instruction. The transaction management device comprises: an update start device, an update counter, and an update end device. A memory having a record storage area for storing two or more variables 1 to n, a memory having a pointer record save area for storing variables 1 to n, a switch pointing to two or more record storage areas, and a rollback device When the higher-level device attempts to start updating the variable i (1 ≦ i ≦ n), it receives a start request from the higher-level device, passes it to the update start device, The device uses the update counter to determine whether another higher-level device is updating the variable, and if no other update has been performed, increments the update counter, and indicates the variable 1 to which the switch points. n is copied to the record save area, the contents of the variable i stored in the record in the record save area are sent to the host device, and if another update is being performed. The update counter is incremented, and the contents of the variable i stored in the record in the record save area are sent to the higher-level device. Receiving the content M of the variable i and passing it to the update end device, the update end device stores M in the variable i stored in the record in the record save area, decrements the update counter,
Using the update counter, confirm that the variable is not being updated by another host device, and if no other update has been performed, the next record in the record storage area pointed to by the switch indicates the contents of the record in the record save area. Copy to the storage area, increase the value of the switch by one, and change it to point to the current next record storage area. When the rollback is instructed after updating the contents in an arbitrary combination and order, the number of stages r (r is an integer of 1 or more) is received from the higher-level device and passed to the rollback device. A transaction management apparatus characterized in that r is subtracted from a value of a switch and a record storage area indicated by the switch is changed.
【請求項3】任意の上位装置より、記憶領域上の構造体
1〜n(nは任意の整数)のうち1つ以上の構造体に対
して任意の組み合わせ・順序でその内容の更新を指示さ
れたとき、その更新を同時不可分の処理とすることを可
能とするトランザクション管理装置であって、 トランザクション管理装置は、更新開始装置、更新カウ
ンタ、更新終了装置、2本のログインデックス1〜nを
格納するレコード記憶領域を有するメモリ、ログインデ
ックス1〜nを格納するポインタレコード退避領域を有
するメモリ、n本のインデックスと内容を格納した構造
体記憶領域を有するメモリ、2本のレコード記憶領域の
いずれかを指すスイッチを備え、 上位装置が構造体i(1≦i≦n)の更新を開始しよう
とするとき、上位装置より開始要求を受信し、更新開始
装置へ渡し、 更新装置は、他の上位装置が構造体を更新中であるか否
かを更新カウンタを用いて確認し、他の更新が行われて
いないならば、更新カウンタを増加させ、スイッチが指
す、ログインデックス1〜nを格納したレコード記憶領
域の内容をレコード退避領域へコピーし、レコード退避
領域上のレコードに格納されている構造体iに固有のロ
グインデックスの指すログの内容を上位装置へ渡し、他
の更新が行われている最中ならば、更新カウンタを増加
させ、レコード退避領域上のレコードに記憶されている
構造体iに固有のログインデックスの指すログの内容を
上位装置へ渡し、 上位装置が変数i(1≦i≦n)の更新を終了しようと
するとき、上位装置より終了要求を受信し、更新終了装
置へ渡し、 更新終了装置は、更新カウンタを減じ、レコード退避領
域上のレコードに格納されている変数iに固有のログイ
ンデックスが指すログとは異なるログへ上位装置から渡
された構造体iの新しい内容をコピーし、その場所を指
すようにレコード退避領域上のレコードに格納されてい
るログインデックスを更新し、他の上位装置が変数を更
新中でないことを更新カウンタを用いて確認し、他の更
新が行われていないならば、レコード退避領域上のレコ
ードの内容をスイッチが指すレコード記憶領域とは逆の
レコード記憶領域にコピーし、スイッチが現在とは反対
側のレコード記憶領域を指すように変更することを特徴
とするトランザクション管理装置。
3. An instruction to update the contents of one or more of the structures 1 to n (n is an arbitrary integer) in the storage area in an arbitrary combination and order from an arbitrary host device. A transaction management device that, when performed, makes the update an inseparable process. The transaction management device includes an update start device, an update counter, an update end device, and two log indexes 1 to n. A memory having a record storage area for storing, a memory having a pointer record save area for storing log indexes 1 to n, a memory having a structure storage area for storing n indexes and contents, and two record storage areas A switch that indicates whether a higher-level device starts updating the structure i (1 ≦ i ≦ n), receives a start request from the higher-level device, Handover to the new start device, the update device checks whether the structure is being updated by another host device using the update counter, and if no other update has been performed, increments the update counter. The content of the record storage area storing the log indexes 1 to n indicated by the switch is copied to the record save area, and the content of the log indicated by the log index unique to the structure i stored in the record in the record save area To the higher-level device. If another update is being performed, the update counter is incremented, and the contents of the log indicated by the log index unique to the structure i stored in the record in the record save area are transferred. When the higher-level device attempts to end the update of the variable i (1 ≦ i ≦ n), the higher-level device receives a termination request from the higher-level device and passes it to the update ending device. Decrease the counter, copy the new contents of the structure i passed from the higher-level device to a log different from the log indicated by the log index unique to the variable i stored in the record in the record save area, and point to that location Update the log index stored in the record in the record save area as described above, using the update counter to confirm that no other higher-level device is updating the variable, and if no other update has been performed, Transaction management characterized in that the contents of a record in a record save area are copied to a record storage area opposite to the record storage area pointed to by the switch, and the switch is changed to point to the record storage area opposite to the current one. apparatus.
JP2001138564A 2001-05-09 2001-05-09 Transaction management device Expired - Fee Related JP4027055B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2001138564A JP4027055B2 (en) 2001-05-09 2001-05-09 Transaction management device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2001138564A JP4027055B2 (en) 2001-05-09 2001-05-09 Transaction management device

Publications (2)

Publication Number Publication Date
JP2002334004A true JP2002334004A (en) 2002-11-22
JP4027055B2 JP4027055B2 (en) 2007-12-26

Family

ID=18985480

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2001138564A Expired - Fee Related JP4027055B2 (en) 2001-05-09 2001-05-09 Transaction management device

Country Status (1)

Country Link
JP (1) JP4027055B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006185130A (en) * 2004-12-27 2006-07-13 Sumitomo Mitsui Banking Corp Financial product provision system and method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006185130A (en) * 2004-12-27 2006-07-13 Sumitomo Mitsui Banking Corp Financial product provision system and method

Also Published As

Publication number Publication date
JP4027055B2 (en) 2007-12-26

Similar Documents

Publication Publication Date Title
KR100396722B1 (en) Transactional file system for realizing atomic update of plural files by transactions
US4868744A (en) Method for restarting a long-running, fault-tolerant operation in a transaction-oriented data base system without burdening the system log
US7107294B2 (en) Method and apparatus for interrupting updates to a database to provide read-only access
US5287496A (en) Dynamic, finite versioning for concurrent transaction and query processing
US6018746A (en) System and method for managing recovery information in a transaction processing system
JP2505112B2 (en) Transaction management method
JPH07175700A (en) Database management system
JP2003513357A (en) Method and apparatus for performing atomic updates using a logical flash memory device
US6944635B2 (en) Method for file deletion and recovery against system failures in database management system
Mohan et al. ARIES-RRH: Restricted repeating of history in the ARIES transaction recovery method
JPH07110784A (en) Method and device for storing additional form record
US6535893B1 (en) Method for estimating the elapsed time required for a log apply process
US6134562A (en) System for modifying a database using a transaction log
US20030220950A1 (en) Database controlling system
JP2002334004A (en) Transaction managing device
JPH0816881B2 (en) Database update method
JP2003085021A (en) Batch processing system equipped with recovery/restart function, program for batch processing system equipped with recovery/restart function, and recording medium for recording program
JPH06149485A (en) Data completion guarantee processing method
JPH05307478A (en) Constituting method for data base management system
JP2001229063A (en) Data managing system
JP2817705B2 (en) Post-update journal collection method
JPS63133240A (en) Contents assurance system for residence table
JP3330006B2 (en) Network system including information storage system, input system of the system, and
JPH11353215A (en) Journal-after-update collecting process system
JPH03271841A (en) Recovery system for data base

Legal Events

Date Code Title Description
RD03 Notification of appointment of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7423

Effective date: 20060425

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20070619

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20070810

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20071009

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

Free format text: PAYMENT UNTIL: 20101019

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20101019

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20111019

Year of fee payment: 4

LAPS Cancellation because of no payment of annual fees