JP2009301352A - Test unit and test method - Google Patents
Test unit and test method Download PDFInfo
- Publication number
- JP2009301352A JP2009301352A JP2008155680A JP2008155680A JP2009301352A JP 2009301352 A JP2009301352 A JP 2009301352A JP 2008155680 A JP2008155680 A JP 2008155680A JP 2008155680 A JP2008155680 A JP 2008155680A JP 2009301352 A JP2009301352 A JP 2009301352A
- Authority
- JP
- Japan
- Prior art keywords
- data
- test
- production
- unit
- version
- 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
Links
Images
Abstract
Description
本発明は、データベースでデータ処理(この処理を、「データベース処理」という場合がある。)をするためのプログラムのテストの技術に関する。 The present invention relates to a technique for testing a program for data processing in a database (this processing may be referred to as “database processing”).
従来、計算機に、データベースでデータ処理を実行させるプログラム(データベース処理プログラム(つまり、アプリケーション(Application:以下「AP」と略記する場合がある。)))のテストを行う際は、本番用データベースとは異なるテスト用データベースを使用するか、またはテストに本番用データベースを使用して、テスト終了後にロールバックして、本番用データベースの状態をテスト前の状態に戻す、といった方法をとっていた。 Conventionally, when testing a program (a database processing program (that is, application (hereinafter sometimes abbreviated as “AP”))) that causes a computer to perform data processing on a database, what is a production database? Either a different test database was used, or a production database was used for the test, and the test database was rolled back after the test to return the production database to the state before the test.
これらの従来のテストの方法のうち、テスト用データベースを使用する方法の場合には、本番用データベースとは別にテスト用データベースを用意しなければならなかったので、テスト環境を整えるまでに時間がかかる。加えて、資源等の問題もあって、大規模データベースに対するテストは行いづらい。もし、本番用データベースよりも規模の小さいテスト用データベースを使用した場合には、データの組み合わせや処理件数によって生じる問題等については、十分なテストが行えない等の欠点がある。 Of these conventional test methods, in the case of using the test database, it was necessary to prepare a test database separately from the production database, so it took time to prepare the test environment. . In addition, there are problems with resources, etc., making it difficult to test large databases. If a test database having a smaller scale than the production database is used, there is a drawback that a sufficient test cannot be performed for problems caused by the combination of data and the number of processing cases.
また、本番用データベースを使用してテストを行い、テスト終了後にロールバックする方法では、テストと本番との実施期間を隔離しなければならないという欠点がある。 In addition, the method of performing a test using a production database and rolling back after the test is completed has a disadvantage that it is necessary to separate the test and production periods.
前記欠点を解消するために、特許文献1に記載されている方式が提案されているが、インメモリデータベースの分野では適用しづらいという欠点がある。特許文献1に示す、ディスクを使った従来のデータベースの場合、一般的に検索のときも更新のときもバッファに読み込んでから処理するようになっている。データを読み込む単位や、データ構造、検索アルゴリズムなどが、バッファに読み込んだデータへのキャッシュヒット率が高くなるように最適化されているので、特許文献1の解決方法でも本番に近いテストを行うことができる。一方、インメモリデータベースの場合は、データはメモリ上に存在するので、直接データにアクセスするように設計されている。そのため、テストの場合だけ検索や更新で特別なバッファを使用するという解決策を適用するのは困難である。 In order to eliminate the drawbacks, a method described in Patent Document 1 has been proposed, but there is a drawback that it is difficult to apply in the field of in-memory databases. In the case of a conventional database using a disk as shown in Patent Document 1, generally, a search and an update are performed after reading into a buffer. Since the unit for reading data, data structure, search algorithm, etc. are optimized so as to increase the cache hit rate for the data read into the buffer, even the solution of Patent Document 1 should perform a test close to the actual test Can do. On the other hand, in the case of an in-memory database, since the data exists in the memory, it is designed to directly access the data. Therefore, it is difficult to apply a solution that uses a special buffer for searching and updating only for testing.
分散APサーバの分野では、本番とテストとを区別するために、例えば、特許文献2に記載されているような方式が提案されている。しかし、特許文献2では、APサーバからデータベースまで一貫してテストを行う方法は言及されていない。
前記事情を鑑みて、本発明の目的は、データベース処理プログラムのテストを容易に行うことである。 In view of the above circumstances, an object of the present invention is to easily test a database processing program.
前記目的を達成するために、本発明は、データベース処理プログラムのテストを実施する際に、本番用データベースを使用しながら、被テストプログラムによるテスト用データの更新の影響を、本番用データから切り離すようにする。詳細は後記する。 In order to achieve the above object, the present invention separates the influence of the update of the test data by the program under test from the production data while using the production database when testing the database processing program. To. Details will be described later.
本発明によれば、テスト用データベースを用意することなく、かつ本番用データベースのロールバックを行うこともないため、データベース処理プログラムのテストを容易に行うことができる。 According to the present invention, since a test database is not prepared and a production database is not rolled back, a database processing program can be easily tested.
以下、本発明を実施するための最良の形態(以下、「実施形態」という。)を、図面を適宜参照しつつ、詳細に説明する。 Hereinafter, the best mode for carrying out the present invention (hereinafter referred to as “embodiment”) will be described in detail with reference to the drawings as appropriate.
≪構成≫
図1は、本実施形態のデータベース処理プログラムのテスト方法を実行する計算機の内部機能構成を図示したものである。
計算機1000(テスト装置)は、データベースを用いてデータを処理するアプリケーション実行部(AP実行部)の実行を制御する制御部として実現されるCPU(Central Processing Unit:中央処理装置)1100、および記憶部として実現される主記憶装置1200を有して構成されるコンピュータである。主記憶装置1200上には、AP配備情報1300、APサーバ1400、データベース1500が配置される。なお、主記憶装置1200に何らかのデータ、アプリケーション実行部、ミドルウェア、データベース等が「配置」されるとは、データ、アプリケーション実行部、ミドルウェア、データベース等が主記憶装置1200内の所定の場所(アドレス)に記憶されることを意味する。また、本実施形態のデータベース処理プログラムをテストするために実行されるプログラムは、主記憶装置1200に記憶されていると良い。CPU1100は、そのプログラムを読み出すことにより、データベース処理プログラムのテストを実行するように処理する。換言すれば、このプログラムは、以降で説明する各部を実現するためのものであって、このプログラムがCPU1100で処理されることで、各部の処理が実現される。各処理部(各部)は、プログラムで実現されても良く、その場合はCPU1100で実行されることにより、その処理は実現される。それらのプログラムは、CD−ROMやDVDに記憶され、メモリ(主記憶装置1200)にインストールされても良い。各処理部は、その機能をハードウェアで実現することも可能である。
≪Configuration≫
FIG. 1 illustrates the internal functional configuration of a computer that executes the database processing program test method of the present embodiment.
A computer 1000 (test apparatus) includes a CPU (Central Processing Unit) 1100 that is realized as a control unit that controls execution of an application execution unit (AP execution unit) that processes data using a database, and a storage unit A computer having a
AP配備情報1300は、AP情報1310と、実行モード情報1320とを有している。AP情報1310は、配備を行うAP実行部に関する情報(例えば、当該AP実行部を実行するためのファイル等)を保持する。なお、AP実行部の「配備」とは、計算機1000に、前記ファイルを読み出してAPをインストールして、そのAP実行部を利用可能な状態にすることを意味する。実行モード情報1320は、AP実行部が本番用に実行されることを示す本番モードまたはAP実行部がテスト用に実行されることを示すテストモードに区別される実行モードを識別する情報である。後記する実行モード判定処理部1511により、その識別が行われる。
The AP
APサーバ1400は、ユーザからの要求(計算機1000の入力手段(キーボードやマウス等で実現されるもの)から入力された要求)を受け付けて、その要求をデータベース1500の処理に橋渡しする機能を有するミドルウェアである。このAPサーバ1400は、アプリケーション実行部を実行するための環境(記憶領域)を与えるコンテナ1410、AP配備情報1300に基づいてAP実行部の配備を行うAP配備部1420、AP実行部の実行モードを管理するテスト情報管理部1430、データベース1500と通信するDB(Data Base)アクセス制御部1440を有している。
The AP
このAPサーバ1400おいて、さらに、コンテナ1410には、計算機1000において実行されるアプリケーション実行部として、AP実行部1(1411)、AP実行部2(1412)が配備されている。
また、テスト情報管理部1430には、AP実行部ごとに実行モードを格納するためのテスト情報管理テーブル1431が接続されている。
In this AP
The test
データベース1500は、主記憶装置1200に配置されたインメモリデータベースである。このデータベース1500は、DBアクセス制御部1440からの接続要求を受け付ける接続処理部1510、コネクションの生成と管理をするコネクション制御部1520、SQL(Structured Query Language)を解析してデータ処理の計画をたてるSQL解析部1530、AP実行部を実行したときに対象となるデータの処理を制御するデータ制御部1540、MVCC(Multi Version Concurrency Control)で本番用データ(本番用の更新データ等)を管理するため、データのタイムスタンプを管理するバージョン制御部1550、データを格納するデータ格納部(図1の、本番用データ格納部1560およびテスト用データ格納部1561の総称)を有している。
The
このデータベース1500において、さらに、接続処理部1510には、実行モード情報1320から実行モードを判定する実行モード判定処理部1511が接続されている。
また、コネクション制御部1520には、実行モードがテストモードであるときは、当該実行モード情報1320をコネクションに設定するテスト用コネクション処理部1521が接続されている。
また、バージョン制御部1550には、MVCCでテスト用データ(テスト用の更新データ等)を管理するため、データのタイムスタンプを管理するテスト用バージョン制御部1551が接続されている。
以下、各部について簡単に説明する。
In the
Further, when the execution mode is the test mode, the
The
Hereinafter, each part will be briefly described.
[コンテナ]
コンテナ1410は、AP実行部の実行環境を提供する。その実行環境を提供するために、例えば、データ構造、抽象データ型またはクラス等を表現するオブジェクトの集合を組織的に主記憶装置1200に格納する。そして、AP実行部はコンテナ1410の中に配備された後、実行が開始される。図1の例では、AP実行部1(1411)、AP実行部2(1412)はコンテナ1410に配備された後、それぞれに要求された処理を実行する。
[container]
The
[AP配備部]
AP配備部1420は、指定されたAP実行部の配備を行う。そして、実行モードに応じて配備のための処理を切り替える機能なども含めている。なお、AP実行部の指定は、例えば、計算機1000が備える、前記入力手段により当該APを選択することによりなされる。
[AP deployment department]
The AP
[テスト情報管理部]
テスト情報管理部1430は、指定された実行モードをテスト情報管理テーブル1431に格納する。実行モードの指定は、例えば、実行モード情報1320を用いて前記入力手段から行われ、その指定内容が、テスト情報管理テーブル1431に反映される。図1において、テスト情報管理テーブル1431では、AP実行部1(1411)はテストモードで実行され、AP実行部2(1412)は本番モードで実行されるように、実行モードがAP実行部ごとに格納されている。
[Test Information Management Department]
The test
[DBアクセス制御部]
DBアクセス制御部1440は、データベース1500への接続を行う機能を有する。また、コンテナ1410に配備されたAP実行部(図1では、AP実行部1(1411)、AP実行部2(1412))からAP実行部が配備されたことを示す接続情報を受信し、その接続情報をデータベース1500に送信する。
このDBアクセス制御部1440は、接続処理部1510に通信して接続する(接続要求をする)と、SQL文をデータベース1500に伝えるためのコネクションを、接続処理部1510から受け取る。
また、DBアクセス制御部1440は、接続時に、テスト情報管理部1430から取得した実行モード情報1320を、接続処理部1510に伝える機能も有する。
[DB access control unit]
The DB
When the DB
The DB
[接続処理部]
接続処理部1510は、DBアクセス制御部1440からデータベース1500への接続要求を受け取って、SQLリクエストを受け付けるためのコネクションをDBアクセス制御部1440へ返す。さらに、前記接続情報を解析する機能も有しており、この接続情報には、タイムアウトなどの情報も含まれる。さらに、接続処理部1510は、実行モード判定処理部1511から実行モードを受け取り、実行モードを接続情報とともにコネクション制御部1520に出力する機能を有する。
[Connection processing section]
The
[コネクション制御部]
コネクション制御部1520は、接続処理部1510から接続情報および実行モードが入力されたときに、コネクションを生成する。さらに、テスト用コネクション処理部1521を使い、実行モードがテストモードであるときは、生成したコネクションに当該実行モード情報1320を入力する機能を有する。このようにして、実行モードがテストモードであるときは、テスト用のコネクションを生成し、実行モードが本番モードであるときは、本番用のコネクションを生成する。
[Connection control section]
The
[SQL解析部]
SQL解析部1530は、コネクションから入力されたSQLリクエストを解析し、検索(参照)や更新といったデータ処理をデータ制御部1540に要求する。
[SQL analysis section]
The
[データ制御部]
データ制御部1540は、データ格納部(1560、1561)に格納されているデータを参照したり、更新データを作成したりする。データのある場所や作成する場所(アドレス)は、バージョン制御部1550から取得する。
[Data control section]
The
[バージョン制御部]
バージョン制御部1550は、データが更新されるたびに、その更新データの各々に対してバージョン情報を追加し、データの更新状況を制御する機能を有する。トランザクションのタイムスタンプから、そのトランザクションが開始した時点より前に更新されたバージョンのデータを見えるようにする。例えば、計算機1000が備える表示手段(ディスプレイ等により実現されたもの)において、追加したバージョン情報として、そのデータに採番したバージョン、タイムスタンプ、内容、更新日時等を表示するようにする。実行モードがテストモードの場合には、テスト用バージョン制御部1551にテストデータのバージョンを問い合わせる機能を有する。このようにして、本番用のデータの更新状況およびテスト用のデータの更新状況を独立に管理する。
[Version control section]
Each time the data is updated, the
[データ格納部]
データ格納部は、アプリケーション実行部が実行の対象とするデータを格納するエリア(記憶領域:例えば、RAM(Random Access Memory)等で実現される。)であり、本番用のデータを格納する本番用データ格納部1560とテスト用のデータを格納するテスト用データ格納部1561に分かれている。本番用データ格納部1560とテスト用データ格納部1561は、それぞれデータに対してのロックの状態をもつ。その状態をもたせるために、当該データに対し、ロックの状態を示すフラグを追加し、データ制御部1540の制御に基づいてフラグの値を設定する。
[Data storage section]
The data storage unit is an area (storage area: realized by, for example, a RAM (Random Access Memory) or the like) that stores data to be executed by the application execution unit, and is used for production data that stores production data. It is divided into a
このような構成を有することにより、CPU1100は、アプリケーション実行部ごとに付された実行モード情報1320に基づいて、配備されたアプリケーション実行部を本番用またはテスト用として実行することができる。このとき、本番用としてあるアプリケーション実行部を実行している間に、テスト用として別のアプリケーション実行部を実行することもできる。つまり、各アプリケーション実行部の実行は、テストモードであれ本番モードであれ、独立して行われる。
By having such a configuration, the
≪処理≫
図2は、本実施形態において、AP実行部を配備しテストを実行する処理の流れ全体を示すシーケンス図である。なお、接続処理部1510がコネクション2000を生成する処理の流れの詳細は、図3にて説明する。また、SQLリクエストを受け取ったコネクション2000の処理の流れの詳細は、図4、図5にて説明する。
<< Process >>
FIG. 2 is a sequence diagram illustrating the entire flow of processing for deploying an AP execution unit and executing a test in the present embodiment. Details of the flow of processing in which the
AP配備部1420は、AP情報1310と実行モード情報1320から構成されるAP配備情報1300の入力を受けて、実行モード情報1320をテスト情報管理部1430に書き込む(ステップS210)。さらに、AP配備部1420は、AP情報を使い、コンテナ1410に、テストの対象となるAP実行部1(1411)を配備する(ステップS211)。
The
AP実行部1(1411)の配備後にテストが開始され、データベース処理が必要になった時に、DBアクセス制御部1440に、データベース1500に接続するためのコネクションを要求する(ステップS212)。この要求をするにあたり、AP実行部1(1411)は、接続情報をDBアクセス制御部1440に送信する。
When the test is started after the deployment of the AP execution unit 1 (1411) and database processing becomes necessary, the DB
前記要求を受け付けたDBアクセス制御部1440は、テスト情報管理部1430からAP実行部1(1411)の実行モード情報を読み取り(ステップS213)、接続情報に実行モード情報を追加し、接続処理部1510に接続する(ステップS214)。
The DB
DBアクセス制御部1440と接続処理部1510は、接続情報を使って通信路を確立する。この例では、接続処理部1510が、コネクション制御部1520(図3参照)によりコネクション2000を生成させ(ステップS215)、生成したコネクション2000を、そのままDBアクセス制御部1440に返している(ステップS216)。この処理の流れの詳細は、図3を使って説明する。
The DB
AP実行部1(1411)は、DBアクセス制御部1440から受け取ったコネクション2000を使い、SQLリクエストを送信し(ステップS217)、その返信としてSQLレスポンスを受け取る(ステップS218)。この処理の流れの詳細は、それぞれ図4、図5を使って説明する。
以上で、AP実行部を配備しテストを実行する処理の流れ全体に関する説明を終了する。
The AP execution unit 1 (1411) uses the
This is the end of the description of the entire process flow of deploying the AP execution unit and executing the test.
図3は、接続処理部1510がコネクション2000を生成する処理の流れの詳細を示すシーケンス図である。接続処理部1510は、DBアクセス制御部1440から実行モード情報を含んだ接続情報を入力として受け取る。
FIG. 3 is a sequence diagram showing details of the flow of processing in which the
接続処理部1510は、接続情報を実行モード判定処理部1511に送信する(ステップS301)。実行モード判定処理部1511は、接続情報から実行モード情報をとりだして、実行モードを判定する。ちなみに、配備されたのはAP実行部1(1411)であるため、実行モードは、テストモードである(例えば、図1参照)。判定した後、その実行モード情報を接続処理部1510に返す(ステップS302)。
The
接続処理部1510は、接続情報と実行モード情報を入力として、コネクション制御部1520にコネクションを要求する(ステップS303)。コネクション制御部1520はコネクション2000を生成し(ステップS304)、さらに、実行モードがテストモードであるため、生成したコネクション2000の情報と実行モード情報とをテスト用コネクション処理部1521に送信する(ステップS305)。テスト用コネクション処理部1521は、コネクション2000に実行モード情報を設定する(ステップS306)。このようにしてテスト用のコネクションを生成する。
The
その後、生成したコネクション2000は、コネクション制御部1520から、接続処理部1510を介して、DBアクセス制御部1440に渡される。これにより、APサーバ1400とデータベース1500との通信路が確立される。
以上で、接続処理部1510がコネクション2000を生成する処理の流れの詳細の説明を終了する。
Thereafter, the generated
This is the end of the detailed description of the flow of processing in which the
図4は、参照系のSQLリクエストを受け取ったコネクション2000の処理の流れの詳細を示すシーケンス図である。ここでいう「参照系のSQLリクエスト」とは、データの更新や削除をせず、さらにデータにロックをかける必要のないSQLリクエストのことをいう。
FIG. 4 is a sequence diagram showing details of the processing flow of the
AP実行部1(1411)からSQLリクエストを受信したコネクション2000は、SQL解析部1530にSQLリクエストを入力する。この際、コネクション毎に設定されている実行モード情報も入力する(ステップS401)。
The
SQL解析部1530は、入力されたSQLリクエストの解析を行う。解析した結果、データに対しての処理が必要な場合は、データ制御部1540にデータ処理を要求する。この際に、実行モード情報も入力する(ステップS402)。
The
データ制御部1540は、SQL解析部1530からの要求に従って、バージョン制御部1550に対し、データのバージョン情報(本番用データのバージョン情報またはテスト用データのバージョン情報)を取得するように要求する。このとき、本番用データ格納部1560またはテスト用データ格納部1561上のデータを参照する方法も要求する(ステップS403)。バージョン制御部1550は、実行モードがテストモードだった場合、テスト用バージョン制御部1551に、テスト用データ格納部1561上のデータを参照する方法を要求する(ステップS404)。
The
データがテスト用データ格納部1561に存在する場合、テスト用データ格納部1561上のデータを参照するための情報が、テスト用バージョン制御部1551からバージョン制御部1550を介してデータ制御部1540に送信される。データがテスト用データ格納部1561に存在しない場合、または実行モードが本番モードの場合、本番用データ格納部1560上のデータを参照するための情報が、バージョン制御部1550を介してデータ制御部1540に送信される。
When the data exists in the test
データ制御部1540は、バージョン制御部1550から受け取った情報に従って、本番用データ格納部1560かテスト用データ格納部1561かのどちらかに存在するデータを参照する(ステップS405)。
The
その後、前記SQLリクエストに対するSQLレスポンスが、データ制御部1540からSQL解析部1530およびコネクション2000を介して、AP実行部1(1411)に送信される。これにより、本番用データ格納部1560のデータまたはテスト用データ格納部1561のデータの参照処理が完了する。
以上で、参照系のSQLリクエストを受け取ったコネクション2000の処理の流れの詳細に関する説明を終了する。
Thereafter, an SQL response to the SQL request is transmitted from the
This is the end of the description regarding the details of the processing flow of the
図5は、更新系のSQLリクエストを受け取ったコネクション2000の処理の流れの詳細を示すシーケンス図である。ここでいう「更新系のSQLリクエスト」とは、参照系のSQLリクエスト以外のSQLリクエストをいう。
FIG. 5 is a sequence diagram showing details of the processing flow of the
一般的に、データベースでデータを更新する場合は、障害に備えて更新前と更新後のデータの値をログに書き込むため、更新前データも必要とする。そのため、更新前データ取得の処理(ステップS501からステップS505)までは、図4のデータ参照までの処理の流れ(ステップS401からステップS405)と同じである。つまり、更新前のデータを取得するための一連の処理は、データを参照するための一連の処理と同一である。よって、このあたりの詳細な説明は、省略する。 In general, when data is updated in a database, data values before and after updating are written in a log in preparation for a failure, so that data before updating is also required. For this reason, the process for obtaining pre-update data (step S501 to step S505) is the same as the process flow (step S401 to step S405) up to the data reference in FIG. That is, a series of processes for acquiring data before update is the same as a series of processes for referring to data. Therefore, detailed description around this will be omitted.
更新後データは、実行モードが本番モードの場合は、本番用データ格納部1560に作成される(ステップS506)。また、更新後データは、実行モードがテストモードの場合は、テスト用データ格納部1561に作成される(ステップS507)。
The updated data is created in the production
さらに、データ制御部1540は、更新後データを本番用データ格納部1560に作成した場合(ステップS506参照)は、バージョン制御部1550に、作成した更新後データの情報を入力して、バージョン情報を追加する(ステップS508)。このとき、本番用データの最新のバージョンを採番する。また、データ制御部1540は、更新後データをテスト用データ格納部1561に作成した場合(ステップS507参照)は、テスト用バージョン制御部1551に、作成した更新後データの情報を入力して、バージョン情報を追加する(ステップS509)。このとき、テスト用データの最新のバージョンを採番する。
Furthermore, when the updated data is created in the production data storage unit 1560 (see step S506), the
その後、前記SQLリクエストに対するSQLレスポンスが、データ制御部1540からSQL解析部1530およびコネクション2000を介して、AP実行部1(1411)に送信される。これにより、本番用データ格納部1560のデータまたはテスト用データ格納部1561のデータの更新処理が完了する。
以上で、更新系のSQLリクエストを受け取ったコネクション2000の処理の流れの詳細に関する説明を終了する。
Thereafter, an SQL response to the SQL request is transmitted from the
This is the end of the description regarding the details of the processing flow of the
図6は、テストと本番が同じデータの参照および更新をする場合の、データの管理について示すシーケンス図である。SQL解析部1530、データ制御部1540、バージョン制御部1550、テスト用バージョン制御部1551の動作は図3および図4で説明しているので、重複した説明を避けるため、この図には含めないものとする。
FIG. 6 is a sequence diagram showing data management when referring to and updating data having the same test and production. Since the operations of the
この処理では、コネクション(テスト)C60とコネクション(本番)C61からは、データ1の参照と更新を行うSQLリクエストが、それぞれ送信されてくるものとする。また、テストを実施する前は、本番用データ格納部1560にしかデータ1は存在しないものとする(ND601参照)。なお、コネクション(テスト)C60は、テストモードとして実行されるAP実行部1(1411)がデータベース1500にアクセスしたときに生成されるコネクションである。また、コネクション(本番)C61は、本番モードとして実行されるAP実行部2(1412)がデータベース1500にアクセスしたときに生成されるコネクションである。したがって、図6では、AP実行部1(1411)およびAP実行部2(1412)が1つのデータ(データ1)に対してデータ処理を実行する場合における、当該データの管理に関するものである。
In this process, it is assumed that an SQL request for referring to and updating data 1 is transmitted from the connection (test) C60 and the connection (production) C61. Further, it is assumed that data 1 exists only in the production
この処理では、まず、コネクション(テスト)C60でテストモードのトランザクションが開始される(ステップS601)。データ1の参照では、テスト用データ格納部1561にはデータ1が存在しないので、本番用データ格納部1560上の、バージョンが本番001と採番されたデータ1(ND601)を参照する(ステップS602)。また、データ1の更新では、本番001と採番されたデータ1(ND601)をテスト用に複製し、その複製したデータを更新する。その結果、テスト用データ格納部1561には、更新後のデータ1(TD601)を、テスト001というバージョンで作成する(ステップS603)。更新前の古いデータである、バージョンが本番001のデータ1(ND601)は、本番用データ格納部1560の中では最新のデータなので、捨てずに残しておく。なお、本番用データをテスト用データに複製する処理は、データ制御部1540が実行する。
In this process, first, a test mode transaction is started at connection (test) C60 (step S601). In reference to data 1, since data 1 does not exist in test
次に、コネクション(本番)C61にて、本番モードのトランザクションが開始されると(ステップS604)、実行モードが本番モードなので、参照(ステップS605)も、更新(ステップS606)も、本番用データ格納部1560に格納された本番001と採番されたデータ1(ND601)に対して行われる。その結果、更新後の新しいデータ1をバージョンが本番002と採番して、作成する(ND602参照)。
Next, when a transaction in the production mode is started in the connection (production) C61 (step S604), since the execution mode is the production mode, both the reference (step S605) and the update (step S606) are stored for production data. This is performed for the production number 001 and the numbered data 1 (ND601) stored in the
バージョンが本番001であるデータ1(ND601)は、参照する本番モードのトランザクションが終了した時点で、不要データとして回収対象になる。回収対象になったデータ(つまり、本番001と採番されたデータ1(ND601))は非同期で回収され、本番用データ格納部1560から削除される(ステップS607)。 Data 1 (ND601) whose version is 001 is the collection target as unnecessary data at the time when the transaction in the production mode to be referred to is completed. Data to be collected (that is, production number 001 and numbered data 1 (ND601)) are collected asynchronously and deleted from the production data storage unit 1560 (step S607).
次に、コネクション(テスト)C60で、テストモードのトランザクションが開始される(ステップS608)。データ1の参照では、テスト用データ格納部1561に格納された、バージョンがテスト001と採番されたデータ1(TD601)が存在するので、そのデータ1を参照する(ステップS609)。また、データ1の更新では、テスト001と採番されたデータ1(TD601)を更新し、テスト用データ格納部1561に更新後のデータ1(TD602)を、テスト002というバージョンで作成する(ステップS610)。
Next, a test mode transaction is started at connection (test) C60 (step S608). In reference to data 1, since there is data 1 (TD601) numbered version 001 stored in test
バージョンがテスト001であるデータ1(TD601)は、参照するテストモードのトランザクションが終了した時点で、不要データとして回収対象になる。回収対象になったデータ(つまり、テスト001と採番されたデータ1(TD601))は、非同期で回収され、テスト用データ格納部1561から削除される(ステップS611)。
以上で、テストと本番が同じデータの参照および更新をする場合の、データの管理に関する説明を終了する。
Data 1 (TD601) whose version is test 001 becomes a collection target as unnecessary data at the time when the transaction in the test mode to be referred to is completed. Data to be collected (that is, data 1 (TD601) numbered as test 001) is collected asynchronously and deleted from the test data storage unit 1561 (step S611).
This is the end of the description regarding the management of data in the case of referring to and updating data having the same test and production.
図7は、テスト用のデータにロックをかけた場合の本番の処理の流れを示すシーケンス図である。ここでいう「ロック」とは、参照ロックと更新ロックのどちらの場合も含むものとする。なお、参照ロックとは、あるユーザによって参照中のデータが、別のユーザによって同時に更新等されるのを防ぐロックである。また、更新ロックとは、あるユーザによって更新中のデータが、別のユーザによって同時に更新等されるのを防ぐロックである。また、コネクション(テスト)C70は、テストモードとして実行されるAP実行部1(1411)がデータベース1500にアクセスしたときに生成されるコネクションである。また、コネクション(本番)C71は、本番モードとして実行されるAP実行部2(1412)がデータベース1500にアクセスしたときに生成されるコネクションである。
FIG. 7 is a sequence diagram showing the flow of the actual process when the test data is locked. The term “lock” here includes both a reference lock and an update lock. The reference lock is a lock that prevents data being referred to by a certain user from being updated simultaneously by another user. An update lock is a lock that prevents data being updated by one user from being updated simultaneously by another user. The connection (test) C70 is a connection generated when the AP execution unit 1 (1411) executed as the test mode accesses the
まず、コネクション(本番)C71で実行モードが本番モードのトランザクションが開始される(ステップS701)。次に、コネクション(テスト)C70で実行モードがテストモードのトランザクションが開始される(ステップS702)。さらに、データ制御部1540によって、データ1のロックがAP実行部1(1411)から取得される(ステップS703)。この際、テスト用データ格納部1561において、バージョンが本番001のデータ1(ND701)の複製を、バージョンがテスト001のデータ1(TD701)として作成し、さらに、テスト用データ格納部1561上のデータ1(TD701)にのみロックをかける。
First, a transaction in which the execution mode is the production mode is started in the connection (production) C71 (step S701). Next, a transaction whose execution mode is the test mode is started in the connection (test) C70 (step S702). Further, the
バージョンがテスト001のデータ1(TD701)を別個に作成しているので、実行モードが本番モードのトランザクション(S701参照)は、実行モードがテストモードのトランザクション(S702参照)がかけたロックから影響を受けない。よって、ロックの開放(ステップS706)を行う前に、バージョンが本番001と採番されたデータ1(ND701)に対しての参照(ステップS704)や更新(ステップS705)を行うことができる。 Since data 1 (TD701) whose version is test 001 is created separately, the transaction whose execution mode is the production mode (see S701) is affected by the lock applied by the transaction whose execution mode is the test mode (see S702). I do not receive it. Therefore, before releasing the lock (step S706), the reference (step S704) and the update (step S705) can be performed with respect to the data 1 (ND701) whose version is numbered 001.
なお、図7の処理は、本番用のデータにロックをかけた場合のテストの処理についても同様である。実行モードがテストモードのトランザクションは、実行モードが本番モードのトランザクションがかけたロックから影響を受けないので、本番用のデータにかけたロックの開放を行う前に、テスト用のデータに対しての参照や更新を行うことができる。
以上で、テスト用のデータにロックをかけた場合の本番の処理に関する説明を終了する。
The process of FIG. 7 is the same as the test process when the production data is locked. Transactions whose execution mode is test mode are not affected by the lock applied by the transaction whose execution mode is production mode, so the reference to the test data before releasing the lock applied to the production data And can be updated.
This is the end of the description of the actual process when the test data is locked.
≪まとめ≫
以上説明した本実施形態によれば、テスト用データベースを用意することなく、かつ本番用データベースのロールバックを行うこともないため、データベース処理プログラムのテストを容易に行うことができる。
≪Summary≫
According to the present embodiment described above, the test of the database processing program can be easily performed because the test database is not prepared and the production database is not rolled back.
このとき、本番モードとテストモードとで同じデータを使用する場合であっても、テストによるデータの更新を本番用データに影響させずにすむため、テストを容易に行うことができるようになる。
また、参照系SQLの場合に、既存の本番用データをそのまま使うことができるので、テストによって使用するデータの記憶領域を削減することができる。
At this time, even when the same data is used in the production mode and the test mode, the update of the data by the test is not affected to the production data, so that the test can be easily performed.
Further, in the case of the reference system SQL, the existing production data can be used as it is, so that it is possible to reduce the data storage area used by the test.
また、本番用データとテスト用データとでロックの管理を分離するので、テストモードのトランザクションがロックをかけることによる、本番モードにおけるトランザクションのスループットの低下を削減することができる。
また、本番モードのトランザクションがロックをかけることによる、テストモードのトランザクションへの影響も削減することができる。
Further, since the lock management is separated between the production data and the test data, it is possible to reduce a decrease in the throughput of the transaction in the production mode due to the lock in the test mode transaction.
In addition, the influence on the test mode transaction due to the lock of the production mode transaction can be reduced.
また、本実施形態だと、参照にしか使わないデータの複製を必要としないので、インメモリデータベースの場合に、テストで使用するメモリの使用量を削減できるという効果もある。 In addition, according to the present embodiment, it is not necessary to duplicate data that is used only for reference. Therefore, in the case of an in-memory database, there is an effect that the amount of memory used for testing can be reduced.
≪その他≫
以上本発明の実施形態についての一例を示したが、本発明は、これに限定されず、本発明の趣旨を逸脱しない範囲で適宜変更が可能である。
≪Others≫
An example of the embodiment of the present invention has been described above, but the present invention is not limited to this and can be appropriately changed without departing from the spirit of the present invention.
例えば、本実施形態では、実行モード情報として本番モードとテストモードとの2つを区別する情報しか使わなかった。しかし、テスト毎に実行モード情報を変更し、複数のテストを同時にできるようにしても良い。具体的には、テスト情報管理テーブル1431において、アプリケーション実行部ごとに、実行しようとする種々のテストモードを割り当てて対応付けるように記憶する。 For example, in the present embodiment, only information that distinguishes between the production mode and the test mode is used as the execution mode information. However, the execution mode information may be changed for each test so that a plurality of tests can be performed simultaneously. Specifically, in the test information management table 1431, for each application execution unit, various test modes to be executed are assigned and stored so as to be associated with each other.
また、本実施形態では、コネクション制御部1520で生成したコネクション2000を、接続処理部1510を介して、通信路を含めてDBアクセス制御部1440に渡すようにした。しかし、通信路だけをDBアクセス制御部1440に返し、DBアクセス制御部1440でコネクション2000を別途作成することで、APサーバ1400とデータベース1500間を別の計算機に配置し、それらの間をネットワーク接続するようにしても良い。このようなネットワークを構成することにより、ディスクを使ったデータベースに対してこのテストを実行することもできる。
In the present embodiment, the
その他、ハードウェア、ソフトウェア、各シーケンスなどの具体的な構成について、本発明の趣旨を逸脱しない範囲で適宜変更が可能である。 In addition, specific configurations of hardware, software, each sequence, and the like can be changed as appropriate without departing from the spirit of the present invention.
1000 計算機
1100 CPU
1200 主記憶装置
1300 AP配備情報
1310 AP情報
1320 実行モード情報
1400 APサーバ
1410 コンテナ
1411、1412 AP実行部
1420 AP配備部
1430 テスト情報管理部
1431 テスト情報管理テーブル
1440 DBアクセス制御部
1500 データベース
1510 接続処理部
1511 実行モード判定処理部
1520 コネクション制御部
1521 テスト用コネクション処理部
1530 SQL解析部
1540 データ制御部
1550 バージョン制御部
1551 テスト用バージョン制御部
1560 本番用データ格納部
1561 テスト用データ格納部
2000、C60、C61、C70、C71 コネクション
ND601、ND602、ND701、ND702、TD601、TD602、TD701 データ1
1000
1200
Claims (4)
前記アプリケーション実行部の実行を制御する制御手段と、
を有するアプリケーションのテスト装置において、
前記記憶手段は、
少なくとも本番用に配備されたアプリケーション実行部を当該本番用に実行するように定める本番モードおよびテスト用に配備されたアプリケーション実行部を当該テスト用に実行するように定めるテストモードを有する実行モードを含む実行モード情報と、
前記実行モード情報を用いて前記アプリケーション実行部と前記実行モードとを対応付けることにより、本番用に実行されるアプリケーション実行部およびテスト用に実行されるアプリケーション実行部を特定するテスト情報管理部と、
前記特定したアプリケーション実行部の実行に際して、前記データベースにアクセスする要求を行うときには前記データベースに前記実行モード情報を送信するデータベースアクセス制御部と、
前記要求に従い、アクセスしようとするアプリケーション実行部に対応する実行モード情報に基づいて、本番用のコネクションまたはテスト用のコネクションを生成し、前記アプリケーション実行部と前記データベースとのアクセスを確立するコネクション制御部と、
前記実行モードが本番モードであるとき、前記本番用のアプリケーション実行部が処理するデータを本番用データとして格納する本番用データ格納部と、
前記実行モードがテストモードであるとき、前記テスト用のアプリケーション実行部が処理するデータをテスト用データとして格納するテスト用データ格納部と、
前記本番用データおよび前記テスト用データを、参照または更新するデータ制御部と、
前記本番用データが更新されると、その更新された本番用データのバージョンを特定し、前記本番用データの更新状況を管理する本番用バージョン制御部と、
前記テスト用データが更新されると、その更新されたテスト用データのバージョンを特定し、前記テスト用データの更新状況を管理するテスト用バージョン制御部と、
を記憶し、
前記制御手段は、
前記実行モード情報に基づいて、前記本番用のアプリケーション実行部およびテスト用のアプリケーション実行部のいずれかを実行させる
ことを特徴とするテスト装置。 A storage unit that deploys a database and an application execution unit that processes data using the database in an executable state;
Control means for controlling execution of the application execution unit;
In an application testing device having
The storage means
It includes an execution mode having at least a production mode for executing an application execution unit deployed for production and a test mode for executing an application execution unit deployed for test for the test. Execution mode information and
A test information management unit that identifies an application execution unit to be executed for production and an application execution unit to be executed for a test by associating the application execution unit with the execution mode using the execution mode information;
A database access control unit that transmits the execution mode information to the database when making a request to access the database during execution of the identified application execution unit;
In accordance with the request, a connection control unit that generates a production connection or a test connection based on execution mode information corresponding to the application execution unit to be accessed and establishes access between the application execution unit and the database When,
When the execution mode is the production mode, a production data storage unit that stores data to be processed by the production application execution unit as production data;
When the execution mode is a test mode, a test data storage unit that stores data to be processed by the test application execution unit as test data;
A data control unit for referring to or updating the production data and the test data;
When the production data is updated, the version of the updated production data is specified, and the production version control unit that manages the update status of the production data;
When the test data is updated, the version of the updated test data is specified, and the test version control unit that manages the update status of the test data;
Remember
The control means includes
One of the production application execution unit and the test application execution unit is executed based on the execution mode information.
前記データ制御部は、
前記実行モードがテストモードであり、前記テスト用データ格納部に前記テスト用データが格納されているときは、前記テスト用バージョン制御部から前記テスト用データのバージョンを特定し、前記バージョンのテスト用データを参照し、
前記実行モードが本番モードであるか、または、前記実行モードがテストモードであるが前記テスト用データ格納部に前記テスト用データが格納されていないときは、前記本番用バージョン制御部から前記本番用データのバージョンを特定し、前記バージョンの本番用データを参照する
ことを特徴とする請求項1に記載のテスト装置。 When a data reference request is made from the application execution unit,
The data control unit
When the execution mode is a test mode and the test data is stored in the test data storage unit, a version of the test data is specified from the test version control unit, and the version test Browse the data,
When the execution mode is the production mode or when the execution mode is the test mode but the test data is not stored in the test data storage unit, the production version control unit The test apparatus according to claim 1, wherein a data version is specified, and the production data of the version is referred to.
前記データ制御部は、
前記実行モードがテストモードであるときは、前記テスト用バージョン制御部から前記テスト用データのバージョンを特定し、前記バージョンのテスト用データを更新前データとして取得して更新し、当該更新後データを前記テスト用データ格納部に格納するとともに、前記テスト用バージョン制御部により、前記更新後データに対するバージョンを採番し、
前記実行モードが本番モードであるときは、前記本番用バージョン制御部から前記本番用データのバージョンを特定し、前記バージョンの本番用データを更新前データとして取得して更新し、当該更新後データを前記本番用データ格納部に格納するとともに、前記本番用バージョン制御部により、前記更新後データに対するバージョンを採番する
ことを特徴とする請求項1に記載のテスト装置。 When a data update request is made from the application execution unit,
The data control unit
When the execution mode is a test mode, the version of the test data is specified from the test version control unit, the test data of the version is acquired and updated as pre-update data, and the updated data is updated. While storing in the test data storage unit, by the test version control unit, number the version for the updated data,
When the execution mode is the production mode, the version of the production data is identified from the production version control unit, the production data of the version is acquired and updated as pre-update data, and the post-update data is updated. The test apparatus according to claim 1, wherein the test apparatus is stored in the production data storage unit, and the version for the updated data is numbered by the production version control unit.
前記アプリケーション実行部の実行を制御する制御手段と、
を有するアプリケーションのテスト装置におけるテスト方法おいて、
前記記憶手段は、
少なくとも本番用に配備されたアプリケーション実行部を当該本番用に実行するように定める本番モードおよびテスト用に配備されたアプリケーション実行部を当該テスト用に実行するように定めるテストモードを有する実行モードを含む実行モード情報を記憶し、
前記制御手段において、
前記実行モード情報を用いて前記アプリケーション実行部と前記実行モードとを対応付けることにより、本番用に実行されるアプリケーション実行部およびテスト用に実行されるアプリケーション実行部を特定するステップと、
前記特定したアプリケーション実行部の実行に際して、前記データベースにアクセスする要求を行うときには前記データベースに前記実行モード情報を送信するステップと、
前記要求に従い、アクセスしようとするアプリケーション実行部に対応する実行モード情報に基づいて、本番用のコネクションまたはテスト用のコネクションを生成し、前記アプリケーション実行部と前記データベースとのアクセスを確立するステップと、
前記実行モードが本番モードであるとき、前記本番用のアプリケーション実行部が処理するデータを本番用データとして格納するステップと、
前記実行モードがテストモードであるとき、前記テスト用のアプリケーション実行部が処理するデータをテスト用データとして格納するステップと、
前記本番用データおよび前記テスト用データを、参照または更新するステップと、
前記本番用データが更新されると、その更新された本番用データのバージョンを特定し、前記本番用データの更新状況を管理するステップと、
前記テスト用データが更新されると、その更新されたテスト用データのバージョンを特定し、前記テスト用データの更新状況を管理するステップと、を実行し、
前記実行モード情報に基づいて、前記本番用のアプリケーション実行部およびテスト用のアプリケーション実行部のいずれかを実行させる
ことを特徴とするテスト方法。 A storage unit that deploys a database and an application execution unit that processes data using the database in an executable state;
Control means for controlling execution of the application execution unit;
In a test method for an application test apparatus having
The storage means
It includes an execution mode having at least a production mode for executing an application execution unit deployed for production and a test mode for executing an application execution unit deployed for test for the test. Memorize execution mode information,
In the control means,
Identifying the application execution unit executed for production and the application execution unit executed for testing by associating the application execution unit with the execution mode using the execution mode information;
Transmitting the execution mode information to the database when making a request to access the database when executing the specified application execution unit;
In accordance with the request, based on execution mode information corresponding to the application execution unit to be accessed, generating a production connection or a test connection, and establishing access between the application execution unit and the database;
When the execution mode is the production mode, storing the data processed by the production application execution unit as production data;
When the execution mode is a test mode, storing data processed by the test application execution unit as test data;
Referencing or updating the production data and the test data;
When the production data is updated, the version of the updated production data is specified, and the update status of the production data is managed,
When the test data is updated, the version of the updated test data is specified, and the update status of the test data is managed.
One of the production application execution unit and the test application execution unit is executed based on the execution mode information.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2008155680A JP2009301352A (en) | 2008-06-13 | 2008-06-13 | Test unit and test method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2008155680A JP2009301352A (en) | 2008-06-13 | 2008-06-13 | Test unit and test method |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2009301352A true JP2009301352A (en) | 2009-12-24 |
Family
ID=41548167
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2008155680A Pending JP2009301352A (en) | 2008-06-13 | 2008-06-13 | Test unit and test method |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2009301352A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2013206126A (en) * | 2012-03-28 | 2013-10-07 | Nec Corp | Content switching method, content switching system, relying party and open id provider |
JP2016021161A (en) * | 2014-07-15 | 2016-02-04 | 株式会社日立製作所 | Simulator system, gateway system test device, and gateway system test method |
JPWO2017072828A1 (en) * | 2015-10-26 | 2018-03-08 | 株式会社日立製作所 | Method and computer system for supporting debugging |
-
2008
- 2008-06-13 JP JP2008155680A patent/JP2009301352A/en active Pending
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2013206126A (en) * | 2012-03-28 | 2013-10-07 | Nec Corp | Content switching method, content switching system, relying party and open id provider |
JP2016021161A (en) * | 2014-07-15 | 2016-02-04 | 株式会社日立製作所 | Simulator system, gateway system test device, and gateway system test method |
JPWO2017072828A1 (en) * | 2015-10-26 | 2018-03-08 | 株式会社日立製作所 | Method and computer system for supporting debugging |
US10235270B2 (en) | 2015-10-26 | 2019-03-19 | Hitachi Ltd. | Method for assisting with debugging, and computer system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP6553822B2 (en) | Dividing and moving ranges in distributed systems | |
US9251163B2 (en) | File sharing system and file sharing method | |
KR101099199B1 (en) | System and method for a snapshot query during database recovery | |
JP5652228B2 (en) | Database server device, database update method, and database update program | |
US20170192863A1 (en) | System and method of failover recovery | |
US20110082833A1 (en) | Database parallel editing method | |
CN105144162B (en) | Integrated data base frame | |
US8959052B2 (en) | Database update control apparatus, database management system, and non-transitory computer-readable storage medium | |
US9998544B2 (en) | Synchronization testing of active clustered servers | |
JP2022550049A (en) | Data indexing method in storage engine, data indexing device, computer device and computer program | |
CN106407376B (en) | Index reconstruction method and device | |
CN110795447A (en) | Data processing method, data processing system, electronic device, and medium | |
KR20200092095A (en) | Transaction control method to synchronize DML statements in relational database to NoSQL database | |
US8001098B2 (en) | Database update management | |
CN113056734A (en) | System and method for managing shared database | |
JP6008947B2 (en) | Database management method, database system, and program | |
US9009098B1 (en) | Methods and apparatus for creating a centralized data store | |
JP4951140B2 (en) | How to manage the database | |
WO2009147846A1 (en) | Conflict resolution system for database parallel editing | |
JP2009301352A (en) | Test unit and test method | |
US10437813B2 (en) | Self-healing of layer metadata within a layering system | |
US9015116B2 (en) | Consistent replication of transactional updates | |
CN112328637B (en) | High-speed distributed data caching method, device, computer equipment and storage medium | |
CN116821232A (en) | Data synchronization method and related device | |
CN115113989A (en) | Transaction execution method and device, computing equipment and storage medium |