KR101936787B1 - Method for database replication and System for database replication - Google Patents

Method for database replication and System for database replication Download PDF

Info

Publication number
KR101936787B1
KR101936787B1 KR1020170063860A KR20170063860A KR101936787B1 KR 101936787 B1 KR101936787 B1 KR 101936787B1 KR 1020170063860 A KR1020170063860 A KR 1020170063860A KR 20170063860 A KR20170063860 A KR 20170063860A KR 101936787 B1 KR101936787 B1 KR 101936787B1
Authority
KR
South Korea
Prior art keywords
slot
slots
reflector
query
database
Prior art date
Application number
KR1020170063860A
Other languages
Korean (ko)
Other versions
KR20180128580A (en
Inventor
이현철
Original Assignee
(주)선재소프트
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 (주)선재소프트 filed Critical (주)선재소프트
Priority to KR1020170063860A priority Critical patent/KR101936787B1/en
Priority to CN201780084899.1A priority patent/CN110300964B/en
Priority to PCT/KR2017/005573 priority patent/WO2018216839A1/en
Publication of KR20180128580A publication Critical patent/KR20180128580A/en
Application granted granted Critical
Publication of KR101936787B1 publication Critical patent/KR101936787B1/en

Links

Images

Classifications

    • G06F17/30174
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/178Techniques for file synchronisation in file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/1865Transactional file systems
    • G06F17/30227
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures

Abstract

본 발명은 데이터베이스 이중화 방법 및 데이터베이스 이중화 시스템에 관한 것이다. 여기서, 본 발명의 데이터베이스 이중화 방법은 메인장비의 제1데이터베이스 가운데 처리될 쿼리(Query)를 감지하여, 쿼리를 제2데이터베이스를 포함하는 이중화장비의 수신기에 전송하는 (A)단계, 쿼리로부터 제1데이터베이스에 저장된 릴레이션의 레코드에 적용될 기본키(Primary Key)를 갖는 슬롯 ID와 트랜잭션 ID(Transaction ID)를 갖는 슬롯을 추출하는 (B)단계, 슬롯을 락(Lock)하는 (C)단계, 슬롯 가운데 기본키(Primary Key)가 동일하되 전순위에 처리되는 전슬롯은 주분배자에서 대기시키고, 기본키가 동일하되 후순위에 처리되는 후슬롯은 부분배자로 전송하는 (D)단계, 전슬롯과 후슬롯을 반영자에 할당하는 (E)단계, 전슬롯이 할당된 반영자로 메인래퍼런스 카운트(Main Reference Count)를 증가시키고, 후슬롯이 할당된 반영자로 서브래퍼런스 카운트(Sub Reference Count)를 증가시키는 (F)단계 및 전슬롯의 락과 후슬롯의 락을 해지하는 (G)단계를 포함한다.
또한, 본 발명의 데이터베이스 이중화 시스템은 제1데이터베이스에 저장된 하나의 릴레이션에 처리될 쿼리를 감지하는 감지기, 쿼리를 전송하는 송신기, 송신기에서 전송되는 쿼리를 수신하는 수신기, 수신기에서 수신된 쿼리에서 슬롯 ID(Slot ID), 트랜잭션 ID(Transaction ID)를 갖는 슬롯을 형성하고, 형성된 슬롯 가운데 기본키(Primary Key)가 동일하되 전순위에 처리되는 전슬롯은 대기시키고, 후순위에 처리될 후슬롯은 부분배자로 전송하는 주분배자 및 전슬롯과 후슬롯을 제2데이터베이스에 반영하는 반영자를 포함한다.
The present invention relates to a database duplication method and a database duplication system. Here, the database duplication method of the present invention includes the steps of (A) detecting a query to be processed among a first database of a main device and transmitting the query to a receiver of a duplication device including a second database, (B) extracting a slot having a slot ID and a transaction ID having a primary key to be applied to a record of a relation stored in a database, locking the slot, (C) (D) a step of (D) waiting for all slots to be processed in the same order in which the primary key is the same but all slots processed in the previous order are queued in the main distributor, (E) assigning a sub reference count to a reflector, increasing a main reference count as a reflector to which all slots are allocated, and assigning a sub reference count to a reflector to which a later slot is allocated, (F) of increasing the number of slots and releasing the lock of all slots and (G) of releasing the lock of the slots.
Further, the database duplication system of the present invention includes a sensor for detecting a query to be processed in a relation stored in a first database, a transmitter for transmitting a query, a receiver for receiving a query transmitted from the transmitter, (Slot ID) and a Transaction ID (Transaction ID), and all of the formed slots have the same primary key but wait for all the slots to be processed in the prior order, And a reflector for reflecting the entire slot and the after slot in the second database.

Description

데이터베이스 이중화 방법 및 데이터베이스 이중화 시스템{Method for database replication and System for database replication}BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a database replication method,

본 발명은 데이터베이스 이중화 방법 및 데이터베이스 이중화 시스템에 관한 것으로서, 더욱 상세하게는 데이터베이스 이중화장비에 트랜잭션을 병렬로 처리하며 트랜잭션을 신속히 처리하면서도 데이터 무결성을 보증할 수 있는 데이터베이스 이중화 방법 및 데이터베이스 이중화 시스템에 관한 것이다.BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a database duplication method and a database duplication system, and more particularly, to a database duplication method and a database duplication system capable of processing transactions in parallel to a database duplication device in parallel and ensuring data integrity while rapidly processing transactions .

데이터베이스는 컴퓨터에 기록된 데이터들이 논리적이 관계로 연계된 집합을 의미한다. 데이터 요소들 간의 논리적 관계는 질의 된 내용을 기반으로 데이터베이스로부터 특정 정보를 수정, 제거, 변경 등의 편집할 수 있도록 한다.A database is a set of data recorded in a computer in a logical relationship. The logical relationship between the data elements enables the editing of certain information from the database, such as modification, deletion, modification, etc., based on the queried content.

데이터베이스는 편집된 데이터에 오류가 없도록 하며, 새로운 데이터의 삽입, 삭제, 갱신할 수 있도록 할 수 있다. 또한, 여러 사용자가 동시에 자기가 원하는 데이터를 이용할 수 있도록 한다.The database ensures that edited data is free from errors, and new data can be inserted, deleted, and updated. In addition, multiple users can use the data they want simultaneously.

데이터베이스에 저장되는 많은 데이터들은 여러 질의 내용을 통해 데이터의 무결성을 보증하며 트랜잭션 되고 있다.Many of the data stored in the database is transactional, ensuring the integrity of the data through multiple query contents.

이러한 방식의 데이터 처리는 사회의 산업 전반에 있어, 업무를 처리하는 많이 사용되고 있다. 특히, 데이터를 신속하고 정확하게 수정 및 생성해야하는 분야에서 중요하게 여겨지고 있다.This type of data processing is widely used in the business of society in general. In particular, it is considered important in the field where data must be modified and generated quickly and accurately.

현재, 데이터 처리의 안정성을 높이기 위해, 물리적으로 떨어져 있는 여러 데이터베이스에 대하여 메인 데이터베이스에 저장되는 데이터를 백업 데이터베이스에 동기화 시키는 과정이 활발히 개발되고 있다. 즉, 데이터의 이중화 기술이 많이 개발되고 있다.At present, in order to increase the stability of data processing, a process of synchronizing data stored in a main database with a backup database for various physically separated databases is actively being developed. That is, many techniques for duplicating data have been developed.

중요 데이터를 트랜잭션하는 은행 및 한국 거래소 등은 컴퓨터의 오류 및 바이러스 침입에 의한 사고 등에 대비하기 위해 데이터 이중화 기술을 많이 이용하고 있다.Banks and the Korea Exchange, which are transactions of important data, use data duplication technology to prepare for computer errors and virus incident.

금융권에서 데이터 이중화 방식의 사용이 점차 늘어남에 따라, 이중화 방식의 데이터 처리의 안전성을 높이는 방법 및 시스템에 대한 연구가 활발히 진행되고 있다. 일례로, 대한민국 등록특허 제10-1605455가 있다.As the use of data duplication method is increasingly used in the financial sector, studies on methods and systems for increasing the safety of data processing of duplication methods are being actively conducted. For example, Korean Patent Registration No. 10-1605455.

그러나, 전술한 등록특허를 비롯해 개발된 대다수의 기술은 처리되는 데이터의 손실을 방지하는 기술일 뿐, 데이터의 무결성 및 데이터의 처리 속도를 향상시키는 방안은 제시하지 못하고 있는 실정이다.However, most of the developed technologies including the above-mentioned registered patents are technologies for preventing loss of data to be processed, and there is no way to improve data integrity and data processing speed.

대한민국 등록특허 제10-1605455호 (2016.03.16)Korean Patent No. 10-1605455 (2016.03.16)

본 발명이 이루고자 하는 기술적 과제는 이러한 문제점을 해결하기 위한 것으로서, 트랜잭션의 처리 속도를 향상시키고 데이터 무결성을 보증할 수 있는 데이터베이스 이중화 방법 및 데이터베이스 이중화 시스템을 제공하는 것이다.SUMMARY OF THE INVENTION The present invention has been made to solve the above-mentioned problems occurring in the prior art, and it is an object of the present invention to provide a database duplication method and a database duplication system which can improve a transaction processing speed and assure data integrity.

본 발명의 기술적 과제는 이상에서 언급한 과제들로 제한되지 않으며, 언급되지 않은 또 다른 기술적 과제들은 아래의 기재로부터 당업자에게 명확하게 이해될 수 있을 것이다.The technical problem of the present invention is not limited to the above-mentioned problems, and other technical problems which are not mentioned can be clearly understood by those skilled in the art from the following description.

상기 기술적 과제를 달성하기 위한 본 발명의 데이터베이스 이중화 방법은
감지기가 메인장비의 제1데이터베이스 가운데 처리될 쿼리(Query)를 감지하여, 상기 쿼리를 제2데이터베이스를 포함하는 이중화장비의 수신기에 전송하는 (A)단계;
According to an aspect of the present invention,
(A) detecting a query to be processed among a first database of the main equipment and transmitting the query to a receiver of a duplication equipment including a second database;

주분배자가 상기 쿼리로부터 상기 제1데이터베이스에 저장된 릴레이션의 레코드에 적용될 기본키(Primary Key)를 갖는 슬롯 ID와 트랜잭션 ID(Transaction ID)를 갖는 슬롯을 추출하되,
주분배자는 형성된 슬롯 가운데 앞서 처리된 내용을 변경하는 내용을 포함하는 쿼리를 진행하는 슬롯은 앞선 형성된 슬롯 ID와 동일한 슬롯 ID를 갖는 슬롯으로 형성하는 (B)단계;
The main distributor extracts a slot having a slot ID and a transaction ID having a primary key to be applied to a record of a relation stored in the first database from the query,
Wherein the main distributor forms a slot having a slot ID equal to the previously formed slot ID with a slot having a slot ID that is ahead of a formed slot,

주분배자가 추출된 상기 슬롯을 락(Lock)하는 (C)단계;(C) locking the slot from which the main distributor is extracted;

주분배자가 상기 슬롯 가운데 기본키(Primary Key)가 동일하되 전순위에 처리되는 전슬롯은 주분배자에서 대기시키고, 상기 기본키가 동일하되 후순위에 처리되는 후슬롯은 부분배자로 전송하는 (D)단계;(D) the main distributor is in the same slot but all the slots processed in the previous order are queued in the main distributor and the latter slots are processed in the same order but transmitted to the sub-distributor (D) step;

상기 주분배자와 상기 부분배자가 상기 전슬롯과 상기 후슬롯을 반영자에 할당하는 (E)단계;(E) allocating the former slot and the latter slot to the reflector;

상기 주분배자는
상기 전슬롯이 할당된 상기 반영자로 메인래퍼런스 카운트(Main Reference Count)를 증가시키고, 상기 후슬롯이 할당된 상기 반영자로 서브래퍼런스 카운트(Sub Reference Count)를 증가시키는 (F)단계; 및
The main distributor
Increasing (F) a main reference count to the reflector to which the all slots are allocated, and increasing a sub reference count to the reflector to which the after slot is allocated; And

상기 전슬롯의 락과 상기 후슬롯의 락을 해지하는 (G)단계를 포함하되,
상기 주분배자가 상기 전슬롯을 상기 반영자에 각각 전송하여 동시에 수행할 수 있도록 하는 단계,
상기 부분배자가 상기 전슬롯이 처리되면, 상기 후슬롯을 동시에 처리하는 단계,
상기 부분배자는 처리된 전슬롯과 기본키가 동일한 상기 후슬롯을 전슬롯을 처리한 반영자에 전송하는 단계,
상기 주분배자에서 상기 반영자로 넘긴 슬롯이 릴레이션에 다 반영되는 동안 대기하고 있다가 완료되면 상기 반영자에 후슬롯을 동시에 넘겨 상기 후슬롯을 동시에 처리하는 단계를 포함한다.
(G) releasing the locking of the entire slot and the locking of the rear slot,
Allowing the main distributor to transmit the entire slot to the reflector to perform simultaneously,
Processing the post slots simultaneously when the partial slots have been processed;
Wherein the partial embedder comprises the steps of: transmitting, to the reflector that has processed the entire slot, the after-slot having the same primary key as the entire slot processed;
And a step of simultaneously waiting for the slots passed from the main distributor to the reflector to be reflected while being reflected in the relation and then completing the subsequent slots to the reflector simultaneously when the slots are passed.

상기 주분배자는 추출된 슬롯이 락이 되지 않을 경우, 상기 슬롯이 락이 될 때까지 대기할 수 있다.If the extracted slot is not locked, the main distributor can wait until the slot is locked.

삭제delete

삭제delete

제1데이터베이스에 저장된 하나의 릴레이션에 처리될 쿼리를 감지하는 감지기;A sensor for detecting a query to be processed in one relation stored in the first database;

상기 쿼리를 전송하는 송신기;A transmitter for transmitting the query;

상기 송신기에서 전송되는 상기 쿼리를 수신하는 수신기;A receiver for receiving the query transmitted from the transmitter;

상기 수신기에서 수신된 상기 쿼리에서 슬롯 ID(Slot ID), 트랜잭션 ID(Transaction ID)를 갖는 슬롯을 형성하고, 형성된 상기 슬롯 가운데 기본키(Primary Key)가 동일하되 전순위에 처리되는 전슬롯은 대기시키고, 후순위에 처리될 후슬롯은 부분배자로 전송하는 주분배자; 및A slot having a slot ID and a transaction ID is formed in the query received by the receiver, all slots in which the primary key is the same among the slots formed, And the slot after being processed at a subordinate position is transmitted to the partial embosser; And

상기 전슬롯과 상기 후슬롯을 제2데이터베이스에 반영하는 반영자를 포함하되,
상기 주분배자는 상기 쿼리가 진행 된 후, 커밋(commit)쿼리를 진행하며 하나의 트랜잭션 ID 및 하나의 기본키를 포함하는 슬롯을 생성하고,
상기 전슬롯이 할당된 상기 반영자로 메인래퍼런스 카운트(Main Reference Count)를 증가시키고, 상기 후슬롯이 할당된 상기 반영자로 서브래퍼런스 카운트(Sub Reference Count)를 증가시키고,
상기 주분배자가 상기 전슬롯을 상기 반영자에 각각 전송하여 동시에 처리될 수 있도록 하고,
상기 부분배자는 전슬롯의 기본키와 동일한 기본키를 갖는 후슬롯을 전슬롯을 처리한 반영자에 전송하여, 상기 주분배자에서 상기 반영자로 넘긴 슬롯이 릴레이션에 다 반영되는 동안 대기하고 있다가 완료되면 상기 반영자에 후슬롯을 동시에 넘겨 상기 후슬롯이 동시에 처리될 수 있도록 한다.
And a reflector for reflecting the entire slot and the after-slot in a second database,
After the query is processed, the main distributor proceeds a commit query and generates a slot including one transaction ID and one primary key,
The main reference count is increased to the reflector to which the all slots are allocated, the sub reference count is increased to the reflector to which the next slot is allocated,
The main distributor transmits the entire slot to the reflector so that it can be processed simultaneously,
The partial embedder transmits a subsequent slot having the same basic key as the basic key of all the slots to the reflector that processes all the slots and waits while the slot transferred from the main distributor to the reflector is reflected in the relation, Slots are concurrently handed over to the reflector so that the latter slots can be processed simultaneously.

삭제delete

삭제delete

삭제delete

본 발명에 따른 데이터베이스 이중화 방법 및 데이터베이스 이중화 시스템은 데이터의 트랜잭션(Transaction)속도를 높여, 원격지 서버에 트랜잭션 병목현상이 발생되지 않도록 할 수 있다.The database duplication method and the database duplication system according to the present invention can increase the transaction speed of data and prevent a transaction bottleneck to occur in a remote server.

또한, 본 발명은 원격지 서버에 데이터 무결성을 보증하며 데이터를 병렬 처리할 수 있도록 한다.In addition, the present invention guarantees data integrity to a remote server and enables data to be processed in parallel.

도 1은 본 발명의 일 실시예에 의한 데이터베이스 이중화 시스템의 블록도이다.
도 2는 도 1의 이중화장비가 수신된 쿼리로부터 슬롯ID 및 트랜잭션 ID를 추출하여 나타낸 표이다.
도 3은 도 1의 데이터베이스 이중화 시스템의 주분배자와 부분배자의 동작을 개념적으로 도식한 개념도이다.
도 4는 도 3의 주분배자와 부분배자의 동작에 의해 쿼리가 처리되며 나타난 릴레이션이다.
도 5는 도 1의 데이터베이스 이중화 시스템의 주분배자의 동작과정을 나타낸 순서도이다.
도 6은 도 1의 데이터베이스 이중화 시스템의 부분배자의 동작과정을 나타낸 순서도이다.
도 7은 도 1의 데이터베이스 이중화 시스템의 반영자를 회수하는 과정을 나타낸 순서도이다.
도 8은 도 4의 주분배자의 작동 과정과 도 6의 반영자의 회수 과정이 결합되는 지점을 개략적으로 나타낸 순서도이다.
도 9는 종래기술과 데이터베이스 이중화 시스템의 트랜잭션 수행에 소비되는 시간을 나타낸 도면이다.
1 is a block diagram of a database duplication system according to an embodiment of the present invention.
FIG. 2 is a table showing the slot ID and the transaction ID extracted from the received query of the duplication device of FIG.
FIG. 3 is a conceptual diagram conceptually illustrating the operation of a pseudo-multiplier and a partial multiplier of the database duplication system of FIG. 1. FIG.
FIG. 4 is a relation in which a query is processed by the operation of the main divider and the partial divider in FIG.
FIG. 5 is a flowchart illustrating an operation procedure of a master distributor of the database duplication system of FIG.
FIG. 6 is a flowchart illustrating the operation of the partial replica of the database duplication system of FIG. 1;
FIG. 7 is a flowchart illustrating a process of retrieving a reflector of the database duplication system of FIG. 1;
FIG. 8 is a flowchart schematically showing a point where the operation of the main distributor of FIG. 4 and the process of collecting the reflector of FIG. 6 are combined.
FIG. 9 is a diagram showing time consumed in the transaction execution of the conventional technology and the database duplication system.

본 발명의 이점 및 특징 그리고 그것들을 달성하기 위한 방법들은 첨부되는 도면과 함께 상세하게 후술되어 있는 실시예들을 참조하면 명확해질 것이다. 그러나 본 발명은 이하에서 개시되는 실시예들에 한정되는 것이 아니라 서로 다른 다양한 형태로 구현될 수 있으며, 단지 본 실시예들은 본 발명의 개시가 완전하도록 하고 본 발명이 속하는 기술분야에서 통상의 지식을 가진 자에게 발명의 범주를 완전하게 알려주기 위해 제공되는 것이다.BRIEF DESCRIPTION OF THE DRAWINGS The advantages and features of the present invention and methods for achieving them will become apparent with reference to the embodiments described in detail below with reference to the accompanying drawings. The present invention may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art. It is provided to fully inform the owner of the scope of the invention.

본 발명은 청구범위는 청구항을 비롯해 청구항을 뒷받침하는 설명에 의해 정의될 수 있다. 아울러, 명세서 전체에 걸쳐 동일 참조부호는 동일 구성요소를 지칭한다.The scope of the invention is defined by the claims which follow. In addition, like reference characters refer to like elements throughout the specification.

이하, 도 1 내지 도 9를 참조하여 본 발명의 일 실시예에 의한 데이터베이스 이중화 방법 및 데이터베이스 이중화 시스템에 대해 상세히 설명한다.Hereinafter, a database duplication method and a database duplication system according to an embodiment of the present invention will be described in detail with reference to FIG. 1 to FIG.

다만, 설명이 간결하고 명확해 질 수 있도록 도 1 내지 4를 참조하여 데이터베이스 이중화 시스템에 대해 상세히 설명한 후, 이를 바탕으로 도 5 내지 도 9를 참조해 데이터베이스 이중화 방법에 대해 설명하도록 한다.Hereinafter, a database duplication system will be described in detail with reference to FIGS. 1 to 4 so that the description will be concise and clear, and then a database duplication method will be described with reference to FIG. 5 to FIG.

먼저, 도 1을 참조하여 본 발명의 일 실시예에 따른 데이터베이스 이중화 시스템(1)에 대해 설명한다.First, a database duplication system 1 according to an embodiment of the present invention will be described with reference to FIG.

도 1은 본 발명의 일 실시예에 의한 데이터베이스 이중화 시스템의 블록도이다.1 is a block diagram of a database duplication system according to an embodiment of the present invention.

본 발명의 일 실시예에 따른 데이터베이스 이중화 시스템(1)은 이중화장비(20)의 주분배자(202)가 메인장비(10)의 송신기에서 전송된 쿼리(Query)에서 슬롯 ID(Slot ID), 트랜잭션 ID(Transaction ID)를 갖는 슬롯(S)을 형성한다. 그리고, 형성된 슬롯 가운데 기본키(P.K: Primary Key)가 동일하되, 전순위에 처리되는 전슬롯(FS, 도 3참조)은 주분배자(202)에서 처리되도록 하고, 후순위에 처리되는 후슬롯(PS, 도 3참조)은 부분배자(203)에서 처리되도록 한다.The database duplication system 1 according to an embodiment of the present invention is a system in which the main distributor 202 of the duplication device 20 performs a slot ID in a query transmitted from a transmitter of the main device 10, And forms a slot S having an ID (Transaction ID). 3) are processed in the pseudo embosser 202, and a post-slot (PS (see FIG. 3) processed in the rearrangement (PS , See Fig. 3) are processed in the partial embosser 203. [

이때, 데이터베이스 이중화 시스템(1)은 주분배자(202)에서 기본키가 상이한 복수 개의 전슬롯(FS)을 동시에 처리한 후, 부분배자(203)에서 복수 개의 후슬롯(PS)을 동시에 처리하며 모든 슬롯을 제2데이터베이스(205)에 신속히 반영한다.At this time, the database duplication system 1 simultaneously processes a plurality of all slots FS having different primary keys in the pivot partition 202, simultaneously processes a plurality of back slots PS in the partial partition 203, And quickly reflects the slot in the second database 205.

즉, 데이터베이스 이중화 시스템(1)은 이중화 데이터를 전처리하여 처리 과정을 분리시켜 병목현상 없이 데이터를 이중화시킬 수 있다.That is, the database duplication system 1 can duplicate the data without bottleneck by separating the process by preprocessing the duplicated data.

이러한 데이터베이스 이중화 시스템(1)은 제1데이터베이스에 저장된 하나의 릴레이션에 처리될 쿼리를 감지하는 감지기(102), 쿼리를 전송하는 송신기(103), 송신기(103)에서 전송되는 쿼리를 수신하는 수신기(201), 수신기(201)에서 수신된 쿼리에서 슬롯 ID(Slot ID), 트랜잭션 ID(Transaction ID)를 갖는 슬롯(S)을 형성하고, 형성된 슬롯 가운데 기본키(Primary Key)가 동일하되 전순위에 처리되는 전슬롯(FS)은 대기시키고, 후순위에 처리될 후슬롯(PS)은 부분배자(203)로 전송하는 주분배자(202) 및 전슬롯(FS)과 후슬롯(PS)을 제2데이터베이스(205)에 반영하는 반영자(204)를 포함한다.The database duplication system 1 includes a sensor 102 for detecting a query to be processed in a relation stored in a first database 103, a transmitter 103 for transmitting a query, a receiver for receiving a query transmitted from the transmitter 103 A slot S having a slot ID and a transaction ID is formed in the query received by the receiver 201 and the primary key among the formed slots is the same, (PS) to the partial embosser 203 and the entire slot FS and the after slot PS to the second database 202. The slot escort 202 is a slot for transferring the slot PS to the partial embosser 203, And reflectors 204 that reflect the results of the analysis.

여기서, 제1데이터베이스(101)는 데이터베이스 관리 시스템인 메인장비(10)에 설치되고, 제2데이터베이스(205)는 데이터베이스 관리 시스템인 이중화장비(20)에 설치될 수 있다. 데이터베이스 관리 시스템은 사용자와 데이터베이스 사이에서 쿼리에 따라 정보를 생성 및 조작할 수 있다.Here, the first database 101 may be installed in the main equipment 10, which is a database management system, and the second database 205 may be installed in the duplication equipment 20, which is a database management system. A database management system can generate and manipulate information between a user and a database according to a query.

이하, 데이터베이스 이중화 시스템(1)을 구성하는 구성요소들에 대해 상세히 설명한다.Hereinafter, the components constituting the database duplication system 1 will be described in detail.

감지기(102)는 메인장비(10)에 포함된 제1데이터베이스(101)에 저장된 하나의 릴레이션에 처리될 쿼리를 감지한다. 즉, 감지기(102)는 이중화 데이터를 감지한다. 일례로, 감지기(102)는 쿼리 처리기(Query Processor)로 형성될 수 있다.The sensor 102 detects a query to be processed in one relation stored in the first database 101 included in the main equipment 10. [ That is, the sensor 102 senses the redundant data. For example, the detector 102 may be formed of a query processor.

이러한 감지기(102)는 감지된 쿼리를 메인장비(10)에 포함된 송신기(103)에 전송할 수 있다.Such a sensor 102 may transmit the sensed query to the transmitter 103 included in the main equipment 10.

송신기(103)는 수신된 쿼리를 이중화장비(20)에 포함된 수신기(201)에 전송한다. 수신기(201)는 이중화장비(20)에 포함되어, 송신기(103)에서 송신한 쿼리 즉, 주문 데이터를 수신한다. 이때, 송신기(103)와 수신기(201)는 네트워크로 연결되어 주문 데이터를 원활히 송/수신할 수 있다.The transmitter 103 transmits the received query to the receiver 201 included in the duplication equipment 20. The receiver 201 is included in the duplication equipment 20 and receives a query transmitted from the transmitter 103, that is, order data. At this time, the transmitter 103 and the receiver 201 can be connected to each other via a network to smoothly transmit / receive order data.

주분배자(202)는 이중화장비(20)에 반영되어야 할 데이터가 어떤 것이 있는지 판단하여 반영자(204)에 분배한다. 이러한 주분배자(202)는 이중화장비(20)에 포함되고, 수신기(201)에서 수신된 쿼리에서 슬롯 ID(Slot ID)와 트랜잭션 ID(Transaction ID)를 갖는 슬롯(S)을 적어도 하나 추출할 수 있다.The manger 202 determines which data to be reflected in the duplication equipment 20 and distributes to the reflector 204. This middleman 202 is included in the duplication equipment 20 and is capable of extracting at least one slot S having a slot ID (Slot ID) and a transaction ID (Transaction ID) in a query received by the receiver 201 have.

이때, 주분배자(202)는 하나의 주문 쿼리가 진행된 후, 하나의 커밋(commit) 쿼리를 진행하며 하나의 트랜잭션 ID를 갖는 슬롯을 생성한다. 그리고, 생성된 슬롯을 락(lock)하여 하나의 트랜잭션이 사용하는 데이터에 다른 트랜잭션이 접근하지 못하도록 할 수 있다. At this time, the scorer 202 proceeds with one commit query and generates a slot having one transaction ID. Then, the created slot can be locked to prevent another transaction from accessing the data used by one transaction.

또한, 주분배자(202)는 형성된 슬롯 가운데 앞서 처리된 내용을 변경하는 내용을 포함하는 쿼리를 진행하는 슬롯은 앞선 형성된 슬롯 ID와 동일한 슬롯 ID로 슬롯을 형성한다. 즉, 주분배자(202)는 기본키가 동일 앞서 처리되는 쿼리를 변경하는 후슬롯을 형성할 수 있다.Also, the slot machine 202 forms a slot with a slot ID that is the same as the previously formed slot ID, in a slot for which a query including a content for changing contents processed before is formed among slots formed. That is, the mimeograph 202 can form a slot after the primary key changes the query to be processed the same as before.

주분배자(202)는 앞서 처리되는 쿼리를 포함하는 전슬롯은 대기시키고, 후처리되는 쿼리를 포함하는 후슬롯은 부분배자(203)로 전송한다. 즉, 주분배자(202)는 수신된 쿼리에서 슬롯 ID와 트랜잭션 ID를 갖는 슬롯을 생성한 후, 일부 슬롯은 대기시키고 나머지 일부 슬롯은 부분배자(203)로 넘긴다.The mip-distributor 202 waits for all slots including the query to be processed before, and transmits the post-slot including the post-processed query to the partial accumulator 203. [ That is, after the pseudo multiplier 202 generates a slot having the slot ID and the transaction ID in the received query, some of the slots are queued and the remaining slots are transferred to the partial embedder 203.

여기서, 슬롯은 1개의 레코드를 저장할 수 있는 공간을 의미한다. 이러한 슬롯은 기본키(Primary Key), 트랜잭션 ID를 포함할 수 있고, 기본키가 동일한 슬롯을 찾아 릴레이션의 내용을 변경할 수 있다.Here, a slot means a space in which one record can be stored. These slots can contain a primary key, a transaction ID, and can change the contents of a relation by finding the slot with the same primary key.

주분배자(202)와 부분배자(203)는 서로 다른 트랜잭션 ID를 갖는 트랜잭션이 동일한 기본키를 갖는 릴레이션을 수정하기 원하는 경우, ID가 다른 트랜잭션이 레코드를 동시에 처리하지 못하도록 한다. The escrow 202 and the partial escrow 203 prevent transactions with different IDs from simultaneously processing records if a transaction having different transaction IDs wants to modify a relation having the same primary key.

이와 같이, 주분배자(202)와 부분배자(203)는 트랜잭션을 처리하며 트랜잭션의 독립성을 확보할 수 있다. 이러한 주분배자(202)와 부분배자(203)의 동작에 대해서는 후술하여 구체적으로 설명하도록 한다.Thus, the mip coin 202 and the partial coin 203 process transactions and ensure the independence of the transaction. The operation of the midsubstrate 202 and the partial accumulator 203 will be described later in detail.

반영자(204)는 슬롯에 저장된 레코드를 제2데이터베이스(205)에 반영하는 역할을 한다. 즉, 반영자(204)는 전슬롯(FS)과 후슬롯(PS)을 제2데이터베이스(205)에 반영한다. 이러한 반영자(204)의 개수에 대응하여 트랜잭션을 동시에 처리할 수 있다. 일례로, 반영자의 개수가 4개인 경우, 4개의 트랜잭션을 동시에 처리할 수 있다.The reflector 204 reflects the record stored in the slot in the second database 205. That is, the reflector 204 reflects the entire slot FS and the after-slot PS in the second database 205. It is possible to simultaneously process transactions corresponding to the number of such reflectors 204. [ For example, if the number of reflectors is four, four transactions can be processed at the same time.

이하, 도 2 내지 도 4를 참조하여, 데이터베이스 이중화 시스템이 복수 개의 처리내용을 트랜잭션하는 상태에 대해 설명한다.Hereinafter, with reference to FIG. 2 to FIG. 4, a description will be given of a state in which the database duplication system transacts a plurality of processing contents.

도 2는 도 1의 이중화장비가 수신된 쿼리로부터 슬롯ID 및 트랜잭션 ID를 추출하여 나타낸 표이고, 도 3은 도 1의 데이터베이스 이중화 시스템의 주분배자와 부분배자의 동작을 개념적으로 도식한 개념도이고, 도 4는 도 3의 주분배자와 부분배자의 동작에 의해 쿼리가 처리되며 나타난 릴레이션이다.FIG. 2 is a table showing the slot ID and the transaction ID extracted from the received query of the redundant equipment of FIG. 1. FIG. 3 is a conceptual diagram conceptually illustrating operations of a pseudo embedment and a partial embedder of the database duplication system of FIG. FIG. 4 is a relation in which a query is processed by the operation of the main divider and the partial divider in FIG.

일례로, 도 2의 (a)에 도시된 바와 같이, 12개의 쿼리가 수신기(201)에 수신되면, 주분배자(202)는 수신된 쿼리에서 도 2의 (b)에 도시된 바와 같이 슬롯 ID와 트랜잭션 ID를 추출한다. 일례로, 주분배자(202)는 도 2의 (b)에 도시된 바와 같이, 제1쿼리에‘열(column)의 값이 AA인 새로운 레코드를 삽입’하라는 쿼리와 제2쿼리에‘트랜잭션을 커밋한다.’라는 쿼리가 수신되면 제1쿼리와 제2쿼리에 대해서는 트랜잭션 ID와 슬롯 ID의 값을 1로 추출한다.As shown in FIG. 2 (a), when 12 queries are received at the receiver 201, the pivot divider 202 extracts the slot IDs as shown in FIG. 2 (b) And the transaction ID. For example, as shown in FIG. 2 (b), the scorer 202 inserts a query to insert a new record having a column value of AA in the first query and a query to insert a new transaction in the second query Commit 'is received, the value of the transaction ID and the slot ID is extracted as 1 for the first query and the second query.

그리고, 제3쿼리에‘열(column)의 값이 BB인 새로운 레코드를 삽입’하라는 쿼리와 제4쿼리에‘트랜잭션을 커밋한다.’라는 쿼리가 수신되면 제3쿼리와 제4쿼리에 대해서는 트랜잭션 ID와 슬롯 ID의 값을 2로 추출한다.When a query to insert a new record having a column value of BB in the third query and a query of 'commit the transaction' are received in the fourth query, The value of ID and slot ID is extracted as two.

제5쿼리에‘열(column)이 값이 AA인 레코드의 두 번째 열(column)을 BB로 변경’하라는 쿼리와 제6쿼리에‘트랜잭션을 커밋한다.’라는 쿼리가 수신되면 제5쿼리와 제6쿼리에 대해서는 트랜잭션 ID의 값을 3으로 추출하고, 슬롯 ID의 값을 1로 추출한다.In the fifth query, when the query that the column is changed to the BB in the second column of the record having the value AA is received and the query 'commit the transaction' is received in the sixth query, For the sixth query, the value of the transaction ID is extracted as three, and the value of the slot ID is extracted as one.

제7쿼리에‘열(column)이 값이 CC인 레코드를 삽입’하라는 쿼리와 제8쿼리에‘트랜잭션을 커밋한다.’라는 쿼리가 수신되면 제7쿼리와 제8쿼리에 대해서는 트랜잭션 ID의 값을 4로 추출하고, 슬롯 ID의 값을 3로 추출한다.When a query that inserts a record having a column value of CC in the seventh query and a query of 'commit the transaction' is received in the eighth query, the value of the transaction ID for the seventh and eighth queries Is extracted as 4, and the value of the slot ID is extracted as 3.

그리고, 제9쿼리에‘열(column)이 값이 CC인 레코드의 두 번째 열(column)을 DD로 변경’하라는 쿼리와 제10쿼리에‘트랜잭션을 커밋한다.’라는 쿼리가 수신되면 제9쿼리와 제10쿼리에 대해서는 트랜잭션 ID 값을 5로 추출하고, 슬롯 ID의 값은 3으로 추출한다.If the query to 'change the second column of the record whose column value is CC to DD' is received in the ninth query and the query 'commit the transaction' is received in the tenth query, For the query and the tenth query, the transaction ID value is extracted as 5 and the slot ID value is extracted as 3.

그리고, 제11쿼리에‘열(column)의 값이 EE인 새로운 레코드를 삽입’하라는 쿼리와 제12쿼리에‘트랜잭션을 커밋한다.’라는 쿼리가 수신되면 제11쿼리와 제12쿼리에 대해서는 트랜잭션 ID값을 6으로 추출하고, 슬롯 ID값을 4로 추출한다.When a query to insert a new record having a column value of EE is received in the eleventh query and a query 'commit transaction' is received in the twelfth query, The ID value is extracted as 6, and the slot ID value is extracted as 4.

이러한 방식으로 주분배자(202)는 두 개의 쿼리에 한 개의 트랜잭션 ID 그리고 하나의 슬롯 ID를 추출할 수 있다. 이때, 슬롯에 형성되는 ID은 슬롯이 처리하는 내용이 앞서 처리된 내용과 연관이 있는 경우, 앞서 슬롯에 형성된 ID와 동일한값으로 형성된다.In this manner, the quotient master 202 can extract one transaction ID and one slot ID in two queries. At this time, the ID formed in the slot is formed to have the same value as the ID formed in the slot in advance if the contents to be processed by the slot are related to the previously processed contents.

주분배자(202)는 트랜잭션 ID와 슬롯 ID가 추출된 슬롯 가운데 기본키(P.K: Primary Key)가 동일하되, 전순위에 처리되는 전슬롯(FS)은 대기시키고, 후순위에 처리되는 후슬롯(PS)은 부분배자(203)로 전송한다.The pseudo-multiplier 202 waits for all the slots FS to be processed in the previous order, and the post-slot (PS To the partial embosser 203.

즉, 주분배자(202)는 반영자(204)에게 당장 분배할 수 있는 슬롯은 반영자(204)에게 보내고 그렇지 않고 대기 한 후 처리되어야 할 슬롯은 부분배자(203)에 전송하여 처리한다.That is, the slot machine 202 sends the slot that can be immediately distributed to the reflector 204 to the reflector 204, and the slot to be processed after the slot is not processed is transmitted to the partial embosser 203 for processing.

부분배자(203)는 전슬롯의 기본키와 동일한 기본키를 갖는 후슬롯(PS)을 전슬롯(FS)을 처리한 반영자(204)에 전송하여 처리될 수 있도록 한다. 이때, 부분배자(203)는 주분배자(202)에서 반영자(204)로 넘긴 슬롯이 릴레이션에 다 반영되는 동안 대기하고 있다가, 완료되면 반영자(204)에 후슬롯(PS)을 동시에 넘기며 동시에 처리될 수 있도록 한다.The partial embosser 203 transmits a post-slot (PS) having the same basic key as the basic key of all the slots to the reflector 204 that has processed the entire slot (FS) so that it can be processed. At this time, the partial embosser 203 waits while the slot passed from the main embosser 202 to the reflector 204 is reflected in the relation, and if completed, passes the next slot PS simultaneously to the reflector 204 So that they can be processed simultaneously.

이와 같이, 주분배자(202)와 부분배자(203)가 트랜잭션 ID와 슬롯 ID가 추출된 슬롯을 반영자(204)에 넘기며 처리되도록 하며, 제2데이터베이스(205)에 도 4에 도시된 바와 같이 기본키가 1인 두 번째 열인 β열의 AA이 BB로 변경되고, 기본기가 4인 두 번째 열인 CC가 DD로 변경된 릴레이션이 반영될 수 있도록 한다.As shown in FIG. 4, the main database 202 and the partial database 203 transfer the slot from which the transaction ID and the slot ID are extracted to the reflector 204 and are processed in the second database 205, The second column of the primary key is 1, the AA of the β column is changed to BB, and the CC of the second base of 4 is reflected to the DD.

이하, 지금까지 설명한 데이터베이스 이중화 시스템(1)에 대한 설명을 바탕으로 본 발명의 일 실시예에 의한 데이터베이스 이중화 방법에 대해 설명하도록 한다.Hereinafter, a database duplication method according to an embodiment of the present invention will be described based on the description of the database duplication system 1 described so far.

데이터베이스 이중화 방법은 메인장비의 제1데이터베이스(101) 가운데 처리될 쿼리(Query)를 감지하여, 쿼리를 제2데이터베이스(205)를 포함하는 이중화장비의 수신기에 전송하는 (A)단계를 시작한다.The database duplication method starts the step (A) of sensing the query to be processed among the first database 101 of the main equipment and transmitting the query to the receiver of the duplication equipment including the second database 205.

(A)단계 이후, 쿼리로부터 제1데이터베이스에 저장된 릴레이션의 레코드에 적용될 기본키(Primary Key)를 갖는 슬롯 ID와 트랜잭션 ID를 갖는 슬롯을 추출하는 (B)단계를 진행한다.After step (A), step (B) is performed to extract a slot having a slot ID and a transaction ID having a primary key to be applied to a record of a relation stored in the first database from the query.

슬롯 ID와 트랜잭션 ID이 할당된 슬롯이 추출되면, 슬롯을 락(Lock)하는 (C)단계를 진행한다.When the slot to which the slot ID and the transaction ID are allocated is extracted, the process proceeds to step (C) of locking the slot.

이후, 슬롯 가운데 기본키가 동일하되, 전순위에 처리되는 전슬롯(FS)은 주분배자에서 대기시키고, 후순위에 처리되는 후슬롯은 부분배자로 전송하는 (D)단계를 진행한다.Thereafter, the process proceeds to step (D) in which all slots (FS) having the same basic key among the slots are queued in the main distributor and the post slots processed in the rearrangement are transferred to the partial distributor.

(D)단계가 완료되면, 전슬롯(FS)과 후슬롯(PS)을 반영자(204)에 할당하는 (E)단계를 진행한다. 이후, 전슬롯(FS)이 할당된 반영자(204)로 메인래퍼런스 카운트(Main Reference Count)를 증가시키고, 후슬롯(PS)이 할당된 반영자(204)로 서브래퍼런스 카운트(Sub Reference Count)를 증가시키는 (F)단계를 진행한다.When the step (D) is completed, the process goes to step (E) of allocating all slots (FS) and a rear slot (PS) to the reflector (204). Thereafter, the main reference count is increased by the reflector 204 to which the entire slot FS is allocated, and the sub reference count is applied to the reflector 204 to which the next slot PS is allocated. (F).

이후, 전슬롯의 락과 후슬롯의 락을 해지하는 (G)단계를 진행한다.Thereafter, the process goes to step (G) of releasing the lock of all the slots and the lock of the after slots.

데이터베이스 이중화 방법은 (A)단계 내지 (G)단계를 일련의 단계로 진행하며, 쿼리를 트랜잭션 하는 속도를 높여, 원격지 서버에 트랜잭션의 병목현상이 발생되지 않도록 할 수 있다.The database duplication method proceeds from step (A) through step (G) to a series of steps, which speeds up the transaction of the query, thereby preventing the bottleneck of the transaction to the remote server.

이와 같은 데이터베이스 이중화 방법에 있어, 주분배자(202)의 작동은 도 5의 순서도를 기준으로 작동되고, 부분배자(203)의 작동은 도 6의 순서도를 기준으로 작동된다.In such a database duplication method, the operation of the mul- tipractor 202 is operated on the basis of the flowchart of Fig. 5, and the operation of the partial embosser 203 is operated on the basis of the flowchart of Fig.

도 5는 도 1의 데이터베이스 이중화 시스템의 주분배자의 동작과정을 나타낸 순서도이고, 도 6은 도 1의 데이터베이스 이중화 시스템의 부분배자의 동작과정을 나타낸 순서도이다.FIG. 5 is a flowchart illustrating an operation procedure of a main distributor of the database duplication system of FIG. 1, and FIG. 6 is a flowchart illustrating an operation of a partial replication system of the database duplication system of FIG.

도 5와 도 6에 도시된 주분배자와 부분배자의 동작과정은 도 2를 참조하여 설명하도록 한다.The operation of the main distributor and the partial distributor shown in FIGS. 5 and 6 will be described with reference to FIG.

주분배자(202)는 도 2(b)에 도시된 바와 같이, 수신된 쿼리에서 슬롯 ID와 트랜잭션 ID를 추출한다(S110). 이때, 쿼리는 주분배자(202)가 트랜잭션 ID와 슬롯 ID를 추출할 수 있도록 특정 정보를 포함할 수 있다.As shown in FIG. 2 (b), the scrivener 202 extracts the slot ID and the transaction ID from the received query (S110). At this time, the query may include specific information so that the pseudo distributor 202 can extract the transaction ID and the slot ID.

이후, 주분배자(202)는 추출된 슬롯의 동시성 제어를 위해 슬롯 락(lock)을 거는 단계를 진행한다(S120). 이때, 부분배자(203) 또는 커밋의 처리로 인하여 슬롯에 락이 걸리지 않은 경우 일정시간 대기한 후 슬롯에 락이 건다(S121). 이후, 락이 걸린 슬롯 가운데 기본키가 동일하되, 전순위에 처리되는 전슬롯(FS)은 대기시키고, 기본키가 동일하되 후순위에 처리되는 후슬롯(PS)은 부분배자(203)로 전송한다.Thereafter, the pivot divider 202 proceeds to step S120 for locking a slot for concurrency control of the extracted slot. At this time, if the slot is not locked due to the partial embossment 203 or the commit process, the slot is locked after waiting for a predetermined time (S121). Thereafter, all slots (FS) that are the same in the primary key among the locked slots are the same, but all the slots (FS) processed in the previous order are queued, and the post slot (PS) having the same primary key but processed in the latter is transmitted to the partial embosser 203.

이때, 부분배자(203)에서 슬롯을 처리 대기 중이라면, 서브래퍼런스 카운트(Sub Reference Count)를 증가시켜, 전송될 후슬롯(PS)이 대기되도록 한다.At this time, if the partial embosser 203 is waiting to process a slot, the sub reference count is increased and the slot PS to be transmitted is queued.

또한, 주분배자(202)는 전슬롯(FS)에 설정된 슬롯 ID와 트랜잭션 ID로 적절한 반영자(204)가 존재하는지 판단한다(S140). 이때, 전슬롯(FS)이 사용 중이 아닐 경우에는 전슬롯(FS)에 반영자(204) 정보를 저장한다(S141). 이후, 반영자(204)에 쿼리에 설정된 트랜잭션 ID와 주분배자에서 추출된 트랜잭션ID를 비교하여 동일한지를 판별한다(S150). 이때, 쿼리에 설정된 트랜잭션 ID와 추출된 트랜잭션 ID가 동일하여 반영자가 동일한 경우, 메인래퍼런스 카운트(Main Reference Count)를 증가시킨다. 반면, 반영자(204)가 상이한 경우, 서브래퍼런스 카운트(Sub Referebce Count)를 증가시킨다.In addition, the mip distributor 202 determines whether there is an appropriate reflector 204 based on the slot ID and the transaction ID set in the entire slot FS (S140). At this time, if the entire slot FS is not in use, information on the reflector 204 is stored in all slots FS (S141). Thereafter, the transaction ID set in the query is compared with the transaction ID extracted from the main database in the reflector 204 (S150). At this time, when the transaction ID set in the query and the extracted transaction ID are the same and the reflectors are the same, the main reference count is increased. On the other hand, if the reflector 204 is different, it increases the sub referee count.

이후, 메인래퍼런스 카운트와 서브래퍼런스 카운트를 증가시킨 슬롯의 락을 해지하여, 다른 트랜잭션이 접근할 수 있도록 한다.Thereafter, the lock of the slot with the increased main reference count and sub-reference count is released, allowing other transactions to be accessed.

부분배자(203)는 전술한 주분배자(202)에서 슬릇이 부분배자(203)로 분류되어 작동하는 것으로 시작한다(S151). 이후, 부분배자(203)는 분류된 슬롯의 동시성 제어를 위하여 후슬롯(PS)에 락을 거는 것으로 진행된다(S161).The partial embosser 203 starts with the slab being classified as a partial embossment 203 and operating in the above-mentioned coin embosser 202 (S151). Thereafter, the partial embosser 203 proceeds to lock the post-slot PS for concurrency control of the classified slot (S161).

이때, 커밋의 처리로 인하여 후슬롯(PS)에 락이 걸리지 않은 경우 일정시간 대기한 후, 후슬롯(PS)에 락이 걸리도록 한다(S183).At this time, if the lock is not applied to the back slot (PS) due to the process of the commit, the lock is applied to the back slot (PS) after waiting for a predetermined time (S183).

락이 걸린 후슬롯(PS) 가운데, 반영자(204)에 후슬롯(PS)이 반영되지 않은 경우, 후슬롯(PS)에 반영자(204) 정보를 저장한다(S172). 한편, 반영자(204)에 후슬롯(PS)이 반영된 경우, 쿼리에 설정된 트랜잭션 ID와 후슬롯의 트랜잭션 ID를 비교하여 동일한지를 판별한다(S181). 이때, 쿼리에 설정된 트랜잭션 ID와 후슬릇의 트랜잭션 ID가 상이한 경우, 락을 해지한 후, 대기 및 재시도한다.If the backslot PS is not reflected in the reflector 204 after the lock is applied, the reflector 204 information is stored in the backslot PS at step S172. If the reflector 204 reflects the next slot PS, the transaction ID set in the query is compared with the transaction ID of the next slot to determine whether they are the same (S181). At this time, if the transaction ID set in the query differs from the transaction ID in the subsequent transaction, the lock is canceled, and the transaction is queued and retried.

반면, 반영자(204)가 동일한 경우, 서브래퍼런스 카운트(Sub Reference Count)를 증가시킨 후 다음 처리를 진행한다.On the other hand, if the reflector 204 is the same, the sub reference count is increased and then the next process is performed.

부분배자(203)에서는 대기중이었던 트랜잭션이 반영자(204)에서 처리되며, 대기중이었다는 정보인 서브래퍼러스 카운트를 감소시킨다(S191). 그리고 메인레버러스카운트를 증가시켜 처리중으로 상태를 변경한다(S201).In the partial accumulator 203, the transaction that was waiting is processed in the reflector 204, and the sub-wrapper count, which is information indicating that the transaction is waiting, is decreased (S191). The main lever count is increased to change the state during processing (S201).

이후, 후슬롯(PS)이 다른 트랜잭션을 처리할 수 있도록 락을 해지한다. Thereafter, the lock is released so that the next slot (PS) can process another transaction.

즉, 부분배자(203)는 대기중인 트랜잭션이 처리가 가능한 시점이 되면, 반영자로 넘겨 트랜잭션이 처리될 수 있도록 한다.That is, the partial accumulator 203 transfers the waiting transaction to the reflector so that the transaction can be processed.

이하, 도 7 및 도 8을 참조하여 반영자가 회수되는 과정 및 주분배자의 작동 과정과 반영자의 회수 과정의 연결되어 작동하는 것에 대해 설명하도록 한다.Hereinafter, the process of collecting the reflector and the operation of the main distributor and the process of collecting the reflector will be described with reference to FIGS. 7 and 8. FIG.

도 7은 도 1의 데이터베이스 이중화 시스템의 반영자를 회수하는 과정을 나타낸 순서도이고, 도 8은 도 4의 주분배자의 작동 과정과 도 6의 반영자의 회수 과정이 결합되는 지점을 개략적으로 나타낸 순서도이다.FIG. 7 is a flowchart showing a process of retrieving a reflector of the database duplication system of FIG. 1, FIG. 8 is a flowchart schematically showing a point where an operation process of the main distributor of FIG. 4 and a process of collecting the reflector of FIG. 6 are combined.

제2데이터베이스(205)에 트랜잭션이 반영되면, 트랜잭션 커밋 완료를 진행한다(S210). 이후, 현재 트랜잭션이 사용하고 있는 모든 슬롯 정보를 분배자의 메모리 등을 참조하여 얻는 단계를 진행한다(S220). 다음으로, 추출된 슬롯을 락(lock)하는 단계를 진행한다(S230).When the transaction is reflected in the second database 205, the transaction commit is completed (S210). Thereafter, the process advances to step S220 in which all slot information currently used by the transaction is obtained by referring to the distributor's memory or the like. Next, the extracted slot is locked (S230).

이때, 슬롯에 락이 걸리지 않은 경우 일정시간 대기한 후 슬롯에 락이 걸리도록 한다(S231). 반면, 슬롯에 락이 걸리는 경우, 메인래퍼런스 카운트와 서브래퍼런스 카운트를 감소하는 단계로 진입한다(S240). 이때, 트랜잭션 내 실행된 쿼리의 개수만큼 메인래퍼런스 카운트와 서브래퍼런스 카운트를 감소시킨다.At this time, if the slot is not locked, the slot is locked after waiting for a predetermined time (S231). On the other hand, if the slot is locked, the main reference count and sub-reference count are decreased (S240). At this time, the main reference count and sub-reference count are reduced by the number of queries executed in the transaction.

본 발명에서는 하나의 트랜잭션 ID에 하나의 주문쿼리를 포함하고 있기 때문에 1인 메인래퍼런스 카운트와 서브래퍼런스 카운트에서 1만큼 감소시켜준다.In the present invention, since one transaction ID includes one order query, it is reduced by one in the main reference count of one and in the sub-reference count.

이후, 메인레퍼런스 카운트와 서브래퍼런스 카운트가 0인지를 판단하는 단계를 진행한다(S250). 이때, 각 래퍼런스 카운트가 0이면 해당 슬롯의 반영자 정보를 삭제하는 단계(S260) 그리고 슬롯의 락을 해지하는 단계(S270)를 순차적으로 진행한다. Thereafter, it is determined whether the main reference count and the sub-reference count are 0 (S250). At this time, if the reference count is 0, step S260 of deleting the reflector information of the corresponding slot and step S270 of releasing the slot are sequentially performed.

반면, 각 래퍼런스 카운트가 0이 아니면 슬롯의 락을 해제하는 단계를 바로 진행한다. 이후, 더 이상 처리할 쿼리가 남아 있는지 확인한다.On the other hand, if the respective reference count is not 0, the process of releasing the lock of the slot proceeds immediately. After that, make sure that there are no more queries to process.

더욱이, S260에서 반영자 정보를 슬롯에서 삭제하면, 도 5의 S140단계와 연결되어 반영자를 재할당하고, 쿼리를 계속적으로 수행해 나갈 수 있다. 다시, 도 7과 관련하여, 이후 현재 트랜잭션이 포함하고 있는 쿼리의 슬롯에 대해 처리를 완료했는지 확인한다.Furthermore, if the reflector information is deleted from the slot in step S260, the reflector may be reassigned in step S140 of FIG. 5 to continue the query. Referring again to FIG. 7, it is confirmed whether or not the processing of the slot of the query included in the current transaction has been completed.

이와 같은 방법을 반복하여 슬롯 내 할당된 반영자들을 모두 회수하고, 각 슬롯에 새로운 트랜잭션이 접근할 수 있도록 한다.This method is repeated to retrieve all the allocators allocated in the slot, and to allow a new transaction to access each slot.

도 9는 종래기술과 데이터베이스 이중화 시스템의 트랜잭션 수행에 소비되는 시간을 나타낸 도면이다.FIG. 9 is a diagram showing time consumed in the transaction execution of the conventional technology and the database duplication system.

도 9의 (a)는 종래의 방식에 따른 트랜잭션 수행에 따른 시간을 나타낸 도면이고, (b)는 본 발명에 따른 트랜잭션 수행에 따른 시간을 나타낸 도면이다.FIG. 9A is a diagram illustrating a time according to a transaction according to a conventional method, and FIG. 9B is a diagram illustrating a time according to a transaction according to the present invention.

도 9의 (a)에서 보는 바와 같이, 하나의 트랜잭션을 처리하는데 있어, 앞선 트랜잭션을 처리하는데 까지 대기해야 하는 방법은 처리하는 레코드가 다름에도 하나의 반영자를 이용한다. 따라서, 하나의 트랜잭션이 처리된 이후, 나머지 트랜잭션들이 처리되므로 전체 트랜잭션을 완료하는데 오랜 시간이 걸린다.As shown in FIG. 9 (a), in order to process one transaction, a method of waiting until processing of the preceding transaction uses one reflector even if the records to be processed are different. Thus, after one transaction is processed, the rest of the transactions are processed, so the entire transaction takes a long time to complete.

반면, 도 9(b)에서 보는 바와 같이, 본 발명의 데이터베이스 이중화 방법은 기본키가 상이한 트랜잭션 ID 1, 트랜잭션 ID 2, 트랜잭션 ID 4 및 트랜잭션 ID 6은 주분배자(202)에서 병렬로 수행한다. 그리고, 트랜잭션 ID 2와 기본키가 동일한 트랜잭션 ID 3과 트랜잭션 ID 4와 동일한 트랜잭션 ID 5를 부분배자(203)에서 병렬로 수행한다.9 (b), in the database duplication method of the present invention, transaction ID 1, transaction ID 2, transaction ID 4, and transaction ID 6 having different primary keys are executed in parallel on the main distributor 202. Then, in the partial embosser 203, the transaction IDs 3 and 4, which are identical to the transaction IDs 2 and 3, are executed in parallel.

이와 같이, 주분배자(202)와 부분배자(203)는 트랜잭션을 병렬 처리하되, 부분배자(203)는 주분배자(202)의 트랜잭션이 완료된 후 처리한다. 따라서, 데이터베이스 이중화방법은 트랜잭션의 전체 처리 시간을 줄일 수 있다.In this manner, the coin transfer 202 and the partial coin 203 process the transactions in parallel, while the partial coin 203 processes the transactions after the coin transfer 202 completes the transaction. Therefore, the database duplication method can reduce the total processing time of the transaction.

특히, 본 발명의 데이터베이스 이중화 방법은 트랜잭션이 많고, 많은 반영자를 생성하여 동시에 수행되는 트랜잭션이 많아지는 경우, 전체 데이터베이스를 이중화 하는데 소비되는 시간을 현격히 감소시킬 수 있다.In particular, in the database duplication method of the present invention, when there are many transactions and a large number of transactions are performed simultaneously by generating a large number of reflectors, the time spent in duplicating the entire database can be significantly reduced.

이상 첨부된 도면을 참조하여 본 발명의 실시예들을 설명하였지만, 본 발명이 속하는 기술분야에서 통상의 지식을 가진 자는 본 발명이 그 기술적 사상이나 필수적인 특징을 변경하지 않고서 다른 구체적인 형태로 실시될 수 있다는 것을 이해할 수 있을 것이다. 그러므로 이상에서 기술한 실시예들은 모든 면에서 예시적인 것이며 한정적이 아닌 것으로 이해해야 한다.
While the present invention has been described in connection with what is presently considered to be practical exemplary embodiments, it is to be understood that the invention is not limited to the disclosed embodiments, but, on the contrary, You will understand. It is therefore to be understood that the embodiments described above are in all respects illustrative and not restrictive.

1: 데이터베이스 이중화 시스템
10: 메인장비 101: 제1데이터베이스
102: 감지기 103: 송신기
20: 이중화장비 201: 수신기
202: 주분배자 203: 부분배자
204: 반영자 205: 제2데이터베이스
S: 슬롯 FS: 전슬롯
PS: 후슬롯
1: Database duplication system
10: main equipment 101: first database
102: Detector 103: Transmitter
20: Redundant equipment 201: Receiver
202: Jupiter embosser 203: partial embosser
204: Reflector 205: Second database
S: Slot FS: All slots
PS: after slot

Claims (8)

감지기가 메인장비의 제1데이터베이스 가운데 처리될 쿼리(Query)를 감지하여, 상기 쿼리를 제2데이터베이스를 포함하는 이중화장비의 수신기에 전송하는 (A)단계;
주분배자가 상기 쿼리로부터 상기 제1데이터베이스에 저장된 릴레이션의 레코드에 적용될 기본키(Primary Key)를 갖는 슬롯 ID와 트랜잭션 ID(Transaction ID)를 갖는 슬롯을 추출하되,
주분배자는 형성된 슬롯 가운데 앞서 처리된 내용을 변경하는 내용을 포함하는 쿼리를 진행하는 슬롯은 앞선 형성된 슬롯 ID와 동일한 슬롯 ID를 갖는 슬롯으로 형성하는 (B)단계;
주분배자가 추출된 상기 슬롯에 락(Lock)하는 (C)단계;
주분배자가 상기 슬롯 가운데 기본키(Primary Key)가 동일하되 전순위에 처리되는 전슬롯을 대기시키고, 상기 기본키가 동일하되 후순위에 처리되는 후슬롯은 부분배자로 전송하는 (D)단계;
상기 주분배자와 상기 부분배자가 상기 전슬롯과 상기 후슬롯을 반영자에 할당하는 (E)단계,
상기 주분배자는
상기 전슬롯이 할당된 상기 반영자로 메인래퍼런스 카운트(Main Reference Count)를 증가시키고, 상기 후슬롯이 할당된 상기 반영자로 서브래퍼런스 카운트(Sub Reference Count)를 증가시키는 (F)단계 및
상기 전슬롯의 락과 상기 후슬롯의 락을 해지하는 (G)단계를 포함하되, 상기 주분배자가 상기 전슬롯을 상기 반영자에 각각 전송하여 동시에 수행할 수 있도록 하는 단계,
상기 부분배자가 상기 전슬롯이 처리되면, 상기 후슬롯을 동시에 처리하는 단계,
상기 부분배자는 처리된 전슬롯과 기본키가 동일한 상기 후슬롯을 전슬롯을 처리한 반영자에 전송하는 단계,
상기 주분배자에서 상기 반영자로 넘긴 슬롯이 릴레이션에 다 반영되는 동안 대기하고 있다가 완료되면 상기 반영자에 후슬롯을 동시에 넘겨 상기 후슬롯을 동시에 처리하는 단계,를 포함하는 데이터베이스 이중화 방법.
(A) detecting a query to be processed among a first database of the main equipment and transmitting the query to a receiver of a duplication equipment including a second database;
The main distributor extracts a slot having a slot ID and a transaction ID having a primary key to be applied to a record of a relation stored in the first database from the query,
Wherein the main distributor forms a slot having a slot ID equal to the previously formed slot ID with a slot having a slot ID that is ahead of a formed slot,
(C) locking the slot in which the master distributor is extracted;
(D) a main distributor waiting for all the slots in which the primary key is the same among the slots but being processed in all the ranks, and transmitting the post-slot in which the primary key is the same but is processed in the rearrangement, to the partial embosser;
(E) allocating the entire slot and the partial slot to the reflector as the reflector,
The main distributor
Increasing (F) the main reference count to the reflector to which the all slots are allocated, and increasing the sub reference count to the reflector to which the after slot is allocated, and
(G) releasing the locking of the entire slot and the locking of the back slot so that the master distributor can simultaneously transmit the entire slot to the reflector to perform simultaneously,
Processing the post slots simultaneously when the partial slots have been processed;
Wherein the partial embedder comprises the steps of: transmitting, to the reflector that has processed the entire slot, the after-slot having the same primary key as the entire slot processed;
And a step of simultaneously waiting for a slot passed from the main distributor to the reflector to be reflected while being reflected in the relation, and if the slot is completed, passing the next slot to the reflector simultaneously and processing the next slot simultaneously.
삭제delete 삭제delete 제1항에 있어서,
상기 주분배자는 추출된 슬롯이 락이 되지 않을 경우, 상기 슬롯이 락이 될 때까지 대기하는 데이터베이스 이중화 방법.
The method according to claim 1,
Wherein the main distributor waits until the slot is locked when the extracted slot is not locked.
제1데이터베이스에 저장된 하나의 릴레이션에 처리될 쿼리를 감지하는 감지기;
상기 쿼리를 전송하는 송신기;
상기 송신기에서 전송되는 상기 쿼리를 수신하는 수신기;
상기 수신기에서 수신된 상기 쿼리에서 슬롯 ID(Slot ID), 트랜잭션 ID(Transaction ID)를 갖는 슬롯을 형성하고, 형성된 상기 슬롯 가운데 기본키(Primary Key)가 동일하되 전순위에 처리되는 전슬롯은 대기시키고, 후순위에 처리될 후슬롯은 부분배자로 전송하는 주분배자; 및
상기 전슬롯과 상기 후슬롯을 제2데이터베이스에 반영하는 반영자를 포함하되,
상기 주분배자는 상기 쿼리가 진행 된 후, 커밋(commit)쿼리를 진행하며 하나의 트랜잭션 ID 및 하나의 기본키를 포함하는 슬롯을 생성하고,
상기 전슬롯이 할당된 상기 반영자로 메인래퍼런스 카운트(Main Reference Count)를 증가시키고, 상기 후슬롯이 할당된 상기 반영자로 서브래퍼런스 카운트(Sub Reference Count)를 증가시키고,
상기 주분배자가 상기 전슬롯을 상기 반영자에 각각 전송하여 동시에 처리될 수 있도록 하고,
상기 부분배자는 전슬롯의 기본키와 동일한 기본키를 갖는 후슬롯을 전슬롯을 처리한 반영자에 전송하여, 상기 주분배자에서 상기 반영자로 넘긴 슬롯이 릴레이션에 다 반영되는 동안 대기하고 있다가 완료되면 상기 반영자에 후슬롯을 동시에 넘겨 상기 후슬롯이 동시에 처리될 수 있도록 하는, 데이터베이스 이중화 시스템.
A sensor for detecting a query to be processed in one relation stored in the first database;
A transmitter for transmitting the query;
A receiver for receiving the query transmitted from the transmitter;
A slot having a slot ID and a transaction ID is formed in the query received by the receiver, all slots in which the primary key is the same among the slots formed, And the slot after being processed at a subordinate position is transmitted to the partial embosser; And
And a reflector for reflecting the entire slot and the after-slot in a second database,
After the query is processed, the main distributor proceeds a commit query and generates a slot including one transaction ID and one primary key,
The main reference count is increased to the reflector to which the all slots are allocated, the sub reference count is increased to the reflector to which the next slot is allocated,
The main distributor transmits the entire slot to the reflector so that it can be processed simultaneously,
Wherein the partial embedder transmits a subsequent slot having a same basic key as the basic key of all the slots to a reflector that processes all slots, Wherein the slots are passed through to the reflector and are reflected in the relation, and if they are completed, the reflectors are simultaneously passed through the after-slots so that the after-slots can be processed simultaneously.
삭제delete 삭제delete 삭제delete
KR1020170063860A 2017-05-24 2017-05-24 Method for database replication and System for database replication KR101936787B1 (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
KR1020170063860A KR101936787B1 (en) 2017-05-24 2017-05-24 Method for database replication and System for database replication
CN201780084899.1A CN110300964B (en) 2017-05-24 2017-05-29 Database replication method and database replication system
PCT/KR2017/005573 WO2018216839A1 (en) 2017-05-24 2017-05-29 Database replication method and database replication system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020170063860A KR101936787B1 (en) 2017-05-24 2017-05-24 Method for database replication and System for database replication

Publications (2)

Publication Number Publication Date
KR20180128580A KR20180128580A (en) 2018-12-04
KR101936787B1 true KR101936787B1 (en) 2019-01-14

Family

ID=64396828

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020170063860A KR101936787B1 (en) 2017-05-24 2017-05-24 Method for database replication and System for database replication

Country Status (3)

Country Link
KR (1) KR101936787B1 (en)
CN (1) CN110300964B (en)
WO (1) WO2018216839A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102303895B1 (en) * 2020-03-12 2021-09-23 (주)선재소프트 Database Replication System With Improved Database Replication

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101549655B1 (en) 2013-07-11 2015-09-03 (주)선재소프트 Method of duplicating database using pararell-processing and computer readable storage media storing the same)

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8073820B2 (en) * 2008-04-07 2011-12-06 Sonics, Inc. Method and system for a database to monitor and analyze performance of an electronic design
EP2306319B1 (en) * 2009-09-14 2012-06-06 Software AG Database server, replication server and method for replicating data of a database server by at least one replication server
US10430298B2 (en) * 2010-10-28 2019-10-01 Microsoft Technology Licensing, Llc Versatile in-memory database recovery using logical log records
US9411866B2 (en) * 2012-12-19 2016-08-09 Sap Global Ip Group, Sap Ag Replication mechanisms for database environments
KR101605455B1 (en) * 2014-07-04 2016-03-22 (주)선재소프트 Method for Replicationing of Redo Log without Data Loss and System Thereof
US10078556B2 (en) * 2015-08-31 2018-09-18 Paypal, Inc. Data replication between databases with heterogenious data platforms
CN105574187B (en) * 2015-12-23 2019-02-19 武汉达梦数据库有限公司 A kind of Heterogeneous Database Replication transaction consistency support method and system

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101549655B1 (en) 2013-07-11 2015-09-03 (주)선재소프트 Method of duplicating database using pararell-processing and computer readable storage media storing the same)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102303895B1 (en) * 2020-03-12 2021-09-23 (주)선재소프트 Database Replication System With Improved Database Replication

Also Published As

Publication number Publication date
KR20180128580A (en) 2018-12-04
CN110300964B (en) 2022-11-08
WO2018216839A1 (en) 2018-11-29
CN110300964A (en) 2019-10-01

Similar Documents

Publication Publication Date Title
US7103586B2 (en) Collision avoidance in database replication systems
CN111143389B (en) Transaction execution method and device, computer equipment and storage medium
CN100445998C (en) Transactional file system
US8352490B2 (en) Method and system for locating update operations in a virtual machine disk image
EP3803618B1 (en) Distributed transactions in cloud storage with hierarchical namespace
US8224860B2 (en) Database management system
CN101567805B (en) Method for recovering failed parallel file system
US11768885B2 (en) Systems and methods for managing transactional operation
EP1241592A2 (en) Collision avoidance in Bidirectional database replication
CN101681383A (en) Data replication method and system for database management system
US20080033934A1 (en) Distributed query search
JP2012221419A (en) Information storage system and data duplication method thereof
CN101268439A (en) Database fragment cloning and management
US20080033925A1 (en) Distributed search analysis
CN110990399B (en) Reconstruction index method and device
KR101936787B1 (en) Method for database replication and System for database replication
US7194486B2 (en) Method and system for data processing with data replication for the same
US20030115206A1 (en) Method for fault tolerant modification of data representation in a large database
US20130006920A1 (en) Record operation mode setting
CN114127707A (en) System, computing node and method for processing write requests
CN106997305B (en) Transaction processing method and device
CN110121712B (en) Log management method, server and database system
Zhang et al. Dependency preserved raft for transactions
CN114020986B (en) Content retrieval system
JP2005293323A (en) Differential distribution record reflection system between different type rdbms

Legal Events

Date Code Title Description
A201 Request for examination
E902 Notification of reason for refusal
E701 Decision to grant or registration of patent right