JP2007183728A - Multiplex database system, synchronization method therefor, intermediation device and intermediation program - Google Patents

Multiplex database system, synchronization method therefor, intermediation device and intermediation program Download PDF

Info

Publication number
JP2007183728A
JP2007183728A JP2006000530A JP2006000530A JP2007183728A JP 2007183728 A JP2007183728 A JP 2007183728A JP 2006000530 A JP2006000530 A JP 2006000530A JP 2006000530 A JP2006000530 A JP 2006000530A JP 2007183728 A JP2007183728 A JP 2007183728A
Authority
JP
Japan
Prior art keywords
server
database
response
processing
query
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2006000530A
Other languages
Japanese (ja)
Inventor
Takeshi Mishima
健 三島
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 JP2006000530A priority Critical patent/JP2007183728A/en
Publication of JP2007183728A publication Critical patent/JP2007183728A/en
Pending legal-status Critical Current

Links

Images

Landscapes

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

Abstract

<P>PROBLEM TO BE SOLVED: To provide a synchronization method in a multiplex database system, not causing contradiction between respective databases even if processing a plurality of transactions in parallel. <P>SOLUTION: In this multiplex database system, an intermediation device 200 detects contradiction of a processing result between respective servers 100, or a non-response of the server 100, selects one response from respective responses and cuts off the server 100 returning the response except the selected response from the system when detecting the contradiction of the processing result. When detecting the non-response of the server 100, the intermediation device 200 cuts off the server 100 of the no-response from the system, performs synchronization processing with the server 100 during normal operation incorporated in the system and the server 100 cut off from the system, and incorporates the server 100 cut off from the system into the system again after the synchronization processing is completed. <P>COPYRIGHT: (C)2007,JPO&INPIT

Description

本発明は、複数のデータベースマネージメントシステム(DBMS)を並列動作させた多重化データベースシステムに関し、特に各データベース間の同期技術に関する。   The present invention relates to a multiplexed database system in which a plurality of database management systems (DBMS) are operated in parallel, and more particularly to a synchronization technique between databases.

従来の多重化データベースシステムは、例えば特許文献1に記載されたものが知られている。このシステムでは、図50に示すように、それぞれデータベースを備えた2つの計算機1010と計算機1020が通信回線により接続されている。各計算機1010と1020とは、いわゆる二相コミット制御によりデータベース間の同期が図られている。   As a conventional multiplexed database system, for example, one described in Patent Document 1 is known. In this system, as shown in FIG. 50, two computers 1010 and 1020 each having a database are connected by a communication line. The computers 1010 and 1020 are synchronized between databases by so-called two-phase commit control.

計算機1010は、各種の業務処理を実行する応用プログラム1011と、データベース1014の検索及び更新の制御を行うとともにトランザクションモニタ1013を介して他の計算機1020のデータベース1024における更新処理との同期を取るデータベース管理システム1012と、いわゆる二相コミット制御によってデータベース1014と1024の更新処理の同期をとるトランザクションモニタ1013とから構成される。計算機1020についても計算機1010と同様に、応用プログラム1021と、データベース管理システム1022と、トランザクションモニタ1023とから構成されている。   The computer 1010 controls the application program 1011 for executing various business processes and the search and update of the database 1014 and synchronizes with the update process in the database 1024 of another computer 1020 via the transaction monitor 1013. The system 1012 includes a transaction monitor 1013 that synchronizes update processing of the databases 1014 and 1024 by so-called two-phase commit control. Similarly to the computer 1010, the computer 1020 is composed of an application program 1021, a database management system 1022, and a transaction monitor 1023.

本システムにおいて、計算機1010のデータベース1014と計算機1020のデータベース1024で同じデータを保持し、更新があった場合でも両方のデータベース1014と1024に同じ更新が反映される処理手順について説明する。   In this system, a processing procedure in which the same data is held in the database 1014 of the computer 1010 and the database 1024 of the computer 1020 and the same update is reflected in both the databases 1014 and 1024 even when there is an update will be described.

応用プログラム1011は、あるトランザクション内でデータベース1014と1024を同一クエリで更新する。データベース1014は、データベース管理システム1012が更新し、データベース1024はデータベース管理システム1022が更新する。   The application program 1011 updates the databases 1014 and 1024 with the same query within a certain transaction. The database 1014 is updated by the database management system 1012, and the database 1024 is updated by the database management system 1022.

そして、応用プログラム1011は、トランザクションの最後に今までの更新を確定する「COMMIT要求」又は今までの更新を取り消す「ROLLBACK要求」を発行する。「COMMIT要求」又は「ROLLBACK要求」は、トランザクションモニタ1013によってデータベース管理システム1012と、トランザクションモニタ1023を経由してデータベース管理システム1022へ送られる。   Then, the application program 1011 issues a “COMMIT request” for confirming the update so far or a “ROLLBACK request” for canceling the update so far at the end of the transaction. The “COMMIT request” or “ROLLBACK request” is sent by the transaction monitor 1013 to the database management system 1022 via the database management system 1012 and the transaction monitor 1023.

例えば、トランザクションモニタ1013が「COMMIT要求」を転送した場合、データベース管理システム1012と1022は、COMMIT実行の可否をトランザクションモニタ1013へ返答する。この際、データベース管理システム1012と1022は実際にはCOMMITを実行せず、実行の可否のみを答えるのみである。   For example, when the transaction monitor 1013 transfers a “COMMIT request”, the database management systems 1012 and 1022 return whether or not COMMIT execution is possible to the transaction monitor 1013. At this time, the database management systems 1012 and 1022 do not actually execute COMMIT, but only answer whether or not execution is possible.

トランザクションモニタ1013及び1023は、データベース管理システム1012及び1022の双方から「COMMIT可」の応答を受け取ると、それぞれデータベース管理システム1012及び1022に「COMMIT実行」を送信する。「COMMIT実行」を受け取ったデータベース管理システム10112と1022は、実際にCOMMITを実行する。   When the transaction monitors 1013 and 1023 receive a “COMMIT OK” response from both the database management systems 1012 and 1022, they transmit “COMMIT execution” to the database management systems 1012 and 1022, respectively. The database management systems 10112 and 1022 that have received “COMMIT execution” actually execute COMMIT.

一方、例えばトランザクションモニタ1013が、データベース管理システム1012又は1022の一方から「COMMIT不可」の応答を受け取った場合、他方の応答が「COMMIT可」であったとしても、データベース管理システム1012と1022に対して「ROLLBACK実行」を送信し、トランザクションをキャンセルする。「ROLLBACK実行」を受け取ったデータベース管理システム1012と1022は、実際にROLLBACKを実行する。   On the other hand, for example, when the transaction monitor 1013 receives a “COMMIT not possible” response from one of the database management systems 1012 or 1022, even if the other response is “COMMIT OK”, the transaction monitor 1013 responds to the database management systems 1012 and 1022. Then, “Execute ROLLBACK” is transmitted to cancel the transaction. Receiving “Execute ROLLBACK”, the database management systems 1012 and 1022 actually execute ROLLBACK.

以上のようにして、どちらか一方のデータベースだけ更新が反映されることを防ぎ、両方のデータベースに対して常に同一の更新が行われるようにすることで、データベース間の同期を保つ。
特開平6−161862号公報
As described above, the update is prevented from being reflected only in one of the databases, and the same update is always performed on both databases, thereby maintaining synchronization between the databases.
JP-A-6-161862

しかしながら、上述の従来技術は、複数のデータベースにおける一トランザクションのデータベースの同期を図る方法であって、複数のトランザクション間でのデータベースの同期を制御することはできない。つまり、複数のトランザクションが並行に実行されている状態で、且つ、それらのトランザクションが同一のテーブルの同一行にほぼ同時にアクセスした場合には、データベースの同期が崩れたり、クライアントへ返す返答が一意に決まらないなどの問題が生じる。この問題点について以下に具体的に例示する。   However, the above-described conventional technique is a method for synchronizing the database of one transaction in a plurality of databases, and cannot control the synchronization of the database between the plurality of transactions. In other words, when multiple transactions are executed in parallel and these transactions access the same row of the same table almost simultaneously, the database is out of sync or the response returned to the client is unique. Problems such as being undecided arise. This problem will be specifically exemplified below.

図51に示すtest_tableという名前のテーブルを考える。この時、図52に示すトランザクションT1及びT2がほぼ同時に実行される場合を考える。トランザクションT1はid=101の行を更新し、トランザクションT2はid=101の行とid=102の行を更新する。どちらのトランザクションのUPDATEが先に実行されるかによって、id=101の値は異なってしまう。   Consider a table named test_table shown in FIG. At this time, consider a case where transactions T1 and T2 shown in FIG. 52 are executed almost simultaneously. Transaction T1 updates the row with id = 101, and transaction T2 updates the row with id = 101 and the row with id = 102. The value of id = 101 differs depending on which transaction UPDATE is executed first.

2つのトランザクション中のUPDATEが実行される順序は以下の2通りが考えられる。   The order in which the UPDATEs in the two transactions are executed can be considered in the following two ways.

(1)T1のUPDATEの後にT2のUPDATE
(2)T2のUPDATEの後にT1のUPDATE
(1)の場合、2つのトランザクション実行後にはT2のUPDATEの結果が残り、department=2となる。一方(2)の場合、2つのトランザクション実行後にはT1のUPDATEの結果が残り、department=1となる。すなわち、(1)と(2)では最終的なテーブルtest_tableのデータが異なる。
(1) T2 UPDATE after T1 UPDATE
(2) T2 UPDATE after T2 UPDATE
In the case of (1), after two transactions are executed, the result of UPDATE of T2 remains and division = 2. On the other hand, in the case of (2), the result of UPDATE of T1 remains after execution of two transactions, and division = 1. That is, the data of the final table test_table differs between (1) and (2).

つまり、複数のデータベースの初期状態が同じで、且つ、同じトランザクションを実行したとしても、あるDBMSでは(1)の順で実行し、別のDBMSは(2)の順で実行した場合、2つのデータベースは同期状態(同じデータを保持している状態)が崩れてしまう問題が発生する。   That is, even if the initial state of a plurality of databases is the same and the same transaction is executed, if one DBMS executes in the order (1) and another DBMS executes in the order (2), There is a problem that the database is out of sync (the state that holds the same data).

また、別の例として、図53に示すトランザクションT3及びT4がほぼ同時に実行される場合を考える。トランザクションT4のSELECTがトランザクションT3のCOMMITの前に実行されるか又は後に実行されるかで、トランザクションT4のSELECTで得られる値は異なってしまう。   As another example, consider a case where transactions T3 and T4 shown in FIG. 53 are executed almost simultaneously. The value obtained in the SELECT of the transaction T4 differs depending on whether the SELECT of the transaction T4 is executed before or after the COMMIT of the transaction T3.

トランザクションT4のSELECTとトランザクションT3のCOMMITが実行される順序は以下の2通りが考えられる。   There are two possible orders for executing SELECT of transaction T4 and COMMIT of transaction T3.

(3)T4のSELECTの後にT3のCOMMIT
(4)T3のCOMMITの後にT4のSELECT
(3)の場合、トランザクションT4のSELECT実行後には、トランザクションT3のUPDATEが反映されていない古い値department=3が得られる。一方(4)の場合、トランザクションT4のSELECT実行後には、トランザクションT3のUPDATEが反映された値department=1が得られる。
(3) T3 COMMIT after T4 SELECT
(4) T4 SELECT after T3 COMMIT
In the case of (3), after the SELECT of the transaction T4 is executed, an old value department = 3 that does not reflect the UPDATE of the transaction T3 is obtained. On the other hand, in the case of (4), the value department = 1 reflecting the UPDATE of the transaction T3 is obtained after the SELECT of the transaction T4 is executed.

つまり、複数のデータベースの初期状態が同じで、且つ、同じトランザクションを実行したとしても、あるDBMSは(3)の順で実行し、別のDBMSは(4)の順で実行した場合、得られる値が異なってしまう。   That is, even if the initial state of a plurality of databases is the same and the same transaction is executed, it is obtained when one DBMS is executed in the order of (3) and another DBMS is executed in the order of (4). The value will be different.

本発明は、上記事情に鑑みてなされたものであり、その目的とするところは、複数のトランザクションを並行処理しても各データベース間で矛盾の生じることがない多重化データベースシステムにおける同期化方法を提供することにある。   The present invention has been made in view of the above circumstances, and an object of the present invention is to provide a synchronization method in a multiplexed database system in which inconsistency does not occur between databases even when a plurality of transactions are processed in parallel. It is to provide.

本願発明は、複数のデータベースサーバと、クライアントコンピュータからの処理要求を各データベースサーバに中継するとともに各データベースサーバからの正当な応答の1つをクライアントコンピュータに処理結果として返す仲介装置とを備えた多重化データベースシステムにおける各データベースの同期化処理に関するものである。   The invention of the present application is a multiplex comprising a plurality of database servers and an intermediary device that relays a processing request from a client computer to each database server and returns one of the valid responses from each database server as a processing result to the client computer. The present invention relates to the synchronization processing of each database in the database system.

ところで、各データベースサーバにおいて複数のトランザクションが並行して処理され、しかも各データベースサーバでトランザクション内での処理要求が互いに異なる順番で処理されると、仲介装置側からは、(1)あるデータベースサーバからの応答はあるが他のデータベースサーバからの応答はない、又は、(2)あるデータベースサーバからの応答と他のデータベースサーバからの応答とが矛盾している(異なっている)、と認識される場合がある。   By the way, when a plurality of transactions are processed in parallel in each database server, and processing requests in the transactions are processed in different orders in each database server, from the intermediary device side, (1) from a certain database server It is recognized that there is no response from another database server, or (2) the response from one database server and the response from another database server are inconsistent (different) There is a case.

そこで、本願発明では、仲介装置は、(A)(i)データベースサーバから処理要求に対する応答がない事を検出すると該無応答のデータベースサーバをシステムから切り離し、又は、(ii)各データベースサーバ間における処理結果の矛盾を検出し、処理結果の矛盾を検出したら各応答の中から1つの応答を選定するとともに当該選定した応答をクライアントコンピュータに返し、選定した応答以外の応答を返したデータベースサーバをシステムから切り離し、(B)システムから切り離されたデータベースサーバとシステムに組み込まれている正常稼働中のデータベースサーバとの同期化処理を行い、(C)同期化処理が完了したらシステムから切り離されたデータベースサーバを再びシステムに組み込む。   Therefore, in the present invention, the intermediary device (A) (i) upon detecting that there is no response to the processing request from the database server, disconnects the non-response database server from the system, or (ii) between each database server A database server that detects a contradiction in processing results, selects one response from each response, returns the selected response to the client computer, and returns a response other than the selected response. (B) The database server separated from the system is synchronized with the database server operating normally in the system, and (C) the database server separated from the system when the synchronization processing is completed. Is incorporated into the system again.

これにより、あるデータベースサーバからの応答はあるが他のデータベースからの応答がない場合には、当該応答のないデータベースサーバがシステムから切り離される。または、あるデータベースサーバからの応答と他のデータベースサーバからの応答とが矛盾している場合には、各応答の中から1つの応答が選定され、選定された応答以外の応答を返したデータベースサーバがシステムから切り離される。すなわち、各データベースサーバ間で処理要求の処理順序が異なり各データベースサーバ間で非同期になった(各データベースサーバ間で同一であるはずのデータが同一でなくなった)可能性を検出すると、あるデータベースサーバを基準として該データベースサーバと非同期になった可能性のあるデータベースサーバがシステムから切り離される。そして、正常稼働中のデータベースサーバとシステムから切り離されたデータベースサーバとの同期化処理が行われ、同期化処理が完了するとシステムから切り離されたデータベースサーバが再びシステムに組み込まれる。これにより、各データベースサーバの同期化が図られる。   As a result, when there is a response from a certain database server but no response from another database, the database server having no response is disconnected from the system. Or, if a response from one database server and a response from another database server are inconsistent, one response is selected from the responses, and the database server returns a response other than the selected response Is disconnected from the system. In other words, when a database server detects the possibility that the processing order of processing requests differs between database servers and the database servers become asynchronous (data that should be the same between the database servers is no longer the same) As a reference, the database server that may be asynchronous with the database server is disconnected from the system. Then, synchronization processing is performed between the database server that is operating normally and the database server that is separated from the system. When the synchronization processing is completed, the database server that is separated from the system is incorporated into the system again. Thereby, synchronization of each database server is achieved.

上記同期化処理においては、仲介装置にクライアントコンピュータからの処理要求を差分情報として記憶する差分情報記憶部と、データベースのスナップショットを記憶するスナップショット記憶部とを設け、データベースサーバがシステムから切り離されている間にクライアントコンピュータから受信した処理要求を差分情報として記憶する。また、仲介装置は、正常稼働中のデータベースサーバからスナップショットを取得してスナップショット記憶部に記憶する。そして、仲介装置は、該該スナップショットを用いて、システムから切り離されたデータベースサーバのデータベースを復元する。その後に、仲介装置は、前記差分情報記憶部に記憶されてた差分情報を当該データベースサーバに順次送信する。データベースサーバは、仲介装置から差分情報として処理要求を処理することで正常稼働中のサーバとの同期化が図れる。   In the synchronization process, the intermediary device is provided with a difference information storage unit that stores processing requests from client computers as difference information and a snapshot storage unit that stores database snapshots, and the database server is disconnected from the system. During this time, the processing request received from the client computer is stored as difference information. Further, the mediation device acquires a snapshot from the database server that is operating normally and stores it in the snapshot storage unit. Then, the intermediary device restores the database of the database server separated from the system using the snapshot. Thereafter, the mediation device sequentially transmits the difference information stored in the difference information storage unit to the database server. The database server can synchronize with a normally operating server by processing a processing request as difference information from the mediation device.

なお、ここでシステムへのデータベースサーバの組み込みとは、多重化データベースシステムを構成するデータベースサーバとして機能するよう仲介装置が当該データベースサーバを取り扱うようにすることを意味する。また、システムからのデータベースサーバからの切り離しとは、多重化データベースシステムを構成するデータベースサーバとして機能しないよう仲介装置が当該データベースサーバを取り扱うようにすることを意味する。したがって、システムに組み込まれているデータベースサーバにはクライアントコンピュータからの処理要求が仲介装置を介して届くが、システムから切り離されたデータベースサーバにはクライアントコンピュータからの処理要求が届かない状態となる。なお、データベースサーバがシステムに組み込まれていること又は切り離されていることと、データベースサーバが仲介装置と通信可能又は不能であることとは無関係である点に留意されたい。つまり、データベースサーバと仲介装置が通信可能な状態にある場合であっても、データベースサーバがシステムに組み込まれていない場合もあり得る。   Here, the incorporation of the database server into the system means that the mediating apparatus handles the database server so as to function as a database server constituting the multiplexed database system. In addition, the separation from the database server from the system means that the mediating apparatus handles the database server so that it does not function as the database server constituting the multiplexed database system. Therefore, the processing request from the client computer reaches the database server incorporated in the system via the mediation device, but the processing request from the client computer does not reach the database server separated from the system. It should be noted that it is irrelevant whether the database server is incorporated in or disconnected from the system, and whether the database server can or cannot communicate with the mediation device. That is, even when the database server and the mediation apparatus are in a communicable state, the database server may not be incorporated in the system.

以上説明したように本発明によれば、複数のトランザクションを並行処理することにより各データベースサーバ間で矛盾が生じても、各データベースサーバの同期化が図られるので当該矛盾を解消できる。また、各データベースサーバの同期を維持するための制御処理は、専ら仲介装置でのみ実施するので、データベースそのものは従来の既存のものを無改造で利用できる。さらに、各データベースサーバでは同期を保つために全てのデータベースで同じ順序で更新されることを保証する処理、つまり、更新クエリの順序制御やスケジューリング、それらを実現するためのサーバ間通信、順序制御が失敗した場合のロールバックなどの処理を行う必要がないので、当該処理に伴う処理負荷の増加を防止できる。   As described above, according to the present invention, even if a contradiction occurs between the database servers by processing a plurality of transactions in parallel, the database servers can be synchronized and thus the conflict can be resolved. In addition, since the control process for maintaining the synchronization of each database server is performed exclusively by the mediation device, the existing database can be used without modification as the database itself. Furthermore, each database server has processing that guarantees that all databases are updated in the same order in order to maintain synchronization, that is, update query order control and scheduling, server-to-server communication and order control for realizing them. Since it is not necessary to perform processing such as rollback in the case of failure, an increase in processing load associated with the processing can be prevented.

(第1の実施の形態)
本発明の第1の実施の形態に係る多重化データベースシステムについて図面を参照して説明する。図1は本実施の形態に係る多重化データベースシステムの全体構成を説明するブロック図である。
(First embodiment)
A multiplexed database system according to a first embodiment of the present invention will be described with reference to the drawings. FIG. 1 is a block diagram illustrating the overall configuration of a multiplexed database system according to the present embodiment.

この多重化データベースシステムは、図1に示すように、複数のデータベースサーバ(以下「サーバ」と言う)100と仲介装置200とをネットワーク300で接続したものであり、ネットワーク400を介して1以上のクライアントコンピュータ(以下「クライアント」と言う)500及びデータベース一致検査装置600からアクセスされるものである。本実施の形態では、図1に示すように、2台のサーバ100a及び100bを有しており、2台のクライアント500a及び500bからアクセスされる。以降の説明において各サーバ100を他のサーバ100と区別する場合には添え字「a」「b」を付加するものとする。クライアント500についても同様である。なお、図1の例では、サーバ100とクライアント500はそれぞれ別々のネットワーク300,400に接続されているが、同じネットワークに接続されていてもよい。   As shown in FIG. 1, this multiplexed database system is a system in which a plurality of database servers (hereinafter referred to as “servers”) 100 and an intermediary device 200 are connected by a network 300, and one or more database servers are connected via the network 400. It is accessed from a client computer (hereinafter referred to as “client”) 500 and a database match checking device 600. In the present embodiment, as shown in FIG. 1, two servers 100a and 100b are provided and accessed from two clients 500a and 500b. In the following description, when each server 100 is distinguished from other servers 100, subscripts “a” and “b” are added. The same applies to the client 500. In the example of FIG. 1, the server 100 and the client 500 are connected to different networks 300 and 400, respectively, but may be connected to the same network.

図1に示すように、仲介装置200は、ネットワーク400側にIPアドレス172.17.1.1を持っており、これをデータベースサーバのIPアドレスとして公開している。クライアント500やデータベース一致検査装置600はデータベースにアクセスしたいときはIPアドレス172.17.1.1へクエリを送信し、IPアドレス172.17.1.1の仲介装置200からそのクエリに対する応答パケットを受信する。これは、クライアント500等にとっては、IPアドレス172.17.1.1を持ったデータベースサーバとパケットを送受信していることと同じである。このIPアドレス172.17.1.1を持った仮想的なデータベースサーバを仮想サーバ800と呼ぶ。この仮想サーバ800の目的は、サーバ100が冗長化されていることを隠蔽するためである。つまり、サーバ100aとサーバ100b両方が稼働していようとサーバ100bがダウンしてサーバ100aのみが稼働していようとサーバ100aとサーバ100bの他に新たなサーバが追加されようとクライアントには影響は無く、動作を変更する必要がない。   As shown in FIG. 1, the intermediary device 200 has an IP address 172.17.1.1 on the network 400 side, and discloses this as the IP address of the database server. When the client 500 or the database match checking device 600 wants to access the database, it sends a query to the IP address 172.17.1.1, and receives a response packet to the query from the intermediary device 200 with the IP address 172.17.1.1. This is the same as sending / receiving a packet to / from the database server having the IP address 172.17.1.1 for the client 500 or the like. A virtual database server having this IP address 172.17.1.1 is called a virtual server 800. The purpose of the virtual server 800 is to conceal that the server 100 is redundant. That is, whether both the server 100a and the server 100b are operating, whether the server 100b is down and only the server 100a is operating, whether a new server is added in addition to the server 100a and the server 100b, the client is not affected. There is no need to change the operation.

サーバ100は、データを保存・管理するデータベース101を備えている。また、サーバ100は、仲介装置200等の外部からの指示に応じて再起動を行う。このサーバ100の再起動によりデータベース101が起動する。   The server 100 includes a database 101 that stores and manages data. Further, the server 100 restarts in response to an instruction from the outside such as the mediation apparatus 200. When the server 100 is restarted, the database 101 is started.

データベース101は、SQL(Structured Query Language)を解して処理を行うRDBMS(Relational Database Management System)である。このようなデータベース101としては種々のものがあり、例えばThe PostgreSQL Global Development GroupによるPostgreSQL(http://www.postgres.org/)や、Oracle社によるOracle(登録商標)(http://www.oracle.com/)などが挙げられる。本実施の形態ではデータベース101としてPostgreSQLを用いるものとする。   The database 101 is an RDBMS (Relational Database Management System) that performs processing by solving SQL (Structured Query Language). There are various types of such databases 101, for example, PostSQL (http://www.postgres.org/) by The PostgreSQL Global Development Group, Oracle (registered trademark) by Oracle (http: // www. oracle.com/). In the present embodiment, PostgreSQL is used as the database 101.

また、データベース101は、ネットワークを介して他の端末から、スナップショットの作成、及び、スナップショットからのデータベースの復元する機能を有しているものとする。この機能は、通常、データベース101のメンテナンスに係る機能として提供されている。例えば、PostgreSQLでは、pg_dump及びpsqlというツールが用意されており、これらのツールを用いることにより他の端末からスナップショットの取得及びスナップショットからの復元を実施できる。ここで、スナップショットとはデータベース全体の複製データやデータベースを復元するために必要なデータを意味する。一般的に、スナップショット作成開始時にコミットされていないデータがスナップショットに含まれるか否かや、スナップショット作成中にクエリの処理が可能か否かなどはデータベース101の仕様によって異なる。本実施の形態では、スナップショット作成開始時にコミットされているデータのみがスナップショットに反映される、つまり、スナップショット作成開始後にコミットされたクエリの内容はスナップショットに反映されない、という事を前提とする。   In addition, the database 101 has functions of creating a snapshot and restoring the database from the snapshot from another terminal via the network. This function is normally provided as a function related to maintenance of the database 101. For example, in PostgreSQL, tools pg_dump and psql are prepared, and by using these tools, it is possible to acquire a snapshot from another terminal and restore from the snapshot. Here, the snapshot means replicated data of the entire database or data necessary for restoring the database. In general, whether or not uncommitted data is included in a snapshot at the start of snapshot creation, whether or not a query can be processed during snapshot creation, and the like depend on the specifications of the database 101. In this embodiment, it is assumed that only the data committed at the start of snapshot creation is reflected in the snapshot, that is, the contents of the query committed after the start of snapshot creation is not reflected in the snapshot. To do.

仲介装置200は、図2に示すように、本システム内のサーバ100を管理するサーバ管理表201と、トランザクションを管理するトランザクション管理表202と、サーバ100に送信するクエリを一時保存する送信キュー203と、クライアント500から受信したクエリを送信キュー203に投入する受信クエリ処理部204と、送信キュー203からクエリを取り出してサーバ100に送信するクエリ送信処理部205と、クエリ送信処理部205で送信したクエリに対する各サーバ100からの応答の正当性を判定する正当性判定部206と、正当性判定部206で正当と判定された応答を要求元のクライアント500等に送信する応答送信処理部207と、各サーバ100間の同期化処理を制御する同期化処理制御部208と、同期化処理時にサーバ100から取得したデータベース101のスナップショットを一時記憶するスナップショット記憶部209とを備えている。   As shown in FIG. 2, the intermediary device 200 includes a server management table 201 that manages the server 100 in this system, a transaction management table 202 that manages transactions, and a transmission queue 203 that temporarily stores queries to be transmitted to the server 100 The query received from the client 500 is input to the transmission queue 203, the query is extracted from the transmission queue 203 and transmitted to the server 100, and the query transmission processor 205 transmits the query. A legitimacy determination unit 206 that determines the legitimacy of a response from each server 100 to the query, a response transmission processing unit 207 that transmits a response determined to be legitimate by the legitimacy determination unit 206 to the requesting client 500, A synchronization processing control unit 208 that controls the synchronization processing between the servers 100; And a snapshot storage unit 209 for temporarily storing a snapshot of the database 101 obtained from the server 100 during the synchronization process.

サーバ管理表201は、サーバが正常稼働中でクエリの処理が可能であるか(active)、同期化処理中であるか(sync)という状態情報を保存している。また、サーバ100がシステムから切り離された場合には、当該サーバ100についてのエントリはサーバ管理表201から削除される。図3にサーバ管理表の一例を示す。サーバ管理表201は、図3に示すように、サーバ100を識別するためのサーバIDと、サーバの稼働状態から構成されている。図3の例では、サーバ100aとサーバ100bとが登録されており、稼働状態は共に正常稼働を示すactiveである。また、本実施形態では、サーバIDとしてサーバ100に付されたIPアドレスを用いた。   The server management table 201 stores state information indicating whether the server is operating normally and whether the query can be processed (active) or whether the synchronization process is being performed (sync). When the server 100 is disconnected from the system, the entry for the server 100 is deleted from the server management table 201. FIG. 3 shows an example of the server management table. As shown in FIG. 3, the server management table 201 is composed of a server ID for identifying the server 100 and an operating state of the server. In the example of FIG. 3, the server 100 a and the server 100 b are registered, and the operation state is “active” indicating both normal operation. In this embodiment, the IP address assigned to the server 100 is used as the server ID.

トランザクション管理表202は、現在実行中の又は実行開始を保留されているトランザクションの有無を記憶する。図4にトランザクション管理表202の一例を示す。図4に示すように、トランザクション管理表202は、クライアントを一意に識別するクライアントIDとトランザクションを一意に識別するトランザクションIDから構成される。これらのペアは、受信クエリ処理部204がトランザクション開始時にトランザクション管理表202に登録し、応答送信処理部207がトランザクション終了時にトランザクション管理表202から削除する。クライアントIDは、例えばクライアント500等のIPアドレスやポート番号である。トランザクションIDは新しいトランザクションが発生する毎に受信クエリ処理部204が新たに割り振る。   The transaction management table 202 stores the presence / absence of a transaction that is currently being executed or whose execution has been suspended. FIG. 4 shows an example of the transaction management table 202. As shown in FIG. 4, the transaction management table 202 includes a client ID for uniquely identifying a client and a transaction ID for uniquely identifying a transaction. These pairs are registered in the transaction management table 202 by the reception query processing unit 204 at the start of the transaction, and deleted from the transaction management table 202 by the response transmission processing unit 207 at the end of the transaction. The client ID is an IP address or a port number of the client 500, for example. The transaction ID is newly allocated by the reception query processing unit 204 every time a new transaction occurs.

送信キュー203は、クライアント500等から受信したクエリをサーバ100に送信する際の送信バッファとしての機能を有するとともに、同期化処理時にクライアント500から受信したクエリを差分情報として記憶蓄積する機能とを有するものである。   The transmission queue 203 has a function as a transmission buffer when transmitting a query received from the client 500 or the like to the server 100, and also has a function of storing and storing the query received from the client 500 during the synchronization process as difference information. Is.

送信キュー203のデータ構造について図5を参照して説明する。送信キュー203は、クライアント500から受信したクエリの内容と、そのクエリの属するトランザクションIDと、各サーバ100への送信状態とを記憶する。トランザクションIDは、トランザクション管理表202から取得される。各サーバ100への送信状態は、システムに属する各サーバ100毎に記憶される。   The data structure of the transmission queue 203 will be described with reference to FIG. The transmission queue 203 stores the contents of the query received from the client 500, the transaction ID to which the query belongs, and the transmission state to each server 100. The transaction ID is acquired from the transaction management table 202. The transmission state to each server 100 is stored for each server 100 belonging to the system.

送信キュー203の各サーバ100への送信状態は、「未送信」,「送信完了」,「保留」,「保留解除」の4つの値を取りうる。「未送信」は、特に保留することなく当該サーバ100に送信予定であるが未だ送信されていない状態である。「送信完了」は、当該サーバ100への送信が完了した状態である。「保留」は、サーバ100のシステムへの組み込み処理中に、当該サーバ100へ転送されることなく保留されている状態である。「保留解除」は、「保留」状態が解除されたが未送信の状態である。送信キュー203の各エントリは、全てのサーバ100についての送信状態が「送信完了」になり、且つ、当該クエリの属するトランザクションが終了すると送信キュー203から削除される。   The transmission status of the transmission queue 203 to each server 100 can take four values: “untransmitted”, “transmission complete”, “hold”, and “hold release”. “Non-transmission” is a state in which the transmission is scheduled to be made to the server 100 without being suspended, but has not been transmitted yet. “Transmission complete” is a state in which transmission to the server 100 is completed. “Hold” is a state where the server 100 is held without being transferred to the server 100 during the process of incorporating the server 100 into the system. “Release hold” is a state where the “hold” state is released but not transmitted. Each entry in the transmission queue 203 is deleted from the transmission queue 203 when the transmission state for all the servers 100 is “transmission complete” and the transaction to which the query belongs is completed.

受信クエリ処理部204は、クライアント500からのクエリをネットワーク400経由で受信すると、当該クエリを解析して新規トランザクションの開始を検出した場合にはトランザクション管理表202に該トランザクションを登録するとともに、サーバ管理表201を参照して受信クエリを送信キュー203に投入する。   When receiving a query from the client 500 via the network 400, the received query processing unit 204 analyzes the query and detects the start of a new transaction, and registers the transaction in the transaction management table 202 and server management. Referring to the table 201, the reception query is input to the transmission queue 203.

受信クエリ処理部204が新規トランザクションの開始を検出する方法は、DBMSの種類によって異なる。例えば前述のPostgreSQLの場合は、トランザクションの開始はクライアント500等が「BEGIN」というSQLを送信した時であり、トランザクションの終了はクライアント500等が「COMMIT」「ROLLBACK」というSQLを送信した時である。また、Oracleの場合は、トランザクションの開始はクライアント500等が有効なSQLを送信したときであり(明示的なトランザクションの開始を宣言するSQLは無い)、トランザクションの終了はクライアント500等が「COMMIT」「ROLLBACK」というSQLを送信した時である。また、サーバ100がAUTO COMMITモードで動作する場合には、クライアント500等から受信したSQL文はそれぞれ1つの独立したトランザクションに属していると解釈できるので、クライアント500等からSQLを受信する毎に、該SQL実行前にトランザクションが開始されるとともにSQL実行後に当該トランザクションが終了したこととして扱うことができる。   The method by which the received query processing unit 204 detects the start of a new transaction differs depending on the type of DBMS. For example, in the case of the above PostgreSQL, the start of the transaction is when the client 500 or the like transmits an SQL “BEGIN”, and the end of the transaction is when the client 500 or the like transmits an SQL “COMMIT” or “ROLLBACK”. . In the case of Oracle, the transaction starts when the client 500 or the like transmits a valid SQL (there is no SQL for declaring the explicit start of the transaction), and the end of the transaction is “COMMIT” by the client 500 or the like. This is a time when SQL “ROLLBACK” is transmitted. In addition, when the server 100 operates in the AUTO COMMIT mode, each SQL sentence received from the client 500 or the like can be interpreted as belonging to one independent transaction, so that every time an SQL is received from the client 500 or the like, It can be treated that the transaction is started before the SQL execution and the transaction is ended after the SQL execution.

受信クエリ処理部204が受信クエリを送信キュー203に投入する際には以下のようにして各サーバ100についての送信状態を設定する。サーバ管理表201のサーバ稼働状態が「active」である場合には、当該サーバ100については送信状態を「未送信」とする。また、サーバ管理表201のサーバ稼働状態が「sync」の場合であって、当該サーバ100に対するクエリの転送処理が未だ始まっていない場合には、当該サーバ100については送信状態を「保留」とする。すなわち、本実施の形態では、受信クエリを「保留」として送信キュー203に記憶することにより、差分情報の蓄積を図っている。また、サーバ管理表201のサーバ稼働状態が「sync」の場合であって、当該サーバ100に対するクエリの転送処理が始まっている場合には、当該サーバ100については送信状態を「保留解除」とする。   When the reception query processing unit 204 puts a reception query into the transmission queue 203, the transmission state for each server 100 is set as follows. When the server operating state of the server management table 201 is “active”, the transmission state of the server 100 is set to “untransmitted”. When the server operating state of the server management table 201 is “sync” and the query transfer process for the server 100 has not yet started, the transmission state of the server 100 is set to “hold”. . In other words, in the present embodiment, the difference information is accumulated by storing the received query as “hold” in the transmission queue 203. When the server operating state of the server management table 201 is “sync” and the query transfer process for the server 100 has started, the transmission state of the server 100 is set to “hold release”. .

クエリ送信処理部205は、送信キュー203を監視して、該送信キュー203に送信状態が「未送信」又は「保留解除」となっているクエリを古いものから順に取り出し、対象となるサーバ100に対して送信するとともに、送信キュー203の送信状態を「送信完了」に更新する。   The query transmission processing unit 205 monitors the transmission queue 203, extracts queries in the transmission queue 203 whose transmission status is “untransmitted” or “hold release” from the oldest one to the target server 100. The transmission state of the transmission queue 203 is updated to “transmission complete”.

正当性判定部206は、クエリ送信処理部205で各サーバ100に送信したクエリに対する応答を受信して当該応答の正当性を判定する。この正当性判定は、一台以上のサーバ100間でのクエリ処理の正当性を判定するものである。具体的には、サーバ100が3台以上ある場合には多数決で決める方法や、受信した応答を所定のルールに基づいて判断する方法がある。例えば、クライアント500からの「参照」要求に対して「更新成功」という応答が返ってきた場合、正常であればそのような応答はあり得ないので(参照成功など参照に関する応答のはず)、この応答は正しくないと判断する。また、当該応答に係るパケット中にデータ長フィールドがある場合、このデータ長フィールドの値と実際に受信したパケット長を比較し、異なる場合は正しくないと判断する。また、複数のサーバ100の中からMasterサーバを予め1台決めておき、このサーバ100からの応答を常に正しいと判断する。また、上記複数の方法を併用する方法もある。例えば、3台で多数決を行った結果、応答の中身が全てバラバラであり、多数派の応答を決められない場合はMasterサーバの応答を正しいと判断する。正常稼働しているサーバ100が1つだけの場合は、そのサーバ100からの応答を正常と判断する。なお、正常稼働しているサーバ100の台数はサーバ管理表201を参照することにより認識できる。正当性判定部206は、正当性判定の結果、正当でない応答を返したサーバ100を検出すると、サーバ管理表201及び送信キュー203から当該サーバ100についてのエントリを削除するとともに、該サーバ100に対して再起動指示を送出する。これにより、当該サーバ100にはクエリが送信されなくなるので、該サーバ100はシステムから切り離されたことになる。また、当該サーバ100は再起動指示に応じて再起動処理を行う。   The validity determination unit 206 receives a response to the query transmitted to each server 100 by the query transmission processing unit 205 and determines the validity of the response. This validity determination is for determining the validity of query processing between one or more servers 100. Specifically, when there are three or more servers 100, there are a method of deciding by majority vote, and a method of judging a received response based on a predetermined rule. For example, when a response “update successful” is returned in response to a “reference” request from the client 500, such a response is not possible if it is normal (it should be a response related to reference such as successful reference). Judge that the response is not correct. Also, if there is a data length field in the packet related to the response, the value of this data length field is compared with the actually received packet length, and if they are different, it is determined that they are not correct. Further, one Master server is determined in advance from the plurality of servers 100, and it is determined that the response from this server 100 is always correct. There is also a method using a combination of the above methods. For example, as a result of performing a majority decision with three units, the contents of the responses are all disjoint, and if the majority response cannot be determined, it is determined that the master server response is correct. If only one server 100 is operating normally, it is determined that the response from that server 100 is normal. The number of servers 100 that are operating normally can be recognized by referring to the server management table 201. When the correctness determination unit 206 detects the server 100 that returned an invalid response as a result of the correctness determination, the correctness determination unit 206 deletes the entry for the server 100 from the server management table 201 and the transmission queue 203 and Send a restart instruction. As a result, the query is not transmitted to the server 100, so that the server 100 is disconnected from the system. In addition, the server 100 performs a restart process in response to the restart instruction.

応答送信処理部207は、正当性判定部206において正当と判断された応答であって、該応答の送信元サーバ100の稼働状態が「active」の場合、当該応答の1つを処理要求元のクライアント500等に返す。また、応答送信処理部207は、サーバ100から受信した応答がトランザクションの終了に係るものであるかを検出し、トランザクションの終了に係るものである場合には、当該トランザクションについてのエントリをトランザクション管理表202から削除する。また、応答送信処理部207は、終了したトランザクションに属するクエリであり且つ全てのサーバ100の送信状態が「送信完了」となったものを送信キュー203から削除する。また、応答送信処理部207は、「保留解除」のクエリが送信キュー203からなくなった場合には、「保留解除」となっていたサーバ100について、サーバ管理表201の稼働状態を「active」に更新する。これにより、当該サーバ100はシステムに組み込まれる。なお、システムへの組み込みのタイミングは、正常稼働中のサーバ100においてクエリの実行中であっても構わず、またトランザクションが継続中であっても構わない点に留意されたい。   The response transmission processing unit 207 is a response that is determined to be valid by the validity determination unit 206, and when the operating state of the transmission source server 100 of the response is “active”, one of the responses is sent to the processing request source. Return to the client 500 or the like. In addition, the response transmission processing unit 207 detects whether the response received from the server 100 is related to the end of the transaction. If the response is related to the end of the transaction, the response transmission processing unit 207 displays an entry about the transaction. Delete from 202. Further, the response transmission processing unit 207 deletes, from the transmission queue 203, a query that belongs to the completed transaction and in which the transmission state of all the servers 100 is “transmission complete”. In addition, when the “hold release” query disappears from the transmission queue 203, the response transmission processing unit 207 sets the operation state of the server management table 201 to “active” for the server 100 that has been “hold release”. Update. Thereby, the server 100 is incorporated into the system. It should be noted that the timing of incorporation into the system may be during execution of a query in the normally operating server 100, or the transaction may be ongoing.

同期化処理制御部208は、システム外のサーバ100(ここでは便宜上「新規サーバ100」と呼ぶ)をシステムに組み込む際に、該新規サーバ100とシステム内で正常稼働中のサーバとの同期化処理を制御する。ここで、新規サーバ100としては、システムに新たに追加するもの、一旦システムから切り離され再びシステムに組み込むものの双方が含まれる。   The synchronization processing control unit 208 performs synchronization processing between the new server 100 and a server that is operating normally in the system when the server 100 outside the system (referred to here as “new server 100” for convenience) is incorporated into the system. To control. Here, the new server 100 includes both a server that is newly added to the system and a server that is once disconnected from the system and incorporated into the system again.

同期化処理制御部208は、データベース同期化要求(システムの組み込み要求)の入力を検出すると、(1)当該新規サーバ100について稼働状態を「sync」にしてサーバ管理表201に追加する、(2)送信キュー203の送信状態の欄に当該新規サーバ100についての列を追加する、(3)正常稼働中のサーバ100の中から同期化処理用のサーバを1台を選定して当該サーバ100について送信キュー203の送信状態が「未送信」となっているものは「保留」に更新する、(4)同期化処理用のサーバ100において実行中クエリの処理が完了するまで待機し、同期化処理用のサーバ100において実行中クエリの処理が完了したら該サーバ100のスナップショットを取得してスナップショット記憶部209に保存する処理を開始する、という処理を行う。なお、本実施の形態では、データベース同期化要求は、オペレータが新規サーバ100の再起動完了を確認した後に所定の入力装置(図示省略)するものとする。   When detecting the input of the database synchronization request (system integration request), the synchronization processing control unit 208 (1) sets the operation state of the new server 100 to “sync” and adds it to the server management table 201 (2 ) A column for the new server 100 is added to the transmission status column of the transmission queue 203. (3) One server for synchronization processing is selected from the servers 100 operating normally and the server 100 is selected. If the transmission status of the transmission queue 203 is “unsent”, it is updated to “pending”. (4) The server 100 for synchronization processing waits until the processing of the query being executed is completed, and the synchronization processing When the processing of the query being executed in the server 100 is completed, a snapshot of the server 100 is acquired and stored in the snapshot storage unit 209 To start the management, carry out the process of. In the present embodiment, it is assumed that the database synchronization request is a predetermined input device (not shown) after the operator confirms the completion of restart of the new server 100.

また、同期化処理制御部208は、データの整合性を維持するために、前記(1)から(4)のスナップショット作成開始までの処理は1つの処理として取り扱い、排他制御を行う。つまり、同期化処理制御部208は、前記(1)から(4)のスナップショット作成開始までの処理を行っている間は、各処理でアクセスするサーバ管理表201及び送信キュー203に対して、他の機能ブロック(例えば受信クエリ処理部204など)からのアクセスを中断させる。   Also, the synchronization processing control unit 208 handles the processes from (1) to (4) from the start of snapshot creation as one process and performs exclusive control in order to maintain data consistency. In other words, the synchronization processing control unit 208 performs the processing from (1) to (4) on the server management table 201 and the transmission queue 203 accessed in each processing while performing the processing from the start of snapshot creation to (4). Access from other functional blocks (for example, the received query processing unit 204) is interrupted.

前記(2)において同期化処理制御部208は、送信キュー203にクエリが残っている場合には、そのクエリについての新規サーバ100の送信状態は全て「保留」とする。前述したように、送信キュー203のエントリは、トランザクションが終了した際に削除される。したがって、送信キュー203に残っているクエリは、トランザクションが終了していないクエリであり、前記(4)で作成されるスナップショットには反映されないものである。前記(2)の処理では、このクエリについての送信状態を「保留」とすることで該クエリを差分情報として保持する。   When the query remains in the transmission queue 203 in (2), the synchronization processing control unit 208 sets all the transmission states of the new server 100 for the query to “pending”. As described above, the entry in the transmission queue 203 is deleted when the transaction ends. Therefore, the query remaining in the transmission queue 203 is a query whose transaction has not ended, and is not reflected in the snapshot created in (4). In the process (2), the transmission state for this query is set to “pending”, and the query is held as difference information.

また、同期化処理制御部208は、(5)スナップショットの作成が完了したら、当該スナップショットから新規サーバ100のデータベース101を復元させる、(6)データベース101の復元が完了すると送信キュー203に記憶されている新規サーバ100の欄の全てのクエリについて送信状態を「保留」から「保留解除」に変更する。これにより、クエリ送信処理部205が新規サーバ100に対して差分情報としてクエリの送信を開始する。「保留解除」になっていたクエリの処理が全て終了すると、応答送信処理部207が、当該新規サーバ100について、サーバ管理表201の稼働状態を「active」に更新することにより、新規サーバ100はシステムに組み込まれる。   Further, the synchronization processing control unit 208 (5) restores the database 101 of the new server 100 from the snapshot when the creation of the snapshot is completed, and (6) stores the data in the transmission queue 203 when the restoration of the database 101 is completed. The transmission state is changed from “hold” to “hold release” for all the queries in the new server 100 column. As a result, the query transmission processing unit 205 starts transmitting a query as difference information to the new server 100. When the processing of the query that has been “hold release” is completed, the response transmission processing unit 207 updates the operating state of the server management table 201 to “active” for the new server 100, so that the new server 100 Built into the system.

クライアント500は、多重化データベースシステムに対して更新クエリ(データベースを更新するリクエスト)や参照クエリ(データベースの内容を参照するリクエスト)などを発行するものである。   The client 500 issues an update query (request to update the database) and a reference query (request to refer to the contents of the database) to the multiplexed database system.

データベース一致検査装置600は、クライアント500と同様に多重化データベースシステムのクライアントとして動作するものであり、各サーバ100のデータベース101が互いに一致しているか否かを確認するためのクエリを発行する。このクエリは、参照系のものであり、例えば所定のテーブルtest_tableに対する「SELECT * FROM test_table」などである。データベース一致検査装置600は、定期的に又はオペレータ等の指示に応じて当該検査用クエリの発行を行う。   Similar to the client 500, the database match checking device 600 operates as a client of the multiplexed database system, and issues a query for checking whether or not the databases 101 of the servers 100 match each other. This query is of the reference system, and is, for example, “SELECT * FROM test_table” for a predetermined table test_table. The database coincidence inspection apparatus 600 issues the inspection query periodically or in response to an instruction from an operator or the like.

次に、本実施の形態に係る多重化データベースシステムの動作について図面を参照して説明する。まず、サーバ100aと100bが正常に動作している場合の動作を図6から図8を参照して説明する。   Next, the operation of the multiplexed database system according to the present embodiment will be described with reference to the drawings. First, the operation when the servers 100a and 100b are operating normally will be described with reference to FIGS.

初期状態では、データベース101aと101bは完全に同一であり、サーバ管理表201は図7のようになっているものとする。また、トランザクション管理表202と送信キュー203は空であるとする。各サーバ100a,100bには、テーブルtest_tableが存在しているとする。   In the initial state, the databases 101a and 101b are completely the same, and the server management table 201 is as shown in FIG. Further, it is assumed that the transaction management table 202 and the transmission queue 203 are empty. Assume that a table test_table exists in each of the servers 100a and 100b.

クライアント500aが172.17.1.1宛にトランザクション開始SQLを含んだパケットを送信すると、仲介装置200の受信クエリ処理部204はそのパケットを受信する(ステップS1)。受信クエリ処理部204は、トランザクションが開始されたことを検知し、トランザクション管理表202にクライアント500aのIPアドレスとトランザクション番号を登録する(ステップS2)。図8にこのときのトランザクション管理表202を示す。そして、このパケットに係るクエリを、サーバ管理表201を参照して正常稼働しているサーバ100(ここではサーバ100a及び100b)について送信状態を「未送信」にして送信キュー203に入れる。   When the client 500a transmits a packet including the transaction start SQL address to 172.17.1.1, the reception query processing unit 204 of the mediation apparatus 200 receives the packet (step S1). The reception query processing unit 204 detects that a transaction has started, and registers the IP address and transaction number of the client 500a in the transaction management table 202 (step S2). FIG. 8 shows the transaction management table 202 at this time. Then, the query related to this packet is placed in the transmission queue 203 with the transmission state set to “untransmitted” for the server 100 (in this case, the servers 100 a and 100 b) operating normally with reference to the server management table 201.

クエリ送信処理部205は、送信キュー203から送信状態が「未送信」のクエリを取り出し、対応するサーバ100に該パケットを送信する。ここでは、サーバ100aと100bが正常稼働しているので、サーバ100aとサーバ100bへ該パケットを転送する(それぞれステップS3とS4)。そして、各サーバ100への送信が完了したので各サーバ100について送信キュー203の送信状態を「送信完了」に更新する。正当性判定部206は、トランザクションが正常に開始されたことを通知する応答パケットをサーバ100aから受信するが(ステップS5)、この時点では、未だ全ての応答パケットが揃っているわけではないので(この場合、サーバ100bからの応答パケットが来ていない)、正当性判定部206は何もせずにサーバ100bからの応答パケットを待つ。そして、トランザクションが正常に開始されたことを通知する応答パケットをサーバ100bから受信すると(ステップS6)、これで全ての応答パケットが揃ったので、正当性判定部206はそれらの応答パケットを互いに比較することでサーバ100に障害が発生しているか否かをチェックする(ステップS7)。この場合、2つの応答パケットは共にトランザクションが正常に開始されたことを示すパケットであるため、障害は無いと判断する。そして、応答送信処理部207は正当な応答パケットの1つをクライアント500aに返す(ステップS8)。   The query transmission processing unit 205 extracts a query whose transmission state is “untransmitted” from the transmission queue 203 and transmits the packet to the corresponding server 100. Here, since the servers 100a and 100b are operating normally, the packets are transferred to the server 100a and the server 100b (steps S3 and S4, respectively). Since transmission to each server 100 is completed, the transmission state of the transmission queue 203 for each server 100 is updated to “transmission complete”. The correctness determination unit 206 receives a response packet notifying that the transaction has started normally from the server 100a (step S5), but at this point in time, all the response packets are not yet complete ( In this case, the response packet from the server 100b has not arrived), and the validity determination unit 206 does nothing and waits for the response packet from the server 100b. When a response packet notifying that the transaction has started normally is received from the server 100b (step S6), since all the response packets have been prepared, the validity determination unit 206 compares the response packets with each other. Thus, it is checked whether or not a failure has occurred in the server 100 (step S7). In this case, since both of the two response packets are packets indicating that the transaction has started normally, it is determined that there is no failure. Then, the response transmission processing unit 207 returns one of the valid response packets to the client 500a (Step S8).

次に、クライアント500aは、テーブルtest_tableを更新するSQL(UPDATE)を含んだパケットを172.17.1.1へ送信する(ステップS9)。受信クエリ処理部204は、サーバ管理表201を参照して正常稼働しているサーバ100について送信状態を「未送信」にして送信キュー203に入れる。クエリ送信処理部205は、送信キュー203から当該クエリを取り出し、各サーバ100へパケットを転送し(それぞれステップS10とS11)、送信キュー203の送信状態を「送信完了」に更新する。サーバ100aは正常にUPDATE成功したことを通知する応答パケットを仲介装置200に送信し、仲介装置200の正当性判定部206がこの応答パケットを受信する(ステップS12)。この時点では全ての応答パケットが全て揃っているわけではないので、正当性判定部206は何もせず待機する。そして、正常にUPDATE成功したことを通知する応答パケットをサーバ100bから受信すると(ステップS13)、これで応答パケットが全て揃ったので、正当性判定部206はそれら応答パケットを互いに比較することでサーバ100に障害が発生しているか否かをチェックする(ステップS14)。この場合、2つの応答パケットは共にUPDATE成功したことを示すパケットであるため、障害は無いと判断する。そして、応答送信処理部207は、正当な応答パケットの1つをクライアント500aへ転送する(ステップS15)。   Next, the client 500a transmits to 172.17.1.1 a packet including SQL (UPDATE) for updating the table test_table (step S9). The reception query processing unit 204 refers to the server management table 201 and sets the transmission state of the normally operating server 100 to “untransmitted” and puts it in the transmission queue 203. The query transmission processing unit 205 extracts the query from the transmission queue 203, transfers the packet to each server 100 (steps S10 and S11, respectively), and updates the transmission state of the transmission queue 203 to “transmission completed”. The server 100a transmits a response packet notifying that UPDATE has been successfully completed to the mediation apparatus 200, and the validity determination unit 206 of the mediation apparatus 200 receives the response packet (step S12). At this time, not all response packets are prepared, and the validity determination unit 206 waits without doing anything. When a response packet notifying that UPDATE has been successfully received is received from the server 100b (step S13), since all the response packets are now prepared, the validity determination unit 206 compares the response packets with each other, thereby It is checked whether a failure has occurred in 100 (step S14). In this case, since both of the two response packets are packets indicating that UPDATE was successful, it is determined that there is no failure. Then, the response transmission processing unit 207 transfers one valid response packet to the client 500a (step S15).

次に、クライアント500aは、テーブルtest_tableへの更新を確定する(実際にデータベースを更新する)SQL(COMMIT)を含んだパケットを172.17.1.1へ送信する(ステップS16)。受信クエリ処理部204は、サーバ管理表201を参照して正常稼働しているサーバ100について送信状態を「未送信」にして送信キュー203に入れる。クエリ送信処理部205は、送信キュー203から当該クエリを取り出し各サーバ100へパケットを転送し(それぞれステップS17とS18)、送信キュー203の送信状態を「送信完了」に更新する。サーバ100aは正常にCOMMIT成功したことを通知するパケットを仲介装置200に送信し、仲介装置200の正当性判定部206がこの応答パケットを受信する(ステップS19)。この時点では全ての応答パケットが全て揃っているわけではないので、正当性判定部206は何もせず待機する。そして、正常にCOMMIT成功したことを通知する応答パケットをサーバ100bから受信すると(ステップS20)、これで応答パケットが全て揃ったので、正当性判定部206はそれら応答パケットを互いに比較することでサーバ100に障害が発生しているか否かをチェックする(ステップS21)。この場合、2つの応答パケットは共にCOMMIT成功したことを示すパケットであるため、障害は無いと判断する。応答送信処理部207は、正当な応答パケットの1つをクライアント500aへ転送する(ステップS22)。また、COMMITが正常に完了したことから、トランザクションが終了したことが分かるので、応答送信処理部207はトランザクション管理表202からこのトランザクションの登録を削除するとともに(ステップS23)、全てのサーバ100について送信状態が「送信完了」となっているクエリ(ここでは、「BEGIN」,「UPDATE」,「COMMIT」の3つのクエリ)を送信キュー203から削除する(ステップS23)。このときのトランザクション管理表202及び送信キュー203は再び初期状態(すなわち空)になる。   Next, the client 500a transmits to 172.17.1.1 a packet including SQL (COMMIT) that confirms the update to the table test_table (actually updates the database) (step S16). The reception query processing unit 204 refers to the server management table 201 and sets the transmission state of the normally operating server 100 to “untransmitted” and puts it in the transmission queue 203. The query transmission processing unit 205 retrieves the query from the transmission queue 203, transfers the packet to each server 100 (steps S17 and S18, respectively), and updates the transmission state of the transmission queue 203 to “transmission completed”. The server 100a transmits a packet notifying that the COMMIT has been successful to the mediation device 200, and the validity determination unit 206 of the mediation device 200 receives this response packet (step S19). At this time, not all response packets are prepared, and the validity determination unit 206 waits without doing anything. When the response packet notifying that the COMMIT has been successfully received is received from the server 100b (step S20), since all the response packets are now prepared, the validity determination unit 206 compares the response packets with each other to determine the server. It is checked whether a failure has occurred in 100 (step S21). In this case, since the two response packets are packets indicating that the COMMIT has succeeded, it is determined that there is no failure. The response transmission processing unit 207 transfers one of the valid response packets to the client 500a (Step S22). In addition, since the COMMIT has been completed normally, it can be seen that the transaction has ended. Therefore, the response transmission processing unit 207 deletes the registration of the transaction from the transaction management table 202 (step S23) and transmits to all the servers 100. Queries whose status is “transmission completed” (here, three queries “BEGIN”, “UPDATE”, and “COMMIT”) are deleted from the transmission queue 203 (step S23). At this time, the transaction management table 202 and the transmission queue 203 are again in the initial state (that is, empty).

次に、サーバ100bが故障などで障害になった場合の動作を図9から図11を参照して説明する。初期状態では、データベース101aと101bは完全に同一であり、サーバ管理表201は前述した図7のようになっているとする。また、トランザクション管理表202と送信キュー203は空であるとする。   Next, an operation when the server 100b becomes a failure due to a failure or the like will be described with reference to FIGS. In the initial state, it is assumed that the databases 101a and 101b are completely the same, and the server management table 201 is as shown in FIG. Further, it is assumed that the transaction management table 202 and the transmission queue 203 are empty.

クライアント500aが172.17.1.1宛にトランザクション開始SQL(BEGIN)を含んだパケットを送信すると、仲介装置200の受信クエリ処理部204はそのパケットを受信する(ステップS30)。受信クエリ処理部204は、トランザクションが開始されたことを検知し、トランザクション管理表202にクライアント500aのIPアドレスとトランザクション番号を登録する(ステップS31)。図10にこのときのトランザクション管理表202を示す。そして、このパケットに係るクエリを、サーバ管理表201を参照して正常稼働しているサーバ100について送信状態を「未送信」にして送信キュー203に入れる。   When the client 500a transmits a packet including a transaction start SQL (BEGIN) addressed to 172.17.1.1, the reception query processing unit 204 of the mediation apparatus 200 receives the packet (step S30). The reception query processing unit 204 detects that a transaction has started, and registers the IP address and transaction number of the client 500a in the transaction management table 202 (step S31). FIG. 10 shows the transaction management table 202 at this time. Then, the query relating to this packet is placed in the transmission queue 203 with the transmission state “unsent” for the server 100 operating normally with reference to the server management table 201.

クエリ送信処理部205は、送信キュー203から送信状態が「未送信」のクエリを取り出し、対応する各サーバ100に該パケットを転送する(それぞれステップS32とS33)。次いで、送信キュー203の送信状態を「送信完了」に更新する。仲介装置200の正当性判定部206は、トランザクションが正常に開始されたことを通知する応答パケットをサーバ100aから受信するが(ステップS34)、この時点では、未だ全ての応答パケットが揃っているわけではないので(この場合、サーバ100bからの応答パケットが来ていない)、何もせずにサーバ100bからの応答パケットを待つ。そして、トランザクションが正常に開始されたことを通知する応答パケットをサーバ100bから受信すると(ステップS35)、これで全ての応答パケットが揃ったので、正当性判定部206はそれら応答パケットを互いに比較することでサーバ100に障害が発生しているか否かをチェックする(ステップS36)。この場合、2つの応答パケットは共にトランザクションが正常に開始されたことを示すパケットであるため、障害は無いと判断する。そして、応答送信処理部207は、正当な応答パケットの1つをクライアント500aへ転送する(ステップS37)。   The query transmission processing unit 205 extracts a query whose transmission state is “untransmitted” from the transmission queue 203 and transfers the packet to each corresponding server 100 (steps S32 and S33, respectively). Next, the transmission state of the transmission queue 203 is updated to “transmission completed”. The legitimacy determination unit 206 of the mediation apparatus 200 receives a response packet notifying that the transaction has started normally from the server 100a (step S34), but at this point, all the response packets are still ready. (In this case, the response packet from the server 100b does not come), and nothing is done to wait for the response packet from the server 100b. Then, when a response packet notifying that the transaction has been started normally is received from the server 100b (step S35), since all the response packets are now prepared, the validity judgment unit 206 compares the response packets with each other. Thus, it is checked whether or not a failure has occurred in the server 100 (step S36). In this case, since both of the two response packets are packets indicating that the transaction has started normally, it is determined that there is no failure. Then, the response transmission processing unit 207 transfers one of the valid response packets to the client 500a (Step S37).

ここで、サーバ100bは、ステップS35で応答パケットを返した後、故障などの障害が発生してダウンしたものとする(ステップS38)。   Here, it is assumed that the server 100b is down due to a failure such as a failure after returning the response packet in step S35 (step S38).

次に、クライアント500aは、テーブルtest_tableを更新するSQL(UPDATE)を含んだパケットを172.17.1.1へ送信する(ステップS39)。受信クエリ処理部204は、サーバ管理表201を参照して正常稼働しているサーバ100について送信状態を「未送信」にして送信キュー203に入れる。この時点では、仲介装置200はサーバ100bのダウンを知らないので、サーバ100bが正常稼働しているという情報がサーバ管理表201に格納されたままである。したがって、受信クエリ処理部204は、サーバ100aの欄だけでなくサーバ100bの欄についても送信状態を「未送信」にして送信キュー203に受信クエリを格納する。クエリ送信処理部205は、送信キュー203から送信状態が「未送信」のクエリを取り出して各サーバ100a及び100bにパケットを転送する(それぞれステップS40とS41)。次いで、クエリ送信処理部205は、送信キュー203の送信状態を「送信完了」に更新する。サーバ100aは正常にUPDATE成功したことを通知する応答パケットを仲介装置200に送信し、仲介装置200の正当性判定部206がこの応答パケットを受信する(ステップS42)。この時点では応答パケットが全て揃っているわけではないので、正当性判定部206は何もせず待機する。しかし、サーバ100bはダウンしているのでサーバ100bからの応答パケットはいつまで経っても正当性判定部206には届かない。これにより正当性判定部206はタイムアウトし、サーバ100bのダウンを検知する。そして、正当性判定部206はサーバ管理表201からサーバ100bのエントリを削除する(ステップS43)。このときのサーバ管理表201を図11に示す。また、サーバ100bについての送信状態の欄を送信キュー203から削除する。このときの送信キュー203を図12に示す。次に、応答送信処理部207は応答パケットをクライアント500aへ転送する(ステップS44)。ここでは、クライアント500aにとって、サーバ100bが障害になったかどうかは認識せず、今までと同様に仮想サーバ800からサービスを受けることができることに注目すべきである。   Next, the client 500a transmits a packet containing SQL (UPDATE) for updating the table test_table to 172.17.1.1 (step S39). The reception query processing unit 204 refers to the server management table 201 and sets the transmission state of the normally operating server 100 to “untransmitted” and puts it in the transmission queue 203. At this point, since the mediation apparatus 200 does not know that the server 100b is down, the information that the server 100b is operating normally remains stored in the server management table 201. Therefore, the reception query processing unit 204 stores the reception query in the transmission queue 203 by setting the transmission state to “untransmitted” not only in the field of the server 100 a but also in the field of the server 100 b. The query transmission processing unit 205 extracts a query whose transmission state is “untransmitted” from the transmission queue 203 and transfers the packet to each of the servers 100a and 100b (steps S40 and S41, respectively). Next, the query transmission processing unit 205 updates the transmission state of the transmission queue 203 to “transmission complete”. The server 100a transmits a response packet notifying that UPDATE has been successfully completed to the mediation device 200, and the validity determination unit 206 of the mediation device 200 receives the response packet (step S42). At this point in time, not all response packets are available, so the validity determination unit 206 waits without doing anything. However, since the server 100b is down, the response packet from the server 100b does not reach the correctness determination unit 206 indefinitely. As a result, the validity determination unit 206 times out and detects that the server 100b is down. Then, the validity judgment unit 206 deletes the entry of the server 100b from the server management table 201 (step S43). The server management table 201 at this time is shown in FIG. Also, the transmission status column for the server 100 b is deleted from the transmission queue 203. The transmission queue 203 at this time is shown in FIG. Next, the response transmission processing unit 207 transfers the response packet to the client 500a (step S44). Here, it should be noted that the client 500a does not recognize whether the server 100b has failed, and can receive services from the virtual server 800 as before.

次に、クライアント500aは、テーブルtest_tableへの更新を確定するSQL(COMMIT)を含んだパケットを172.17.1.1へ送信する(ステップS45)。受信クエリ処理部204は、サーバ管理表201を参照して正常稼働しているサーバ100について送信状態を「未送信」にして送信キュー203に入れる。ここでは、サーバ100aについてのみ送信状態が「未送信」で送信キュー203にクエリが記憶される。そして、クエリ送信処理部205は、送信キュー203から当該クエリを取り出し、対応するサーバ、この場合、サーバ100aのみへ該パケットを転送する(ステップS46)。次いで、送信キュー203の送信状態を「送信完了」に更新する。サーバ100aは正常にCOMMIT成功したことを通知する応答パケットを送信し、仲介装置200の正当性判定部206がこの応答パケットを受信する(ステップS47)。ここでは、正常稼働中のサーバ100が1台のみなので正当性判定部206は当該応答パケットを正当と判断し、応答送信処理部207は該応答パケットをクライアント500aへ転送する(ステップS48)。また、COMMITが正常に完了したことから、トランザクションが終了したことが分かるので、応答送信処理部207はトランザクション管理表202からこのトランザクションの登録を削除するとともに(ステップS49)、全てのサーバ100について送信状態が「送信完了」となっているクエリ(ここでは、「BEGIN」,「UPDATE」,「COMMIT」の3つのクエリ)を送信キュー203から削除する(ステップS50)。このときのトランザクション管理表202及び送信キュー203は再び初期状態(すなわち空)になる。   Next, the client 500a transmits, to 172.17.1.1, a packet including SQL (COMMIT) for confirming update to the table test_table (step S45). The reception query processing unit 204 refers to the server management table 201 and sets the transmission state of the normally operating server 100 to “untransmitted” and puts it in the transmission queue 203. Here, the query is stored in the transmission queue 203 with the transmission state “unsent” only for the server 100a. Then, the query transmission processing unit 205 extracts the query from the transmission queue 203, and transfers the packet only to the corresponding server, in this case, the server 100a (step S46). Next, the transmission state of the transmission queue 203 is updated to “transmission completed”. The server 100a transmits a response packet notifying that the COMMIT has succeeded normally, and the validity determination unit 206 of the mediation apparatus 200 receives this response packet (step S47). Here, since only one server 100 is operating normally, the validity determination unit 206 determines that the response packet is valid, and the response transmission processing unit 207 transfers the response packet to the client 500a (step S48). In addition, since the COMMIT has been completed normally, it can be seen that the transaction has ended. Therefore, the response transmission processing unit 207 deletes the registration of the transaction from the transaction management table 202 (step S49), and transmits to all the servers 100. Queries whose status is "transmission complete" (here, three queries "BEGIN", "UPDATE", and "COMMIT") are deleted from the transmission queue 203 (step S50). At this time, the transaction management table 202 and the transmission queue 203 are again in the initial state (that is, empty).

次に、並行処理される複数のトランザクションについて、各サーバ100における処理順序が異なった場合について図13及び図14のシーケンスチャートを参照して説明する。   Next, a case where the processing order in each server 100 is different for a plurality of transactions processed in parallel will be described with reference to the sequence charts of FIGS. 13 and 14.

ここでは、2台の正常稼働中のサーバ100a及び100bが各クライアント500からのクエリを処理するものとする。初期状態では、データベース101aと101bは完全に同一であり、サーバ管理表201は図7のようになっているものとする。また、トランザクション管理表202と送信キュー203は空であるとする。各サーバ100a,100bには、テーブルtest_tableが存在しているとする。そして、図51のテーブルtest_tableに対して、図52のトランザクションT1をクライアント500aが発行し、同図のトランザクションT2をクライアント500bが発行したものとする。前述したように、この2つのトランザクションT1,T2の処理後におけるデータベース101のデータは、各トランザクションの処理順序によって異なった内容になることに注意されたい。   Here, it is assumed that the two servers 100a and 100b that are operating normally process a query from each client 500. In the initial state, the databases 101a and 101b are completely the same, and the server management table 201 is as shown in FIG. Further, it is assumed that the transaction management table 202 and the transmission queue 203 are empty. Assume that a table test_table exists in each of the servers 100a and 100b. Then, it is assumed that the client 500a issues the transaction T1 in FIG. 52 and the client Tb issues the transaction T2 in FIG. 52 to the table test_table in FIG. As described above, it should be noted that the data in the database 101 after the processing of these two transactions T1 and T2 has different contents depending on the processing order of each transaction.

なお、ここではクエリの処理順序に伴うデータベースの不整合とその解決方法の大まかな流れについて説明するため、サーバ管理表201の更新動作、送信キュー203に対するクエリの入出力、トランザクション管理表202の更新動作など、仲介装置200の各部についての詳細な動作については省略する。   Here, in order to explain the database inconsistency in the query processing order and the rough flow of the solution, the update operation of the server management table 201, the input / output of queries to the transmission queue 203, the update of the transaction management table 202 Detailed operations of each part of the mediation apparatus 200, such as operations, are omitted.

図13に示すように、クライアント500aがトランザクションT1を開始するクエリ(BEGIN)を仲介装置200に送信し(ステップS101)、一方、クライアント500bがトランザクションT2を開始するクエリ(BEGIN)を仲介装置200に送信する(ステップS102)。仲介装置200は、各クエリをそれぞれ正常稼働中のサーバ100a及び100bに転送する(ステップS103〜S106)。そして、各サーバ100a及び100bからのそれぞれ応答(ステップS107〜S110)について正当性をチェックし(図示省略)、正当な応答の1つをそれぞれの要求元のクライアント500a又は500bに転送する(ステップS111〜S112)。   As shown in FIG. 13, the client 500a transmits a query (BEGIN) for starting a transaction T1 to the mediation apparatus 200 (step S101), while the client 500b sends a query (BEGIN) for starting a transaction T2 to the mediation apparatus 200. Transmit (step S102). The mediation apparatus 200 transfers each query to the servers 100a and 100b that are operating normally (steps S103 to S106). Then, the legitimacy of the responses (steps S107 to S110) from the respective servers 100a and 100b is checked (not shown), and one of the legitimate responses is transferred to the requesting client 500a or 500b (step S111). To S112).

仲介装置200からBEGINに対する応答を受信したクライアント500a及び500bは、それぞれのトランザクションに属する次のクエリを仲介装置200に送信する。本実施例では、クライアント500aはトランザクションT1のUPDATEクエリを仲介装置200に送信し(ステップS113)、クライアント500bはトランザクションT2のUPDATEクエリを仲介装置200に送信する(ステップS114)。クライアント500a及び500bからクエリを受信した仲介装置200は、当該クエリをそれぞれ正常稼働中のサーバ100a及び100bに転送する(ステップS115〜S118)。   The clients 500a and 500b that have received a response to BEGIN from the mediation device 200 transmit the next query belonging to each transaction to the mediation device 200. In the present embodiment, the client 500a transmits an UPDATE query for transaction T1 to the mediation apparatus 200 (step S113), and the client 500b transmits an UPDATE query for transaction T2 to the mediation apparatus 200 (step S114). The mediation apparatus 200 that has received the query from the clients 500a and 500b transfers the query to the servers 100a and 100b that are operating normally (steps S115 to S118).

サーバ100aではトランザクションT1のUPDATEクエリがトランザクションT2のUPDATEクエリより先に処理されたとする。トランザクションT1のUPDATEクエリを処理したサーバ100aは、処理結果を仲介装置200に送信する(ステップS119)。このとき、トランザクションT1のUPDATEクエリによるtest_tableの当該更新対象行は、トランザクションT1がCOMMITされるまでロックされる。トランザクションT2のUPDATEクエリは上記ロックされている行が更新対象となっているので、当該クエリの処理はロックが解除されるまで保留される(ステップS120)。   In the server 100a, it is assumed that the UPDATE query of the transaction T1 is processed before the UPDATE query of the transaction T2. The server 100a that has processed the UPDATE query of the transaction T1 transmits the processing result to the mediation apparatus 200 (step S119). At this time, the update target row of test_table by the UPDATE query of transaction T1 is locked until transaction T1 is committed. In the UPDATE query of transaction T2, the locked row is an update target, so the processing of the query is suspended until the lock is released (step S120).

一方、サーバ100bではトランザクションT2のUPDATEクエリがトランザクションT1のUPDATEクエリより先に処理されたとする。トランザクションT2のUPDATEクエリを処理したサーバ100bは、処理結果を仲介装置200に送信する(ステップS121)。このとき、トランザクションT2のUPDATEクエリによるtest_tableの当該更新対象行は、トランザクションT2がCOMMITされるまでロックされる。トランザクションT1のUPDATEクエリは上記ロックされている行が更新対象となっているので、当該クエリの処理はロックが解除されるまで保留される(ステップS122)。   On the other hand, in the server 100b, it is assumed that the UPDATE query for transaction T2 is processed before the UPDATE query for transaction T1. The server 100b that has processed the UPDATE query of the transaction T2 transmits the processing result to the mediation apparatus 200 (step S121). At this time, the update target row of test_table by the UPDATE query of transaction T2 is locked until transaction T2 is committed. In the UPDATE query of the transaction T1, since the locked row is an update target, the processing of the query is suspended until the lock is released (step S122).

ここで、サーバ100aからのトランザクションT1のUPDATEクエリに対する応答(ステップS119)が、サーバ100bからのトランザクションT2のUPDATEクエリに対する応答(ステップS121)よりも先に仲介装置200に到達したとする。   Here, it is assumed that the response to the UPDATE query of the transaction T1 from the server 100a (step S119) reaches the mediation apparatus 200 before the response to the UPDATE query of the transaction T2 from the server 100b (step S121).

仲介装置200は、トランザクションT1のUPDATEクエリについての応答を一方のサーバ100aから受信したが(ステップS119)、他方のサーバ100bからの応答は受信していないので当該応答を待つ(ステップS123)。これは、前述したように、仲介装置200において、各サーバ100a及び100bからの応答を互いに比較して正当性を判断するためである。同様に、仲介装置200は、トランザクションT2のUPDATEクエリについての応答を一方のサーバ100bから受信したが(ステップS121)、他方のサーバ100aからの応答は受信していないので当該応答を待つ(ステップS124)。   The intermediary device 200 has received a response for the UPDATE query of the transaction T1 from one server 100a (step S119), but has not received a response from the other server 100b, and waits for the response (step S123). As described above, this is because the intermediary device 200 compares the responses from the servers 100a and 100b with each other to determine the validity. Similarly, the intermediary device 200 receives a response to the UPDATE query of the transaction T2 from one server 100b (step S121), but has not received a response from the other server 100a, and waits for the response (step S124). ).

前述のようにサーバ100bにおいてトランザクションT1のUPDATEクエリの処理はロック解除待ちされているので(ステップS122)、仲介装置200における当該クエリに対する応答待ち(ステップS123)はタイムアウトする(ステップS125)。これにより、仲介装置200は、サーバ100bが障害になったと判断し、前記ステップS124の応答待ちをキャンセルし、当該サーバ100bをシステムから切り離す(ステップS126)。具体的には、サーバ管理表201から当該サーバ100bのエントリを削除するとともに、送信キュー203からサーバ100bの送信状態の欄を削除する。そして、仲介装置200は、図14に示すように、システムから切り離したサーバ100bに対して再起動指示を送信するとともに(ステップS127)、応答をクライアント500aに返す(ステップS128)。   As described above, since the UPDATE query processing of the transaction T1 is waiting for unlocking in the server 100b (step S122), the response waiting for the query (step S123) in the mediating apparatus 200 times out (step S125). As a result, the intermediary device 200 determines that the server 100b has failed, cancels waiting for a response in step S124, and disconnects the server 100b from the system (step S126). Specifically, the entry of the server 100b is deleted from the server management table 201, and the transmission status column of the server 100b is deleted from the transmission queue 203. Then, as shown in FIG. 14, the mediating apparatus 200 transmits a restart instruction to the server 100b separated from the system (step S127), and returns a response to the client 500a (step S128).

サーバ100bは、仲介装置200からの再起動指示を受信すると、自身の再起動を開始する(ステップS129)。   When receiving the restart instruction from the mediation apparatus 200, the server 100b starts its own restart (step S129).

トランザクションT1のUPDATEクエリについて応答を受信したクライアント500aは、更新を確定するクエリ(COMMIT)を仲介装置200に送信する(ステップS130)。仲介装置200は、クライアント500aからクエリを受信すると、サーバ管理表201を参照して正常稼働中のサーバ100aに当該クエリを転送する(ステップS131)。   The client 500a that has received the response for the UPDATE query of the transaction T1 transmits a query (COMMIT) for confirming the update to the mediation apparatus 200 (step S130). When receiving the query from the client 500a, the mediation device 200 refers to the server management table 201 and transfers the query to the normally operating server 100a (step S131).

サーバ100aでは、トランザクションT1のCOMMITクエリを処理することによりロックが解除されてトランザクションT2の処理が再開可能となる(ステップS132)。これにより、サーバ100aはトランザクションT1のCOMMITクエリに対する応答を仲介装置200に返し(ステップS133)、仲介装置200は当該応答をクライアント500aに転送する(ステップS134)。次いで、サーバ100aはトランザクションT2のUPDATEクエリに対する応答を仲介装置200に返し(ステップS135)、仲介装置200は当該応答をクライアント500bに転送する(ステップS136)。   In the server 100a, the lock is released by processing the COMMIT query of the transaction T1, and the processing of the transaction T2 can be resumed (step S132). As a result, the server 100a returns a response to the COMMIT query of the transaction T1 to the mediation device 200 (step S133), and the mediation device 200 transfers the response to the client 500a (step S134). Next, the server 100a returns a response to the UPDATE query of the transaction T2 to the mediation device 200 (step S135), and the mediation device 200 transfers the response to the client 500b (step S136).

トランザクションT2のUPDATEクエリについて応答を受信したクライアント500bは、更新を確定するクエリ(COMMIT)を仲介装置200に送信する(ステップS137)。仲介装置200は、クライアント500bからクエリを受信すると、サーバ管理表201を参照して正常稼働中のサーバ100aに当該クエリを転送する(ステップS138)。サーバ100aは当該クエリを処理して応答を仲介装置200に返し(ステップS139)、仲介装置200は当該応答をクライアント500bに転送する(ステップS140)。   The client 500b that has received the response for the UPDATE query of the transaction T2 transmits a query (COMMIT) for confirming the update to the mediation apparatus 200 (step S137). When receiving the query from the client 500b, the mediation device 200 refers to the server management table 201 and transfers the query to the normally operating server 100a (step S138). The server 100a processes the query and returns a response to the mediation device 200 (step S139), and the mediation device 200 transfers the response to the client 500b (step S140).

ここで、システムから切り離されたサーバ100bの再起動が完了したものとする(ステップS141)。仲介装置200のオペレータは、サーバ100bの再起動完了を確認すると、仲介装置200に対してデータベース同期化要求を入力指示する(ステップS142)。仲介装置200は、正常稼働中のサーバ100aのデータベース101aと、サーバ100bのデータベース101bとを同期化させる処理を行う(ステップS143)。この同期化処理の詳細については後述する。仲介装置200は、同期化処理が完了したら当該サーバ100bを再びシステムに組み込む(ステップS144)。システムへの組込処理の詳細についてはステップS143の同期化処理の詳細と併せて後述する。   Here, it is assumed that the restart of the server 100b disconnected from the system is completed (step S141). When the operator of the mediation device 200 confirms the completion of the restart of the server 100b, the operator instructs the mediation device 200 to input a database synchronization request (step S142). The intermediary device 200 performs a process of synchronizing the database 101a of the normally operating server 100a and the database 101b of the server 100b (step S143). Details of this synchronization processing will be described later. When the synchronization process is completed, the mediation apparatus 200 incorporates the server 100b into the system again (step S144). Details of the incorporation processing into the system will be described later together with details of the synchronization processing in step S143.

以上の処理により、並行処理される複数のトランザクションについて、各サーバ100における処理順序が異なった場合であっても、各サーバ100間でデータベース101の同期が保たれる。   With the above processing, the synchronization of the database 101 is maintained between the servers 100 even if the processing order of the servers 100 is different for a plurality of transactions processed in parallel.

次に、並行処理される複数のトランザクションについて、各サーバ100における処理順序が異なった場合の他の例について図15及び図16のシーケンスチャートを参照して説明する。   Next, another example of a plurality of transactions processed in parallel when the processing order in each server 100 is different will be described with reference to the sequence charts of FIGS. 15 and 16.

ここでは、2台の正常稼働中のサーバ100a及び100bが各クライアント500からのクエリを処理するものとする。初期状態では、データベース101aと101bは完全に同一であり、サーバ管理表201は図7のようになっているものとする。また、トランザクション管理表202と送信キュー203は空であるとする。各サーバ100a,100bには、テーブルtest_tableが存在しているとする。そして、図51のテーブルtest_tableに対して、図53のトランザクションT3をクライアント500aが発行し、同図のトランザクションT4をクライアント500bが発行したものとする。前述したように、この2つのトランザクションT3,T4の処理後におけるデータベース101のデータは、各トランザクションの処理順序には影響されない。しかしながら、前述したように、トランザクションT4におけるSELECTの結果は各トランザクションT3,T4の処理順序によって異なった内容になることに注意されたい。   Here, it is assumed that the two servers 100a and 100b that are operating normally process a query from each client 500. In the initial state, the databases 101a and 101b are completely the same, and the server management table 201 is as shown in FIG. Further, it is assumed that the transaction management table 202 and the transmission queue 203 are empty. Assume that a table test_table exists in each of the servers 100a and 100b. Then, it is assumed that the client 500a issues the transaction T3 in FIG. 53 and the client Tb issues the transaction T4 in FIG. 53 to the table test_table in FIG. As described above, the data in the database 101 after the processing of the two transactions T3 and T4 is not affected by the processing order of each transaction. However, as described above, it should be noted that the result of SELECT in the transaction T4 differs depending on the processing order of the transactions T3 and T4.

なお、ここではクエリの処理順序に伴うデータベースの不整合とその解決方法の大まかな流れについて説明するため、サーバ管理表201の更新動作、送信キュー203に対するクエリの入出力、トランザクション管理表202の更新動作など、仲介装置200の各部についての詳細な動作については省略する。   Here, in order to explain the database inconsistency in the query processing order and the rough flow of the solution, the update operation of the server management table 201, the input / output of queries to the transmission queue 203, the update of the transaction management table 202 Detailed operations of each part of the mediation apparatus 200, such as operations, are omitted.

図15に示すように、クライアント500aがトランザクションT3を開始するクエリ(BEGIN)を仲介装置200に送信すると(ステップS201)、仲介装置200は、サーバ管理表201を参照して正常稼働中のサーバ100a及び100bに転送する(ステップS202,S203)。仲介装置200は、各サーバ100a及び100bからの応答を受信すると(ステップS204,S205)、正当な応答の1つをクライアント500aに転送する(ステップS206)。   As illustrated in FIG. 15, when the client 500a transmits a query (BEGIN) for starting a transaction T3 to the mediation device 200 (step S201), the mediation device 200 refers to the server management table 201 and the normally operating server 100a. And 100b (steps S202 and S203). When the intermediary device 200 receives a response from each of the servers 100a and 100b (steps S204 and S205), it transfers one of the valid responses to the client 500a (step S206).

次いで、クライアント500aはトランザクションT3の更新クエリ(UPDATE)を仲介装置200に送信する(ステップS207)。一方、クライアント500bはトランザクションT4を開始するクエリ(BEGIN)を仲介装置200に送信する(ステップS208)。   Next, the client 500a transmits an update query (UPDATE) of the transaction T3 to the mediation apparatus 200 (step S207). On the other hand, the client 500b transmits a query (BEGIN) for starting the transaction T4 to the mediation apparatus 200 (step S208).

仲介装置200は、トランザクションT3のUPDATEクエリを正常稼働中のサーバ100a及び100bに転送するとともに(ステップS209,S210)、トランザクションT4のBEGINクエリを正常稼働中のサーバ100a及び100bに転送する(ステップS211,S212)。そして、仲介装置200は、トランザクションT3のUPDATEクエリに対する応答を各サーバ100a及び100bから受信すると(ステップS213,S214)、正当な応答の1つをクライアント500aに転送する(ステップS215)。また、トランザクションT4のBEGINクエリに対する応答を各サーバ100a及び100bから受信すると(ステップS216,S217)、正当な応答の1つをクライアント500bに転送する(ステップS218)。   The intermediary device 200 transfers the UPDATE query of the transaction T3 to the servers 100a and 100b that are operating normally (steps S209 and S210), and transfers the BEGIN query of the transaction T4 to the servers 100a and 100b that are operating normally (step S211). , S212). When the intermediary device 200 receives a response to the UPDATE query of the transaction T3 from each of the servers 100a and 100b (steps S213 and S214), it transfers one of the valid responses to the client 500a (step S215). When a response to the BEGIN query of transaction T4 is received from each of the servers 100a and 100b (steps S216 and S217), one of the valid responses is transferred to the client 500b (step S218).

次いで、クライアント500aはトランザクションT3を確定するクエリ(COMMIT)を仲介装置200に送信する(ステップS219)。一方、クライアント500bはトランザクションT4の参照クエリ(SELECT)を仲介装置200に送信する(ステップS220)。   Next, the client 500a transmits a query (COMMIT) for confirming the transaction T3 to the mediation apparatus 200 (step S219). On the other hand, the client 500b transmits a reference query (SELECT) of the transaction T4 to the mediation apparatus 200 (step S220).

仲介装置200は、トランザクションT3のCOMMITクエリを正常稼働中のサーバ100a及び100bに転送するとともに(ステップS221,S222)、トランザクションT4のSELECTクエリを正常稼働中のサーバ100a及び100bに転送する(ステップS223,S224)。   The intermediary device 200 transfers the COMMIT query of the transaction T3 to the servers 100a and 100b that are operating normally (steps S221 and S222), and transfers the SELECT query of the transaction T4 to the servers 100a and 100b that are operating normally (step S223). , S224).

ここで、一方のサーバ100aでは、トランザクションT3のCOMMITクエリがトランザクションT4のSELECTクエリより先に処理され(ステップS225,S226)、他方のサーバ100bでは、トランザクションT4のSELECTクエリがトランザクションT3のCOMMITクエリより先に処理されたものとする(ステップS227,S228)。これにより、トランザクションT4のSELECTクエリの応答は、サーバ100aからの応答(ステップS226)と、サーバ100bからの応答(ステップS227)とは異なったものとなったとする。   Here, in one server 100a, the COMMIT query of the transaction T3 is processed before the SELECT query of the transaction T4 (steps S225 and S226), and in the other server 100b, the SELECT query of the transaction T4 is processed from the COMMIT query of the transaction T3. Assume that the processing has been performed first (steps S227 and S228). As a result, it is assumed that the response of the SELECT query of transaction T4 is different from the response from the server 100a (step S226) and the response from the server 100b (step S227).

仲介装置200は、トランザクションT4のSELECTクエリに対する応答が、各サーバ100a及び100b間で不一致となっているので、何れかのサーバ100a又は100bを選定し、選定したサーバ100a又は100bからの応答を正当なものとする(ステップS229)。ここで、サーバ100の選定方法としては、例えば予めMasterサーバを定めておいて、このMasterサーバを選定する方法、最初に応答を返したサーバを選定する方法、ラウンドロビンにより選定サーバを順次選定する方法、ランダムに選定する方法、各サーバの処理能力・処理負荷などにより選定する方法などが挙げられる。本実施の形態では、サーバ100aをMasterサーバとして該サーバ100aを正当な応答を返したサーバとして選定する。仲介装置200は、正当でない応答を返したサーバ100bをシステムから切り離す(ステップS230)。具体的には、サーバ管理表201から当該サーバ100bのエントリを削除するとともに、送信キュー203からサーバ100bの送信状態の欄を削除する。そして、図16に示すように、当該サーバ100bに対して再起動指示を送信する(ステップS231)。   Since the response to the SELECT query of the transaction T4 is inconsistent between the servers 100a and 100b, the intermediary device 200 selects one of the servers 100a or 100b and validates the response from the selected server 100a or 100b. (Step S229). Here, as a selection method of the server 100, for example, a master server is determined in advance, a method of selecting the master server, a method of selecting a server that first returned a response, and selecting a selected server sequentially by round robin. A method, a method of selecting at random, a method of selecting according to the processing capacity and processing load of each server, and the like can be mentioned. In this embodiment, the server 100a is selected as the master server, and the server 100a is selected as the server that returned a valid response. The mediation device 200 disconnects the server 100b that has returned an invalid response from the system (step S230). Specifically, the entry of the server 100b is deleted from the server management table 201, and the transmission status column of the server 100b is deleted from the transmission queue 203. Then, as shown in FIG. 16, a restart instruction is transmitted to the server 100b (step S231).

サーバ100bは、仲介装置200からの再起動指示を受信すると、自身の再起動を開始する(ステップS232)。   When receiving the restart instruction from the mediation apparatus 200, the server 100b starts its own restart (step S232).

仲介装置200は、選定したサーバ100aから受信した、トランザクションT3のCOMMITクエリに対する応答及びトランザクションT4のSELECTクエリに対する応答を、それぞれ要求元のクライアント500a,500bに転送する(ステップS233,S234)。以降、各クライアント500a,500bからのクエリは、正常稼働中のサーバ100aで処理する。図16の例では、クライアント500bがトランザクションT4のCOMMITクエリを仲介装置200に送信すると(ステップS235)、仲介装置200は当該クエリを正常稼働中のサーバ100aに転送する(ステップS236)。そして、仲介装置200は、当該クエリに対する応答をサーバ100aから受信すると(ステップS237)、この応答を要求元のクライアント500bに返す(ステップS238)。   The mediation apparatus 200 transfers the response to the COMMIT query of the transaction T3 and the response to the SELECT query of the transaction T4 received from the selected server 100a, respectively, to the requesting clients 500a and 500b (steps S233 and S234). Thereafter, queries from the clients 500a and 500b are processed by the normally operating server 100a. In the example of FIG. 16, when the client 500b transmits a COMMIT query of transaction T4 to the mediation apparatus 200 (step S235), the mediation apparatus 200 transfers the query to the normally operating server 100a (step S236). When receiving a response to the query from the server 100a (step S237), the mediation apparatus 200 returns this response to the requesting client 500b (step S238).

ここで、システムから切り離されたサーバ100bの再起動が完了したものとする(ステップS239)。仲介装置200のオペレータは、サーバ100bの再起動完了を確認すると、仲介装置200に対してデータベース同期化要求を入力指示する(ステップS240)。仲介装置200は、正常稼働中のサーバ100aのデータベース101aと、サーバ100bのデータベース101bとを同期化させる処理を行う(ステップS241)。この同期化処理の詳細については後述する。仲介装置200は、同期化処理が完了したら当該サーバ100bを再びシステムに組み込む(ステップS242)。システムへの組込処理の詳細についてはステップS241の同期化処理の詳細と併せて後述する。   Here, it is assumed that the restart of the server 100b disconnected from the system is completed (step S239). When the operator of the mediation device 200 confirms the completion of the restart of the server 100b, the operator instructs the mediation device 200 to input a database synchronization request (step S240). The intermediary device 200 performs a process of synchronizing the database 101a of the normally operating server 100a and the database 101b of the server 100b (step S241). Details of this synchronization processing will be described later. When the synchronization process is completed, the mediation apparatus 200 incorporates the server 100b into the system again (step S242). Details of the incorporation processing into the system will be described later together with details of the synchronization processing in step S241.

以上の処理により、並行処理される複数のトランザクションについて、各サーバ100における処理順序が異なった場合であっても、クライアント500には1つの正しい応答のみが処理結果として返される。   With the above processing, even if the processing order in each server 100 is different for a plurality of transactions processed in parallel, only one correct response is returned to the client 500 as a processing result.

なお、この例では、2つのトランザクションT3及びT4に属するクエリの処理順序が異なっても当該トランザクションT3及びT4に属する各クエリの中で同一行を更新するクエリは存在しないので、クエリの処理順序が異なることによる各データベース101間の不整合は生じない。したがって、この例に限定して考えると、データベース101の同期化のための各処理(ステップS230〜S232,S239〜S242)は不要であるとも考えられる。しかし、本実施の形態では、何らかの原因でデータベース101に不整合が潜在していた場合であって、当該不整合について前記ステップS229を契機に検出した場合にも対処できるように、データベース101の同期化のための各処理を実施するようにした。また、この例では、SELECTとUPDATEの順序不一致による結果不一致について説明したが、他にも、参照系ではSELECT FOR UPDATE、更新係ではDELETEなどの組み合わせで結果不一致が生じる場合がある。本実施の形態では、このような場合であっても図15及び図16を参照して説明したシーケンスと同様の処理を行うことによって、データベース101の不整合を解消できる。   In this example, even if the processing order of the queries belonging to the two transactions T3 and T4 is different, there is no query that updates the same row among the queries belonging to the transactions T3 and T4. There is no inconsistency between the databases 101 due to the difference. Therefore, considering only this example, it is considered that each process (steps S230 to S232, S239 to S242) for synchronizing the database 101 is unnecessary. However, in the present embodiment, the synchronization of the database 101 is performed so that it is possible to deal with the case where inconsistency is latent in the database 101 for some reason and the inconsistency is detected in response to the step S229. Each process for conversion was carried out. Further, in this example, the result mismatch due to the mismatch between the SELECT and UPDATE orders has been described. However, there may be a mismatch between results such as SELECT FOR UPDATE in the reference system and DELETE in the updater. In this embodiment, even in such a case, inconsistency of the database 101 can be resolved by performing the same processing as the sequence described with reference to FIGS. 15 and 16.

次に、前記ステップS143及びS241における同期化処理の詳細について説明する。本発明における同期化処理では、仲介装置200が同期化処理開始時において正常稼働しているサーバ100からデータベース101のスナップショットを取得し、このスナップショットを用いて新規サーバ100のデータベース101を復元する。さらに、この処理中に受信したクライアント500からのクエリを仲介装置200において差分情報として蓄積する。この差分情報の蓄積は送信キュー203を利用する。そして、新規サーバ100がスナップショットからのデータベース101の復元が完了したら仲介装置200から差分情報を取得して、この差分情報を処理する。   Next, details of the synchronization processing in steps S143 and S241 will be described. In the synchronization process according to the present invention, the mediation apparatus 200 acquires a snapshot of the database 101 from the server 100 that is operating normally at the start of the synchronization process, and restores the database 101 of the new server 100 using this snapshot. . Further, the query from the client 500 received during this process is accumulated as difference information in the mediation apparatus 200. This difference information is accumulated using the transmission queue 203. When the new server 100 completes the restoration of the database 101 from the snapshot, the difference information is acquired from the mediation apparatus 200 and the difference information is processed.

なお、同期化処理の実施は、仲介装置200からの再起動指示に応じた再起動時に限られない。すなわち、サーバ100が障害となってシステムから切り離され、その後にシステムに再び組み込む際にも実施される。また、システムを構成するサーバを増設する場合にも実施される。   Note that the implementation of the synchronization process is not limited to the restart according to the restart instruction from the mediation apparatus 200. That is, it is also performed when the server 100 is disconnected from the system due to a failure and then re-installed in the system. It is also implemented when adding more servers that make up the system.

以下に、サーバ100bをシステムに組み込む場合の同期化動作を図17から図31を参照して説明する。このとき注目すべきポイントは、クライアント500a及び500bに対するサービスを続けたままサーバ100bを追加する、つまり、システムダウンさせずにデータベース101aと101bを同期させることである。   Hereinafter, the synchronization operation when the server 100b is incorporated into the system will be described with reference to FIGS. The point to be noted at this time is to add the server 100b while continuing the service to the clients 500a and 500b, that is, to synchronize the databases 101a and 101b without bringing down the system.

データベース101bはデータベース101aと同期がとれていない状態、つまり、同一ではない状態である。例えば、データベース101bは、再起動直前のデータ又は障害発生直前のデータを保持しているかもしれないし、全く新しいサーバの場合には、データを全く持っていない状態かもしれない。本発明では、前者の場合でも古いデータは削除し、データベース101bはデータを全く保持していないものとしてシステムに組み込む。つまり、古いデータを保持している必要はない。   The database 101b is not synchronized with the database 101a, that is, is not identical. For example, the database 101b may hold data immediately before restart or data immediately before the occurrence of a failure, or may not have any data in the case of a completely new server. In the present invention, even in the former case, old data is deleted, and the database 101b is incorporated into the system assuming that no data is held. That is, it is not necessary to keep old data.

ここでは、サーバ100aのみが正常稼働しているのでサーバ管理表201は図20のようになっているとする。また、トランザクション管理表202は空であるとする。さらに、送信キュー203は空であり、正常稼働中のサーバ100aについてのみ送信状態を記憶する構成となっている。   Here, since only the server 100a is operating normally, it is assumed that the server management table 201 is as shown in FIG. The transaction management table 202 is assumed to be empty. Further, the transmission queue 203 is empty, and the transmission state is stored only for the server 100a that is operating normally.

図17に示すように、クライアント500aが172.17.1.1宛のトランザクション開始SQL(BEGIN)を含んだパケットを送信すると、仲介装置200の受信クエリ処理部204はそのパケットを受信する(ステップS301)。受信クエリ処理部204は、トランザクションが開始されたことを検知し、トランザクション管理表202にクライアント500aのIPアドレスとトランザクション番号を登録する(ステップS302)。図21にこのときのトランザクション管理表202を示す。受信クエリ処理部204は、サーバ管理表201を参照して正常稼働中のサーバ100aについて送信状態を「未送信」にして受信クエリを送信キュー203に入れる(ステップS303)。クエリ送信処理部205は、送信キュー203から当該クエリを取り出し、対応するサーバ100aに転送し(ステップS304)、送信キュー203の送信状態を「送信完了」に更新する(ステップS305)。仲介装置200の正当性判定部206は、トランザクションが正常に開始されたことを通知する応答パケットをサーバ100aから受信すると(ステップS306)、ここでは、正常稼働中のサーバ100が1台のみなので当該応答パケットを正当と判断し、応答送信処理部207は該応答パケットをクライアント500aへ転送する(ステップS307)。この時の送信キュー203を図22に示す。   As illustrated in FIG. 17, when the client 500a transmits a packet including the transaction start SQL (BEGIN) addressed to 172.17.1.1, the reception query processing unit 204 of the mediation apparatus 200 receives the packet (step S301). The reception query processing unit 204 detects that a transaction has started, and registers the IP address and transaction number of the client 500a in the transaction management table 202 (step S302). FIG. 21 shows the transaction management table 202 at this time. The reception query processing unit 204 refers to the server management table 201 and sets the transmission state to “untransmitted” for the normally operating server 100a and puts the reception query into the transmission queue 203 (step S303). The query transmission processing unit 205 extracts the query from the transmission queue 203, transfers it to the corresponding server 100a (step S304), and updates the transmission state of the transmission queue 203 to “transmission completed” (step S305). When the legitimacy determination unit 206 of the mediation apparatus 200 receives a response packet notifying that the transaction has started normally from the server 100a (step S306), since only one server 100 is operating normally here, The response transmission processing unit 207 determines that the response packet is valid, and transfers the response packet to the client 500a (step S307). The transmission queue 203 at this time is shown in FIG.

次いで、クライアント500aが172.17.1.1宛に、テーブルtest_tableを更新するSQL(UPDATE)を含んだパケットを送信すると、仲介装置200の受信クエリ処理部204はそのパケットを受信する(ステップS308)。受信クエリ処理部204は、サーバ管理表201を参照して正常稼働中のサーバ100aについて送信状態を「未送信」にして受信クエリを送信キュー203に入れる(ステップS309)。この時の送信キュー203を図23に示す。   Next, when the client 500a transmits a packet including SQL (UPDATE) for updating the table test_table to 172.17.1.1, the reception query processing unit 204 of the mediation apparatus 200 receives the packet (step S308). The reception query processing unit 204 refers to the server management table 201, sets the transmission state of the server 100a operating normally to “untransmitted”, and puts the reception query into the transmission queue 203 (step S309). The transmission queue 203 at this time is shown in FIG.

ここで、サーバ100bが再起動したものとする(ステップS310)。仲介装置200のオペレータは、サーバ100bの再起動完了を確認すると、仲介装置200に対してデータベース同期化要求を入力指示する(ステップS311)。   Here, it is assumed that the server 100b is restarted (step S310). When the operator of the mediation device 200 confirms that the server 100b has been restarted, the operator instructs the mediation device 200 to input a database synchronization request (step S311).

同期化処理制御部208は、データベース同期化要求があると、サーバ管理表201を参照して同期化用のサーバ100を選定する。ここでは、正常稼働中のサーバ100は1台のみなので、サーバ100aを選定する。そして、送信キュー203のサーバ100aについて送信状態が「未送信」となっているエントリを「保留」に更新する(ステップS312)。また、同期化処理制御部208は、同期化用のサーバ100aにおいて実行中クエリがないことを確認した後に、新規サーバ100bについて稼働状態を「sync」でサーバ管理表201に追加するとともに(ステップS313)、送信キュー203の送信状態の欄に当該サーバ100b用の列を追加する(ステップS314)。ここで、当該サーバ100bの送信状態は全て「保留」に設定する。この時のサーバ管理表201及び送信キュー203を図24,図25に示す。なお、同期化処理制御部208は、上記ステップS312〜S314の処理は1つの処理として取り扱い、排他制御を行う。つまり、ステップS312〜S314の処理中には、各ステップでアクセスするサーバ管理表201及び送信キュー203に対して、他の機能ブロック(例えば受信クエリ処理部204やクエリ送信処理部205など)からのアクセスを中断させる。   When there is a database synchronization request, the synchronization processing control unit 208 refers to the server management table 201 and selects the server 100 for synchronization. Here, since only one server 100 is operating normally, the server 100a is selected. Then, the entry whose transmission state is “untransmitted” for the server 100a in the transmission queue 203 is updated to “pending” (step S312). In addition, after confirming that there is no query being executed in the synchronization server 100a, the synchronization processing control unit 208 adds the operation state of the new server 100b to the server management table 201 with “sync” (step S313). ), A column for the server 100b is added to the transmission status column of the transmission queue 203 (step S314). Here, all the transmission states of the server 100b are set to “hold”. The server management table 201 and the transmission queue 203 at this time are shown in FIGS. Note that the synchronization processing control unit 208 handles the processes in steps S312 to S314 as one process and performs exclusive control. That is, during the processing of steps S312 to S314, the server management table 201 and the transmission queue 203 accessed in each step are sent from other functional blocks (for example, the reception query processing unit 204 and the query transmission processing unit 205). Interrupt access.

次いで、同期化処理制御部208は、サーバ100aのデータベース101aのスナップショットの作成を開始する(ステップS315)。スナップショットはスナップショット記憶部209に保存する。本実施の形態ではデータベース101としてPostgreSQLを利用したので、スナップショットの作成ツールとしてはpg_dumpを用いた。   Next, the synchronization processing control unit 208 starts creating a snapshot of the database 101a of the server 100a (step S315). The snapshot is stored in the snapshot storage unit 209. Since PostgreSQL is used as the database 101 in this embodiment, pg_dump is used as a snapshot creation tool.

上述したように、本実施の形態で用いるスナップショット作成ツールでは、スナップショット作成中にクエリを実行しても当該スナップショットには影響を与えない。そこで、同期化処理制御部208は、同期化用のサーバ100aについて送信キュー203の各クエリの送信状態を「保留」から「保留解除」に更新する(ステップS316)。この時の送信キュー203を図26に示す。これにより、クエリ送信処理部205による送信キュー203からのクエリの送信が再開する。具体的には、クエリ送信処理部205は、UPDATEクエリを送信キュー203から取り出して同期化用サーバ100aに送信するとともに(ステップS317)、送信状態を「送信完了」に更新する(ステップS318)。正当性判定部206は、当該クエリが正常処理されたことを通知する応答パケットをサーバ100aから受信すると(ステップS319)、ここでは、正常稼働中のサーバ100が1台のみなので当該応答パケットを正当と判断し、応答送信処理部207が該応答パケットをクライアント500aへ転送する(ステップS320)。この時の送信キュー203を図27に示す。また、スナップショット作成開始以降、クライアント500から受信したクエリは、同期化用サーバ100aについては「未送信」で、新規サーバ100bについては「保留」で送信キュー203に投入する。   As described above, with the snapshot creation tool used in this embodiment, even if a query is executed during snapshot creation, the snapshot is not affected. Therefore, the synchronization processing control unit 208 updates the transmission state of each query in the transmission queue 203 for the synchronization server 100a from “hold” to “hold release” (step S316). The transmission queue 203 at this time is shown in FIG. As a result, the transmission of the query from the transmission queue 203 by the query transmission processing unit 205 is resumed. Specifically, the query transmission processing unit 205 extracts the UPDATE query from the transmission queue 203 and transmits it to the synchronization server 100a (step S317), and updates the transmission state to “transmission completed” (step S318). When the validity determination unit 206 receives from the server 100a a response packet notifying that the query has been normally processed (step S319), the validity determination unit 206 determines that the response packet is valid because only one server 100 is operating normally. The response transmission processing unit 207 transfers the response packet to the client 500a (step S320). The transmission queue 203 at this time is shown in FIG. In addition, since the snapshot creation is started, the query received from the client 500 is put in the transmission queue 203 as “unsent” for the synchronization server 100a and “hold” for the new server 100b.

ここで、スナップショットの作成処理が完了したものとする(ステップS321)。同期化処理制御部208は、スナップショットの作成処理が完了すると、当該スナップショットを用いて新規サーバ100bのデータベース101bの復元処理を開始する(ステップS322)。本実施の形態ではデータベース101としてPostgreSQLを利用したので、スナップショットからの復元ツールとしてはpsqlを用いた。   Here, it is assumed that the snapshot creation processing has been completed (step S321). When the snapshot creation processing is completed, the synchronization processing control unit 208 starts restoration processing of the database 101b of the new server 100b using the snapshot (step S322). Since PostgreSQL is used as the database 101 in this embodiment, psql is used as a restoration tool from a snapshot.

前述したように、スナップショット作成開始以降、クライアント500から受信したクエリは、同期化用サーバ100aについては「未送信」で、新規サーバ100bについては「保留」で送信キュー203に投入する。図18の例では、受信クエリ処理部204は、クライアント500aからINSERTクエリを受信すると(ステップS323)、同期化用サーバ100aについては「未送信」で、新規サーバ100bについては「保留」で当該エリを送信キュー203に投入する(ステップS324)。この時の送信キュー203を図28に示す。そして、クエリ送信処理部205は、送信状態が「未送信」となっているクエリを取り出して対応する同期化用サーバ100aに転送するとともに(ステップS325)、送信状態を「送信完了」に更新する(ステップS326)。正当性判定部206は、当該クエリが正常処理されたことを通知する応答パケットをサーバ100aから受信すると(ステップS327)、ここでは、正常稼働中のサーバ100が1台のみなので当該応答パケットを正当と判断し、応答送信処理部207が該応答パケットをクライアント500aへ転送する(ステップS328)。   As described above, the query received from the client 500 after starting the snapshot creation is put in the transmission queue 203 as “unsent” for the synchronization server 100a and “hold” for the new server 100b. In the example of FIG. 18, upon receipt of the INSERT query from the client 500a (step S323), the received query processing unit 204 is “unsent” for the synchronization server 100a and “hold” for the new server 100b. Is put into the transmission queue 203 (step S324). The transmission queue 203 at this time is shown in FIG. Then, the query transmission processing unit 205 extracts a query whose transmission state is “untransmitted” and transfers the query to the corresponding synchronization server 100a (step S325), and updates the transmission state to “transmission completed”. (Step S326). When the validity determination unit 206 receives from the server 100a a response packet notifying that the query has been normally processed (step S327), the validity determination unit 206 determines that the response packet is valid because only one server 100 is operating normally. The response transmission processing unit 207 transfers the response packet to the client 500a (step S328).

ここで、新規サーバ100bのデータベース101bの復元処理が完了したものとする(ステップS329)。同期化処理制御部208は、新規サーバ100bのデータベース101bのスナップショットからの復元が完了すると、送信キュー203に保留となっているクエリを差分情報として送出すべく、新規サーバ100bについて送信状態が「保留」となっているすべてのクエリを、送信状態「保留解除」に更新する(ステップS330)。この時の送信キュー203を図29に示す。これにより、クエリ送信処理部205による送信キュー203からの差分情報としてのクエリの送信が開始される。具体的には、クエリ送信処理部205は、BEGINクエリを送信キュー203から取り出して新規サーバ100bに送信するとともに(ステップS331)、送信状態を「送信完了」に更新する(ステップS332)。正当性判定部206は、当該クエリが正常処理されたことを通知する応答パケットを新規サーバ100bから受信する(ステップS333)。ここで、当該応答は差分情報としてのクエリの処理応答なので、当該応答はクライアント500へは転送しない。   Here, it is assumed that the restoration process of the database 101b of the new server 100b has been completed (step S329). When the restoration from the snapshot of the database 101b of the new server 100b is completed, the synchronization processing control unit 208 sets the transmission state of the new server 100b to “transmission query 203” as difference information. All queries that are “pending” are updated to the transmission state “pending release” (step S330). The transmission queue 203 at this time is shown in FIG. As a result, transmission of a query as difference information from the transmission queue 203 by the query transmission processing unit 205 is started. Specifically, the query transmission processing unit 205 extracts the BEGIN query from the transmission queue 203 and transmits it to the new server 100b (step S331), and updates the transmission state to “transmission completed” (step S332). The validity determination unit 206 receives from the new server 100b a response packet notifying that the query has been processed normally (step S333). Here, since the response is a query processing response as difference information, the response is not transferred to the client 500.

受信クエリ処理部204は、差分情報転送開始以降クライアント500から受信したクエリは、同期化用サーバ100aについては送信状態を「未送信」で、新規サーバ100bについては送信状態を「保留解除」で送信キュー203に投入する。図19の例では、クライアント500aからCOMMITクエリを受信すると(ステップS334)、受信クエリ処理部204は、同期化用サーバ100aについては送信状態を「未送信」で、新規サーバ100bについては送信状態を「保留解除」で送信キュー203に投入する(ステップS335)。この時の送信キュー203を図30に示す。   The received query processing unit 204 transmits the query received from the client 500 after the start of the difference information transfer with the transmission state “unsent” for the synchronization server 100a and the transmission state “unhold” for the new server 100b. Put it in the queue 203. In the example of FIG. 19, when a COMMIT query is received from the client 500a (step S334), the reception query processing unit 204 sets the transmission state for the synchronization server 100a to “unsent” and the transmission state for the new server 100b. The “hold release” is entered into the transmission queue 203 (step S335). The transmission queue 203 at this time is shown in FIG.

以降、クエリ送信処理部205は、送信状態が「未送信」及び「保留解除」となっているクエリを対応するサーバ100に送信するとともに送信状態を「送信完了」に更新する。そして、送信状態が「未送信」であったクエリに対する応答に対しては、正当性判定部206が正当性の判定を行うとともに、応答送信処理部207が正当な応答の1つをクライアント500に返す。一方、送信状態が「保留解除」であったクエリに対する応答に対してはクライアント500への転送は行わない。   Thereafter, the query transmission processing unit 205 transmits the query whose transmission status is “untransmitted” and “hold release” to the corresponding server 100 and updates the transmission status to “transmission complete”. For the response to the query whose transmission state is “unsent”, the validity determination unit 206 determines the validity, and the response transmission processing unit 207 sends one of the valid responses to the client 500. return. On the other hand, the response to the query whose transmission state is “hold release” is not transferred to the client 500.

図19の例では、クエリ送信処理部205は、送信状態が「未送信」であるCOMMITクエリを取り出して対応する同期化用サーバ100aに転送するとともに(ステップS336)、送信状態を「送信完了」に更新する(ステップS337)。正当性判定部206は、当該クエリが正常処理されたことを通知する応答パケットをサーバ100aから受信すると(ステップS338)、ここでは、正常稼働中のサーバ100が1台のみなので当該応答パケットを正当と判断し、応答送信処理部207が該応答パケットをクライアント500aへ転送する(ステップS339)。また、このCOMMITクエリの処理によりトランザクションが終了するので、応答送信処理部207は当該トランザクションの登録をトランザクション管理表202から削除する(ステップS340)。   In the example of FIG. 19, the query transmission processing unit 205 extracts a COMMIT query whose transmission state is “untransmitted” and transfers it to the corresponding synchronization server 100a (step S336), and the transmission state is “transmission complete”. (Step S337). When the validity determination unit 206 receives a response packet notifying that the query has been processed normally from the server 100a (step S338), the validity determination unit 206 determines that the response packet is valid because only one server 100 is operating normally. The response transmission processing unit 207 transfers the response packet to the client 500a (step S339). Further, since the transaction is terminated by the processing of the COMMIT query, the response transmission processing unit 207 deletes the registration of the transaction from the transaction management table 202 (step S340).

また、図19の例では、クエリ送信処理部205は、送信状態が「保留解除」となっているUPDATEクエリ,INSERTクエリ、COMMITクエリを差分情報として順次、新規サーバ100bに転送し、送信状態を「送信完了」に更新する処理を繰り返す(ステップS341〜S349)。差分情報の送出が完了すると、すなわち送信キュー203に送信状態が「保留解除」となっているクエリがなくなると、新規サーバ100bをシステムに組み込むべくサーバ100bについてのサーバ管理表201の稼働状態を「active」に更新する(ステップS350)。この時のサーバ管理表201を図31に示す。なお、このステップS350の処理は、前述のステップS144,S242の処理に対応するものである。   In the example of FIG. 19, the query transmission processing unit 205 sequentially transfers the UPDATE query, the INSERT query, and the COMMIT query whose transmission status is “hold release” as difference information to the new server 100b, and sets the transmission status. The process of updating to “transmission completed” is repeated (steps S341 to S349). When the transmission of the difference information is completed, that is, when there is no query in the transmission queue 203 whose transmission state is “pending release”, the operating state of the server management table 201 for the server 100b is set to “ updated to "active" (step S350). The server management table 201 at this time is shown in FIG. The process in step S350 corresponds to the processes in steps S144 and S242 described above.

以上詳述したように、本実施の形態に係る多重化データベースシステムによれば、複数のトランザクションを並行処理しても、各データベース101間で矛盾の生じるおそれがあるような状態、具体的には各サーバ100においてクエリの処理順序が異なることによるサーバ100の無応答やサーバ100間での応答結果の矛盾が生じた状態になると、各データベース101間の同期化処理が実行される。これにより、各データベース101の同期状態を保つことができる。また、このような状態においても、クライアント500には1つの正しい応答のみが処理結果として返されるので、システム全体として正常稼働を維持できる。   As described above in detail, according to the multiplexed database system according to the present embodiment, even if a plurality of transactions are processed in parallel, there is a possibility that inconsistencies may occur between the databases 101, specifically, When there is no response of the servers 100 due to different query processing orders in each server 100 or inconsistencies in response results between the servers 100, synchronization processing between the databases 101 is executed. Thereby, the synchronization state of each database 101 can be maintained. Even in such a state, only one correct response is returned to the client 500 as a processing result, so that the normal operation of the entire system can be maintained.

なお、上記同期化処理自体は、もともとシステムに組み込まれていたが障害等のためにシステムから切り離されたサーバ100だけでなく、システム内のサーバ数増大のための新規のサーバ100であっても適用できる。   The synchronization process itself is not limited to the server 100 originally incorporated in the system but disconnected from the system due to a failure or the like, but may be a new server 100 for increasing the number of servers in the system. Applicable.

また、上記同期化処理においては、仲介装置200において差分情報として送信キュー203に記憶するデータは、同期化要求(システムの組み込み要求)があった後から蓄積を開始するので、仲介装置200において同期化用データが増大することがない。これにより、仲介装置200の記憶容量を節約でき、該記憶容量が溢れることによる障害発生を未然に防止できる。さらに、サーバ100の切り離しも任意に行うことができる。   In the synchronization process, data stored in the transmission queue 203 as difference information in the mediation apparatus 200 starts to accumulate after a synchronization request (system incorporation request) is received. There is no increase in data for conversion. Thereby, the storage capacity of the intermediary device 200 can be saved, and the occurrence of a failure due to the overflow of the storage capacity can be prevented. Further, the server 100 can be arbitrarily disconnected.

このように、本実施の形態に係る多重化データベースシステムでは、サーバの組み込み及び切り離しを任意に実施できるので、用途や予算などの要求に応じて柔軟なシステム設計を行うことができる。   As described above, in the multiplexed database system according to the present embodiment, the server can be arbitrarily incorporated and disconnected, so that a flexible system design can be performed according to requests such as usage and budget.

なお、本実施形態では、クライアント500a及び500bからの処理要求を多重化データベースシステムで処理する場合について説明したが、データベース一致検査装置600からの処理要求も同様に処理すればよい。これは、多重化データベースシステムから見るとデータベース一致検査装置600もクライアントコンピュータの1つだからである。ところで、データベース一致検査装置600は、前述したように、定期的に又は必要に応じてデータベース一致検査用の参照クエリを仲介装置200に送信する。これにより、何らかの理由でデータベース101間でデータの矛盾が生じた場合であっても、当該クエリによりデータベース101間の矛盾が検出され上記同期化処理が実行される。これにより、データベース101間の同期をより確実に図ることができる。   In the present embodiment, a case has been described in which processing requests from the clients 500a and 500b are processed by the multiplexed database system. However, processing requests from the database match checking device 600 may be processed in the same manner. This is because the database match checking device 600 is one of the client computers when viewed from the multiplexed database system. Incidentally, as described above, the database match checking device 600 transmits a reference query for database match checking to the mediation device 200 periodically or as necessary. Thereby, even if data inconsistency occurs between the databases 101 for some reason, the inconsistency between the databases 101 is detected by the query, and the synchronization processing is executed. Thereby, the synchronization between the databases 101 can be more reliably achieved.

(第2の実施の形態)
本発明の第2の実施の形態に係る多重化データベースシステムについて図面を参照して説明する。本実施の形態が前述の第1の実施の形態と異なる点は、仮想サーバ800が3台のサーバ100を備えていること、及び、スナップショットの作成・復元ルーツとしてSQLを用いた汎用的なものを用いる点にある。さらに具体的には、本実施の形態と第1の実施の形態とでは、システムにサーバ100を組み込む際の同期化処理(第1の実施の形態における図14のステップS143及び図16のステップS241)の動作が異なり、他の動作については同じである。以下、この同期化処理について詳述する。
(Second Embodiment)
A multiplexed database system according to a second embodiment of the present invention will be described with reference to the drawings. This embodiment is different from the first embodiment described above in that the virtual server 800 includes three servers 100 and that the SQL is used as a snapshot creation / restoration root. The point is to use things. More specifically, in the present embodiment and the first embodiment, the synchronization processing when incorporating the server 100 into the system (step S143 in FIG. 14 and step S241 in FIG. 16 in the first embodiment). ) Are different, and other operations are the same. Hereinafter, this synchronization processing will be described in detail.

前記第1の実施の形態において同期化処理制御部208は、スナップショットの作成ツールとして、スナップショット作成中にクエリを実行しても当該スナップショットには影響を与えないpg_dumpを用いた。一方、本実施の形態において同期化処理制御部208は、データベース101に対してSELECTなどの一般的なクエリを発行することによりスナップショットを取得し、INSERTクエリ等を発行することによりスナップショットからのデータベース101の復元を行う。このような方法を採用することにより、データベース101の種類に依存しない汎用的なシステムを構築可能となる。   In the first embodiment, the synchronization processing control unit 208 uses pg_dump as a snapshot creation tool, which does not affect the snapshot even if a query is executed during the creation of the snapshot. On the other hand, in the present embodiment, the synchronization processing control unit 208 acquires a snapshot by issuing a general query such as SELECT to the database 101, and issues an INSERT query or the like from the snapshot. The database 101 is restored. By adopting such a method, a general-purpose system independent of the type of the database 101 can be constructed.

ところで、このような汎用的なスナップショットの作成及びデータベースの復元方法では、スナップショット作成開始後に処理された更新クエリがスナップショットに反映するか否かが問題となる。このため、第1の実施の形態のようなシステム構成では、スナップショットの作成中にはクエリの処理を停止する必要がある。そして、これによりクライアント500へのサービス提供が停止してしまうという問題がある。そこで、本実施の形態では、クライアント500に対するサービス継続とスナップショット作成とをそれぞれ別のサーバ100で行うことにより、クライアント500へのサービス提供を継続するようにしている。以下、本実施の形態に係るシステムの動作について詳述する。   By the way, in such a general-purpose snapshot creation and database restoration method, it becomes a problem whether or not an update query processed after the start of snapshot creation is reflected in the snapshot. For this reason, in the system configuration as in the first embodiment, it is necessary to stop query processing while creating a snapshot. This causes a problem that service provision to the client 500 is stopped. Therefore, in the present embodiment, service continuation for the client 500 and snapshot creation are performed by different servers 100 so that service provision to the client 500 is continued. Hereinafter, the operation of the system according to the present embodiment will be described in detail.

ここでは、3台のサーバ100a〜100cのうち1台のサーバ100cがシステムから切り離されている状態から、該サーバ100cをシステムに再び組み込む場合について図32〜図49を参照して説明する。   Here, a case where one server 100c among the three servers 100a to 100c is detached from the system and then the server 100c is re-installed in the system will be described with reference to FIGS.

初期状態におけるサーバ管理表201を図37に示す。また、トランザクション管理表202は空であるものとする。送信キュー203は空であり図38に示すような構造となっている。   FIG. 37 shows the server management table 201 in the initial state. The transaction management table 202 is assumed to be empty. The transmission queue 203 is empty and has a structure as shown in FIG.

図32に示すように、クライアント500aが172.17.1.1宛のトランザクション開始SQL(BEGIN)を含んだパケットを送信すると、仲介装置200の受信クエリ処理部204はそのパケットを受信する(ステップS401)。受信クエリ処理部204は、トランザクションが開始されたことを検知し、トランザクション管理表202にクライアント500aのIPアドレスとトランザクション番号を登録する(ステップS402)。受信クエリ処理部204は、サーバ管理表201を参照して正常稼働中のサーバ100a及び100bについて送信状態を「未送信」にして受信クエリを送信キュー203に入れる(ステップS403)。クエリ送信処理部205は、送信キュー203から当該クエリを取り出し、対応するサーバ100a及び100bに転送し(ステップS404,S405)、それぞれ送信キュー203の送信状態を「送信完了」に更新する(ステップS406)。仲介装置200の正当性判定部206は、トランザクションが正常に開始されたことを通知する応答パケットをサーバ100a及び100bから受信すると(ステップS407,S408)、各サーバ100a及び100bからの応答パケットの正当性を判定する。そして、応答送信処理部207は正当な応答パケットの1つをクライアント500aへ転送する(ステップS409)。この時の送信キュー203を図39に示す。   As illustrated in FIG. 32, when the client 500a transmits a packet including the transaction start SQL (BEGIN) addressed to 172.17.1.1, the reception query processing unit 204 of the mediation apparatus 200 receives the packet (step S401). The reception query processing unit 204 detects that a transaction has started, and registers the IP address and transaction number of the client 500a in the transaction management table 202 (step S402). The reception query processing unit 204 refers to the server management table 201 and sets the transmission state to “untransmitted” for the servers 100a and 100b that are operating normally, and puts the reception query into the transmission queue 203 (step S403). The query transmission processing unit 205 retrieves the query from the transmission queue 203, transfers it to the corresponding servers 100a and 100b (steps S404 and S405), and updates the transmission state of the transmission queue 203 to “transmission complete” (step S406). ). When the legitimacy determination unit 206 of the mediation apparatus 200 receives a response packet notifying that the transaction has started normally from the servers 100a and 100b (steps S407 and S408), the legitimacy of the response packet from each of the servers 100a and 100b. Determine sex. Then, the response transmission processing unit 207 transfers one of the valid response packets to the client 500a (Step S409). The transmission queue 203 at this time is shown in FIG.

次いで、クライアント500aが172.17.1.1宛に、テーブルtest_tableを更新するSQL(UPDATE)を含んだパケットを送信すると、仲介装置200の受信クエリ処理部204はそのパケットを受信する(ステップS410)。受信クエリ処理部204は、サーバ管理表201を参照して正常稼働中のサーバ100a及び100bについて送信状態を「未送信」にして受信クエリを送信キュー203に入れる(ステップS411)。この時の送信キュー203を図40に示す。   Next, when the client 500a transmits a packet including SQL (UPDATE) for updating the table test_table to 172.17.1.1, the reception query processing unit 204 of the mediation apparatus 200 receives the packet (step S410). The reception query processing unit 204 refers to the server management table 201, sets the transmission state of the servers 100a and 100b that are operating normally to “untransmitted”, and puts the reception query into the transmission queue 203 (step S411). The transmission queue 203 at this time is shown in FIG.

ここで、サーバ100cが再起動したものとする(ステップS412)。仲介装置200のオペレータは、サーバ100cの再起動完了を確認すると、仲介装置200に対してデータベース同期化要求を入力指示する(ステップS413)。   Here, it is assumed that the server 100c is restarted (step S412). When the operator of the mediation device 200 confirms that the server 100c has been restarted, the operator instructs the mediation device 200 to input a database synchronization request (step S413).

同期化処理制御部208は、データベース同期化要求があると、サーバ管理表201を参照して同期化用のサーバ100を1台選定する。ここでは、正常稼働中のサーバ100は2台なので、何れか一方のサーバを所定の規則に従って選定する。本実施の形態では、サーバ100bを同期化用サーバとして選定したものとする。同期化処理制御部208は、サーバ管理表201のサーバ100bについての稼働状態を「sync」に更新するとともに(ステップS414)、送信キュー203のサーバ100bについて送信状態が「未送信」となっているエントリを「保留」に更新する(ステップS415)。また、同期化処理制御部208は、同期化用のサーバ100bにおいて実行中クエリの処理が完了したことを確認した後に、要求元のサーバ100cについて稼働状態を「sync」でサーバ管理表201に追加するとともに(ステップS416)、送信キュー203の送信状態の欄に当該サーバ100c用の列を追加する(ステップS417)。ここで、当該サーバ100cの送信状態は全て「保留」に設定する。この時のサーバ管理表201及び送信キュー203を図41,図42に示す。なお、同期化処理制御部208は、上記ステップS414〜S417の処理は1つの処理として取り扱い、排他制御を行う。つまり、ステップS414〜S417の処理中には、各ステップでアクセスするサーバ管理表201及び送信キュー203に対して、他の機能ブロック(例えば受信クエリ処理部204やクエリ送信処理部205など)からのアクセスを中断させる。   When there is a database synchronization request, the synchronization processing control unit 208 refers to the server management table 201 and selects one server 100 for synchronization. Here, since there are two servers 100 operating normally, either one of the servers is selected according to a predetermined rule. In the present embodiment, it is assumed that the server 100b is selected as the synchronization server. The synchronization processing control unit 208 updates the operation state for the server 100b in the server management table 201 to “sync” (step S414), and the transmission state for the server 100b in the transmission queue 203 is “not transmitted”. The entry is updated to “pending” (step S415). In addition, the synchronization processing control unit 208 confirms that the processing of the query being executed in the synchronization server 100b is completed, and then adds the operation status of the requesting server 100c to the server management table 201 with “sync”. At the same time (step S416), a column for the server 100c is added to the transmission status column of the transmission queue 203 (step S417). Here, all the transmission states of the server 100c are set to “hold”. The server management table 201 and the transmission queue 203 at this time are shown in FIGS. Note that the synchronization processing control unit 208 handles the processes in steps S414 to S417 as one process and performs exclusive control. That is, during the processing of steps S414 to S417, the server management table 201 and the transmission queue 203 accessed in each step are sent from other functional blocks (for example, the reception query processing unit 204 and the query transmission processing unit 205). Interrupt access.

次いで、同期化処理制御部208は、サーバ100bのデータベース101bのスナップショットの作成を開始する(ステップS418)。スナップショットはスナップショット記憶部209に保存する。本実施の形態では前述したようにSELECTクエリを使ってデータベース101bの各テーブルのデータ等を取得する。   Next, the synchronization processing control unit 208 starts creating a snapshot of the database 101b of the server 100b (step S418). The snapshot is stored in the snapshot storage unit 209. In this embodiment, as described above, the data of each table in the database 101b is acquired using the SELECT query.

同期化処理制御部208が上記ステップS413〜S416の排他処理を終えると、図33に示すように、クエリ送信処理部205は、送信キュー203から送信状態が「未送信」のクエリを取り出し、対応するサーバ100aに転送するとともに(ステップS419)、送信キュー203の送信状態を「送信完了」に更新する(ステップS420)。仲介装置200の受信クエリ処理部204は、UPDATEが正常に処理されたことを通知する応答パケットをサーバ100aから受信すると(ステップS421)、ここでは、正常稼働中のサーバ100が1台のみなので当該応答パケットを正当と判断し、応答送信処理部207は該応答パケットのクライアント500aへ転送する(ステップS422)。   When the synchronization processing control unit 208 finishes the exclusive processing of steps S413 to S416, the query transmission processing unit 205 retrieves a query whose transmission state is “untransmitted” from the transmission queue 203 as shown in FIG. (Step S419), and the transmission state of the transmission queue 203 is updated to “transmission completed” (step S420). When the reception query processing unit 204 of the mediation device 200 receives a response packet notifying that the UPDATE has been processed normally from the server 100a (step S421), since only one server 100 is operating normally, the response query processing unit 204 The response transmission processing unit 207 determines that the response packet is valid, and transfers the response packet to the client 500a (step S422).

また、クライアント500bが172.17.1.1宛のトランザクション開始SQL(BEGIN)を含んだパケットを送信すると、仲介装置200の受信クエリ処理部204はそのパケットを受信する(ステップS423)。受信クエリ処理部204は、トランザクションが開始されたことを検知し、トランザクション管理表202にクライアント500bのIPアドレスとトランザクション番号を登録する(ステップS424)。受信クエリ処理部204は、サーバ管理表201を参照して正常稼働中のサーバ100aについて送信状態を「未送信」にするとともに、同期化処理中のサーバ100b及び100cについて送信状態を「保留」にして受信クエリを送信キュー203に入れる(ステップS425)。クエリ送信処理部205は、送信キュー203から当該クエリを取り出し、送信状態が「未送信」であるサーバ100aに転送し(ステップS426)、送信キュー203のサーバ100aについての送信状態を「送信完了」に更新する(ステップS427)。仲介装置200の正当性判定部206は、トランザクションが正常に開始されたことを通知する応答パケットをサーバ100aから受信すると(ステップS428)、ここでは、正常稼働中のサーバ100が1台のみなので当該応答パケットを正当と判断し、応答送信処理部207は該応答パケットのクライアント500bへ転送する(ステップS429)。この時の送信キュー203を図43に示す。   When the client 500b transmits a packet including the transaction start SQL (BEGIN) addressed to 172.17.1.1, the reception query processing unit 204 of the mediation apparatus 200 receives the packet (step S423). The reception query processing unit 204 detects that a transaction has started, and registers the IP address and transaction number of the client 500b in the transaction management table 202 (step S424). The reception query processing unit 204 refers to the server management table 201 and sets the transmission state to “unsent” for the server 100a that is operating normally, and sets the transmission state to “hold” for the servers 100b and 100c that are performing the synchronization processing. The reception query is put in the transmission queue 203 (step S425). The query transmission processing unit 205 retrieves the query from the transmission queue 203, transfers it to the server 100a whose transmission state is “untransmitted” (step S426), and sets the transmission state for the server 100a in the transmission queue 203 to “transmission complete”. (Step S427). When the legitimacy determination unit 206 of the mediation apparatus 200 receives a response packet notifying that the transaction has started normally from the server 100a (step S428), since only one server 100 is operating normally here, The response transmission processing unit 207 determines that the response packet is valid, and transfers the response packet to the client 500b (step S429). The transmission queue 203 at this time is shown in FIG.

ここで、スナップショットの作成処理が完了したものとする(ステップS430)。同期化処理制御部208は、スナップショットの作成処理が完了すると、当該スナップショットを用いて新規サーバ100cのデータベース101cの復元処理を開始する(ステップS431)。本実施の形態では、INSERTクエリ等を新規サーバ100cに発行することによりスナップショットからのデータベース101の復元を図る。   Here, it is assumed that the snapshot creation processing has been completed (step S430). When the snapshot creation processing is completed, the synchronization processing control unit 208 starts restoration processing of the database 101c of the new server 100c using the snapshot (step S431). In this embodiment, the database 101 is restored from the snapshot by issuing an INSERT query or the like to the new server 100c.

また、スナップショットの作成処理が完了すると、同期化処理制御部208は、該サーバ100bについて送信キュー203の送信状態が「保留」となっているものを「保留解除」に更新する(ステップS432)。この時の送信キュー203を図44に示す。以降、各クライアント500から受信したクエリは、サーバ100aについては送信状態を「未送信」で、サーバ100bについては送信状態を「保留解除」で、サーバ100cについては送信状態を「保留」にして送信キュー203に入れる。これにより、クエリ送信処理部205は、送信状態が「保留解除」となったクエリを差分情報として古いものから順にサーバ100bに送信する。   When the snapshot creation processing is completed, the synchronization processing control unit 208 updates the server 100b in which the transmission state of the transmission queue 203 is “pending” to “hold release” (step S432). . The transmission queue 203 at this time is shown in FIG. Thereafter, the query received from each client 500 is transmitted with the transmission state “unsent” for the server 100a, the transmission state “unhold” for the server 100b, and the transmission state “hold” for the server 100c. Put in the queue 203. As a result, the query transmission processing unit 205 transmits the queries whose transmission status is “hold release” to the server 100b in order from the oldest as difference information.

具体的には、クエリ送信処理部205は、送信キュー203からUPDATEクエリを取り出してサーバ100bに転送するとともに(ステップS433)、送信キュー203の送信状態を「送信完了」に更新する(ステップS434)。仲介装置200の正当性判定部206は、更新が正常に処理されたことを通知する応答パケットをサーバ100bから受信する(ステップS435)。ここで、当該応答は差分情報としてのクエリの処理応答なので、当該応答はクライアント500へは転送しない。   Specifically, the query transmission processing unit 205 extracts the UPDATE query from the transmission queue 203 and transfers it to the server 100b (step S433), and updates the transmission state of the transmission queue 203 to “transmission completed” (step S434). . The validity determination unit 206 of the mediation apparatus 200 receives a response packet notifying that the update has been processed normally from the server 100b (step S435). Here, since the response is a query processing response as difference information, the response is not transferred to the client 500.

ここで、クライアント500bがINSERTクエリを仲介装置200に送信すると(ステップS436)、前述したように、仲介装置200の受信クエリ処理部204は、サーバ100aについては送信状態を「未送信」で、サーバ100bについては送信状態を「保留解除」で、サーバ100cについては送信状態を「保留」で当該クエリを送信キューに投入する(ステップS437)。この時の送信キュー203を図45に示す。クエリ送信処理部205は、送信キュー203から当該クエリを取り出し、送信状態が「未送信」であるサーバ100aに対して転送するとともに(ステップS438)、送信キュー203のサーバ100aについての送信状態を「送信完了」に更新する(ステップS439)。正当性判定部206は、INSERTが正常に処理されたことを通知するパケットをサーバ100aから受信すると(ステップS440)、ここでは、正常稼働中のサーバ100が1台のみなので当該応答パケットを正当と判断し、応答送信処理部207は該応答パケットをクライアント500bへ転送する(ステップS441)。   Here, when the client 500b transmits an INSERT query to the mediation device 200 (step S436), as described above, the reception query processing unit 204 of the mediation device 200 sets the transmission status to “unsent” for the server 100a. For 100b, the transmission state is “hold release”, and for the server 100c, the transmission state is “hold” and the query is put into the transmission queue (step S437). The transmission queue 203 at this time is shown in FIG. The query transmission processing unit 205 retrieves the query from the transmission queue 203 and transfers the query to the server 100a whose transmission state is “untransmitted” (step S438), and sets the transmission state of the transmission queue 203 for the server 100a to “ Update to “transmission completed” (step S439). When the validity determining unit 206 receives from the server 100a a packet notifying that the INSERT has been processed normally (step S440), the response determining unit 206 determines that the response packet is valid because only one server 100 is operating normally. In response, the response transmission processing unit 207 transfers the response packet to the client 500b (step S441).

図45に示すように、この時点では送信キュー203において送信状態が「保留解除」になったクエリは、BEGINクエリとINSERTクエリの2つである。仲介装置200は、前述のステップS433〜S435と同様にして、当該2つのクエリを処理する(ステップS442〜S447)。   As shown in FIG. 45, at this time, there are two queries, the BEGIN query and the INSERT query, whose transmission status is “pending release” in the transmission queue 203. The mediation apparatus 200 processes the two queries in the same manner as in steps S433 to S435 described above (steps S442 to S447).

以上でサーバ100bに対しては、全ての差分情報の転送が終了し(すなわち送信キュー203から「保留解除」のクエリを全て送出し終わり)、且つ、差分情報としてのクエリの処理が正常に処理されたことになるので、サーバ100aのデータベース101aとサーバ100bのデータベース101bの同期化が完了したことになる。そこで、仲介装置200の応答送信処理部207は、サーバ100bをシステムに組み込むべくサーバ100bについてのサーバ管理表201の稼働状態を「active」に更新する(ステップS448)。なお、システムへの組み込みのタイミングは、正常稼働中のサーバ100aにおいてクエリの実行中であっても構わず、またトランザクションが継続中であっても構わない点に留意されたい。   As described above, the transfer of all the difference information to the server 100b is completed (that is, the transmission of all “hold release” queries from the transmission queue 203), and the query processing as the difference information is processed normally. As a result, the synchronization of the database 101a of the server 100a and the database 101b of the server 100b is completed. Therefore, the response transmission processing unit 207 of the mediation apparatus 200 updates the operating state of the server management table 201 for the server 100b to “active” in order to incorporate the server 100b into the system (step S448). Note that the timing of incorporation into the system may be during execution of a query in the normally operating server 100a, or the transaction may be ongoing.

以降、クライアント500からのクエリは、サーバ100a及びサーバ100bについては送信状態を「未送信」で、サーバ100cについては送信状態を「保留」にして送信キュー203に入れる。具体的には、図34に示すように、クライアント500aが172.17.1.1宛のトランザクション確定SQL(COMMIT)を含んだパケットを送信すると、仲介装置200の受信クエリ処理部204はそのパケットを受信する(ステップS449)。受信クエリ処理部204は、サーバ管理表201を参照して正常稼働中のサーバ100a及び100bについては送信状態を「未送信」に、同期化処理中のサーバ100cについては送信状態を「保留」にして受信クエリを送信キュー203に入れる(ステップS450)。この時の送信キュー203を図46に示す。クエリ送信処理部205は、送信キュー203から当該クエリを取り出し、対応するサーバ100a及び100bに転送し(ステップS451,S452)、それぞれ送信キュー203の送信状態を「送信完了」に更新する(ステップS453)。仲介装置200の正当性判定部206は、トランザクションが正常にCOMMITされたことを通知する応答パケットをサーバ100a及び100bから受信すると(ステップS454,S455)、各サーバ100a及び100bからの応答パケットの正当性を判定する。そして、応答送信処理部207は正当な応答パケットの1つをクライアント500aへ転送する(ステップS456)。また、COMMITが正常に完了したことから、トランザクションが終了したことが分かるので、応答送信処理部207はトランザクション管理表202からこのトランザクションの登録を削除する(ステップS457)。   Thereafter, the query from the client 500 is placed in the transmission queue 203 with the transmission state “untransmitted” for the server 100a and the server 100b and the transmission state “held” for the server 100c. Specifically, as illustrated in FIG. 34, when the client 500a transmits a packet including the transaction confirmation SQL (COMMIT) addressed to 172.17.1.1, the reception query processing unit 204 of the mediation apparatus 200 receives the packet ( Step S449). The reception query processing unit 204 refers to the server management table 201 and sets the transmission state to “unsent” for the servers 100a and 100b that are operating normally, and sets the transmission state to “hold” for the server 100c that is performing the synchronization process. The reception query is put in the transmission queue 203 (step S450). The transmission queue 203 at this time is shown in FIG. The query transmission processing unit 205 extracts the query from the transmission queue 203, transfers it to the corresponding servers 100a and 100b (steps S451 and S452), and updates the transmission state of the transmission queue 203 to “transmission completed” (step S453). ). When the legitimacy determination unit 206 of the mediation apparatus 200 receives a response packet notifying that the transaction has been successfully committed from the servers 100a and 100b (steps S454 and S455), the legitimacy of the response packet from each of the servers 100a and 100b. Determine sex. Then, the response transmission processing unit 207 transfers one valid response packet to the client 500a (step S456). Further, since the COMMIT has been completed normally, it can be seen that the transaction has ended, so the response transmission processing unit 207 deletes the registration of this transaction from the transaction management table 202 (step S457).

ここで、新規サーバ100cのデータベース101cの復元処理が完了したものとする(ステップS458)。同期化処理制御部208は、新規サーバ100cのデータベース101cのスナップショットからの復元が完了すると、送信キュー203に保留となっているクエリを差分情報として送出すべく、新規サーバ100cについて送信キュー203の送信状態が「保留」となっているものを「保留解除」に更新する(ステップS459)。この時の送信キュー203を図47に示す。以降、各クライアント500から受信したクエリは、サーバ100a及びサーバ100bについては送信状態を「未送信」で、サーバ100cについては送信状態を「保留解除」にして送信キュー203に入れる。これにより、クエリ送信処理部205は、送信状態が「保留解除」となったクエリを差分情報として古いものから順にサーバ100cに送信する。   Here, it is assumed that the restoration process of the database 101c of the new server 100c has been completed (step S458). When the restoration from the snapshot of the database 101c of the new server 100c is completed, the synchronization processing control unit 208 sends the query held in the transmission queue 203 as difference information for the new server 100c in the transmission queue 203. The one whose transmission status is “hold” is updated to “hold release” (step S459). The transmission queue 203 at this time is shown in FIG. Thereafter, the query received from each client 500 is placed in the transmission queue 203 with the transmission state “untransmitted” for the server 100a and the server 100b and the transmission state “unhold” for the server 100c. As a result, the query transmission processing unit 205 transmits, to the server 100c, in order from the oldest as the difference information, the queries whose transmission status is “hold release”.

具体的には、クエリ送信処理部205は、送信キュー203からBEGINクエリを取り出してサーバ100cに転送するとともに(ステップS460)、送信キュー203の送信状態を「送信完了」に更新する(ステップS461)。仲介装置200の正当性判定部206は、トランザクションが正常に開始されたことを通知する応答パケットをサーバ100cから受信する(ステップS462)。ここで、当該応答は差分情報としてのクエリの処理応答なので、当該応答はクライアント500へは転送しない。   Specifically, the query transmission processing unit 205 extracts the BEGIN query from the transmission queue 203 and transfers it to the server 100c (step S460), and updates the transmission state of the transmission queue 203 to “transmission completed” (step S461). . The validity determination unit 206 of the mediation apparatus 200 receives a response packet notifying that the transaction has been started normally from the server 100c (step S462). Here, since the response is a query processing response as difference information, the response is not transferred to the client 500.

サーバ100cへの差分情報転送中にクライアント500bからUPDATEクエリを受信すると(ステップS463)、受信クエリ処理部204は、サーバ100a及び100bについては送信状態を「未送信」で、サーバ100cについては送信状態を「保留解除」で当該クエリーを送信キュー203に投入する(ステップS464)。この時の送信キュー203を図48に示す。クエリ送信処理部205は、送信キュー203から当該クエリを取り出し、送信状態が「未送信」であるサーバ100a及び100bに転送し(ステップS465,S466)、それぞれのサーバ100a及び100bについて送信キュー203の送信状態を「送信完了」に更新する(ステップS467)。正当性判定部206は、各サーバ100a及び100bからUPDATEが正常に処理されたことを通知するパケットを受信すると(ステップS468,S469)、各応答の正当性を判定して正当な応答の1つをクライアント500bに返す(ステップS470)。   When the UPDATE query is received from the client 500b during the transfer of the difference information to the server 100c (step S463), the reception query processing unit 204 sets the transmission status to “unsent” for the servers 100a and 100b, and the transmission status for the server 100c. Is put into the transmission queue 203 with “hold release” (step S464). The transmission queue 203 at this time is shown in FIG. The query transmission processing unit 205 retrieves the query from the transmission queue 203, transfers it to the servers 100a and 100b whose transmission status is “untransmitted” (steps S465 and S466), and sets the transmission queue 203 for each of the servers 100a and 100b. The transmission state is updated to “transmission complete” (step S467). When the validity determining unit 206 receives a packet notifying that the UPDATE has been processed normally from each of the servers 100a and 100b (steps S468 and S469), the validity determining unit 206 determines the validity of each response and determines one of the valid responses. Is returned to the client 500b (step S470).

全ての差分情報の転送が終了し(すなわち送信キュー203から「保留解除」のクエリを全て送出し終わり)、且つ、差分情報としてのクエリの処理が正常に処理された時点で、サーバ100aのデータベース101aとサーバ100cのデータベース101cの同期化が完了するので、サーバ100cをシステムに組み込むべくサーバ100cについてのサーバ管理表201の稼働状態を「active」に更新する。なお、システムへの組み込みのタイミングは、正常稼働中のサーバ100においてクエリの実行中であっても構わず、またトランザクションが継続中であっても構わない点に留意されたい。   When the transfer of all the difference information is completed (that is, the transmission of all the “hold release” queries from the transmission queue 203 is completed) and the query processing as the difference information is normally processed, the database of the server 100a Since the synchronization of the database 101c between the server 101c and the server 100c is completed, the operating state of the server management table 201 for the server 100c is updated to “active” in order to incorporate the server 100c into the system. It should be noted that the timing of incorporation into the system may be during execution of a query in the normally operating server 100, or the transaction may be ongoing.

図48の例では、まず、トランザクションIDが5番のUPDATEクエリからトランザクションIDが6番のINSERTクエリについて、前述のステップS460〜S462と同様の処理を行う。以下、図48の例における、トランザクションIDが5番のCOMMITクエリと、トランザクションIDが6番のUPDATEクエリの処理について詳述する。   In the example of FIG. 48, first, processing similar to that in steps S460 to S462 described above is performed for the UPDATE query with the transaction ID No. 5 to the INSERT query with the transaction ID No. 6. The processing of the COMMIT query with the transaction ID No. 5 and the UPDATE query with the transaction ID No. 6 in the example of FIG. 48 will be described in detail below.

クエリ送信処理部205は、送信キュー203からCOMMITクエリを取り出してサーバ100cに転送するとともに(ステップS490)、送信キュー203の送信状態を「送信完了」に更新する(ステップS491)。仲介装置200の正当性判定部206は、トランザクションが確定したことを通知する応答パケットをサーバ100cから受信する(ステップS492)。ここで、当該応答は差分情報としてのクエリの処理応答なので、当該応答はクライアント500へは転送しない。   The query transmission processing unit 205 retrieves the COMMIT query from the transmission queue 203 and transfers it to the server 100c (step S490), and updates the transmission state of the transmission queue 203 to “transmission completed” (step S491). The validity determination unit 206 of the mediation apparatus 200 receives a response packet notifying that the transaction has been confirmed from the server 100c (step S492). Here, since the response is a query processing response as difference information, the response is not transferred to the client 500.

この時点でトランザクションID5のトランザクションは全てのサーバ100において処理が終了し、且つ、送信キュー203にはトランザクションID5に属する各クエリは全てのサーバ100a,100b,100cについて送信状態が「送信完了」となったので、応答送信処理部207は、当該トランザクションに属するクエリのエントリを送信キュー203から削除する(ステップS493)。この時の送信キュー203を図49に示す。   At this time, the transaction with transaction ID 5 has been processed in all servers 100, and the transmission status of each query belonging to transaction ID 5 in the transmission queue 203 is “transmission complete” for all servers 100a, 100b, 100c. Therefore, the response transmission processing unit 207 deletes the query entry belonging to the transaction from the transmission queue 203 (step S493). The transmission queue 203 at this time is shown in FIG.

次いで、図36に示すように、クエリ送信処理部205は、送信キュー203からUPDATEクエリを取り出してサーバ100cに転送するとともに(ステップS494)、送信キュー203の送信状態を「送信完了」に更新する(ステップS495)。仲介装置200の正当性判定部206は、UPDATEが正常に処理されたことを通知する応答パケットをサーバ100cから受信する(ステップS496)。ここで、当該応答は差分情報としてのクエリの処理応答なので、当該応答はクライアント500へは転送しない。   Next, as shown in FIG. 36, the query transmission processing unit 205 extracts the UPDATE query from the transmission queue 203 and transfers it to the server 100c (step S494), and updates the transmission state of the transmission queue 203 to “transmission completed”. (Step S495). The validity determination unit 206 of the mediation apparatus 200 receives a response packet notifying that UPDATE has been processed normally from the server 100c (step S496). Here, since the response is a query processing response as difference information, the response is not transferred to the client 500.

この時点で送信キュー203には送信状態が「保留解除」のクエリがなくなったので、応答送信処理部207は、サーバ100cをシステムに組み込むべくサーバ100cについてのサーバ管理表201の稼働状態を「active」に更新する(ステップS497)。なお、このステップS497の処理は、前述のステップS144,S242の処理に対応するものである。   At this point, since there is no query in the transmission queue 203 whose transmission state is “hold release”, the response transmission processing unit 207 sets the active state of the server management table 201 for the server 100c to “active” in order to incorporate the server 100c into the system. (Step S497). Note that the processing in step S497 corresponds to the processing in steps S144 and S242 described above.

以上のように本実施の形態では、スナップショットの作成方法として、該スナップショットの作成中にはクエリの処理を行うことができない方法を採用しているが、スナップショットの作成とクライアントからのクエリの処理を別々のサーバで処理することにより、クライアントへのサービスの提供を維持しつつ同期化処理を行うことができる。他の作用・効果については第1の実施の形態と同じである。   As described above, in this embodiment, as a snapshot creation method, a method in which query processing cannot be performed during creation of the snapshot is employed. However, snapshot creation and a query from a client are employed. By processing these processes with separate servers, the synchronization process can be performed while maintaining the provision of services to the clients. Other operations and effects are the same as those in the first embodiment.

なお、本実施の形態では、スナップショットを作成する同期化用のサーバ100bと、システムに再び組み込まれるサーバ100cとに対して、それぞれ独立したタイミングで差分情報を転送していたが、サーバ100cにおいてデータベースの復旧が完了した後に両サーバ100b,100cに対して同一の差分情報を転送するようにしてもよい。   In the present embodiment, difference information is transferred to the synchronization server 100b for creating a snapshot and the server 100c that is re-installed in the system at independent timings. The same difference information may be transferred to both servers 100b and 100c after the database recovery is completed.

また、本実施の形態では、システムに再び組み込まれるサーバ100cにおいてデータベースの復旧が完了した後に仲介装置200からサーバ100cに差分情報の転送を開始していたが、サーバ100cに差分情報を一時蓄積する機能がある場合にはデータベースの復旧完了を待たずに差分情報の転送を開始しても良い。これにより、仲介装置200からサーバ100への差分情報の転送速度を抑えられるので、差分情報転送によるトラフィック増大を防止できる。   In the present embodiment, transfer of difference information from the mediation apparatus 200 to the server 100c is started after the database recovery is completed in the server 100c that is re-installed in the system. However, the difference information is temporarily stored in the server 100c. If there is a function, the transfer of difference information may be started without waiting for the completion of database recovery. Thereby, since the transfer rate of the difference information from the mediation apparatus 200 to the server 100 can be suppressed, an increase in traffic due to the difference information transfer can be prevented.

以上、本発明の実施形態について詳述したが、上記実施の形態は例示的なものであり、本発明はこれに限定されるものではない。本発明の範囲は特許請求の範囲に示されており、この特許請求の範囲の意味に入る全ての変形例は本発明に含まれるものである。なお、以下の各変形例は適宜組み合わせて上記各実施の形態に適用できる。   As mentioned above, although embodiment of this invention was explained in full detail, the said embodiment is an illustration and this invention is not limited to this. The scope of the invention is set forth in the appended claims, and all modifications that come within the meaning of the claims are intended to be embraced by the invention. Note that the following modifications can be applied to the above-described embodiments in appropriate combinations.

例えば、上記実施の形態の構成に加えて、仲介装置200が、差分情報として新規サーバ100等で処理されたクエリの処理結果の正当性を判定するようにしても良い。具体的には、仲介装置200は、正常稼働中のサーバ100におけるクエリの処理結果を仲介装置200において保存しておく。そして、当該クエリを差分情報として新規サーバ100等で処理された際に、新規サーバ100等での処理結果と正常稼働中のサーバ100での処理結果とを比較する。そして、両者が一致しない場合には、同期化処理を直ちに又は適当なタイミングで再試行すると好適である。   For example, in addition to the configuration of the above embodiment, the mediation apparatus 200 may determine the validity of the processing result of the query processed by the new server 100 or the like as difference information. Specifically, the intermediary device 200 stores a query processing result in the normally operating server 100 in the intermediary device 200. When the query is processed as difference information by the new server 100 or the like, the processing result of the new server 100 or the like is compared with the processing result of the server 100 that is operating normally. If they do not match, it is preferable to retry the synchronization process immediately or at an appropriate timing.

また、上記実施の形態では、送信状態が「保留解除」となっているクエリを送信キュー203から取り出して差分情報としてサーバ100に対して転送し、該転送中にクライアント500からクエリを受信すると、当該サーバ100についての送信状態を「保留解除」にして送信キュー203に投入する処理を行っている。そして、送信状態が「保留解除」となっているクエリが全てサーバ100において処理された後に当該サーバ100をシステムに組み込む処理を行っている。このような処理では、クライアント500からのクエリ受信頻度が高いとサーバ100のシステムへの組み込みに時間を要することが考えられる。そこで、例えば送信キュー203に送信状態が「保留解除」として記憶されているクエリが所定数以下となったら、受信クエリ処理部204が送信キュー203へのクエリの投入を一時停止するなど所定条件で差分情報の転送処理を優先させるようにしてもよい。   Further, in the above embodiment, when a query whose transmission state is “hold release” is taken out from the transmission queue 203 and transferred to the server 100 as difference information, and a query is received from the client 500 during the transfer, Processing for setting the transmission state of the server 100 to “hold release” and putting it in the transmission queue 203 is performed. Then, after all the queries whose transmission status is “hold release” are processed in the server 100, the server 100 is incorporated into the system. In such processing, if the frequency of receiving queries from the client 500 is high, it may be necessary to incorporate the server 100 into the system. Therefore, for example, when the number of queries stored in the transmission queue 203 as “reserved release” falls below a predetermined number, the received query processing unit 204 temporarily stops the input of queries to the transmission queue 203 under predetermined conditions. You may make it give priority to the transfer process of difference information.

また、上記実施の形態では、クライアント500から受信した全てのクエリを送信キュー203に保存しておき、同期化処理時には該送信キュー203に保存されているクエリを差分情報としてサーバ100に転送しているが、SELECTクエリのようにデータベース101の更新を行わない参照系クエリについては差分情報としてのサーバ100への転送を行わないようにしてもよい。これにより、同期化処理の処理時間を短縮化できる。   In the above embodiment, all queries received from the client 500 are stored in the transmission queue 203, and the query stored in the transmission queue 203 is transferred to the server 100 as difference information during the synchronization process. However, a reference query that does not update the database 101, such as a SELECT query, may not be transferred to the server 100 as difference information. Thereby, the processing time of a synchronization process can be shortened.

さらに、UPDATEクエリのようにデータベース101の更新を行う更新系クエリのみを転送し、参照系クエリやトランザクション制御クエリ(BEGIN,ROLLBACK等)の転送を行わないようにしてもよい。そして、当該更新系クエリを差分情報としてサーバ100に転送する際には、サーバ100においてAutoCommitモードで当該クエリを処理させるようにする。これにより、更に同期化処理の短縮化及び記憶容量の節約が可能となる。ただし、この場合にはサーバ100に対してクエリを転送する順序が、正常稼働中のサーバ100で処理された順序と一致することを保証する必要がある。これを実現するためには、各更新系クエリに対する正常稼働中サーバ100からの処理応答から正常稼働中サーバ100における各クエリの実際の処理順序を把握し、当該順序に従って各クエリを転送すればよい。   Further, only an update query that updates the database 101 such as an UPDATE query may be transferred, and a reference query or a transaction control query (BEGIN, ROLLBACK, etc.) may not be transferred. When the update query is transferred to the server 100 as difference information, the server 100 is made to process the query in the AutoCommit mode. As a result, the synchronization process can be further shortened and the storage capacity can be saved. However, in this case, it is necessary to ensure that the order in which queries are transferred to the server 100 matches the order processed by the server 100 that is operating normally. In order to realize this, it is only necessary to grasp the actual processing order of each query in the normal operating server 100 from the processing response from the normal operating server 100 to each update query, and transfer each query according to the order. .

また、上記実施の形態では、サーバ100においてトランザクションが継続中であっても仲介装置200がスナップショットの作成を開始していたが、継続中のトランザクションが無くなった時点でスナップショットの作成指示を送信するようにしてもよい。これにより、データベース101として、トランザクションの継続中にはスナップショットの作成ができないものや、トランザクションの継続中であってもスナップショットの作成は開始できるが当該スナップショットにトランザクションに係るクエリが反映されるか否かが不確定なものを利用することができる。   In the above-described embodiment, the mediation apparatus 200 starts creating a snapshot even when a transaction is ongoing in the server 100. However, when there is no ongoing transaction, a snapshot creation instruction is transmitted. You may make it do. As a result, the database 101 cannot create a snapshot while the transaction is ongoing, or the snapshot can be started even if the transaction is ongoing, but the query related to the transaction is reflected in the snapshot. It is possible to use an uncertain whether or not.

また、上記の実施の形態では、同期化処理中に送信キュー203から各クエリを削除するタイミングは、当該クエリが属するトランザクションが全てのサーバ100において終了した時点としていた。この方法では、通常動作時におけるクエリの削除タイミングと同じなので実装が容易であるという利点がある。一方、同期化処理中には、送信キュー203のクエリが差分情報としてサーバ100において処理されたら随時削除するようにしてもよい。また、同期化処理が完了した後に一括して削除するようにしても良い。   Further, in the above embodiment, the timing for deleting each query from the transmission queue 203 during the synchronization process is the time when the transaction to which the query belongs is completed in all the servers 100. This method has the advantage of being easy to implement because it is the same as the query deletion timing during normal operation. On the other hand, during the synchronization process, if the query of the transmission queue 203 is processed as difference information in the server 100, it may be deleted as needed. Further, it may be deleted in a lump after the synchronization processing is completed.

また、上記の実施の形態では、クエリのバッファリング機能と同期化処理用の差分情報の記憶機能とを送信キュー203に統合させていたが、それぞれ機能毎に記憶手段を設けるようにしてもよい。なお、この場合には、サーバ100が3台構成となっているときには、システムに組み込もうとするサーバ100と、同期化処理用サーバ100とで差分情報記憶部を共有できるので、記憶容量を節約できるという点で有利である。   In the above embodiment, the query buffering function and the synchronization information storage function for synchronization processing are integrated in the transmission queue 203. However, a storage unit may be provided for each function. . In this case, when the number of servers 100 is three, the difference information storage unit can be shared between the server 100 to be incorporated into the system and the synchronization processing server 100. This is advantageous in that it can be saved.

また、上記実施の形態では、オペレータがサーバ100の再起動完了を確認した後に、仲介装置200の所定の入力装置(図示省略)を用いてデータベース同期化要求を入力するようにしていたが、他のコンピュータからネットワークを介して同期化要求を入力するようにしてもよい。また、仲介装置100又は他のコンピュータに、サーバ100の稼働状況を監視してサーバ100の再起動を検出すると仲介装置200に対してデータベース同期化要求を発出するサーバ監視手段を設けてもよい。   In the above embodiment, after the operator confirms that the server 100 has been restarted, the database synchronization request is input using a predetermined input device (not shown) of the intermediary device 200. The synchronization request may be input from the computer via the network. In addition, the intermediary apparatus 100 or another computer may be provided with server monitoring means for issuing a database synchronization request to the intermediary apparatus 200 when the operating status of the server 100 is monitored and the restart of the server 100 is detected.

また、上記の実施の形態に加えて更に、各サーバ100にデータベース101やデータベース制御部102の障害を検出する障害検出手段を設けてもよい。この障害検出手段は、データベース101やデータベース制御部102の動作を定期的に監視することで障害を検出し、障害検出時には仲介装置200に障害発生を通知する。これにより、仲介装置200では各サーバ100やネットワークでの障害発生検出をより確実且つ効率的に行うことができる。   Further, in addition to the above-described embodiment, each server 100 may be provided with a failure detection unit that detects a failure of the database 101 or the database control unit 102. This failure detection means detects a failure by periodically monitoring the operations of the database 101 and the database control unit 102, and notifies the mediation device 200 of the occurrence of the failure when a failure is detected. As a result, the mediation apparatus 200 can more reliably and efficiently detect the occurrence of a failure in each server 100 or network.

また、各サーバは要求に応じて同じ応答をするならば同じ実装である必要はない。すなわち、バージョン、仕様、プログラム言語、コンパイラの種類、コンパイラオプション、ハードウェアかソフトウェアか、などが異なっていてもよい。サーバには、PostgreSQLなどのフリーソフトウェアやOracleなどの市販のソフトウェア、独自開発のソフトウェア、いずれを使ってもよい。また、それらが混在していてもよい。例えば、サーバ100aはPostgreSQLでサーバ100bはOracleでも良い。   Moreover, if each server responds the same according to a request | requirement, it is not necessary to be the same implementation. That is, the version, specification, programming language, compiler type, compiler option, hardware or software, and the like may be different. As the server, free software such as PostgreSQL, commercially available software such as Oracle, or proprietary software may be used. Moreover, they may be mixed. For example, the server 100a may be PostgreSQL and the server 100b may be Oracle.

また、上記実施の形態では、サーバはパソコン上のソフトウェアで実現しているが、ハードウェアで実装しても良い。   In the above-described embodiment, the server is realized by software on a personal computer, but may be implemented by hardware.

また、上記実施の形態では、仮想サーバ800を構成する仲介装置200は1台のみであったが、複数台設けて冗長性を持たせることにより、より可用性の高い構成とすることも可能である。仲介装置を多重化させる技術については、例えば本願出願人による特開2003−345679号公報に記載されたものなどを用いればよい。   In the above embodiment, only one mediation device 200 is included in the virtual server 800. However, by providing a plurality of mediation devices 200 to provide redundancy, a configuration with higher availability can be achieved. . As a technique for multiplexing the mediation device, for example, what is described in Japanese Patent Application Laid-Open No. 2003-345679 by the applicant of the present application may be used.

また、上記実施の形態では、クライアント500とサーバ100はそれぞれ別のネットワーク300,400に属するようにし、仲介装置200が両ネットワーク300,400を仲介するようなネットワーク構成としたが、本発明ではネットワーク構成は不問である。例えば、1つのネットワークにクライアント500,サーバ100,仲介装置200が属するように構成してもよい。   In the above embodiment, the client 500 and the server 100 belong to different networks 300 and 400, respectively, and the mediation apparatus 200 mediates both the networks 300 and 400. The configuration is unquestioned. For example, the client 500, the server 100, and the mediation apparatus 200 may be configured to belong to one network.

さらに、上記各実施の形態では、データベース一致検査装置600を多重化データベースシステムの外側、すなわちネットワーク400に接続していたが、多重化データベースシステムの内側のネットワーク300にデータベース一致検査装置600を接続するようにしてもよい。   Further, in each of the above embodiments, the database match checking device 600 is connected to the outside of the multiplexed database system, that is, the network 400. However, the database match checking device 600 is connected to the network 300 inside the multiplexed database system. You may do it.

第1の実施形態に係る多重化データベースシステムの構成図Configuration diagram of a multiplexed database system according to the first embodiment 第1の実施形態に係る仲介装置の機能ブロック図Functional block diagram of an intermediary device according to the first embodiment 第1の実施形態に係るサーバ管理表の一例を示す図The figure which shows an example of the server management table which concerns on 1st Embodiment 第1の実施形態に係るトランザクション管理表の一例を示す図The figure which shows an example of the transaction management table which concerns on 1st Embodiment 第1の実施形態に係る送信キューの一例を示す図The figure which shows an example of the transmission queue which concerns on 1st Embodiment. 各サーバが正常稼働している場合の多重化データベースシステムの動作を説明するシーケンスチャートSequence chart explaining the operation of the multiplexed database system when each server is operating normally 図5の動作におけるサーバ管理表の一例Example of server management table in the operation of FIG. 図5の動作におけるトランザクション管理表の一例Example of transaction management table in the operation of FIG. サーバが故障した場合の多重化データベースシステムの動作を説明するシーケンスチャートSequence chart explaining operation of multiplexed database system when server fails 図9の動作におけるトランザクション管理表の一例Example of transaction management table in operation of FIG. 図9の動作におけるサーバ管理表の一例An example of the server management table in the operation of FIG. 図9の動作における送信キューの一例An example of a transmission queue in the operation of FIG. サーバにより異なる順序でクエリが実行された場合の多重化データベースシステムの動作を説明するシーケンスチャートSequence chart explaining the operation of the multiplexed database system when queries are executed in different orders by the server サーバにより異なる順序でクエリが実行された場合の多重化データベースシステムの動作を説明するシーケンスチャートSequence chart explaining the operation of the multiplexed database system when queries are executed in different orders by the server サーバにより異なる順序でクエリが実行された場合の多重化データベースシステムの動作を説明するシーケンスチャートSequence chart explaining the operation of the multiplexed database system when queries are executed in different orders by the server サーバにより異なる順序でクエリが実行された場合の多重化データベースシステムの動作を説明するシーケンスチャートSequence chart explaining the operation of the multiplexed database system when queries are executed in different orders by the server 第1の実施形態に係る多重化データベースシステムにおける同期化処理を説明するシーケンスチャートSequence chart for explaining synchronization processing in the multiplexed database system according to the first embodiment 第1の実施形態に係る多重化データベースシステムにおける同期化処理を説明するシーケンスチャートSequence chart for explaining synchronization processing in the multiplexed database system according to the first embodiment 第1の実施形態に係る多重化データベースシステムにおける同期化処理を説明するシーケンスチャートSequence chart for explaining synchronization processing in the multiplexed database system according to the first embodiment 図17乃至図19の動作におけるサーバ管理表の一例An example of the server management table in the operations of FIGS. 図17乃至図19の動作におけるトランザクション管理表の一例An example of a transaction management table in the operations of FIGS. 図17乃至図19の動作における送信キューの一例An example of a transmission queue in the operations of FIGS. 図17乃至図19の動作における送信キューの一例An example of a transmission queue in the operations of FIGS. 図17乃至図19の動作におけるサーバ管理表の一例An example of the server management table in the operations of FIGS. 図17乃至図19の動作における送信キューの一例An example of a transmission queue in the operations of FIGS. 図17乃至図19の動作における送信キューの一例An example of a transmission queue in the operations of FIGS. 図17乃至図19の動作における送信キューの一例An example of a transmission queue in the operations of FIGS. 図17乃至図19の動作における送信キューの一例An example of a transmission queue in the operations of FIGS. 図17乃至図19の動作における送信キューの一例An example of a transmission queue in the operations of FIGS. 図17乃至図19の動作における送信キューの一例An example of a transmission queue in the operations of FIGS. 図17乃至図19の動作におけるサーバ管理表の一例An example of the server management table in the operations of FIGS. 第2の実施形態に係る多重化データベースシステムにおける同期化処理を説明するシーケンスチャートSequence chart for explaining synchronization processing in the multiplexed database system according to the second embodiment 第2の実施形態に係る多重化データベースシステムにおける同期化処理を説明するシーケンスチャートSequence chart for explaining synchronization processing in the multiplexed database system according to the second embodiment 第2の実施形態に係る多重化データベースシステムにおける同期化処理を説明するシーケンスチャートSequence chart for explaining synchronization processing in the multiplexed database system according to the second embodiment 第2の実施形態に係る多重化データベースシステムにおける同期化処理を説明するシーケンスチャートSequence chart for explaining synchronization processing in the multiplexed database system according to the second embodiment 第2の実施形態に係る多重化データベースシステムにおける同期化処理を説明するシーケンスチャートSequence chart for explaining synchronization processing in the multiplexed database system according to the second embodiment 図32乃至図36の動作におけるサーバ管理表の一例An example of the server management table in the operations of FIGS. 32 to 36 図32乃至図36の動作における送信キューのデータ構造の一例An example of the data structure of the transmission queue in the operations of FIGS. 図32乃至図36の動作における送信キューの一例An example of a transmission queue in the operation of FIGS. 32 to 36 図32乃至図36の動作における送信キューの一例An example of a transmission queue in the operation of FIGS. 32 to 36 図32乃至図36の動作におけるサーバ管理表の一例An example of the server management table in the operations of FIGS. 32 to 36 図32乃至図36の動作における送信キューの一例An example of a transmission queue in the operation of FIGS. 32 to 36 図32乃至図36の動作における送信キューの一例An example of a transmission queue in the operation of FIGS. 32 to 36 図32乃至図36の動作における送信キューの一例An example of a transmission queue in the operation of FIGS. 32 to 36 図32乃至図36の動作における送信キューの一例An example of a transmission queue in the operation of FIGS. 32 to 36 図32乃至図36の動作における送信キューの一例An example of a transmission queue in the operation of FIGS. 32 to 36 図32乃至図36の動作における送信キューの一例An example of a transmission queue in the operation of FIGS. 32 to 36 図32乃至図36の動作における送信キューの一例An example of a transmission queue in the operation of FIGS. 32 to 36 図32乃至図36の動作における送信キューの一例An example of a transmission queue in the operation of FIGS. 32 to 36 従来のデータベース同期化システムの構成図Configuration diagram of conventional database synchronization system データベースのテーブルの一例An example of a database table 処理順序が問題となるトランザクションの一例An example of a transaction whose processing order is an issue 処理順序が問題となるトランザクションの一例An example of a transaction whose processing order is an issue

符号の説明Explanation of symbols

100…サーバ、101…データベース、102…データベース制御部、200…仲介装置、201…サーバ管理表、202…トランザクション管理表、203…送信キュー、204…受信クエリ処理部、205…クエリ送信処理部、206…正当性判定部、207…応答送信処理部、208…同期化処理制御部、300,400…ネットワーク、500…クライアント、600…データベース一致検査装置。   DESCRIPTION OF SYMBOLS 100 ... Server, 101 ... Database, 102 ... Database control part, 200 ... Mediation apparatus, 201 ... Server management table, 202 ... Transaction management table, 203 ... Transmission queue, 204 ... Reception query processing part, 205 ... Query transmission processing part, 206 ... Validity determination unit, 207 ... Response transmission processing unit, 208 ... Synchronization processing control unit, 300, 400 ... Network, 500 ... Client, 600 ... Database match checking device.

Claims (8)

複数のデータベースサーバと、クライアントコンピュータからの処理要求を各データベースサーバに中継するとともに各データベースサーバからの正当な応答の1つをクライアントコンピュータに処理結果として返す仲介装置とを備えた多重化データベースシステムにおいて、各データベースサーバを同期化する方法であって、
仲介装置は、クライアントコンピュータからの処理要求を差分情報として記憶する差分情報記憶部と、データベースのスナップショットを記憶するスナップショット記憶部とを備え、
(a)(i)データベースサーバから処理要求に対する応答がない事を検出すると該無応答のデータベースサーバをシステムから切り離し、又は、(ii)各データベースサーバ間における処理結果の矛盾を検出し、処理結果の矛盾を検出したら各応答の中から1つの応答を選定するとともに当該選定した応答をクライアントコンピュータに返し、選定した応答以外の応答を返したデータベースサーバをシステムから切り離し、
(b)正常稼働中のデータベースサーバからデータベースのスナップショットを取得してスナップショット記憶部に記憶する処理を開始し、
(c)クライアントコンピュータから受信する処理要求を差分情報として差分情報記憶部に順次記憶し、
(d)スナップショットの取得を完了するとスナップショット記憶部に記憶したスナップショットを用いてシステムから切り離されたデータベースサーバのデータベースを復元させ、
(e)システムから切り離されたデータベースサーバにおいて前記スナップショットからのデータベースの復元が完了すると、差分情報記憶部に記憶されている処理要求を該データベースサーバに順次送出し、
(f)差分情報記憶部に記憶されている処理要求についてシステムから切り離されたデータベースにおいて処理が終了すると該データベースサーバをシステムに組み込む
ことを特徴とする多重化データベースシステムにおける同期化方法。
In a multiplexed database system comprising a plurality of database servers and an intermediary device that relays processing requests from client computers to each database server and returns one of the valid responses from each database server as a processing result to the client computer A method of synchronizing each database server,
The mediation apparatus includes a difference information storage unit that stores a processing request from a client computer as difference information, and a snapshot storage unit that stores a snapshot of a database.
(A) (i) When it is detected that there is no response to the processing request from the database server, the non-responsive database server is disconnected from the system, or (ii) a processing result inconsistency between the database servers is detected, and the processing result When one of the responses is detected, one response is selected and the selected response is returned to the client computer, and the database server that returns a response other than the selected response is disconnected from the system.
(B) starting a process of acquiring a snapshot of the database from a normally operating database server and storing it in the snapshot storage unit;
(C) sequentially storing processing requests received from the client computer as difference information in the difference information storage unit;
(D) When the acquisition of the snapshot is completed, the database of the database server separated from the system is restored using the snapshot stored in the snapshot storage unit,
(E) When restoration of the database from the snapshot is completed in the database server separated from the system, the processing requests stored in the difference information storage unit are sequentially sent to the database server,
(F) A synchronization method in a multiplexed database system, wherein the processing is stored in a database separated from the system for processing requests stored in the difference information storage unit, and the database server is incorporated into the system.
仲介装置は、前記ステップ(c)において、スナップショットに反映されない処理要求を差分情報として差分情報記憶部に順次記憶する
ことを特徴とする請求項1記載の多重化データベースシステムにおける同期化方法。
The synchronization method in the multiplexed database system according to claim 1, wherein the intermediary device sequentially stores processing requests not reflected in the snapshot as difference information in the difference information storage unit in the step (c).
仲介装置は、前記ステップ(c)において、組み込み要求時に正常稼働中のサーバにおいてコミットされていないトランザクションに係る処理要求を組み込み要求時から遡って記憶する
ことを特徴とする請求項2記載の多重化データベースシステムにおける同期化方法。
3. The multiplexing according to claim 2, wherein the intermediary device stores, in step (c), a processing request related to a transaction that has not been committed in a server that is operating normally at the time of the installation request, retroactively from the time of the installation request. A synchronization method in a database system.
仲介装置は、前記ステップ(b)において、正常稼働中のサーバにおいてトランザクションが処理されていないときにスナップショットの取得を開始する
ことを特徴とする請求項1記載の多重化データベースシステムにおける同期化方法。
2. The synchronization method in a multiplexed database system according to claim 1, wherein in step (b), the intermediary device starts acquiring a snapshot when a transaction is not processed in a normally operating server. .
仲介装置は、正常稼働中のデータベースサーバが2台以上ある場合には、1台のデータベースサーバを同期化用データベースサーバとして選定し、該同期化用データベースサーバからスナップショットを取得し、スナップショット作成中にクライアントから受信した処理要求は他の正常稼働中のデータベースサーバに中継する
ことを特徴とする請求項1記載の多重化データベースシステムにおける同期化方法。
When there are two or more database servers in normal operation, the mediation device selects one database server as a synchronization database server, acquires a snapshot from the synchronization database server, and creates a snapshot. 2. The synchronization method in a multiplexed database system according to claim 1, wherein the processing request received from the client is relayed to another normally operating database server.
複数のデータベースサーバと、クライアントコンピュータからの処理要求を各データベースサーバに中継するとともに各データベースサーバからの正当な応答の1つをクライアントコンピュータに処理結果として返す仲介装置とを備えた多重化データベースシステムにおいて、
仲介装置は、
クライアントコンピュータからの処理要求を差分情報として記憶する差分情報記憶部と、
データベースのスナップショットを記憶するスナップショット記憶部と、
(a)(i)データベースサーバから処理要求に対する応答がない事を検出すると該無応答のデータベースサーバをシステムから切り離し、又は、(ii)各データベースサーバ間における処理結果の矛盾を検出し、処理結果の矛盾を検出したら各応答の中から1つの応答を選定するとともに当該選定した応答をクライアントコンピュータに返し、選定した応答以外の応答を返したデータベースサーバをシステムから切り離し、(b)正常稼働中のデータベースサーバからデータベースのスナップショットを取得してスナップショット記憶部に記憶する処理を開始し、(c)クライアントコンピュータから受信する処理要求を差分情報として差分情報記憶部に順次記憶し、(d)スナップショットの取得を完了するとスナップショット記憶部に記憶したスナップショットを用いてシステムから切り離されたデータベースサーバのデータベースを復元させ、(e)システムから切り離されたデータベースサーバにおいて前記スナップショットからのデータベースの復元が完了すると、差分情報記憶部に記憶されている処理要求を該データベースサーバに順次送出し、(f)差分情報記憶部に記憶されている処理要求についてシステムから切り離されたデータベースにおいて処理が終了すると該データベースサーバをシステムに組み込む制御手段とを備えた
ことを特徴とする多重化データベースシステム。
In a multiplexed database system comprising a plurality of database servers and an intermediary device that relays processing requests from client computers to each database server and returns one of the valid responses from each database server as a processing result to the client computer ,
The intermediary device
A difference information storage unit for storing a processing request from the client computer as difference information;
A snapshot storage unit for storing database snapshots;
(A) (i) When it is detected that there is no response to the processing request from the database server, the non-responsive database server is disconnected from the system, or (ii) a processing result inconsistency between the database servers is detected, and the processing result If a contradiction is detected, one response is selected from the responses, the selected response is returned to the client computer, and the database server that returned a response other than the selected response is disconnected from the system, and (b) Processing for acquiring a database snapshot from the database server and storing it in the snapshot storage unit is started. (C) Processing requests received from the client computers are sequentially stored as difference information in the difference information storage unit, and (d) snap When the acquisition of the shot is completed, the snapshot storage unit The database of the database server separated from the system is restored using the stored snapshot, and (e) when the restoration of the database from the snapshot is completed in the database server separated from the system, it is stored in the difference information storage unit. And (f) control means for incorporating the database server into the system when processing is completed in the database separated from the system for the processing requests stored in the difference information storage unit. A multiplexed database system characterized by comprising.
複数のデータベースサーバと、クライアントコンピュータからの処理要求を各データベースサーバに中継するとともに各データベースサーバからの正当な応答の1つをクライアントコンピュータに処理結果として返す仲介装置とを備えた多重化データベースシステムにおける仲介装置であって、
クライアントコンピュータからの処理要求を差分情報として記憶する差分情報記憶部と、
データベースのスナップショットを記憶するスナップショット記憶部と、
(a)(i)データベースサーバから処理要求に対する応答がない事を検出すると該無応答のデータベースサーバをシステムから切り離し、又は、(ii)各データベースサーバ間における処理結果の矛盾を検出し、処理結果の矛盾を検出したら各応答の中から1つの応答を選定するとともに当該選定した応答をクライアントコンピュータに返し、選定した応答以外の応答を返したデータベースサーバをシステムから切り離し、(b)正常稼働中のデータベースサーバからデータベースのスナップショットを取得してスナップショット記憶部に記憶する処理を開始し、(c)クライアントコンピュータから受信する処理要求を差分情報として差分情報記憶部に順次記憶し、(d)スナップショットの取得を完了するとスナップショット記憶部に記憶したスナップショットを用いてシステムから切り離されたデータベースサーバのデータベースを復元させ、(e)システムから切り離されたデータベースサーバにおいて前記スナップショットからのデータベースの復元が完了すると、差分情報記憶部に記憶されている処理要求を該データベースサーバに順次送出し、(f)差分情報記憶部に記憶されている処理要求についてシステムから切り離されたデータベースにおいて処理が終了すると該データベースサーバをシステムに組み込む制御手段とを備えた
ことを特徴とする仲介装置。
In a multiplexed database system comprising a plurality of database servers and an intermediary device that relays processing requests from client computers to each database server and returns one of the valid responses from each database server to the client computer as a processing result An intermediary device,
A difference information storage unit for storing a processing request from the client computer as difference information;
A snapshot storage unit for storing database snapshots;
(A) (i) When it is detected that there is no response to the processing request from the database server, the non-responsive database server is disconnected from the system, or (ii) a processing result inconsistency between the database servers is detected, and the processing result If a contradiction is detected, one response is selected from the responses, the selected response is returned to the client computer, and the database server that returned a response other than the selected response is disconnected from the system, and (b) Processing for acquiring a database snapshot from the database server and storing it in the snapshot storage unit is started. (C) Processing requests received from the client computers are sequentially stored as difference information in the difference information storage unit, and (d) snap When the acquisition of the shot is completed, the snapshot storage unit The database of the database server separated from the system is restored using the stored snapshot, and (e) when the restoration of the database from the snapshot is completed in the database server separated from the system, it is stored in the difference information storage unit. And (f) control means for incorporating the database server into the system when processing is completed in the database separated from the system for the processing requests stored in the difference information storage unit. An intermediary device characterized by comprising.
複数のデータベースサーバと、クライアントコンピュータからの処理要求を各データベースサーバに中継するとともに各データベースサーバからの正当な応答の1つをクライアントコンピュータに処理結果として返す仲介装置とを備えた多重化データベースシステムにおける仲介装置を実現するプログラムであって、
コンピュータを、
クライアントコンピュータからの処理要求を差分情報として記憶する差分情報記憶部と、
データベースのスナップショットを記憶するスナップショット記憶部と、
(a)(i)データベースサーバから処理要求に対する応答がない事を検出すると該無応答のデータベースサーバをシステムから切り離し、又は、(ii)各データベースサーバ間における処理結果の矛盾を検出し、処理結果の矛盾を検出したら各応答の中から1つの応答を選定するとともに当該選定した応答をクライアントコンピュータに返し、選定した応答以外の応答を返したデータベースサーバをシステムから切り離し、(b)正常稼働中のデータベースサーバからデータベースのスナップショットを取得してスナップショット記憶部に記憶する処理を開始し、(c)クライアントコンピュータから受信する処理要求を差分情報として差分情報記憶部に順次記憶し、(d)スナップショットの取得を完了するとスナップショット記憶部に記憶したスナップショットを用いてシステムから切り離されたデータベースサーバのデータベースを復元させ、(e)システムから切り離されたデータベースサーバにおいて前記スナップショットからのデータベースの復元が完了すると、差分情報記憶部に記憶されている処理要求を該データベースサーバに順次送出し、(f)差分情報記憶部に記憶されている処理要求についてシステムから切り離されたデータベースにおいて処理が終了すると該データベースサーバをシステムに組み込む制御手段として機能させる
ことを特徴とする仲介プログラム。
In a multiplexed database system comprising a plurality of database servers and an intermediary device that relays processing requests from client computers to each database server and returns one of the valid responses from each database server to the client computer as a processing result A program for realizing an intermediary device,
Computer
A difference information storage unit for storing a processing request from the client computer as difference information;
A snapshot storage unit for storing database snapshots;
(A) (i) When it is detected that there is no response to the processing request from the database server, the non-responsive database server is disconnected from the system, or (ii) a processing result inconsistency between the database servers is detected, and the processing result If a contradiction is detected, one response is selected from the responses, the selected response is returned to the client computer, and the database server that returned a response other than the selected response is disconnected from the system, and (b) Processing for acquiring a database snapshot from the database server and storing it in the snapshot storage unit is started. (C) Processing requests received from the client computers are sequentially stored as difference information in the difference information storage unit, and (d) snap When the acquisition of the shot is completed, the snapshot storage unit The database of the database server separated from the system is restored using the stored snapshot. (E) When the restoration of the database from the snapshot is completed in the database server separated from the system, it is stored in the difference information storage unit. (F) function as control means for incorporating the database server into the system when processing is completed in the database separated from the system for the processing request stored in the difference information storage unit. An intermediary program characterized by
JP2006000530A 2006-01-05 2006-01-05 Multiplex database system, synchronization method therefor, intermediation device and intermediation program Pending JP2007183728A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2006000530A JP2007183728A (en) 2006-01-05 2006-01-05 Multiplex database system, synchronization method therefor, intermediation device and intermediation program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2006000530A JP2007183728A (en) 2006-01-05 2006-01-05 Multiplex database system, synchronization method therefor, intermediation device and intermediation program

Publications (1)

Publication Number Publication Date
JP2007183728A true JP2007183728A (en) 2007-07-19

Family

ID=38339775

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2006000530A Pending JP2007183728A (en) 2006-01-05 2006-01-05 Multiplex database system, synchronization method therefor, intermediation device and intermediation program

Country Status (1)

Country Link
JP (1) JP2007183728A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8527501B2 (en) 2010-07-01 2013-09-03 International Business Machines Corporation Method, system, and program for combining and processing transactions

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8527501B2 (en) 2010-07-01 2013-09-03 International Business Machines Corporation Method, system, and program for combining and processing transactions

Similar Documents

Publication Publication Date Title
US20100333094A1 (en) Job-processing nodes synchronizing job databases
US6954877B2 (en) Fault tolerance using logical checkpointing in computing systems
JP5223457B2 (en) Resolution method of in-doubt state in two-phase commit protocol of distributed transaction
CA2657676C (en) Failure tolerant transaction processing system
US7882079B2 (en) Database system configured for automatic failover with user-limited data loss
US9317372B1 (en) Dynamic membership management in a distributed system
US6934247B2 (en) Recovery following process or system failure
CN101770513B (en) Method and system for validation and correction in a distributed namespace
JP2004295540A (en) Method for synchronizing transaction, database system, and database apparatus
US20060259517A1 (en) Data synchronizer with failover facility
US20100030826A1 (en) Production-alternate system including production system for processing transactions and alternate system as a backup system of the production system
CN102640108A (en) Monitoring of replicated data instances
CN102656565A (en) Failover and recovery for replicated data instances
JP2006338145A (en) Multiplex database system, synchronization method thereof, intermediation device and intermediation program
JP4870190B2 (en) Data processing method, computer, and data processing program
JP2017010172A (en) Information processing system, information processing apparatus, and information processing apparatus control method
US8717167B2 (en) Event detection control method and system
US8522069B2 (en) Process for secure backspacing to a first data center after failover through a second data center and a network architecture working accordingly
JP2007183728A (en) Multiplex database system, synchronization method therefor, intermediation device and intermediation program
JP2007156916A (en) Data control device, system, method, and program
JP2007241325A (en) Multiplex database system and its synchronization method, mediation device and mediation program
JP5480046B2 (en) Distributed transaction processing system, apparatus, method and program
JP2007241323A (en) Multiplex database system and its data synchronization method, mediation device, mediation program, database server and database server program
JP2007241324A (en) Multiplex database system and its synchronization method, mediation device and mediation program
CN114510539B (en) Method for generating and applying consistency check point of distributed database