JP2014215680A - Database system - Google Patents

Database system Download PDF

Info

Publication number
JP2014215680A
JP2014215680A JP2013090397A JP2013090397A JP2014215680A JP 2014215680 A JP2014215680 A JP 2014215680A JP 2013090397 A JP2013090397 A JP 2013090397A JP 2013090397 A JP2013090397 A JP 2013090397A JP 2014215680 A JP2014215680 A JP 2014215680A
Authority
JP
Japan
Prior art keywords
unit
engine program
engine
data
replica
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
JP2013090397A
Other languages
Japanese (ja)
Inventor
大河 片山
Taiga Katayama
大河 片山
圭 山地
Kei Yamaji
圭 山地
基孝 金松
Mototaka Kanematsu
基孝 金松
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Toshiba Corp
Original Assignee
Toshiba Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Toshiba Corp filed Critical Toshiba Corp
Priority to JP2013090397A priority Critical patent/JP2014215680A/en
Publication of JP2014215680A publication Critical patent/JP2014215680A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

PROBLEM TO BE SOLVED: To provide a database system which synchronizes databases at a higher speed.SOLUTION: A master-slave database system includes a master device having a master database and a replica device having a replica database. The master device receives a query from a client, generates a first engine program including processing for compiling the query to decide a non-definite value, and updates the master database. The master device generates a second engine program by use of the value decided in the first engine program, and transmits it to the replica device. The replica device executes the second engine program received from the master device, to update a replica database file.

Description

本発明の実施形態は、データベースシステムに関する。   Embodiments described herein relate generally to a database system.

災害時などでハードディスクの故障によるデータ損失を防ぐために、遠隔地にリアルタイムにバックアップを確保することが注目されている。通常のバックアップでは、一定時間を経たデータ復旧が行えるが、障害発生時にもダウンタイムなく復旧し、データが更新される度に、リアルタイムで別サーバへ更新データを複製するレプリケーションが注目されている。   In order to prevent data loss due to hard disk failure in the event of a disaster or the like, securing backups in real time in remote locations has attracted attention. With normal backup, data can be recovered after a certain period of time. However, replication that recovers without downtime even when a failure occurs and replicates the updated data to another server in real time whenever the data is updated has attracted attention.

レプリケーションでは、別サーバを同じネットワーク内、もしくは遠隔地に設置して、リアルタイムでデータをコピーする。   In replication, another server is installed in the same network or at a remote location, and data is copied in real time.

そのため、データベースを高速に同期することが求められ、サーバ間の通信内容が重要である。   Therefore, it is required to synchronize the database at high speed, and the communication content between servers is important.

しかし、従来の技術では同期の高速化に問題があった。   However, the conventional technique has a problem in speeding up the synchronization.

特開2010−277348号公報JP 2010-277348 A 特開2006−146580号公報JP 2006-146580 A

本発明が解決しようとする課題は、データベース間の同期をより高速化することのできるデータベースシステムを提供することである。   The problem to be solved by the present invention is to provide a database system capable of further speeding up synchronization between databases.

実施形態のデータベースシステムは、マスターデータベースを有するマスター装置とレプリカデータベースを有するレプリカ装置から成るマスタースレーブ型のデータベースシステムであって、
前記マスター装置は、
クライアントからクエリを受信するクエリ受信部と、
前記クエリ受信部が受信したクエリを受け取り、クエリをコンパイルし非決定的な値を決定する処理を含む第1エンジンプログラムを生成するコンパイラ層処理部と、
前記コンパイラ層処理部から第1エンジンプログラムを受け取り、前記第1エンジンプログラムで決定した値を用いた第2エンジンプログラムを生成するとともに、前記第1エンジンプログラムを実行してマスターデータベースファイルを更新処理する第1エンジン層処理部と、
前記第2エンジンプログラム、前記第1エンジンプログラムで決定した値を記録する第1レプリケーションデータ管理部と、
前記各部から取得したデータを所定の通信手順に従って前記レプリカ装置に送信するための信号を生成して送信するとともに、前記レプリカ装置から受信した信号をデータに変換して前記各部に送信する第1データ送受信部とを備え、
前記レプリカ装置は、
前記マスター装置から受け取った前記第2エンジンプログラムを格納する第2レプリケーションデータ管理部と、
前記第2エンジンプログラムを実行してレプリカデータベースファイルを更新処理する第2エンジン層処理部と、
前記各部から取得したデータを所定の通信手順に従って前記マスター装置に送信するための信号を生成して送信するとともに、前記マスター装置から受信した信号をデータに変換して前記各部に送信する第2データ送受信部とを備える。
The database system of the embodiment is a master-slave type database system comprising a master device having a master database and a replica device having a replica database,
The master device is
A query receiver for receiving queries from clients;
A compiler layer processing unit that receives the query received by the query receiving unit and generates a first engine program including processing for compiling the query and determining a non-deterministic value;
The first engine program is received from the compiler layer processing unit, a second engine program using a value determined by the first engine program is generated, and the master database file is updated by executing the first engine program. A first engine layer processing unit;
A first replication data management unit for recording a value determined by the second engine program and the first engine program;
First data for generating and transmitting a signal for transmitting the data acquired from each unit to the replica device according to a predetermined communication procedure, and converting the signal received from the replica device to data and transmitting the data to each unit With a transceiver
The replica device
A second replication data management unit for storing the second engine program received from the master device;
A second engine layer processing unit that executes the second engine program to update the replica database file;
Second data for generating and transmitting a signal for transmitting data acquired from each unit to the master device according to a predetermined communication procedure, and converting a signal received from the master device to data and transmitting the data to each unit A transmission / reception unit.

マスタースレーブ型のデータベースシステムの一例を示す図である。It is a figure which shows an example of a master slave type database system. 本発明の実施形態に係るマスター装置の概略構成を示すブロック図である。It is a block diagram which shows schematic structure of the master apparatus which concerns on embodiment of this invention. 本発明の実施形態に係るレプリカ装置の概略構成を示すブロック図である。It is a block diagram which shows schematic structure of the replica apparatus which concerns on embodiment of this invention. エンジンプログラムの一例を示す図である。It is a figure which shows an example of an engine program. マスター装置におけるエンジン層処理部でのレプリケーション処理の流れを示すフローチャートである。It is a flowchart which shows the flow of the replication process in the engine layer process part in a master apparatus. レプリカ装置におけるエンジン層処理部でのレプリケーション処理の流れを示すフローチャートである。It is a flowchart which shows the flow of the replication process in the engine layer process part in a replica apparatus. エンジン層処理部でのレプリケーション実行時のマスター装置とレプリカ装置とのデータ送受信の例を示すシーケンス図である。It is a sequence diagram which shows the example of the data transmission / reception with the master apparatus and replica apparatus at the time of the replication execution in an engine layer process part.

以下、本発明の一実施の形態について、図面を参照して説明する。尚、各図において同一箇所については同一の符号を付すとともに、重複した説明は省略する。   Hereinafter, an embodiment of the present invention will be described with reference to the drawings. In the drawings, the same portions are denoted by the same reference numerals, and redundant description is omitted.

まず、本実施形態で用いる主要な用語について説明する。   First, main terms used in the present embodiment will be described.

「レプリケーション」とは、あるデータベースとまったく同じ内容の複製(レプリカ)を別のコンピュータ上に作成し、内容を同期させる機能をいう。データベース単位以外にも、必要な部分のみのレプリケーションが可能である。設定されたタイミングで同期が行われる。   “Replication” refers to a function of creating a replica (replica) having exactly the same contents as a database on another computer and synchronizing the contents. In addition to database units, only necessary parts can be replicated. Synchronization is performed at the set timing.

「エンジンプログラム」とは、クエリをコンパイルして生成されるものであって、SQL実行エンジンで実行されるプログラムをいう。   The “engine program” is a program that is generated by compiling a query and executed by the SQL execution engine.

「非決定的なクエリ」とは、実行時に定まる関数を含んだクエリをいう。例えば、SQLのデータ操作言語で、データを関係に追加する命令であるINSERTや、現在時刻を求める関数であって、関数が呼び出された瞬間の時刻を返す命令であるSYSDATEを含むクエリがある。   “Non-deterministic query” refers to a query including a function determined at the time of execution. For example, in the SQL data manipulation language, there are queries including INSERT which is an instruction for adding data to a relation, and SYSDATE which is a function for obtaining the current time and returning the time when the function is called.

「マスタースレーブ型レプリケーション」とは、すべてのサーバがマスターでありスレーブである構成をとるマルチマスター型レプリケーションとは異なり、マスター1台に対して、スレーブ複数台の構成で、実際のデータベースへの書き込み処理(更新処理)は、バックにあるマスターサーバ側で処理され、データベースの読み込み処理は、フロントのスレーブサーバで処理する。したがって、スレーブデータベースは検索用途に限定される。   “Master-slave replication” is different from multi-master replication in which all servers are masters and slaves, and writing to the actual database with a configuration of multiple slaves for one master. The process (update process) is processed on the master server side in the back, and the database read process is processed on the front slave server. Therefore, the slave database is limited to search applications.

図1は、マスタースレーブ型のデータベースシステムの一例を示す図である。図1に示すように、データベースシステム1は、1又は複数のクライアント30と、マスター装置10と、1又は複数のレプリカ装置20で構成され、クライアント30とマスター装置10は例えばネットワーク40を介して接続されている。また、マスター装置10とレプリカ装置20は通信可能に接続されている。   FIG. 1 is a diagram illustrating an example of a master-slave database system. As shown in FIG. 1, the database system 1 includes one or more clients 30, a master device 10, and one or more replica devices 20. The client 30 and the master device 10 are connected via a network 40, for example. Has been. Further, the master device 10 and the replica device 20 are connected to be communicable.

クライアント30は、データベースシステム1のデータベース機能を利用する端末装置である。クライアント30からのデータベースの変更はマスター装置10にのみ可能である。マスター装置10とレプリカ装置20とは、マスタースレーブ型の関係になっている。   The client 30 is a terminal device that uses the database function of the database system 1. Only the master device 10 can change the database from the client 30. The master device 10 and the replica device 20 have a master-slave type relationship.

マスター装置10はマスターデータベースを有し、レプリカ装置20はレプリカデータベースを有している。マスターデータベースの更新に応じて、マスター装置10は、レプリカ装置20にレプリカデータベースをマスターデータベースに同期させる。   The master device 10 has a master database, and the replica device 20 has a replica database. In response to the update of the master database, the master device 10 causes the replica device 20 to synchronize the replica database with the master database.

データベースシステム1において、マスター装置10がクライアント30からのトランザクション(セットで実行されるべき1つ以上の更新処理の集まり)の開始を示すBEGINコマンドを受信したときが同期処理の開始である。マスター装置10が該トランザクションを確定して該トランザクションの終了を示すCOMMITコマンドをクライアント30から受信し、該コマンドに応じてマスターデータベース及びレプリカデータベースの両方のデータベースファイルの更新が完了したとき、同期処理の終了となる。尚、トランザクションの処理を終了させるコマンドとして、他には処理を取り消すROLLBACKがある。   In the database system 1, the synchronization process starts when the master device 10 receives a BEGIN command indicating the start of a transaction (a collection of one or more update processes to be executed in a set) from the client 30. When the master device 10 confirms the transaction and receives a COMMIT command indicating the end of the transaction from the client 30 and updates of the database files of both the master database and the replica database are completed according to the command, the synchronization processing End. As another command for ending transaction processing, there is ROLLBACK for canceling processing.

クライアント30は、汎用のコンピュータ(例えばパーソナルコンピュータ(PC)等)と、同コンピュータ上で動作するソフトウェアとを用いて実現される。コンピュータとしては、タブレット端末や移動体通信端末等も含む。   The client 30 is realized using a general-purpose computer (for example, a personal computer (PC)) and software that operates on the computer. Examples of the computer include a tablet terminal and a mobile communication terminal.

マスター装置10は、汎用のコンピュータ(例えばパーソナルコンピュータ(PC)等)と、同コンピュータ上で動作するソフトウェアとを用いて実現される。コンピュータとしては、CAD(Computer Aided Design)やCAE(Computer Aided Engineering)に好適なエンジニアリングワークステーション(EWS)等も含む。   The master device 10 is realized using a general-purpose computer (for example, a personal computer (PC) or the like) and software that operates on the computer. The computer includes an engineering workstation (EWS) suitable for CAD (Computer Aided Design) and CAE (Computer Aided Engineering).

本実施形態においては、マスター装置10及びレプリカ装置20のいずれにおいても、エンジン層処理部でレプリケーション処理を実行する機能を有する。   In the present embodiment, both the master device 10 and the replica device 20 have a function of executing a replication process in the engine layer processing unit.

図2は、本発明の実施形態に係るマスター装置の概略構成を示すブロック図である。   FIG. 2 is a block diagram showing a schematic configuration of the master device according to the embodiment of the present invention.

図2に示すように、本実施形態に係るマスター装置10は、主として、クエリ受信部100、コンパイラ層処理部110、エンジン層処理部120、ページャ層処理部130、レプリケーションデータ管理部140、データ送受信部150、データベース部160から構成されている。   As shown in FIG. 2, the master device 10 according to the present embodiment mainly includes a query receiving unit 100, a compiler layer processing unit 110, an engine layer processing unit 120, a pager layer processing unit 130, a replication data management unit 140, and data transmission / reception. Part 150 and database part 160.

クエリ受信部100は、ネットワーク40を経由してクライアント30に接続されるとともに、コンパイラ層処理部110に接続している。コンパイラ層処理部110は、エンジン層処理部120に接続している。エンジン層処理部120は、ページャ層処理部130に接続している。ページャ層処理部130は、データベース部160に接続している。エンジン層処理部120は、レプリケーションデータ管理部140及びデータ送受信部150に接続している。データ送受信部150は、直接又はネットワーク(図示しない)を介して各レプリカ装置20に接続している。   The query receiving unit 100 is connected to the client 30 via the network 40 and is also connected to the compiler layer processing unit 110. The compiler layer processing unit 110 is connected to the engine layer processing unit 120. The engine layer processing unit 120 is connected to the pager layer processing unit 130. The pager layer processing unit 130 is connected to the database unit 160. The engine layer processing unit 120 is connected to the replication data management unit 140 and the data transmission / reception unit 150. The data transmitting / receiving unit 150 is connected to each replica apparatus 20 directly or via a network (not shown).

クエリ受信部100は、クライアント30からネットワーク40を経由して送信されたクエリを受信する。クエリ受信部100は、受信したクエリをコンパイラ層処理部110に送る。   The query receiving unit 100 receives a query transmitted from the client 30 via the network 40. The query receiving unit 100 sends the received query to the compiler layer processing unit 110.

コンパイラ層処理部110は、クエリ受信部100が受信したクエリを受け取り、コンパイラ層におけるクエリの処理を行う。コンパイラ層処理部110は、コンパイラ部111を有している。   The compiler layer processing unit 110 receives the query received by the query receiving unit 100 and performs query processing in the compiler layer. The compiler layer processing unit 110 has a compiler unit 111.

コンパイラ部111は、クエリをパースしてコンパイルし、第1エンジンプログラムを生成する。クエリ、第1エンジンプログラムは、レプリケーションデータ管理部140に記録させる。   The compiler unit 111 parses and compiles the query to generate a first engine program. The query and the first engine program are recorded in the replication data management unit 140.

第1エンジンプログラムは、マスター装置10が実行するプログラムであってSQLをコンパイルしたものである。   The first engine program is a program executed by the master device 10 and is a compilation of SQL.

エンジン層処理部120は、コンパイラ部111から第1エンジンプログラムを受け取り、第1エンジンプログラムを実行する。詳細は後述する。   The engine layer processing unit 120 receives the first engine program from the compiler unit 111 and executes the first engine program. Details will be described later.

エンジン層処理部120は、エンジンプログラム実行部121とレプリケーション実行部122を有している。エンジンプログラム実行部121は、いわばSQL実行エンジンであって、データベースファイルに書き込むためのデータを生成し、書込み命令の発行等を行う。具体的には、エンジンプログラム実行部121は、クエリの第1エンジンプログラムを実行し、データベース部160のマスターデータベースファイルを更新する。さらに、エンジンプログラム実行部121は第2エンジンプログラムを生成する。第2エンジンプログラムは、SQLをコンパイルしたものでレプリカ装置20が実行するプログラムである。第2エンジンプログラムは、第1エンジンプログラム中の不要なコードを間引いている。すなわち、第1エンジンプログラムでは非決定的な値を決定する処理を含んでおり、非決定的な値が決定後にその決定した値を用いて第2エンジンプログラムが生成される。第2エンジンプログラムは、決定したデータと共にレプリケーションデータ管理部140に記録される。   The engine layer processing unit 120 includes an engine program execution unit 121 and a replication execution unit 122. The engine program execution unit 121 is a so-called SQL execution engine, generates data to be written in the database file, and issues a write command. Specifically, the engine program execution unit 121 executes the first engine program for the query and updates the master database file in the database unit 160. Further, the engine program execution unit 121 generates a second engine program. The second engine program is a program compiled by SQL and executed by the replica device 20. In the second engine program, unnecessary codes in the first engine program are thinned out. That is, the first engine program includes a process for determining a non-deterministic value, and the second engine program is generated using the determined value after the non-deterministic value is determined. The second engine program is recorded in the replication data management unit 140 together with the determined data.

レプリケーション実行部122は、レプリケーションデータ管理部140に記録された第2エンジンプログラムを、後述するように、マスター装置10がCOMMITコマンドをクライアント30から受信したタイミングでレプリカ装置20に送信する。また、レプリケーション実行部122は、更新処理を終え不要となった第2エンジンプログラムをレプリケーションデータ管理部140から削除する。   The replication execution unit 122 transmits the second engine program recorded in the replication data management unit 140 to the replica device 20 at the timing when the master device 10 receives the COMMIT command from the client 30 as will be described later. In addition, the replication execution unit 122 deletes the second engine program that has become unnecessary after the update process from the replication data management unit 140.

ページャ層処理部130は、ページャ層でのクエリの処理を行う。   The pager layer processing unit 130 performs query processing in the pager layer.

レプリケーションデータ管理部140は、第2エンジンプログラムや、第1エンジンプログラムで決定した値を記録する。   The replication data management unit 140 records a value determined by the second engine program or the first engine program.

データ送受信部150は、各部から取得したデータを所定の通信手順に従ってレプリカ装置20に送信するための信号を生成して送信する。また、データ送受信部は、レプリカ装置20から受信した信号をデータに変換して各部に送信する。   The data transmitting / receiving unit 150 generates and transmits a signal for transmitting the data acquired from each unit to the replica device 20 according to a predetermined communication procedure. Further, the data transmitting / receiving unit converts the signal received from the replica device 20 into data and transmits the data to each unit.

データベース部160は、データを一定のルールで蓄積し、必要に応じて取り出して提供する。データベース部160は、マスターデータベースとなるマスターデータベースファイルを記憶している。尚、データベース部160は、必ずしもマスター装置10内に設けられている必要はなく、マスター装置10に接続された別の装置内に設けてもよい。   The database unit 160 accumulates data according to a certain rule, and retrieves and provides the data as necessary. The database unit 160 stores a master database file serving as a master database. Note that the database unit 160 is not necessarily provided in the master device 10 and may be provided in another device connected to the master device 10.

図3は、本発明の実施形態に係るレプリカ装置の概略構成を示すブロック図である。図3に示すように、本実施形態に係るレプリカ装置20は、主として、エンジン層処理部210、ページャ層処理部220、レプリケーションデータ管理部230、データ送受信部240、データベース部250から構成されている。レプリカ装置20は、クライアント30からのクエリはマスター装置10で既にコンパイルされているので、コンパイル部を備えていない。   FIG. 3 is a block diagram showing a schematic configuration of the replica device according to the embodiment of the present invention. As shown in FIG. 3, the replica device 20 according to the present embodiment mainly includes an engine layer processing unit 210, a pager layer processing unit 220, a replication data management unit 230, a data transmission / reception unit 240, and a database unit 250. . Since the query from the client 30 has already been compiled by the master device 10, the replica device 20 does not include a compiling unit.

レプリカ装置20の各部の機能は、マスター装置10の各部の機能と基本的には同様である。   The function of each part of the replica device 20 is basically the same as the function of each part of the master device 10.

エンジン層処理部210は、マスター装置10から第2エンジンプログラムを受け取り、この第2エンジンプログラムを実行する。   The engine layer processing unit 210 receives the second engine program from the master device 10 and executes the second engine program.

ページャ層処理部220は、データベース部250に対してデータの入出力を行うものである。   The pager layer processing unit 220 inputs / outputs data to / from the database unit 250.

レプリケーションデータ管理部230は、第2エンジンプログラムを格納するものである。   The replication data management unit 230 stores the second engine program.

データ送受信部240は、各部から取得したデータを所定の通信手順に従ってマスター装置10に送信するための信号を生成して送信するとともに、マスター装置10から受信した信号をデータに変換して各部に送信する。   The data transmission / reception unit 240 generates and transmits a signal for transmitting data acquired from each unit to the master device 10 according to a predetermined communication procedure, and converts the signal received from the master device 10 into data and transmits the data to each unit. To do.

データベース部250は、データを一定のルールで蓄積し、必要に応じて取り出し可能で、レプリカデータベースとなるレプリカデータベースファイルを記憶する。   The database unit 250 stores data according to a certain rule, can be taken out as necessary, and stores a replica database file serving as a replica database.

<エンジンプログラム>
図4は、エンジンプログラムの一例を示す図である。図4に示す例では、次のクエリを処理するものである。
<Engine program>
FIG. 4 is a diagram illustrating an example of an engine program. In the example shown in FIG. 4, the next query is processed.

INSERT INTO ttt VALUES (random(), ‘ABCDE’);
このクエリは、テーブル名tttにVALUES 句の値、すなわちrandom()の値を挿入するものである。
INSERT INTO ttt VALUES (random (), 'ABCDE');
This query inserts the value of the VALUES clause into the table name ttt, that is, the value of random ().

係るクエリをコンパイルすると、図4(a)に示す第1エンジンプログラムがコンパイラ部111で生成され、図4(b)に示す第2エンジンプログラムがエンジンプログラム実行部121で生成される。   When such a query is compiled, the first engine program shown in FIG. 4A is generated by the compiler unit 111, and the second engine program shown in FIG. 4B is generated by the engine program execution unit 121.

第1エンジンプログラムのFunctionステップでrandom()の値が決定し、MakeRecordステップでデータが生成される。決定したデータは、レプリケーションデータ管理部140に記録される。   The value of random () is determined in the Function step of the first engine program, and data is generated in the MakeRecord step. The determined data is recorded in the replication data management unit 140.

一方、レプリカ装置20が受信する第2エンジンプログラムでは、非決定的な関数の値が決定しており、INSERT文による処理は1回の実行で1行を挿入するもので、レプリカ装置20では、1処理ずつ実行される。   On the other hand, in the second engine program received by the replica device 20, the value of a nondeterministic function is determined, and the processing by the INSERT statement inserts one row in one execution. Each process is executed.

<エンジン層処理部でのレプリケーション>
次に、以上のように構成されたデータベースシステムのエンジン層処理部でのレプリケーションについて説明する。
<Replication in engine tier processing unit>
Next, replication in the engine layer processing unit of the database system configured as described above will be described.

マスター装置10において、エンジン層処理部120でレプリケーションを実行すると判定された場合に、エンジン層レプリケーション処理が実行される。   In the master device 10, when the engine layer processing unit 120 determines to execute replication, engine layer replication processing is executed.

図5は、マスター装置におけるエンジン層処理部でのレプリケーション処理の流れを示すフローチャートである。   FIG. 5 is a flowchart showing the flow of replication processing in the engine layer processing unit in the master device.

まず、コンパイラ層処理部110は、クライアント30からクエリを受け付ける(ステップS51)。次に、コンパイラ層処理部110のコンパイラ部111は、クエリをコンパイルする(ステップS52)。   First, the compiler layer processing unit 110 receives a query from the client 30 (step S51). Next, the compiler unit 111 of the compiler layer processing unit 110 compiles the query (step S52).

次に、エンジン層処理部120での処理に移行し、クエリがCOMMITコマンドか否かを判定する(ステップS53)。レプリカの更新は、トランザクション(BEGINからCOMMITの間)単位で行われ、COMMITがくるまでは、それまでの(INSERT文などの)各第2エンジンプログラムをレプリケーションデータ管理部230に記憶しておく。     Next, the process proceeds to processing in the engine layer processing unit 120, and it is determined whether or not the query is a COMMIT command (step S53). The replica is updated in units of transactions (between BEGIN and COMMIT), and each second engine program (such as an INSERT statement) until that time is stored in the replication data management unit 230 until COMMIT is received.

ステップS53でYesであれば、レプリケーション実行部122は、レプリケーションデータ管理部140に記録されている第2エンジンプログラムをレプリカ装置20へ送信する(ステップS54)。     If Yes in step S53, the replication execution unit 122 transmits the second engine program recorded in the replication data management unit 140 to the replica device 20 (step S54).

一方、クエリがCOMMITコマンドでなければ(ステップS53でNo)、クエリがトランザクションを取り消すROLLBACKコマンドか否かを判定する(ステップS57)。     On the other hand, if the query is not a COMMIT command (No in step S53), it is determined whether the query is a ROLLBACK command for canceling the transaction (step S57).

ROLLBACKコマンドであれば(ステップS57でYes)、次に、レプリケーション実行部122は、これまで記録した第2エンジンプログラムをレプリケーションデータ管理部140から削除する(ステップS55)。     If the command is a ROLLBACK command (Yes in step S57), the replication execution unit 122 then deletes the second engine program recorded so far from the replication data management unit 140 (step S55).

次いで、エンジンプログラム実行部121がクエリの第1エンジンプログラムを実行し、データベース部160のマスターデータベースファイルを更新する(ステップS56)。     Next, the engine program execution unit 121 executes the first engine program for the query, and updates the master database file in the database unit 160 (step S56).

ステップS57の判定でROLLBACKコマンドでなければ(ステップS57でNo)、エンジンプログラム実行部121は、クエリの第1エンジンプログラムを実行しつつ、第2エンジンプログラムをレプリケーションデータ管理部140に記録する(ステップS58)。     If the ROLLBACK command is not determined in step S57 (No in step S57), the engine program execution unit 121 records the second engine program in the replication data management unit 140 while executing the first engine program of the query (step S57). S58).

ステップS56の処理後あるいはステップS58の処理後は、クライアント30から次のクエリを受け付けるべく、ステップS51に戻る。     After the process of step S56 or the process of step S58, the process returns to step S51 to accept the next query from the client 30.

図6は、レプリカ装置におけるエンジン層処理部でのレプリケーション処理の流れを示すフローチャートである。     FIG. 6 is a flowchart showing the flow of replication processing in the engine layer processing unit in the replica apparatus.

レプリケーション実行部212が、マスター装置10から第2エンジンプログラムを受信し、レプリケーションデータ管理部230に記録する(ステップS61)。     The replication execution unit 212 receives the second engine program from the master device 10 and records it in the replication data management unit 230 (step S61).

次に、エンジンプログラム実行部211が第2エンジンプログラムを実行し、データベース部250のレプリカデータベースファイルを更新する(ステップS62)。     Next, the engine program execution unit 211 executes the second engine program, and updates the replica database file in the database unit 250 (step S62).

以上のステップS61〜S62をクエリ数分だけ繰り返す。   The above steps S61 to S62 are repeated for the number of queries.

図7は、エンジン層処理部でのレプリケーション実行時のマスター装置とレプリカ装置とのデータ送受信の例を示すシーケンス図である。   FIG. 7 is a sequence diagram illustrating an example of data transmission / reception between the master device and the replica device at the time of executing replication in the engine layer processing unit.

クライアント30からトランザクション開始文であるBEGINコマンドがマスター装置10に送信される(ステップS701)。すると、コンパイラ層処理部110はレプリカ装置20にBEGINコマンドを送信する(ステップS702)。この送信に要する時間はtsendである。 A BEGIN command, which is a transaction start statement, is transmitted from the client 30 to the master device 10 (step S701). Then, the compiler layer processing unit 110 transmits a BEGIN command to the replica device 20 (step S702). The time required for this transmission is t send .

BEGINコマンドを受信したレプリカ装置20は、BEGINコマンドを処理(ステップS703)し、トランザクションを開始する。   The replica device 20 that has received the BEGIN command processes the BEGIN command (step S703) and starts a transaction.

コンパイラ層処理部110もBEGINコマンドを処理し、トランザクションを開始する(ステップS704)。   The compiler layer processing unit 110 also processes the BEGIN command and starts a transaction (step S704).

BEGINコマンドを処理したレプリカ装置20は、BEGINコマンドを処理したことをマスター装置10に通知する(ステップS705)。この送信に要する時間はtsendである。 The replica device 20 that has processed the BEGIN command notifies the master device 10 that the BEGIN command has been processed (step S705). The time required for this transmission is t send .

次に、クライアント30からINSERT1コマンドがマスター装置10に送信される(ステップS706)。   Next, an INSERT1 command is transmitted from the client 30 to the master device 10 (step S706).

コンパイラ層処理部110は、INSERT1コマンドをコンパイルし、第1エンジンプログラムを生成する(ステップS707)。エンジン層処理部120は、第1エンジンプログラムを実行しつつ、第2エンジンプログラムを生成し、レプリケーションデータ管理部140に記憶させる(ステップS708)。INSERT1が非決定的なクエリである場合には、エンジン層処理部120は非決定的な関数の値が決定した値を用いて第2エンジンプログラムを生成する。   The compiler layer processing unit 110 compiles the INSERT1 command and generates a first engine program (step S707). The engine layer processing unit 120 generates the second engine program while executing the first engine program, and stores it in the replication data management unit 140 (step S708). When INSERT1 is a nondeterministic query, the engine layer processing unit 120 generates a second engine program using a value determined by a nondeterministic function value.

さらに、クライアント30からINSERT2コマンドがマスター装置10に送信される(ステップS709)。上記INSERT1と同様に、コンパイラ層処理部110は、INSERT2コマンドをコンパイル(ステップS710)し、エンジン層処理部120は、第1エンジンプログラムを実行しつつ、第2エンジンプログラムを生成し、レプリケーションデータ管理部140に記憶させる(ステップS711)。INSERT2が非決定的なクエリである場合には、エンジン層処理部120は非決定的な関数の値が決定した値を用いて第2エンジンプログラムを生成する。   Further, the INSERT2 command is transmitted from the client 30 to the master device 10 (step S709). Similar to the above INSERT1, the compiler layer processing unit 110 compiles the INSERT2 command (step S710), and the engine layer processing unit 120 generates the second engine program while executing the first engine program, and manages the replication data. The data is stored in the unit 140 (step S711). When INSERT2 is a non-deterministic query, the engine layer processing unit 120 generates the second engine program using the value determined by the non-deterministic function value.

次に、クライアント30からマスター装置10にCOMMITコマンドが送信される(ステップS712)。   Next, a COMMIT command is transmitted from the client 30 to the master device 10 (step S712).

コンパイラ層処理部110は、レプリケーションデータ管理部140に記憶された第2エンジンプログラムを、データ送受信部150を介してレプリカ装置20に送信する(ステップS713)。ここでは、第2エンジンプログラムは、INSERTクエリを予めコンパイルしたものである。この第2エンジンプログラムの送信に要する時間はtdataである。 The compiler layer processing unit 110 transmits the second engine program stored in the replication data management unit 140 to the replica device 20 via the data transmission / reception unit 150 (step S713). Here, the second engine program is a pre-compiled INSERT query. The time required for transmitting the second engine program is t data .

レプリカ装置20は、マスター装置10から第2エンジンプログラムを受信すると、INSERTクエリをコンパイルすることを要しないので直ちにINSERTコマンドの処理を行う(ステップS714)。レプリカ装置20のエンジン層処理部210においてINSERTコマンドの処理に要する時間は、INSERTコマンドのエンジン層処理部210で処理に要する時間をtengineとし、処理されたクエリ数をnとすると、tengine×nである。 When the replica device 20 receives the second engine program from the master device 10, it does not need to compile the INSERT query, and immediately executes the INSERT command (step S714). The time required for the processing of the INSERT command in the engine layer processing unit 210 of the replica device 20 is t engine × where the time required for processing by the engine layer processing unit 210 of the INSERT command is t engine and the number of processed queries is n. n.

レプリカ装置20は、INSERTコマンドの処理を終了すると、マスター装置10に処理終了を通知する(ステップS715)。この通知送信に要する時間はtsendである。 When the replica device 20 finishes the processing of the INSERT command, the replica device 20 notifies the master device 10 of the end of the processing (step S715). The time required for this notification transmission is t send .

レプリカ装置20から処理終了の通知を受けたマスター装置10のエンジン層処理部120は、レプリカ装置20にCOMMITコマンドを送信する(ステップS716)。このCOMMITコマンドの送信に要する時間はtsendである。 The engine layer processing unit 120 of the master device 10 that has received the processing end notification from the replica device 20 transmits a COMMIT command to the replica device 20 (step S716). The time required for transmitting this COMMIT command is t send .

次に、エンジン層処理部120は、COMMITコマンドを処理して(ステップS718)、クライアント30とマスター装置10間でのトランザクションは終了する。   Next, the engine layer processing unit 120 processes the COMMIT command (step S718), and the transaction between the client 30 and the master device 10 ends.

一方、レプリカ装置20もCOMMITコマンドを処理して(ステップS717)、マスター装置10とレプリカ装置20間でのトランザクションは終了する。   On the other hand, the replica device 20 also processes the COMMIT command (step S717), and the transaction between the master device 10 and the replica device 20 ends.

次に、レプリカ装置20は、エンジン層処理部120に適用完了の通知を送信する(ステップS719)。この通知送信に要する時間はtsendである。 Next, the replica device 20 transmits a notification of application completion to the engine layer processing unit 120 (step S719). The time required for this notification transmission is t send .

以上で、エンジン層処理部120でのレプリケーション処理は終了する。   Thus, the replication process in the engine layer processing unit 120 ends.

係るエンジン層処理部120,210でのレプリケーション処理において、レプリケーションのために追加で必要となる時間は、tsend+tdata+tengine×nとなる。第2エンジンプログラムの送信に要する時間は、決定された値の大きさに依存するがさほど増えることはない。 In the replication processing in the engine layer processing units 120 and 210, the additional time required for replication is t send + t data + t engine × n. The time required for transmission of the second engine program does not increase so much depending on the magnitude of the determined value.

以上説明したように、本実施形態によれば、レプリカ装置におけるコンパイルを省略することができるのでレプリケーション処理の高速化が図られる。   As described above, according to the present embodiment, since the compilation in the replica apparatus can be omitted, the replication process can be speeded up.

本発明のいくつかの実施形態を説明したが、これらの実施形態は、例として提示したものであり、発明の範囲を限定することは意図していない。これら新規な実施形態は、その他の様々な形態で実施されることが可能であり、発明の要旨を逸脱しない範囲で、種々の省略、置き換え、変更を行うことができる。これら実施形態やその変形は、発明の範囲や要旨に含まれるとともに、特許請求の範囲に記載された発明とその均等の範囲に含まれる。   Although several embodiments of the present invention have been described, these embodiments are presented by way of example and are not intended to limit the scope of the invention. These novel embodiments can be implemented in various other forms, and various omissions, replacements, and changes can be made without departing from the scope of the invention. These embodiments and modifications thereof are included in the scope and gist of the invention, and are included in the invention described in the claims and the equivalents thereof.

1・・・データベースシステム
10・・・マスター装置
20・・・レプリカ装置
30・・・クライアント
40・・・ネットワーク
100・・・クエリ受信部
110・・・コンパイラ層処理部
111・・・コンパイラ部
120、210・・・エンジン層処理部
121、211・・・エンジンプログラム実行部
122、212・・・レプリケーション実行部
130、220・・・ページャ層処理部
140、230・・・レプリケーションデータ管理部
150、240・・・データ送受信部
160、250・・・データベース部
DESCRIPTION OF SYMBOLS 1 ... Database system 10 ... Master apparatus 20 ... Replica apparatus 30 ... Client 40 ... Network 100 ... Query receiving part 110 ... Compiler layer process part 111 ... Compiler part 120 210, engine layer processing units 121, 211 ... engine program execution units 122, 212 ... replication execution units 130, 220 ... pager layer processing units 140, 230 ... replication data management unit 150, 240: Data transmission / reception unit 160, 250 ... Database unit

Claims (7)

マスターデータベースを有するマスター装置とレプリカデータベースを有するレプリカ装置から成るマスタースレーブ型のデータベースシステムであって、
前記マスター装置は、
クライアントからクエリを受信するクエリ受信部と、
前記クエリ受信部が受信したクエリを受け取り、クエリをコンパイルし非決定的な値を決定する処理を含む第1エンジンプログラムを生成するコンパイラ層処理部と、
前記コンパイラ層処理部から第1エンジンプログラムを受け取り、前記第1エンジンプログラムで決定した値を用いた第2エンジンプログラムを生成するとともに、前記第1エンジンプログラムを実行してマスターデータベースファイルを更新処理する第1エンジン層処理部と、
前記第2エンジンプログラム、前記第1エンジンプログラムで決定した値を記録する第1レプリケーションデータ管理部と、
前記各部から取得したデータを所定の通信手順に従って前記レプリカ装置に送信するための信号を生成して送信するとともに、前記レプリカ装置から受信した信号をデータに変換して前記各部に送信する第1データ送受信部とを備え、
前記レプリカ装置は、
前記マスター装置から受け取った前記第2エンジンプログラムを格納する第2レプリケーションデータ管理部と、
前記第2エンジンプログラムを実行してレプリカデータベースファイルを更新処理する第2エンジン層処理部と、
前記各部から取得したデータを所定の通信手順に従って前記マスター装置に送信するための信号を生成して送信するとともに、前記マスター装置から受信した信号をデータに変換して前記各部に送信する第2データ送受信部とを備える
データベースシステム。
A master-slave type database system comprising a master device having a master database and a replica device having a replica database,
The master device is
A query receiver for receiving queries from clients;
A compiler layer processing unit that receives the query received by the query receiving unit and generates a first engine program including processing for compiling the query and determining a non-deterministic value;
The first engine program is received from the compiler layer processing unit, a second engine program using a value determined by the first engine program is generated, and the master database file is updated by executing the first engine program. A first engine layer processing unit;
A first replication data management unit for recording a value determined by the second engine program and the first engine program;
First data for generating and transmitting a signal for transmitting the data acquired from each unit to the replica device according to a predetermined communication procedure, and converting the signal received from the replica device to data and transmitting the data to each unit With a transceiver
The replica device
A second replication data management unit for storing the second engine program received from the master device;
A second engine layer processing unit that executes the second engine program to update the replica database file;
Second data for generating and transmitting a signal for transmitting data acquired from each unit to the master device according to a predetermined communication procedure, and converting a signal received from the master device to data and transmitting the data to each unit A database system comprising a transmission / reception unit.
前記クエリ受信部は、クライアントからネットワークを経由して送信されたクエリを受信する請求項1記載のデータベースシステム。   The database system according to claim 1, wherein the query receiving unit receives a query transmitted from a client via a network. 前記第1エンジン層処理部は、
クエリの前記第1エンジンプログラムを実行するとともに、前記第2エンジンプログラムを生成するエンジンプログラム実行部と、
前記第2エンジンプログラムを前記レプリカ装置に送信するレプリケーション実行部を有している請求項1又は請求項2記載のデータベースシステム。
The first engine tier processor is
An engine program execution unit that executes the first engine program of the query and generates the second engine program;
The database system according to claim 1, further comprising a replication execution unit that transmits the second engine program to the replica device.
前記第1エンジンプログラムにおいて非決定的な値を決定する処理で決定したデータは、前記第1レプリケーションデータ管理部に記録される請求項3記載のデータベースシステム。   4. The database system according to claim 3, wherein the data determined by the process of determining a non-deterministic value in the first engine program is recorded in the first replication data management unit. 前記第2エンジンプログラムは、決定したデータと共に前記第1レプリケーションデータ管理部に記録される請求項4記載のデータベースシステム。   The database system according to claim 4, wherein the second engine program is recorded in the first replication data management unit together with the determined data. 前記レプリケーション実行部は、更新処理を終え不要となった前記第2エンジンプログラムを前記第1レプリケーションデータ管理部から削除する請求項5記載のデータベースシステム。   The database system according to claim 5, wherein the replication execution unit deletes the second engine program that has become unnecessary after completing the update process from the first replication data management unit. 前記マスター装置は、クエリを処理し、物理コピーによるページャ層レプリケーション処理を行うページャ層処理部を備え、
前記レプリカ装置は、物理コピーによるページャ層レプリケーション処理を行うページャ層処理部を備える請求項3乃至請求項6のいずれか1項に記載のデータベースシステム。
The master device includes a pager layer processing unit that processes a query and performs pager layer replication processing by physical copy.
The database system according to claim 3, wherein the replica device includes a pager layer processing unit that performs pager layer replication processing by physical copy.
JP2013090397A 2013-04-23 2013-04-23 Database system Pending JP2014215680A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2013090397A JP2014215680A (en) 2013-04-23 2013-04-23 Database system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2013090397A JP2014215680A (en) 2013-04-23 2013-04-23 Database system

Publications (1)

Publication Number Publication Date
JP2014215680A true JP2014215680A (en) 2014-11-17

Family

ID=51941412

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2013090397A Pending JP2014215680A (en) 2013-04-23 2013-04-23 Database system

Country Status (1)

Country Link
JP (1) JP2014215680A (en)

Similar Documents

Publication Publication Date Title
JP7068454B2 (en) Efficient propagation of diff values
US9471590B2 (en) Method and apparatus for replicating virtual machine images using deduplication metadata
US9141685B2 (en) Front end and backend replicated storage
US8260742B2 (en) Data synchronization and consistency across distributed repositories
KR100462839B1 (en) Method for database synchronization and conflict resolution between clients and server of mobile system
KR101662212B1 (en) Database Management System providing partial synchronization and method for partial synchronization thereof
CN109918229B (en) Database cluster copy construction method and device in non-log mode
US10067999B2 (en) High-performance database replication systems and methods
US20130166505A1 (en) Monitoring replication lag between geographically dispersed sites
CN106933703A (en) A kind of method of database data backup, device and electronic equipment
CN105183860A (en) Data synchronization method and system
US9998544B2 (en) Synchronization testing of active clustered servers
US11748215B2 (en) Log management method, server, and database system
JP6196389B2 (en) Distributed disaster recovery file synchronization server system
CN105574026B (en) Method and device for supporting transaction of non-relational database
Truica et al. Asynchronous Replication in Microsoft SQL Server, PostgreSQL and MySQL
CN110121712B (en) Log management method, server and database system
JP2001034518A (en) Master-slave relation information synchronization system in decentralized database
JP6251965B2 (en) Information system and database recovery method
JP2014215680A (en) Database system
CN116821232A (en) Data synchronization method and related device
CN114490570A (en) Production data synchronization method and device, data synchronization system and server
CN111522688B (en) Data backup method and device for distributed system
KR101748913B1 (en) Cluster management method and data storage system for selecting gateway in distributed storage environment
JP2016149049A (en) Information processor, information processing system, and pair data updating method and program