CN101089857B - Internal store data base transaction method and system - Google Patents

Internal store data base transaction method and system Download PDF

Info

Publication number
CN101089857B
CN101089857B CN 200710119445 CN200710119445A CN101089857B CN 101089857 B CN101089857 B CN 101089857B CN 200710119445 CN200710119445 CN 200710119445 CN 200710119445 A CN200710119445 A CN 200710119445A CN 101089857 B CN101089857 B CN 101089857B
Authority
CN
China
Prior art keywords
transaction
operation
record
management module
log
Prior art date
Application number
CN 200710119445
Other languages
Chinese (zh)
Other versions
CN101089857A (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 CN 200710119445 priority Critical patent/CN101089857B/en
Publication of CN101089857A publication Critical patent/CN101089857A/en
Application granted granted Critical
Publication of CN101089857B publication Critical patent/CN101089857B/en

Links

Abstract

A method for managing affairs of internal memory databank includes setting up affairs management module, processing and submitting affairs, setting up journal execution affairs based on journal manage module, finalizing execution process of said affairs in affairs execution process by affairs management module after sub-affairs is executed and finalized if sub-affairs corresponding to said affairs is existed and using journal management module to set up journal corresponding to affairs set-up and processed as well as submitted by affairs management module. The system used for realizing said method is also disclosed.

Description

一种内存数据库事务管理方法及系统技术领域 The technical field of memory management method and system for database transactions

[0001] 本发明涉及计算机数据库领域,尤其涉及一种内存数据库事务管理方法及系统。 [0001] The present invention relates to computer databases, and in particular, to a memory management method and system for database transactions. 背景技术 Background technique

[0002] 内存数据库(MDB,Memory Database)区别于传统的磁盘型数据库,其所有的数据存取、数据流程处理都是驻留在内存中实现的。 [0002] The memory database (MDB, Memory Database) different from the traditional disk database, all of its data access, data flow processing is implemented reside in memory. 因此,相对于传统的磁盘型数据库,内存数据库的处理效率更高。 Thus, relative to conventional disk databases, higher processing efficiency memory database.

[0003] 在对数据访问频率及效率要求较高的系统中,尤其是在通信领域的一些设备系统中,内存数据库是一个必然的选择,其高效的访问处理能力为设备系统的性能提供了可靠的保证。 [0003] In the high frequency access data and system efficiency requirements, especially in some areas of the communication device system, the memory database is an inevitable choice, its ability to provide efficient access to the processing performance of the device for the reliable system guarantee. 随着应用系统处理能力的提高,对内存数据库处理数据能力的要求也越来越高,数据处理流程也越来越复杂,在进行复杂流程处理的过程中,一旦在处理的过程中发生失败, 那么之前修改的数据就会影响其它流程的正常处理。 With the improvement of the processing capability of the application system, the memory requirements of database data processing capabilities have become more sophisticated, more and more complex data processing procedures, the process flow of processing performed in the complex, once failure occurs during processing, Well before the modified data will affect the normal processing of other processes. 因此,为了保证访问数据的完整性,内存数据库就需要具备事务处理机制。 Therefore, in order to ensure the integrity of access to data, you need to have memory database transaction processing mechanism.

[0004] 电信系统,特别是在分布式数据的电信系统中,内存数据库分布在系统的若干个处理单元上,很多数据处理流程都需要跨越不同处理单元访问内存数据库,以下简称之为跨越式访问,因此,也需要事务处理机制在分布式系统上保证访问数据的完整性。 [0004] telecommunication system, particularly in a telecommunication system with distributed data, the memory database distributed over several processing units of the system, a lot of data processing procedures required across different access memory database processing unit, hereinafter referred to as access Leap and, therefore, we need to ensure the integrity of the transaction mechanism to access data on a distributed system. 专利号为US6457021,名称为“h-memory databasesystem”的专利公开了一种内存数据库事务处理的实现方式,但是该专利仅提出一种单处理机中内存数据库事务处理的实现方式,并未涉及由多处理机分布式内存数据库事务处理的方法,而且该专利提出的单处理机内存数据库事务处理的实现方式相对复杂,也没有对事务异常死锁的保护方法,因此,该专利并不适用于电信系统中内存数据库系统的开发使用。 Patent No. US6457021, entitled "h-memory databasesystem" patent discloses a way to realize the database memory transaction, this patent proposes implementations only a single-processor memory database in a transaction, it does not relate to the the method of distributed memory multiprocessors database transaction processing, and a relatively complicated implementation uniprocessor memory database transactions proposed in this patent, there is no abnormal transaction deadlock protection method, therefore, this patent does not apply to the telecommunications systems developed using in-memory database system.

[0005] 另外,在内存数据库事务处理过程中,包括一个重要的事务处理方式,称为数据回滚。 [0005] Further, in-memory database transaction processing, including a significant transaction mode, called data rollback. 内存数据库在执行数据回滚过程中,往往需要占用其大量的内存空间来存储数据的历史记录,由于内存数据库是一种共享式数据库,在实现事务系统时,也应该尽量减少其对非常宝贵的内存资源的占用,因此,如何平衡内存资源占用与事务处理效率这一矛盾是内存数据库事务处理需要解决的一个主要问题。 Memory database in the execution data rollback process, often need to take it a lot of memory space to store historical data, because the shared memory database is a database, when implementing transactional systems, should also try to reduce its invaluable memory resources, and therefore, how to balance the memory resource consumption and transaction processing efficiency of this contradiction is a major problem in-memory database transaction processing need to be addressed. 发明内容 SUMMARY

[0006] 有鉴于此,本发明的目的在于提供一种内存数据库事务管理方法及系统。 [0006] In view of this, an object of the present invention is to provide a database management method and system memory transaction. 该方法及系统克服现有内存数据库中缺乏事务处理系统且无法满足分布式数据系统中事务性处理要求的困难,为内存数据库中数据的一致性及安全性提供可靠保障,并大大减少数据回滚所占用的内存数据库的存储空间。 The method and system overcome the existing lack of memory database transaction processing system and difficult transactional processing requirements of distributed data systems can not be met, provide a reliable guarantee for the consistency and security of data in the database memory, and greatly reduces the data rollback storage space occupied by memory database.

[0007] 本发明提供了一种内存数据库事务管理方法,包括: [0007] The present invention provides a memory database transaction management method, comprising:

[0008] 事务管理模块创建、处理和提交事务,并根据日志管理模块创建的日志执行事务, 在事务执行过程中,如果存在与该事务相应的子事务,事务管理模块需要在子事务执行完成后,完成该事务的执行过程;[0009] 日志管理模块创建和管理与事务管理模块创建、处理和提交事务相应的日志;其中该方法所述日志包括操作日志和数据日志,其中,操作日志记录事务执行过程中访问内存数据库的所有操作;数据日志分布于内存数据库处理系统内的数据表中,用于保存数据的历史记录,数据日志的记录方式取决于与其对应的操作日志。 [0008] Transaction management module creates, processing, and commits the transaction, according to the log transaction log management module created during the transaction, if there is corresponding to the transaction sub-transaction, transaction management module needs after a child transaction execution completion performing the transaction process is completed; [0009] the log management module to create and manage the transaction management module creates the process and submit the appropriate transaction log; said method wherein the operation logs and log data, which operation log record transactions All operations performed during access memory database; distributed in the data log memory database processing system, a data table, storing data for history, recording data corresponding to the log depends on operation logs.

[0010] 该方法所述处理事务包括对内存数据库中记录的读取、修改、删除和插入。 [0010] The transaction processing method comprising the records in the database memory read, modify, delete and insert.

[0011] 该方法所述事务管理模块处理事务的过程包括: [0011] The method of the transaction processing services procedure management module comprises:

[0012] 事务管理模块接收用户发送的事务请求消息,返回确认消息和事务编号给用户; 事务管理模块接收用户根据事务编号发送的开始处理事务消息,开始处理事务。 [0012] Transaction management module receives the transaction request message sent by the user, a transaction number and returns an acknowledgment message to the user; transaction management module receives a user message according to begin processing transactions sent by the transaction number, transaction start processing.

[0013] 该方法所述事务管理模块提交事务的过程包括: [0013] The method processes the transaction commits the transaction management module comprises:

[0014] 事务管理模块接收用户发送的事务提交请求消息,进行事务提交; [0014] Transaction management module transmits the received user transaction commit request message, the transaction commits;

[0015] 事务管理模块根据事务编号查找操作日志,将所有与该事务相关的操作记录取出; [0015] Transaction management module number from the transaction log lookup operation, all related to the transaction record extraction operation;

[0016] 事务管理模块根据操作记录中存储的数据表标识,数据记录号定位到目标记录; [0016] The transaction management module table identifies the data stored in the operation record, the data record number to locate the target record;

[0017] 如果目标记录的事务操作标识为事务删除,则删除该目标记录; [0017] If the transaction identity of the target operating records for the transaction to delete, delete the target record;

[0018] 如果目标记录的事务操作标识为事务修改,则删除数据记录号中的事务操作标识,并删除与数据记录号扩展对应的目标记录; [0018] If the transaction operation identifier for the transaction to modify the target record, the delete operation transaction identification record number in the data, and deletes a target record number data record corresponding to the extension;

[0019] 如果目标记录的事务操作标识为事务读取,则删除数据记录号中的事务操作标识; [0019] If the target operation identifier transaction record is read transaction, the transaction data record delete operation in the identification number;

[0020] 如果目标记录的事务操作标识为事务插入,则删除数据记录号中的事务操作标识; [0020] If the transaction identified target recording operation is inserted into the transaction, deleting the transaction operation in the identification number of the data record;

[0021] 事务管理模块删除事务对应的所有操作日志记录,并且删除事务信息,事务提交结束。 [0021] Transaction management module deletes the transaction log records all the operations corresponding, and delete transaction information, transaction commits an end.

[0022] 该方法所述事务管理模块处理事务失败后,进行数据回滚,过程如下: [0022] The method of the post-processing transaction management module transaction failure, rollback of data, as follows:

[0023] 事务管理模块接收用户发送的回滚请求消息,进行回滚; [0023] Transaction management module receives the request message sent by the user rollback, rollback;

[0024] 事务管理模块根据事务编号查找操作日志,将所有与该事务相关的操作记录取出; [0024] Transaction management module number from the transaction log lookup operation, all related to the transaction record extraction operation;

[0025] 事务管理模块根据操作记录中存储的数据表标识,数据记录号定位到目标记录; [0025] The transaction management module table identifies the data stored in the operation record, the data record number to locate the target record;

[0026] 如果目标记录的事务操作标识为事务插入,则删除该目标记录; [0026] If the transaction operation identifier for the transaction record insertion target, the target record is deleted;

[0027] 如果目标记录的事务操作标识为事务修改,则删除该目标记录,将数据记录号扩展中的内容复制到数据记录号中,并删除数据记录扩展中的内容; [0027] If the transaction record operation identifier for the transaction to modify the target, the target record is deleted, the copy number of the contents data recorded in the extended record number in the data, and delete the contents of the data record extension;

[0028] 如果目标记录的事务操作标识为事务删除,则删除数据记录号中的事务操作标识; [0028] If the transaction operation identifier for the transaction target record deletion, the deletion of data records the identification number of the transaction operation;

[0029] 如果目标记录的事务操作标识为事务读取,则删除数据记录号中的事务操作标识; [0029] If the target operation identifier transaction record is read transaction, the transaction data record delete operation in the identification number;

[0030] 事务管理模块删除事务对应的所有操作日志记录,并且删除事务信息,事务回滚结束。 [0030] Transaction management module deletes all the operation log records corresponding to the transaction, and deletes the transaction information, the end of transaction rollback.

[0031] 该方法所述事务管理模块接收用户发送的请求消息后,启动事务保活机制,通过设置事务存活周期控制事务的存活时间。 [0031] The method of the transaction management module receives a user request message, initiating a transaction transmitted keep-alive mechanism, the survival time of the transaction by the transaction control set survival period.

[0032] 该方法所述日志管理模块管理日志包括:[0033] 如果对目标记录进行了读取操作,则将目标记录的事务操作标识置为事务读取状态,并记录到操作日志中; [0032] The method of the log management log management module comprises: [0033] If the target record transaction operation identifier set a read operation, the target reads the status record for the transaction and records the operation log;

[0034] 如果对目标记录进行修改操作,则先保存一份该目标记录的备份记录,然后在原目标记录上进行修改,在目标记录和备份记录的事务操作标识均置为事务修改状态,并记录到操作日志中,并且将备份记录号中的内容复制到数据记录号扩展中; [0034] If modification operations on the target record, the first save a copy record of the target record, and modify it on the original target record, the transaction operation identifying a target recording and backup recording are set to transaction modifies the state, and record the operation log, and the contents of the backup copy number recorded in the data record number extension;

[0035] 如果对目标记录进行了删除操作,则将目标记录的事务操作标识置为事务删除状态,并记录到操作日志中; [0035] If the target record a delete operation, then the transaction is set target operation identifier for the transaction record delete state, and to record the operation log;

[0036] 如果对目标记录进行了插入操作,则将目标记录的事务操作标识置为事务插入状态,并记录到操作日志中。 [0036] If the target record insertion, the target transaction operations recorded transaction identifier is set to the inserted state, and the operation log record.

[0037] 本发明还提供了一种内存数据库事务管理系统,包括: [0037] The present invention also provides a transaction management system database memory, comprising:

[0038] 事务管理模块,用于创建、处理和提交事务,并根据日志管理模块创建的日志执行事务,在事务执行过程中,如果存在与该事务相应的子事务,事务管理模块需要在子事务执行完成后,完成该事务的执行过程; [0038] Transaction management module, for creating, processing and commits the transaction, and the transaction log according to the log management module created during the transaction, if there is a corresponding sub-transaction with the transaction, the transaction management module needs subtransaction after execution, through the process of executing the transaction;

[0039] 日志管理模块,用于创建和管理与事务管理模块创建、处理和提交事务相应的日志;其中,该系统所述日志管理模块包括操作日志管理模块和数据日志管理模块,其中, [0039] The log management module, for creating and managing the transaction management module creates the process and submit the appropriate transaction log; wherein the system comprises a log management module operation log management module and a data log management module, wherein

[0040] 操作日志管理模块,用于记录事务执行过程中访问内存数据库的所有操作; [0040] The operation log management module, for recording all the operations performed during memory access transaction database;

[0041] 数据日志管理模块,分布于内存数据库处理系统内的数据表中,用于保存数据的历史记录,数据日志的记录方式取决于与其对应的操作日志。 [0041] Data log management module, the data table in a distributed database processing system memory, for storing data for history, recording the log data depending on the operation logs corresponding thereto.

[0042] 本发明所述的内存数据库事务管理方法及系统,有效地解决了现有内存数据库系统对内存数据库事务性处理的需求问题,为内存数据库中数据的一致性及安全性提供了可靠保障,为后续复杂的数据处理流程提供了可靠的保障,并大大减少了数据回滚所占用的内存数据库的存储空间。 [0042] Memory management database transaction method and system of the present invention effectively solves the problems of the prior-memory database system needs memory database transactional processing, provide a reliable guarantee for the safety and consistency of data in the database memory provide a reliable guarantee for the subsequent complex data processing flow, and greatly reduce the storage space occupied by the data rollback memory database.

[0043] 附图说明 [0043] BRIEF DESCRIPTION OF DRAWINGS

[0044] 图1为本发明内存数据库事务管理系统的结构示意图; [0044] Fig 1 a schematic view of the memory structure of the database transaction management system of the invention;

[0045] 图2为本发明内存数据库事务管理系统中事务管理模块的事务信息的结构示意图; [0045] FIG. 2 is a schematic of the transaction information memory transaction management module configuration database transaction management system of the present invention;

[0046] 图3为本发明内存数据库事务管理系统中日志管理模块的操作日志管理模块的结构图; [0046] FIG. 3 is a memory management system database transaction operation log management module configuration diagram of the log management module of the present invention;

[0047] 图4为本发明内存数据库事务管理系统中日志管理模块的数据日志管理模块的结构图; [0047] FIG. 4 memory database management system transaction log management module configuration diagram of a data log management module of the present invention;

[0048] 图5为本发明中内存数据库事务管理系统以跨越式访问方式进行事务处理的流程图; [0048] FIG 5 is a flowchart of the memory management system database transaction to transaction mode access leapfrog invention;

[0049] 图6为本发明中内存数据库事务管理系统进行事务提交的流程图; [0049] FIG. 6 flowchart memory transaction management system database transaction submitted by the present invention;

[0050] 图7为在父事务所在的内存数据库MDB_1上发起事务回滚的处理流程图。 [0050] FIG. 7 is a flowchart of a rollback process on the parent office in memory database MDB_1 initiated.

[0051] 图8为在子事务所在的内存数据库MDB_3上发起事务回滚的处理流程图。 [0051] FIG 8 is a flowchart of a rollback process on the sub-memory database MDB_3 office initiated. 具体实施方式 Detailed ways

[0052] 下面结合附图来说明本发明的具体实施方式。 [0052] The following described embodiments of the present invention in conjunction with the accompanying drawings.

[0053] 图1为本发明内存数据库事务管理系统的结构示意图,包括:[0054] 事务管理模块101,用于创建、处理和提交事务,并根据日志管理模块102创建的日志执行事务,在事务执行过程中,如果存在与该事务相应的子事务,事务管理模块101需要在子事务执行完成后,完成该事务的执行过程; [0053] FIG. 1 is a schematic configuration memory database transaction management system of the present invention, comprising: [0054] Transaction management module 101 for creating, processing and commits the transaction, according to the log management module 102 creates log transaction execution, the transaction during execution, if there is a corresponding sub-transaction with the transaction, transaction management module 101 needs to perform to complete the transaction after a child, to complete the process of execution of the transaction;

[0055] 日志管理模块102,用于创建和管理与事务管理模块101创建、处理和提交事务相应的日志。 [0055] The log management module 102 for creating and managing the transaction management module 101 to create, process and submit the appropriate transaction log. 日志管理模块101包括操作日志管理模块1011和数据日志管理模块1012,其中, Log management module 101 includes an operation log management module 1011 and data log management module 1012, wherein,

[0056] 操作日志管理模块1011,用于记录事务执行过程中访问内存数据库的所有操作; [0056] The operation log management module 1011, a record of all operations performed during the transaction database to access memory;

[0057] 数据日志管理模块1012,分布于内存数据库处理系统内的数据表中,用于保存数据的历史记录,数据日志的记录方式取决于与其对应的操作日志。 [0057] Data log management module 1012, located in the data table in the database processing system memory, for storing data for history, recording data corresponding to the log depends on operation logs.

[0058] 内存数据库事务系统进行处理事务首先进行事务创建,在创建事务时,需要对该事务的信息进行存储。 [0058] memory database transaction system for processing transactions First transaction created when you create a transaction, you need to store the information of the transaction. 图2为本发明内存数据库事务管理系统中事务管理模块的事务信息的结构示意图,事务信息包括事务编号201、事务优先级202、事务生存周期203、事务创建者信息204和子事务信息205。 A schematic structural diagram of the memory transaction information database transaction management system transaction management module of the present invention, FIG. 2, the transaction information comprises a transaction number 201, transaction priority 202, life cycle 203 transaction, transaction information creator 204 and 205 sub transaction information.

[0059] 事务编号201作为事务的唯一标识,整个系统内有效。 [0059] uniquely identifies the transaction as a transaction number 201, the entire system effectively.

[0060] 事务优先级202,用于控制事务的处理先后顺序,反映事务的处理优先级。 [0060] 202 priority transaction, processing the order to control the transaction, the transaction processing priority reflected.

[0061] 事务生存周期203,用于事务保活,避免异常引起的事务死锁问题。 [0061] transaction life cycle 203, keep alive for the transaction, the transaction to avoid deadlock caused by abnormal.

[0062] 事务创建者信息204,用于存储事务创建者的信息,在由事务系统发起的与事务创建者的交互处理过程中需要该信息。 [0062] affairs creator information 204 for storing information creator affairs, the information required in the process of interaction with the creator of the transaction initiated by the transaction system.

[0063] 子事务信息205存储在当前内存数据库创建的子事务中。 [0063] sub-sub-transaction information 205 stores the transaction in the current memory database created. 下面简要描述子、父事务的关系: The following brief description of the child, the relationship between the parent transaction:

[0064] 父事务,也可称作根事务,是由用户在内存数据库事务处理系统中创建的。 [0064] The parent transaction, the transaction may also be referred to as the root is created in the memory database transaction processing systems by the user.

[0065] 子事务,是由父事务在进行跨越式访问时,在目的内存数据库事务处理系统中创建的事务。 [0065] sub-transaction, the transaction is accessed by leaps and bounds during the parent transaction, created in the destination memory database transaction processing system.

[0066] 对一个内存数据库事务处理系统来说,父事务只能在其中创建唯一的子事务,每个子事务有且只有唯一的父事务。 [0066] a memory for database transaction processing systems, in which the parent transaction can only create a unique sub-transaction, each sub-matters and only the sole parent transaction.

[0067] 如图3所示,图3为本发明内存数据库事务管理系统中日志管理模块的操作日志管理模块的结构图,图中包括事务编号201、数据表标识301、数据记录号302和数据记录号扩展303。 [0067] As shown in FIG. 3, FIG. 3 is a memory management system database transaction log management module configuration diagram of the operation log management module of the present invention, FIG. 201 includes transaction number, the data identification table 301, the data 302 and the data record number record number extension 303. 其中, among them,

[0068] 数据表标识301用于标识内存数据库事务处理系统中的一个数据表。 [0068] identifier 301 for identifying the data table memory database in a transaction processing system data table.

[0069] 数据记录号302是数据表301中的记录号,用于标识一个数据表中的一条事务记录。 [0069] Data record number 302 is a number of data records table 301 for identifying a transaction record in a data table.

[0070] 数据记录扩展303也是数据表301中的记录号,作为数据记录号302的辅助数据记录号,用于标识一个数据表中的一条事务记录。 [0070] Data is recorded extent record 303 in data table 301, the auxiliary data as a data record number of record number 302, a transaction record for identifying a data table.

[0071] 一个内存数据库中,包括多个事务数据表,每个事务数据表中包含多条事务记录, 用户通过数据表标识301找到对应的事务数据表,然后,通过该事务数据表中的数据记录号302找到该数据表中对应的事务记录,因此,数据表标识301与数据记录号302联合表示内存数据库事务处理系统中唯一的一条事务记录,该事务记录称为目标记录。 [0071] a memory, database, transaction data comprising a plurality of tables, each table contains data transaction plurality of transaction records, the user 301 to find the corresponding transaction data table through the data table identifier, then the data in the data table by the transaction record number correspondence table 302 to find the transaction records in the data, therefore, the data table 301 with the identification number of the data record 302 only represents a combined transaction record memory database transaction processing system, the transaction record is called the target record.

[0072] 图4为本发明内存数据库事务管理系统中日志管理模块的数据日志管理模块的结构图,图中包括:[0073] 事务操作标识401,用于记录操作记录的当前状态,包括事务读取、事务修改、事务删除、事务插入以及无事务操作。 [0072] FIG 4 is a configuration diagram of the memory management system of the invention the database transaction log management module data log management module, FIG comprising: [0073] The transaction identification operation 401, the current state of the recording operation, a read transaction including take, transactions modify, delete transactions, transaction and non-transaction operations insert. 事务操作标识401还作为各项事务操作的数据日志,用于完成后续的事务提交,数据回滚等操作。 Operation 401 also identifies transaction log of transaction operations as data for completing the subsequent transaction commit, rollback data and other operations.

[0074] 记录内容402用于保存各项事务操作过程的信息,包括事务读取、事务修改、事务删除、事务插入等操作过程的信息。 [0074] 402 for holding the information contents recorded during the operation of the transaction, including the transaction read, transaction modify, delete transaction, transaction information is inserted during operation.

[0075] 结合图3和图4所示的结构,整个事务的日志管理模块即可清晰建立,事务日志在管理上因操作类型的不同而不同,具体如下: [0075] The binding structure shown in FIG. 3 and FIG. 4, the log management module of the entire transaction can be established clearly, due to the transaction log on the management of different types of different operations, as follows:

[0076] 事务读取:在事务的执行过程中,如果对目标记录进行了读取操作,则将目标记录的事务操作标识置为事务读取状态,并记录到操作日志中。 [0076] transaction reads: during the transaction, if the target record of the reading operation, the transaction will be set to the target operation identifier recorded transaction read state, and to record the operation log.

[0077] 事务修改:在事务的执行过程中,如果对目标记录进行修改操作,则先保存一份该目标记录的备份记录,然后在原目标记录上进行修改,在目标记录和备份记录的事务操作标识均置为事务修改状态,并记录到操作日志中,并且将备份记录号中的内容复制到数据记录号扩展中,当需要执行数据回滚操作时,则将数据记录号扩展中的内容重新复制到数据记录号中,即将数据记录号恢复为执行修改操作之前的数据记录号,数据回滚执行完成后,删除数据记录扩展中的内容。 [0077] Affairs Review: during the execution of a transaction, if modification operations to target record, the first to keep a backup record of the target record, and then modify the original target record, transaction operations in the target record and the record of a backup transaction identifier are set to the modified state, and the operation log record, and the record number in the backup copy of the contents of the data record number extension, the data needs to be performed when a rollback operation, the contents of the data is re-recorded number extension copy to data record number, the data record number is about to restore the data record number before the execution of modification operations, data rollback execution is completed, delete the contents of the data record extension.

[0078] 事务删除:在事务的执行过程中,如果对目标记录进行了删除操作,则将目标记录的事务操作标识置为事务删除状态,并记录到操作日志中。 [0078] Affairs Delete: during the execution of a transaction, if the target record a delete operation, the transaction will be set identifies the operation target record is deleted state affairs, and to record the operation log.

[0079] 事务插入:在事务的执行过程中,如果对目标记录进行了插入操作,则将目标记录的事务操作标识置为事务插入状态,并记录到操作日志中。 [0079] transaction is inserted: during the transaction, if the target record of the inserting operation, the transaction will be set target operation identifier for the transaction record insertion state, and the operation log record.

[0080] 在事务结束后,需要将事务日志清除,并且所有该事务相关的事务操作标识标记上无事务操作类型。 [0080] After the end of the transaction, the transaction log needs to be cleared, and the type of non-transactional operations on all matters related to the operation of the transaction identification mark.

[0081] 下面分别介绍上述步骤中出现的事务保活机制、事务提交处理细则和事务回滚处理细则。 [0081] The following describes the transaction keep-alive mechanism appearing above steps, the processing details and transaction commit transaction rollback processing rules.

[0082] 事务的保活机制:在多个内存数据库构成的事务处理系统中,可能会存在一些异常引起的事务性死锁,特别是对于跨处理单元或者跨内存数据库进行事务处理的情况,其潜在的危险性更大,因此需要一种保活机制来防止事务性死锁。 [0082] The keep-alive mechanism transaction: the transaction processing system consisting of a plurality of memory database, there may be some transaction deadlock caused by abnormal, especially for a case where the transaction processing unit or a cross-cross-memory database, which potentially greater risk, and therefore need a keep-alive mechanism to prevent transactional deadlock. 具体过程如下: Specific process is as follows:

[0083] 用户在创建事务时,提供事务存活周期;当事务的存活时间超过事务存活周期时, 则说明此事务异常超时,需要进行事务解锁处理,即内存数据库将强制该事务进行回滚,实现解锁。 [0083] When users create a transaction, the transaction provides survival period; when the survival time of the transaction exceeds the transaction survival period, then this transaction timeout abnormal, you need to unlock the transaction processing, that memory database will force the transaction to rollback to achieve unlock.

[0084] 事务提交处理细则: [0084] transaction commit processing rules:

[0085] 首先,内存数据库处理系统根据事务编号查找事务操作日志,将所有与该事务相关的操作记录取出。 [0085] First, the database processing system in accordance with the memory transaction number lookup operation log transaction, all operations associated with the transaction record removed.

[0086] 然后,内存数据库处理系统根据操作记录中存储的数据表标识,数据记录号定位到目标记录。 [0086] Then, the database processing system memory to locate the data table identifies the target recording operation record stored in the data record number.

[0087] 如果目标记录的事务操作标识为事务删除,则删除该目标记录; [0087] If the transaction identity of the target operating records for the transaction to delete, delete the target record;

[0088] 如果目标记录的事务操作标识为事务修改,则删除数据记录号中的事务操作标识,并删除与数据记录号扩展对应的目标记录; [0088] If the transaction operation identifier for the transaction to modify the target record, the delete operation transaction identification record number in the data, and deletes a target record number data record corresponding to the extension;

[0089] 如果目标记录的事务操作标识为事务读取,则删除数据记录号中的事务操作标识;8[0090] 如果目标记录的事务操作标识为事务插入,则删除数据记录号中的事务操作标识; [0089] If the transaction operation identifier for the transaction to read target record, the delete operation transaction identification number in the data record; 8 [0090] If the transaction identified target recording operation is inserted into the transaction, deleting the transaction data record number in operation identity;

[0091] 最后,内存数据库处理系统删除事务对应的所有操作日志记录,并且删除事务信息,事务提交结束。 [0091] Finally, the in-memory database processing system to remove all transaction log records corresponding to the operation, and delete transaction information, transaction commits an end.

[0092] 事务回滚处理细则: [0092] transaction rollback processing rules:

[0093] 首先,内存数据库处理系统根据事务编号查找事务操作日志,将所有与该事务相关的操作记录取出。 [0093] First, the database processing system in accordance with the memory transaction number lookup operation log transaction, all operations associated with the transaction record removed.

[0094] 然后,内存数据库处理系统根据操作记录中存储的数据表标识,数据记录号定位到目标记录。 [0094] Then, the database processing system memory to locate the data table identifies the target recording operation record stored in the data record number.

[0095] 如果目标记录的事务操作标识为事务插入,则删除该目标记录; [0095] If the transaction operation identifier for the transaction record insertion target, the target record is deleted;

[0096] 如果目标记录的事务操作标识为事务修改,则删除该目标记录,将数据记录号扩展中的内容复制到数据记录号中,并删除数据记录扩展中的内容; [0096] If the transaction record operation identifier for the transaction to modify the target, the target record is deleted, the copy number of the contents data recorded in the extended record number in the data, and delete the contents of the data record extension;

[0097] 如果目标记录的事务操作标识为事务删除,则删除数据记录号中的事务操作标识; [0097] If the transaction operation identifier for the transaction target record deletion, the deletion of data records the identification number of the transaction operation;

[0098] 如果目标记录的事务操作标识为事务读取,则删除数据记录号中的事务操作标识; [0098] If the target operation identifier transaction record is read transaction, the transaction data record delete operation in the identification number;

[0099] 最后,内存数据库处理系统删除事务对应的所有操作日志记录,并且删除事务信息,事务回滚结束。 [0099] Finally, the system deletes all memory database processing operation log record corresponding to the transaction, and deletes the transaction information, the end of transaction rollback.

[0100] 在数据分布式系统中,在事务用户不可知的情况下,事务系统自动创建相应的子事务,进行跨越式访问,从而完成事务处理的全过程。 [0100] In a distributed data system, in the case where the unknown user transaction, the transaction system automatically creates a corresponding sub-transactions, access for leaping to complete the whole process of the transaction. 图5为本发明中内存数据库事务管理系统以跨越式访问方式进行事务处理的流程图。 5 of the present invention FIG transaction memory database management system access mode to a flowchart Leap transaction. 具体步骤如下: Specific steps are as follows:

[0101] 步骤501,用户向MDB_1发送创建第一事务请求消息。 [0101] Step 501, the user sends a transaction request message to create a first MDB_1.

[0102] 步骤502,MDB_1接收创建第一事务请求消息,返回确认消息和事务编号,根据用户提供的第一事务存活周期启动保活机制,保存该第一事务的信息。 [0102] Step 502, MDB_1 creating a first transaction request message received, and returns an acknowledgment message transaction number, according to the survival period of the first user-provided transaction starts keep-alive mechanism, the first transaction information is stored.

[0103] 步骤503,用户接收第一事务编号,根据第一事务编号向MDB_1发送开始执行第一事务消息。 [0103] Step 503, the user receives a first transaction number, transaction sending a first message to begin a first transaction number MDB_1.

[0104] 步骤504,MDB_1在第一事务执行过程中,发现需要对MDB_2进行跨越式访问,于是向MDB_2发起创建第二事务请求消息。 [0104] Step 504, MDB_1 during the execution of the first transaction, be found necessary to MDB_2 leaping access, thus creating a second to initiate a transaction request MDB_2 message.

[0105] 步骤505,MDB_1在第一事务执行过程中,发现还需要对MDB_3进行跨越式访问,于是向MDB_3发起创建第三事务请求消息。 [0105] Step 505, MDB_1 during the execution of the first transaction, it was found necessary to also leaping MDB_3 be accessed, then to initiate creation MDB_3 third transaction request message.

[0106] 步骤506,MDB_3接收创建第三事务请求消息,进行第三事务的处理;在第三事务处理过程中,发现需要对MDB_4进行跨越式访问,于是向MDB_4发起创建第四事务请求消肩、ο [0106] Step 506, MDB_3 received transaction request message to create a third, a third transaction is processed; in the third transaction process, be found necessary to MDB_4 leaping access, so to create a fourth MDB_4 initiate a transaction request message shoulder , ο

[0107] 步骤507,MDB_4接收创建第四事务请求消息,进行第四事务的处理,MDB4完成第四事务的处理后,发送处理完成消息给MDB_3。 [0107] Step 507, MDB_4 received transaction request message to create a fourth, transaction processing of the fourth after the fourth treatment MDB4 completed transaction, and transmits processing completion message to MDB_3.

[0108] 步骤508,MDB_3接收MDB_4发送的处理完成消息,完成第三事务的处理后,发送处理完成消息给MDB_1。 After [0108] Step 508, the process receives MDB_4 MDB_3 complete message sent, a third transaction completion processing, transmission processing completion message to MDB_1.

[0109] 步骤509,MDB_2完成第二事务的处理后,发送处理完成消息给MDB_1。 [0109] Step 509, after completion of the second transaction processing MDB_2 transmits processing completion message to MDB_1.

[0110] 步骤510,MDB_1接收MDB_2和MDB_3发送的处理完成消息,完成第一事务的处理。 [0110] Step 510, MDB_1 receiving and processing MDB_3 MDB_2 complete message sent to complete processing of the first transaction. 9[0111] 根据前述父事务和子事务的定义,上述步骤中,第一事务是第二事务和第三事务的父事务,第三事务是第四事务的父事务;换言之,第二事务和第三事务是第一事务的子事务,第四事务是第三事务的子事务。 9 [0111] The definition of the parent transaction and sub-transaction, said step, the first transaction and the second transaction is the third parent transaction's transaction, the transaction is the third of the fourth parent transaction's transaction; in other words, the second transaction and three sub-transaction transaction is the first transaction, the transaction is the fourth sub-transaction third transaction.

[0112] 在实际事务处理实现过程中,可以结合具体情况按照上述方式处理更多的子事务,从而最终完成对第一事务的处理。 [0112] In an actual implementation of the transaction, the specific circumstances can be more sub-transaction processing as described above, whereby the final finished processing the first transaction. 对于第一事务在MDB_2和MDB_3中分别创建的子事务第二事务和第三事务,两者关系为并列关系,当二者事务处理完成后,发送给MDB_1的处理完成消息不分先后,下述三种情况均可: A first sub-transaction for the second transaction in the transaction created MDB_2 and MDB_3 respectively and a third transaction, parallel relationship as the relationship between the two, when both the transaction is completed, the transmission complete message to the processing MDB_1 no particular order, the following Available in three cases:

[0113] MDB_3先发送处理完成消息给MDB_1,MDB_2后发送处理完成消息给MDB_1 ; [0113] MDB_3 processing completion message to send to the MDB_1, transmission completion message to the treatment MDB_2 MDB_1;

[0114] MDB_2先发送处理完成消息给MDB_1,MDB_3后发送处理完成消息给MDB_1 ; [0114] MDB_2 processing completion message to send to the MDB_1, transmission completion message to the treatment MDB_3 MDB_1;

[0115] MDB_2和MDB_3同时发送处理完成消息给MDB_1。 [0115] MDB_2 MDB_3 simultaneous transmission and processing completion message to MDB_1.

[0116] MDB_1只有在接收到所有第一事务的子事务所在MDB返回的处理完成消息后,才能完成第一事务的处理。 [0116] MDB_1 only after receiving all first transaction completed sub-office message processing MDB returned to complete the processing of the first transaction.

[0117] 在内存数据库中,事务的提交只能由用户发起,并且对于用户而言,只有第一事务可见,因此,用户首先通知内存数据库进行第一事务的提交,如果存在与该第一事务对应的子事务,则需要先完成该子事务的提交后,再完成该第一事务的提交,因此,在实际事务提交过程中,如果存在多级子、父事务嵌套的情况,则必须按顺序由各级父事务通知与其对应的子事务执行事务提交,在各级子事务按顺序完成事务提交后,最终完成整个事务的提交。 [0117] In-memory database, transaction submitted only be initiated by the user and for the user, only the first visible transaction, therefore, first of all inform the user memory database commit the first transaction, if the first transaction after submitting the corresponding sub-transaction, it is necessary to complete the sub-transaction, and then submitted to the completion of the first transaction, and therefore, the actual transaction commit process, if the multi-level sub, nested parent transaction is present, it must be levels by the parent transaction notification sequence corresponding thereto transactions committed subtransaction, in order to complete the sub-levels after the transaction commits the transaction, that finish the transaction commits.

[0118] 图6为本发明中内存数据库事务管理系统进行事务提交的流程图。 [0118] FIG. 6 of the present invention, the memory management system database transaction flowchart of the transaction submitted. 具体步骤如下: Specific steps are as follows:

[0119] 步骤601,用户向MDB_1发送第一事务提交请求消息。 [0119] Step 601, the user sends a request message to the first transaction is committed MDB_1.

[0120] 步骤602,MDB_1收到第一事务提交请求消息后,删除本内存数据库对应的事务日志,通知其在MDB_2和MDB_3中分别创建的第二子事务和第三子事务进行提交,并等待其回应。 [0120] Step 602, MDB_1 submitted after receiving a first transaction request message, the deletion of this memory corresponding to the transaction log database, and notifies the second third sub-sub-transaction created in the transaction respectively MDB_2 and MDB_3 Committing and waits its response.

[0121] 步骤603,MDB_2和MDB_3收到第一事务的提交请求消息后,删除本内存数据库对应的事务日志,进行事务提交,并返回提交完成消息给MDB_1。 [0121] Step 603, MDB_2 MDB_3 and submit the request message after receiving the first transaction, the deletion of this memory corresponding to the transaction log database, transaction submission, and returns to the submitted complete message MDB_1.

[0122] 该步骤中,对于不存在子事务第二事务,MDB_2完成提交后返回提交完成消息给MDB_1。 [0122] In this step, the sub-transaction for the second transaction does not exist, MDB_2 submitted after completion return message is submitted to the complete MDB_1. 对于第三事务,由于存在对应的子事务第四事务,因此,MDB_3需要先向MDB_4发送提交请求消息,在接收到MDB_4完成第四事务提交后返回的提交完成消息后,才能完成其自身的事务提交,MDB_3完成第三事务的提交后,返回提交完成消息给MDB_1。 For the third transaction, the presence of the sub-transaction corresponding to the fourth transaction, therefore, MDB_3 submit request message needs to be sent Xianxiang MDB_4, after receiving the completion MDB_4 submitted after the fourth transaction commit completion message returned to complete its own transaction submit, submit MDB_3 after the completion of the third transaction, returns submitted complete message to the MDB_1.

[0123] 步骤604,MDB_1收到MDB_2的提交完成消息,但尚未收到MDB_3的提交完成消息, 继续等待MDB_3的提交完成消息。 [0123] Step 604, MDB_1 submitted MDB_2 receive the complete message, but have not yet received the complete message submitted MDB_3, continue to wait submitted MDB_3 completion message.

[0124] 步骤605,MDB_4完成第四事务的提交,返回提交完成消息给MDB_3。 [0124] Step 605, MDB_4 fourth completed transaction commit completion message to the return submitted MDB_3.

[0125] 步骤606,MDB_3接收到MDB_4完成第四事务提交后返回的提交完成消息后,完成第三事务的提交,并返回提交完成消息给MDB_1。 After completion message submission [0125] Step 606, MDB_3 MDB_4 received after completion of the fourth return transaction commit, commit the transaction to complete the third, and returns a completion message submitted to the MDB_1.

[0126] 步骤607,MDB_1收到MDB_2和MDB_3返回的提交完成消息,进行第一事务提交,从而完成整个事务的提交。 [0126] Step 607, MDB_1 MDB_3 return and receive MDB_2 submit completed message, the transaction commits first, so as to complete the transaction commits.

[0127] 上述步骤中,由于存在多个内存数据库之间的异步访问,可以在异步访问过程中采用一些安全性手段,如采用内存数据库的事务保活机制,来应对事务提交过程中可能出现的异常情况。 [0127] the above steps, due to the asynchronous memory access between multiple databases, you can use some security tools in an asynchronous course of the visit, such as the use keep alive the memory of the database transaction mechanism to deal with matters that may arise during the submission process abnormal situation. [0128] 图7为在父事务所在的内存数据库MDB_1上发起事务回滚的处理流程图。 [0128] FIG. 7 is a flowchart of a rollback process on the parent office in memory database MDB_1 initiated. 其处理流程类似于事务提交,只是需要根据事务日志进行数据回滚,然后删除事务日志,删除事务,完成回滚。 Its processing flow is similar to the transaction commits, just need to roll back the data from the transaction log, and then delete the transaction log, delete transaction, the rollback is complete. 具体步骤如下: Specific steps are as follows:

[0129] 步骤701,用户向MDB_1发送第一事务回滚请求消息。 [0129] Step 701, the user sends a request message to the first transaction rollback MDB_1.

[0130] 步骤702,MDB_1收到第一事务回滚请求消息后,删除本内存数据库对应的事务日志,通知其在MDB_2和MDB_3中分别创建的第二子事务和第三子事务进行回滚,并等待其回应。 [0130] Step 702, MDB_1 receiving the first transaction rollback request message, the deletion of this memory corresponding to the transaction log database, and notifies the second third sub-sub-transaction created in the transaction respectively MDB_3 MDB_2 and rolled back, and wait for its response.

[0131] 步骤703,MDB_2和MDB_3收到MDB_1的第二、第三事务回滚请求消息后,删除MDB_2和MDB_3中对应的第一事务日志,进行事务回滚,并返回回滚完成消息给MDB_1。 [0131] Step 703, MDB_2 MDB_3 and receiving the second, the third transaction rollback MDB_1 request message, and deleting the first MDB_2 MDB_3 corresponding transaction log, transaction for rollback and the rollback completion message to the return MDB_1 .

[0132] 该步骤中,对于不存在子事务第二事务,MDB_2完成回滚后返回回滚完成消息给MDB_1。 [0132] After this step, the sub-transaction for the second transaction is not present, MDB_2 rollback is complete rollback completion message to the return MDB_1. 对于第三事务,由于存在对应的子事务第四事务,因此,MDB_3需要先向MDB_4发送第四事务回滚请求消息,在接收到MDB_4完成第四事务回滚后返回的第四事务回滚完成消息后,才能完成其自身的事务回滚,MDB_3完成第三事务的回滚后,返回第三事务回滚完成消息给MDB_1。 For the third transaction, since there is a corresponding transaction fourth sub-transaction, therefore, MDB_3 MDB_4 need to first send a fourth message request transaction is rolled back, a fourth receiving transaction completion MDB_4 fourth transaction is rolled back after returning the rollback is complete after the news, to complete its own transaction rollback, after the completion of the third MDB_3 transaction is rolled back, the return of the third transaction rollback completion message to MDB_1.

[0133] 步骤704,MDB_1收到MDB_2的第二事务回滚完成消息,但尚未收到MDB_3返回的第三事务回滚完成消息,继续等待MDB_3返回第三事务回滚完成消息。 [0133] Step 704, MDB_1 received MDB_2 second transaction rollback completion message, but have not yet received MDB_3 return of third transaction rollback completion message, continue to wait MDB_3 return third transaction rollback completion message.

[0134] 步骤705,MDB_4完成第四事务的回滚,返回第四事务回滚完成消息给MDB_3。 [0134] Step 705, MDB_4 fourth transaction rollback is complete, the process returns to the fourth transaction rollback completion message MDB_3.

[0135] 步骤706,MDB_3接收到MDB_4完成第四事务回滚后返回的第四事务回滚完成消息后,完成第三事务的回滚,并返回第三事务回滚完成消息给MDB_1。 [0135] Step 706, MDB_3 MDB_4 received after completion of the fourth return fourth transaction rollback transaction rollback completion message after completion of the third transaction rollback, the rollback is complete and returns the message to the third transaction MDB_1.

[0136] 步骤707,MDB_1收到MDB_2和MDB_3返回的第二、第三回滚完成消息,进行第一事务回滚,从而完成整个事务的回滚。 [0136] Step 707, MDB_1 receive the second, third and MDB_3 MDB_2 rollback completion message returned, a first transaction rollback, thereby completing the entire transaction rollback.

[0137] 图8为在子事务所在的内存数据库MDB_3上发起事务回滚的处理流程图。 [0137] FIG 8 is a flowchart of a rollback process on the sub-memory database MDB_3 office initiated. 具体步骤如下: Specific steps are as follows:

[0138] 步骤801,用户向MDB_3发送第三事务回滚请求消息。 [0138] Step 801, the user sends a third request transaction is rolled back to MDB_3 message.

[0139] 步骤802,MDB_3收到第三事务回滚请求消息后,发送第一事务回滚请求消息给MDB_1,并发送第四事务回滚请求消息给MDB_4。 [0139] Step 802, after received MDB_3 third transaction rollback request message, sending a first request message to the transaction rollback MDB_1, and transmits the fourth message to the transaction rollback request MDB_4.

[0140] 由于第三事务存在父事务,即MDB_1中的第一事务,以及在MDB_4中创建的子事务第四事务,因此,MDB_3需要发送回滚请求消息给第一事务所在的内存数据库MDB_1和第四事务所在的内存数据库MDB_4,分别进行第一事务和第四事务的回滚,对于其子事务第四事务的回滚,MDB_3需要等待MDB_4返回的第四事务回滚完成消息,而对于其父事务第一事务的回滚,MDB_3则不需要等待MDB_1返回的第一事务回滚完成消息。 [0140] Because of the presence of the parent transaction third transaction, i.e. MDB_1 first transaction, and a fourth sub-transaction created in the transaction MDB_4, and therefore, MDB_3 needs to send a rollback request to the first database memory in the office MDB_1 and the fourth in-memory database MDB_4 firm, respectively fourth and first transaction rollback transaction, the transaction for which the fourth sub-transaction rollback, MDB_3 need to wait for the return of the fourth transaction rollback MDB_4 complete message, and for the first transaction rollback parent transaction, MDB_3 without waiting for the return of the first transaction rollback MDB_1 complete message.

[0141] 步骤803,MDB_1接收MDB_3发送的第三事务回滚请求消息,进行第一事务的回滚,由于第一事务还在MDB_2中创建了子事务第二事务,因此,MDB_1发送回滚请求消息给MDB_2,进行第二事务的回滚,并等待MDB_2返回的第二事务回滚完成消息,在接收到第二事务回滚完成消息后,MDB_1才能进行第一事务的回滚。 [0141] Step 803, the third received MDB_3 MDB_1 transaction rollback request message sent, the first transaction is rolled back, since the first transaction is still created in the sub-transaction MDB_2 second transaction, and therefore, the rollback request transmitted MDB_1 message to MDB_2, the second transaction rollback, and waits for the second rollback transaction completion message returned MDB_2, upon receiving the second message is completed transaction rollback, MDB_1 first transaction to be rolled back.

[0142] 该步骤中,MDB_1对于发起事务回滚的MDB_3,将不再发送回滚请求消息。 [0142] In this step, MDB_1 for initiating a rollback MDB_3, will no longer send a rollback request message.

[0143] 步骤804,MDB_4接收MDB_3发送的第四事务回滚请求消息,进行第四事务的回滚, 并返回第四事务回滚完成消息给MDB_3。 [0143] Step 804, the fourth received MDB_3 MDB_4 transaction rollback request message sent, the fourth transaction rollback, the rollback is complete and returns the message to the fourth transaction MDB_3.

[0144] 步骤805,MDB_3收到第四事务回滚完成消息后,进行第三事务的回滚,删除其中对应的第三事务日志,并返回第三回滚完成消息给MDB_1。 [0144] Step 805, MDB_3 receive a fourth message transaction rollback is complete, the third transaction is rolled back, deleting the transaction log which corresponds to the third, the rollback is complete and returns the third message to MDB_1.

[0145] 步骤806,MDB_2收到MDB_1的第二回滚请求消息后,删除其中对应的第二事务日志,进行事务回滚,并返回第二回滚完成消息给MDB_1。 [0145] Step 806, MDB_2 rollback MDB_1 receive a second request message to delete the transaction log which corresponds to the second, transaction rollback, the rollback is complete and return a second message to MDB_1.

[0146] 步骤807,MDB_1收到MDB_2返回的第二事务回滚完成消息和MDB_3返回的第三事务回滚完成消息,进行第一事务的回滚,从而完成整个事务的回滚。 [0146] Step 807, MDB_1 MDB_2 return receive a second transaction rollback transaction completion message and the third message MDB_3 returned rollback is complete, the transaction is rolled back to the first, thereby completing the entire transaction rollback.

[0147] 以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。 [0147] The foregoing is only preferred embodiments of the present invention but are not intended to limit the present invention, any modifications within the spirit and principle of the present invention, the, equivalent substitutions, improvements should be included in the within the scope of the present invention.

Claims (8)

1. 一种内存数据库事务管理方法,其特征在于,包括:事务管理模块创建、处理和提交事务,并根据日志管理模块创建的日志执行事务,在事务执行过程中,如果存在与该事务相应的子事务,事务管理模块需要在子事务执行完成后, 完成该事务的执行过程;日志管理模块创建和管理与事务管理模块创建、处理和提交事务相应的日志,其中,所述日志包括操作日志和数据日志,其中,操作日志记录事务执行过程中访问内存数据库的所有操作;数据日志分布于内存数据库处理系统内的数据表中,用于保存数据的历史记录, 数据日志的记录方式取决于与其对应的操作日志。 A memory database transaction management method, comprising: creating transaction management module, and committing the transaction processing and transaction log according to the log management module created during the execution of a transaction, if the transaction corresponding to the present sub-transaction, transaction management module needs subtransactions is completed after execution, during the execution of the transaction is completed; log management module to create and manage the transaction management module creates the process and submit the appropriate transaction log, wherein said operation logs and data log, wherein all operations performed during the logging operation to access memory transaction database; log data to the data distribution table in the database processing system memory, for storing data for history, recording data corresponding to the log depends the operation log.
2.根据权利要求1所述的方法,其特征在于,所述处理事务包括对内存数据库中记录的读取、修改、删除和插入。 2. The method according to claim 1, wherein said process comprises a memory transaction records in the database to read, modify, delete and insert.
3.根据权利要求2所述的方法,其特征在于,所述事务管理模块处理事务的过程包括: 事务管理模块接收用户发送的事务请求消息,返回确认消息和事务编号给用户;事务管理模块接收用户根据事务编号发送的开始处理事务消息,开始处理事务。 3. The method according to claim 2, wherein the transaction management module during the processing of the transaction comprises: a transaction management module receives a transaction request message sent by the user, a transaction number and returns an acknowledgment message to the user; transaction management module receives the user transaction messages begins processing the transaction number sent, a transaction start processing.
4.根据权利要求2所述的方法,其特征在于,所述事务管理模块提交事务的过程包括: 事务管理模块接收用户发送的事务提交请求消息,进行事务提交;事务管理模块根据事务编号查找操作日志,将所有与该事务相关的操作记录取出; 事务管理模块根据操作记录中存储的数据表标识,数据记录号定位到目标记录; 如果目标记录的事务操作标识为事务删除,则删除该目标记录; 如果目标记录的事务操作标识为事务修改,则删除数据记录号中的事务操作标识,并删除与数据记录号扩展对应的目标记录;如果目标记录的事务操作标识为事务读取,则删除数据记录号中的事务操作标识; 如果目标记录的事务操作标识为事务插入,则删除数据记录号中的事务操作标识; 事务管理模块删除事务对应的所有操作日志记录,并且删除事务信息,事务提交结束。 4. The method according to claim 2, characterized in that, during the transaction management module committing the transaction comprises: a transaction management module receives a transaction commit request message sent by the user, a transaction commit; transaction management module transaction number according to a search operation log, all associated with the transaction operation record extraction; transaction management module to the target record from the data table identifies the operation record stored in the data record number location; if the transaction operation identifier of the target record for the transaction deletes the target record is deleted ; identified target recording operation if the transaction is modifying the transaction, the transaction delete operation identifier in the data record number, and deletes the data record number corresponding to the target recording extension; operation if the transaction identifier of the target record is read transaction, data is deleted record transaction operation identification numbers in; if the transaction operation identifier of the target record for the transaction insert, delete transaction operation identifier data record number in; transaction management module deletes all the operation log records transaction corresponding, and deletes transaction information, transaction commits end .
5.根据权利要求2所述的方法,其特征在于,所述事务管理模块处理事务失败后,进行数据回滚,过程如下:事务管理模块接收用户发送的回滚请求消息,进行回滚;事务管理模块根据事务编号查找操作日志,将所有与该事务相关的操作记录取出; 事务管理模块根据操作记录中存储的数据表标识,数据记录号定位到目标记录; 如果目标记录的事务操作标识为事务插入,则删除该目标记录; 如果目标记录的事务操作标识为事务修改,则删除该目标记录,将数据记录号扩展中的内容复制到数据记录号中,并删除数据记录扩展中的内容;如果目标记录的事务操作标识为事务删除,则删除数据记录号中的事务操作标识; 如果目标记录的事务操作标识为事务读取,则删除数据记录号中的事务操作标识; 事务管理模块删除事务对应的所有操作日志记录,并且 5. The method according to claim 2, characterized in that, after the transaction management module for processing transaction failure, rollback of data, as follows: to rollback the transaction management module receives the request message sent by the user, rolled back; transaction management module number lookup the transaction operation log, all associated with the transaction operation record extraction; transaction management module to the target record from the data table identifies the operation record stored in the data record number is positioned; transaction operation if the identification of the target record for the transaction inserting, deleting the target record; if the transaction operation identifier of the target record for the transaction to modify, delete the target record, copy the contents of the data record number of extensions to the data record number and delete the contents of the data record extension; and if operation transaction identifier of the target record is deleted transaction, deleting the transaction operation in the identification number of the data record; operation if the transaction identifier of the target record is read transaction, the transaction operation identifier delete the data record number; delete transaction corresponding to the transaction managing module all operation log records, and 除事务信息,事务回滚结束。 In addition to the end of the transaction information, transaction rollback.
6.根据权利要求3、4或5所述的方法,其特征在于,所述事务管理模块接收用户发送的请求消息后,启动事务保活机制,通过设置事务存活周期控制事务的存活时间。 The method according to claim 3, 4 or 5, characterized in that, after the transaction management module request message sent by a user, keep-alive mechanism to start a transaction, the transaction by providing the survival period of the control survival time of the transaction.
7.根据权利要求1所述的方法,其特征在于,所述日志管理模块管理日志包括:如果对目标记录进行了读取操作,则将目标记录的事务操作标识置为事务读取状态, 并记录到操作日志中;如果对目标记录进行修改操作,则先保存一份该目标记录的备份记录,然后在原目标记录上进行修改,在目标记录和备份记录的事务操作标识均置为事务修改状态,并记录到操作日志中,并且将备份记录号中的内容复制到数据记录号扩展中;如果对目标记录进行了删除操作,则将目标记录的事务操作标识置为事务删除状态, 并记录到操作日志中;如果对目标记录进行了插入操作,则将目标记录的事务操作标识置为事务插入状态, 并记录到操作日志中。 7. The method according to claim 1, wherein the log management log management module comprises: if the target record of the reading operation, the target of the transaction record for the transaction is set to read operation identifying the state, and recording the operation log; if modification operations on the target record, the first save a backup record of the target record, and modify it on the original target record, the transaction operation identifying a target recording and backup recording are set to a transaction modifies the state , and records the operation log, and the contents of the backup copy of the data record number extension record number; if the target recording the deletion operation, the target transaction operations recorded transaction identifier is set to delete state, and to record operation log; if the target record of the inserting operation, the target operation of the recorded transaction identifier for the transaction is set insertion state, and the operation log record.
8. —种内存数据库事务管理系统,其特征在于,包括:事务管理模块,用于创建、处理和提交事务,并根据日志管理模块创建的日志执行事务,在事务执行过程中,如果存在与该事务相应的子事务,事务管理模块需要在子事务执行完成后,完成该事务的执行过程;日志管理模块,用于创建和管理与事务管理模块创建、处理和提交事务相应的日志;其中,所述日志管理模块包括操作日志管理模块和数据日志管理模块,其中,操作日志管理模块,用于记录事务执行过程中访问内存数据库的所有操作; 数据日志管理模块,分布于内存数据库处理系统内的数据表中,用于保存数据的历史记录,数据日志的记录方式取决于与其对应的操作日志。 8. - kind of transaction memory database management system, characterized by comprising: a transaction management module, for creating, processing and commits the transaction, and the transaction log according to the log management module created during the transaction, if there is the corresponding transaction sub-transaction, transaction management module is necessary, after completion of the sub-transaction execution, the transaction completion process is performed; log management module, for creating and managing the transaction management module creates the process and submit the appropriate transaction log; wherein the said log management module includes an operation log management module and a data log management module, wherein the operation log management module, for recording all the operations performed during the transaction database access memory; a data log management module, distributed within a database memory data processing system table, storing data for history, recording the log data depending on operation logs corresponding thereto.
CN 200710119445 2007-07-24 2007-07-24 Internal store data base transaction method and system CN101089857B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 200710119445 CN101089857B (en) 2007-07-24 2007-07-24 Internal store data base transaction method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 200710119445 CN101089857B (en) 2007-07-24 2007-07-24 Internal store data base transaction method and system

Publications (2)

Publication Number Publication Date
CN101089857A CN101089857A (en) 2007-12-19
CN101089857B true CN101089857B (en) 2011-05-11

Family

ID=38943215

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 200710119445 CN101089857B (en) 2007-07-24 2007-07-24 Internal store data base transaction method and system

Country Status (1)

Country Link
CN (1) CN101089857B (en)

Families Citing this family (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101699412B (en) 2009-10-15 2012-02-22 清华大学 A computer storage method Affairs
CN102279855A (en) * 2010-06-10 2011-12-14 三星电子(中国)研发中心 Apparatus and a method for processing a transaction database
CN102693520A (en) * 2011-03-24 2012-09-26 苏州乐盈科技有限公司 Lottery bet method based on short message
CN102955801B (en) * 2011-08-25 2017-06-16 中兴通讯股份有限公司 Data control method and system based on distributed database system
US20140344236A1 (en) * 2013-05-20 2014-11-20 Amazon Technologies, Inc. Index Update Pipeline
US10102228B1 (en) 2014-02-17 2018-10-16 Amazon Technologies, Inc. Table and index communications channels
US10216768B1 (en) 2014-02-17 2019-02-26 Amazon Technologies, Inc. Table and index communications channels
CN103902479A (en) * 2014-03-27 2014-07-02 浪潮电子信息产业股份有限公司 Quick reconstruction mechanism for metadata cache on basis of metadata log
CN104317850B (en) * 2014-10-14 2017-11-14 北京国双科技有限公司 Data processing method and apparatus
EP3229147A4 (en) * 2014-12-24 2017-12-27 Huawei Technologies Co., Ltd. Transaction processing method, device and computer system
CN104731943A (en) * 2015-03-31 2015-06-24 华为技术有限公司 Server and data processing method
CN106155775A (en) * 2015-04-28 2016-11-23 阿里巴巴集团控股有限公司 Message processing method, equipment and system
CN105183879A (en) * 2015-09-22 2015-12-23 浪潮集团有限公司 Method for distributed database to keep transactional consistency under cloud computation
CN105426234B (en) * 2015-10-30 2019-02-19 小米科技有限责任公司 Database deadlocks detection method and device
CN105938446B (en) * 2016-01-12 2019-01-25 上海交通大学 The data supported based on RDMA and hardware transactional memory replicate fault-tolerance approach
CN106776076B (en) * 2016-12-27 2019-04-26 国网信息通信产业集团有限公司 A kind of method and system for realizing MongoDB transaction management
WO2019037617A1 (en) * 2017-08-25 2019-02-28 阿里巴巴集团控股有限公司 Data transaction processing method, device, and electronic device
WO2019076102A1 (en) * 2017-10-19 2019-04-25 中兴通讯股份有限公司 Data rollback method and system, device, and computer readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1507597A (en) 2001-05-15 2004-06-23 国际商业机器公司 Method for managing distributed savepoints across multiple DBMS's within a distributed transaction
US6981004B2 (en) 2002-09-16 2005-12-27 Oracle International Corporation Method and mechanism for implementing in-memory transaction logging records
CN1858745A (en) 2006-04-05 2006-11-08 华为技术有限公司 Processing method for realizing consistency of internal storage data and data bank data service

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1507597A (en) 2001-05-15 2004-06-23 国际商业机器公司 Method for managing distributed savepoints across multiple DBMS's within a distributed transaction
US6981004B2 (en) 2002-09-16 2005-12-27 Oracle International Corporation Method and mechanism for implementing in-memory transaction logging records
CN1858745A (en) 2006-04-05 2006-11-08 华为技术有限公司 Processing method for realizing consistency of internal storage data and data bank data service

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
施胜盛.内存数据库事务管理研究与实现.中国优秀硕士学位论文全文数据库.2006,全文.
王意洁,王勇军,王志英,胡守仁.嵌套事务模型下的恢复策略.计算机工程25 2.1999,25(2),42-44.
王玮.分布式内存数据库管理的设计与实现.中国优秀硕士学位论文全文数据库.2006,11,15,18-22,27,36-37,40-41.
陈安龙.内存数据库中数据恢复技术的研究与实现.中国优秀硕士学位论文全文数据库.2006,全文.

Also Published As

Publication number Publication date
CN101089857A (en) 2007-12-19

Similar Documents

Publication Publication Date Title
Lee et al. A single phase distributed commit protocol for main memory database systems
US7783610B2 (en) Distributed database system providing data and space management methodology
US8103937B1 (en) Cas command network replication
US5745753A (en) Remote duplicate database facility with database replication support for online DDL operations
Wei et al. Fast in-memory transaction processing using RDMA and HTM
US8161321B2 (en) Virtual machine-based on-demand parallel disaster recovery system and the method thereof
KR101086116B1 (en) Database data recovery system and method
US8150812B2 (en) Methods, apparatus and computer programs for data replication
EP1569120B1 (en) Computer system for recovering data based on priority of the data
JP3974538B2 (en) Information processing system
JP5254611B2 (en) Metadata management for fixed content distributed data storage
JP4219589B2 (en) Transactional file system
CA2550003C (en) Geographically distributed clusters
EP0336035B1 (en) Tree structure database system
CN100461163C (en) System and method for recovery units in databases
US20120109895A1 (en) Versatile in-memory database recovery
CN105404592B (en) Managing message queues
KR101255392B1 (en) Maintenance of link level consistency between database and file system
US7783601B2 (en) Replicating and sharing data between heterogeneous data systems
EP1661000B1 (en) Recovery from failures within data processing systems
JP2505070B2 (en) De - recovery method of file status in the data processing system
US8170997B2 (en) Unbundled storage transaction services
US5923833A (en) Restart and recovery of OMG-compliant transaction systems
US7117229B2 (en) Method and system for online reorganization of databases
CN100365579C (en) Cluster-wide read-copy update system and method

Legal Events

Date Code Title Description
C06 Publication
C10 Request of examination as to substance
C14 Granted