WO2021068850A1 - 事务管理方法、系统、网络设备和可读存储介质 - Google Patents

事务管理方法、系统、网络设备和可读存储介质 Download PDF

Info

Publication number
WO2021068850A1
WO2021068850A1 PCT/CN2020/119646 CN2020119646W WO2021068850A1 WO 2021068850 A1 WO2021068850 A1 WO 2021068850A1 CN 2020119646 W CN2020119646 W CN 2020119646W WO 2021068850 A1 WO2021068850 A1 WO 2021068850A1
Authority
WO
WIPO (PCT)
Prior art keywords
node
participating
request
subsql
transaction
Prior art date
Application number
PCT/CN2020/119646
Other languages
English (en)
French (fr)
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 EP20873872.4A priority Critical patent/EP4024236A4/en
Priority to KR1020227014341A priority patent/KR20220065072A/ko
Priority to US17/767,432 priority patent/US20240095236A1/en
Priority to JP2022519425A priority patent/JP7461468B2/ja
Publication of WO2021068850A1 publication Critical patent/WO2021068850A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2425Iterative querying; Query formulation based on the results of a preceding query
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • G06F16/24534Query rewriting; Transformation
    • G06F16/24535Query rewriting; Transformation of sub-queries or views
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/466Transaction processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning

Definitions

  • the embodiments of the present application relate to but not limited to the field of computer technology, specifically, to but not limited to a transaction management method, system, network device, and readable storage medium.
  • distributed transaction commit is its core function.
  • the implementation of distributed transaction commit directly determines the transaction constraint level of the system.
  • the current mainstream distributed databases have the nature of horizontal fragmentation: that is, the data table presents a horizontal (according to the row key) extended form and is distributed on different physical nodes; the structured query language (SQL) query request initiated by the user passes through the distributed
  • the database accesses the master node (Master) and is routed to each participant (Slave), or called participating node. After being executed on each participating node, it is then executed according to the two-phase commit protocol (2PC) and the transaction coordinator (Coordinator), Or it is called the coordinator, coordinating nodes to interact and complete transaction commit or rollback.
  • 2PC two-phase commit protocol
  • Coordinator the transaction coordinator
  • the first phase is called the voting phase: the transaction coordinator sends a voting request to each physical node, and each participating node puts the transaction in the running state of the node ("ready" prepare or “terminate” abort) write the log and send the status to the transaction coordinator;
  • the second phase is called the decision phase, the transaction coordinator makes a decision based on the operating status of each participating node in the first phase: if all participating nodes In the "ready” state, a "commit” instruction is issued to all participating nodes; if the state of a participating node is "terminated”, a “rollback” instruction is issued to all participating nodes.
  • Participating nodes accept commands from the transaction coordinator, perform a "commit” or “rollback” operation locally, write the “commit” or “rollback” status to the log, and then reply to the transaction coordinator. Finally, the transaction coordinator feeds back the execution of the transaction to the Master control node ("Submit” returns success, and “Return” returns failure).
  • the embodiment of the present application provides a transaction management method, including: a coordination node receives a structured query language SQL request initiated from the outside forwarded by a master control node; the coordination node decomposes the SQL request into sub-request SubSQL, and sends To each corresponding participating node; the participating node receives and processes the sub-request SubSQL, sends the execution status information of the sub-request SubSQL to the coordinating node and/or other participating nodes, and receives other participating nodes to process their respective sub-request SubSQL
  • the execution status information of the participating node according to the status query information initiated by the master control node or the coordinating node, the participating node feeds back the existing local transaction status set of the participating node.
  • the embodiment of the present application also provides a transaction management system, including a master control node, a coordination node, and several participating nodes, wherein: the coordination node receives an externally initiated structured query language SQL request forwarded by the master control node; The coordinating node decomposes the SQL request into sub-request SubSQL and sends it to each corresponding participating node; the participating node receives and processes the sub-request SubSQL, and sends the execution status information of the sub-request SubSQL to the coordinating node and/or Other participating nodes, and receive the execution status information of other participating nodes processing their respective subrequest SubSQL; the participating node feeds back the existing part of the current participating node according to the status query information initiated by the master control node or the coordinating node Transaction status collection.
  • the coordination node receives an externally initiated structured query language SQL request forwarded by the master control node;
  • the coordinating node decomposes the SQL request into sub-request SubSQ
  • the embodiments of the present application also provide a network device.
  • the network device includes a processor, a memory, and a communication bus; the communication bus is used to implement connection and communication between the processor and the memory; the processor is used to execute one or more computers stored in the memory Procedures to implement the steps of the above-mentioned transaction management method.
  • the embodiments of the present application also provide a computer storage medium, and the computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the above-mentioned transaction management method.
  • FIG. 1 is a flowchart of a transaction management method provided by Embodiment 1 of this application;
  • FIG. 2 is a flowchart of the transaction management method provided in the second embodiment of the application.
  • Fig. 3 is a schematic diagram of the composition of the transaction management system provided in the third embodiment of the application.
  • FIG. 4 is a schematic structural diagram of a network device provided in Embodiment 4 of this application.
  • the transaction management method, system, network device, and readable storage medium mainly solve technical problems: in related technologies, log management is prone to blockage and transaction processing efficiency is low.
  • This embodiment provides a transaction management method. Please refer to FIG. 1.
  • the method includes:
  • the coordinating node Coordinator receives the structured query language SQL request initiated from the outside and forwarded by the master control node Master;
  • the coordination node decomposes the SQL request into sub-request SubSQL, and sends it to each corresponding participating node Slave;
  • the participating node receives and processes the subrequest SubSQL, sends the execution status information of the subrequest SubSQL to the coordinating node and/or other participating nodes, and receives the execution status information of the other participating nodes for processing their respective subrequest SubSQL;
  • the participating node feeds back the existing local transaction state set of the current participating node according to the status query information initiated by the master control node or the coordinating node.
  • the master control node plays a role in the interaction between the system and the outside world, that is, the user. Through the master control node, it receives the SQL request initiated by the user, thereby further starting the transaction management process in this embodiment. Then, the master control node can selectively send a query request to the coordinating node or the participating node, and wait for its response message.
  • the master control node sends the SQL request to the coordinating node.
  • the coordination node functions as a relay between the master control node and each participating node.
  • the coordination node decomposes the SQL request to obtain the sub-request SubSQL, and then sends the sub-request SubSQL to each participating node for processing and execution.
  • the coordinating node will also receive relevant execution status information sent from the participating nodes. On the one hand, it records the status of the participating nodes, and on the other hand, it can also respond to query requests initiated by the master control node.
  • the participating node receives the sub-request SubSQL sent by the coordinating node for processing, sends the execution status information of the sub-request SubSQL to the coordinating node and/or other participating nodes, and can receive the execution status information sent by other participating nodes at the same time. In this way, the participating nodes themselves can obtain information to make decisions, which improves the flexibility of the system and reduces the blocking rate of the system.
  • various message primitives that may exist between the master control node, the coordination node, and the participating nodes include but are not limited to the following:
  • Global transaction complete sent by the participating node Slave to the master control node. Contains TX and the global flag GlobalFlag (where “Success” means global success, and “Fail” means global failure).
  • Partial transaction start message sent to Slave by the transaction coordinator Coordinator through TXmsgMgr. Including TX, sub-request SubSQL (obtained after the global transaction SQL request is split by the Coordinator), the Slave that this transaction feedbacks the global result to the Master, the parameter P1 of TXLogMgr, the parameter P2 of TXmsgMgr, and the timeout period.
  • Timeout notification message The timeout timer set by the Slave is sent to itself. Contains TX.
  • Alarm notification message The alarm timer set by Master/Slave is sent to itself. Contains TX.
  • Participating nodes have the following actions during transaction processing:
  • Local transaction execution operation OpExecute first write the "TXBegin" record to the local storage device through the TXLogMgr component, secondly execute the SQL request operation to obtain the local lock resource, and write data change information to the local storage device through the TXLogMgr component during the process.
  • the coordinating node when the coordinating node receives the structured query language SQL request from the outside and forwarded by the master control node, when the master control node forwards the SQL request, it may further include:
  • the coordinating node decomposing the SQL request into sub-request SubSQL and sending to each corresponding participating node may include:
  • the coordinating node decomposes the SQL request into sub-request SubSQL for each participating node, and sets the network parameters of the participating nodes.
  • the network parameters include at least one of log TXLogMgr parameters, message TXmsgMgr parameters, and timeout time point information. Appropriate network parameters can improve the transaction processing efficiency of the system. among them:
  • TXLogMgr In the program of the coordination node and the participating nodes, it processes the log read and write operations of this program.
  • the target medium written by the TXLogMgr component can be a disk or a non-volatile storage device, such as NAND flash memory or PCM phase memory; TXLogMgr performs local buffering when receiving a write request.
  • the buffer time is "write interval parameter" P1, and the buffer expires. Really write to the target medium.
  • the TXLogMgr parameter refers to the write interval parameter P1.
  • TXmsgMgr In the process of coordinating nodes and participating nodes, it processes the network communication operations of this program.
  • the TXmsgMgr component can use traditional communication equipment or the communication equipment supported by the Remote Direct Memory Access (RDMA) protocol to communicate, such as the communication equipment supported by the RDMA protocol; the communication of the TXmsgMgr component, such as the multicast protocol, can also be Use unicast; TXmsgMgr performs local buffering when receiving a sending request, and the buffering time is the "sending interval parameter" P2, and the buffer is expired before it is actually sent.
  • the TXmsgMgr parameter refers to the transmission interval parameter P2.
  • the network parameters of the participating nodes may further include: the coordinating node specifies the specific participating node information of the master control node from the participating nodes. Participating nodes can directly reply to the query request initiated by the master control node, and the coordinating node can designate a specific participating node to reply to the master control node from among the many participating nodes.
  • the coordinating node sends the network parameters to the corresponding participating nodes through TXmsgMgr.
  • the participating node receiving and processing the sub-request SubSQL may include:
  • Participating nodes perform local transaction execution operations until they reach the ready state or the abort state.
  • a participating node when the suspended state is reached, it further includes:
  • Participating nodes perform the rollback action.
  • a participating node when the ready state is reached, it may further include:
  • the ready state is sent to the coordinating node and/or other participating nodes the execution state information corresponding to the ready state, and the ready state is written into the local storage.
  • the execution status information of the sub-request SubSQL processed by other participating nodes may further include:
  • the local execution status information and the received execution status information of the subrequest SubSQL processed by other nodes are merged into the local transaction status collection and written into the local storage.
  • it may further include:
  • the participating nodes initiate a global transaction status query message to the master control node and/or the coordinating node, and actively query the latest status of the transaction TX.
  • the method before the coordinating node receives the structured query language SQL request initiated from the outside forwarded by the master control node, the method further includes:
  • the coordination node receives the structured query language SQL request from the outside and forwarded by the master control node; the coordination node decomposes the SQL request into sub-requests SubSQL and sends them to the corresponding participating nodes; Participating nodes receive and process the sub-request SubSQL, send the execution status information of the sub-request SubSQL to the coordinating node and/or other participating nodes, and receive the execution status information of the other participating nodes to process their respective sub-request SubSQL; the participating nodes follow the master control node Or coordinating the status query information initiated by the node to feed back the existing local transaction status set of the current participating node. In this way, each participating node can also carry out independent transmission and reception of execution status information and feedback of status query information, which improves the flexibility of the system, reduces the blocking rate, and improves the efficiency of transaction processing.
  • This embodiment provides a transaction processing method and a corresponding transaction processing system. Please refer to Figure 2. First, the following definitions are given:
  • Ps be the discrete space of the number of write transactions started in the current cycle of the system, and
  • p is the number of the Ps interval where the number of write transactions started in the current cycle of the system is located, where
  • >p> 0;
  • Fs be the discrete space of the number of write transactions completed in the current cycle of the system, and
  • f is the number of the Fs interval where the number of write transactions completed in the current cycle of the system is located, where
  • >f> 0;
  • Es be the discrete space for the system to increase the TXLogMgr write log interval ratio, and
  • e is the number of the system-related behavior in the Es interval, where
  • >e> 0;
  • Ds be the discrete space for the system to increase the ratio of TXmsgMgr sending messages, and
  • d is the number of the system-related behavior in the Ds interval, where
  • >d> 0;
  • Behavior value table Q a two-dimensional array, where Q[i,j] represents the evaluation score of behavior Aj in state Si;
  • Reward R the average time-consuming acceleration rate of write transactions in the current cycle of the system
  • Utilization rate eps Determines the probability that the system adopts the current optimal parameter settings.
  • the transaction processing system has the following system behaviors:
  • System initialization includes the following contents:
  • Initialization selection Ainit according to the current state Sinit, select the action Ainit in the Q table with the highest evaluation score under the state Sinit with the eps probability; randomly select the action Ainit under S0 with the 1-eps probability;
  • Select Anext According to the state Snext, select the action Anext with the highest evaluation score in the Q table and the state Snext with the eps probability; randomly select the action Anext under Snext with the 1-eps probability;
  • Q[i,j] is the value of behavior Aj in state Si; refer to Table 3:
  • Initialization selection Ainit According to the current state Sinit, select the action Ainit in the Q table with the highest evaluation score under the state Sinit with the eps probability; randomly select the action Ainit under S0 with the 1-eps probability. (For example, the last selected Ainit is A8, then the P1/P2 parameters will go up by 10% respectively);
  • Each network element Master/Slave/Coordinator establishes a communication connection with each other.
  • each network element adopts a multicast communication mode to join the same multicast group.
  • TXmsgMgr component adopts RDMA device and multicast communication protocol; TXLogMgr component storage device is based on flash memory device.
  • the transaction is submitted according to the aforementioned distributed submission protocol, during which the working strategy of TXLogMgr is determined by P1, and the working strategy of TXmsgMgr is determined by P2.
  • Select Anext According to the state Snext, select the action Anext in the Q table with the highest evaluation score under the state Snext with the eps probability; randomly select the action Anext under Snext with the 1-eps probability.
  • a transaction management system is provided. Please refer to FIG. 3.
  • the system includes a master control node 31, a coordination node 32, and a number of participating nodes 33, among which:
  • the coordination node 32 receives the structured query language SQL request initiated from the outside and forwarded by the main control node 31;
  • the coordination node 32 decomposes the SQL request into sub-request SubSQL, and sends it to each corresponding participating node 33;
  • the participating node 33 receives and processes the subrequest SubSQL, sends the execution status information of the subrequest SubSQL to the coordinating node 32 and/or other participating nodes 33, and receives the execution status information of the other participating nodes 33 for processing their respective subrequest SubSQL;
  • the participating node 33 feeds back the existing local transaction status set of the current participating node 33 according to the status query information initiated by the master control node 31 or the coordinating node 32.
  • the master control node 31 plays a role in the interaction between the system and the outside world, that is, the user. Through the master control node 31, the SQL request initiated by the user is received, thereby further starting the transaction management process in this embodiment. Then, the master control node 31 can selectively send a query request to the coordinating node 32 or the participating node 33, and wait for its response message.
  • the master control node 31 sends the SQL request to the coordination node 32.
  • the coordination node 32 acts as a relay between the main control node 31 and each participating node 33.
  • the coordination node 32 decomposes the SQL request to obtain the sub-request SubSQL, and then sends the sub-request SubSQL to each participating node 33 for processing carried out.
  • the coordinating node 32 will also receive related execution status information sent from the participating nodes 33, on the one hand, it can record the status of the participating nodes 33, and on the other hand, it can also respond to query requests initiated by the master control node 31.
  • the participating node 33 receives the sub-request SubSQL sent by the coordinating node 32 for processing, sends the execution status information of the sub-request SubSQL to the coordinating node 32 and/or other participating nodes 33, and can receive the execution status sent by other participating nodes 33 at the same time information. In this way, the participating nodes 33 can obtain information to make decisions by themselves, which improves the flexibility of the system and reduces the blocking rate of the system.
  • the coordinating node 32 when the coordinating node 32 receives the structured query language SQL request from the outside and forwarded by the main control node 31, when the main control node 31 forwards the SQL request, it may further include:
  • the coordinating node 32 decomposing the SQL request into sub-request SubSQL and sending to each corresponding participating node 33 may include:
  • the coordination node 32 decomposes the SQL request into sub-request SubSQL for each participating node 33, and sets network parameters of the participating node 33.
  • the network parameters include at least one of log TXLogMgr parameters, message TXmsgMgr parameters, and timeout time point information. Appropriate network parameters can improve the transaction processing efficiency of the system.
  • the network parameters of the participating node 33 may further include: the coordinating node 32 specifies from the participating nodes 33 to reply to the specific participating node 33 information of the master control node 31.
  • the participating node 33 can directly reply to the query request initiated by the master control node 31, and the coordinating node 32 can designate a specific participating node 33 to reply to the master control node 31 from the numerous participating nodes 33 before this.
  • the coordinating node 32 sends the network parameters to the corresponding participating node 33 via TXmsgMgr.
  • the participating node 33 receiving and processing the sub-request SubSQL may include:
  • the participating nodes 33 perform local transaction execution operations until reaching the ready state or the suspended state.
  • the participating node 33 when the participating node 33 performs the local transaction execution operation, when the suspended state is reached, it further includes:
  • the participating node 33 performs a rollback action.
  • the participating node 33 when it reaches the ready state, it may further include:
  • the ready state is sent to the coordination node 32 and/or other participating nodes 33 and the execution state information corresponding to the ready state is sent, and the ready state is written into the local storage.
  • the execution status information of the sub-request SubSQL processed by other participating nodes 33 may further include:
  • the local execution status information and the received execution status information of the subrequest SubSQL processed by other nodes are merged into the local transaction status collection and written into the local storage.
  • it may further include:
  • the participating node 33 initiates a global transaction status query message to the master control node 31 and/or the coordinating node 32 to actively query the latest status of the transaction TX.
  • the method before the coordination node 32 receives the structured query language SQL request from the outside and forwarded by the master control node 31, the method further includes:
  • the coordination node 32 receives the structured query language SQL request initiated from the outside and forwarded by the main control node 31; the coordination node 32 decomposes the SQL request into sub-request SubSQL and sends it to each corresponding Participating node 33; Participating node 33 receives and processes the sub-request SubSQL, sends the execution status information of the sub-request SubSQL to the coordinating node 32 and/or other participating nodes 33, and receives other participating nodes 33 to process the execution status of their respective sub-request SubSQL Information; the participating node 33 feeds back the existing local transaction status set of the current participating node 33 according to the status query information initiated by the master control node 31 or the coordinating node 32. Therefore, each participating node 33 can also perform independent transmission and reception of execution status information and feedback of status query information, which improves the flexibility of the system, reduces the blocking rate, and improves the efficiency of transaction processing.
  • This embodiment also provides a network device, as shown in FIG. 4, which includes a processor 41, a memory 42, and a communication bus 43, where:
  • the communication bus 43 is used to implement connection and communication between the processor 41 and the memory 42;
  • the processor 41 is configured to execute one or more computer programs stored in the memory 42 to implement the steps of the transaction management method in the foregoing embodiments, and details are not described herein again.
  • This embodiment also provides a computer-readable storage medium, which is included in any method or technology for storing information (such as computer-readable instructions, data structures, computer program modules, or other data). Volatile or non-volatile, removable or non-removable media.
  • Computer-readable storage media include but are not limited to RAM (Random Access Memory), ROM (Read-Only Memory, read-only memory), EEPROM (Electrically Erasable Programmable read only memory, charged Erasable Programmable Read-Only Memory) ), flash memory or other memory technology, CD-ROM (Compact Disc Read-Only Memory), digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage systems, Or any other medium that can be used to store desired information and that can be accessed by a computer.
  • the computer-readable storage medium in this embodiment can be used to store one or more computer programs, and the stored one or more computer programs can be executed by a processor to implement at least one step of the transaction management method in the foregoing embodiments .
  • This embodiment also provides a computer program (or computer software).
  • the computer program can be distributed on a computer-readable medium and executed by a computable system to implement at least one of the transaction management methods in the foregoing embodiments. step.
  • This embodiment also provides a computer program product, including a computer readable system, on which the computer program as shown above is stored.
  • the computer-readable system in this embodiment may include the computer-readable storage medium as shown above.
  • communication media usually contain computer-readable instructions, data structures, computer program modules, or other data in a modulated data signal such as carrier waves or other transmission mechanisms, and may include any information delivery medium. Therefore, this application is not limited to any specific combination of hardware and software.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Computing Systems (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Computation (AREA)
  • Medical Informatics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种事务管理方法、系统、网络设备和可读存储介质,方法包括:协调节点接收主控节点所转发的从外部发起的结构化查询语言SQL请求;协调节点将SQL请求分解为子请求SubSQL,并发送给各相应的参与节点;参与节点接收子请求SubSQL并处理,将子请求SubSQL的执行状态信息发送给协调节点和/或其他参与节点,并接收其他参与节点处理各自的子请求SubSQL的执行状态信息;参与节点根据主控节点或者协调节点所发起的状态查询信息,反馈当前参与节点已有的局部事务状态集合。

Description

事务管理方法、系统、网络设备和可读存储介质
相关申请的交叉引用
本申请基于申请号为201910965337.9、申请日为2019年10月11日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此以引入方式并入本申请。
技术领域
本申请实施例涉及但不限于计算机技术领域,具体而言,涉及但不限于一种事务管理方法、系统、网络设备和可读存储介质。
背景技术
对于分布式数据库来说,分布式事务提交是其核心功能。分布式事务提交的实施方式直接决定了系统的事务约束水平。
当前主流分布式数据库都具有水平分片性质:即数据表呈现水平(根据行键)扩展形态、分布在不同物理节点;用户发起的结构化查询语言(Structured Query Language,SQL)查询请求通过分布式数据库访问主控节点(Master)、被路由到各个参与者(Slave),或者称为参与节点,在各个参与节点上执行后,再根据两阶段提交协议(2PC)与事务协调器(Coordinator),或者叫做协调者、协调节点进行交互、完成事务的提交或者回退。
具体的,在两阶段提交协议2PC中,第一阶段被称为投票阶段:由事务协调器向每个物理节点发出投票请求、每个参与节点将该事务在本节点的运行状态(“就绪”prepare或“终止”abort)写日志、并发送该状态给事务协调器;第二 阶段被称为决策阶段,由事务协调器根据第一阶段每个参与节点的运行状态进行决策:如果全部参与节点都在“就绪”状态下、就向全部参与节点发出“提交(commit)”指令;如果有参与节点的状态是“终止”,则向全部参与节点发出“回退(rollback)”指令。参与节点接受事务协调器的命令、在本地执行“提交”或者“回退”操作、将“提交”或者“回退”状态写入日志、再回复给事务协调器。最后由事务协调器向Master主控节点反馈该事务的执行情况(“提交”则返回成功,“回退”则返回失败)。
发明内容
本申请实施例提供一种事务管理方法,包括:协调节点接收主控节点所转发的从外部发起的结构化查询语言SQL请求;所述协调节点将所述SQL请求分解为子请求SubSQL,并发送给各相应的参与节点;参与节点接收所述子请求SubSQL并处理,将所述子请求SubSQL的执行状态信息发送给协调节点和/或其他参与节点,并接收其他参与节点处理各自的子请求SubSQL的执行状态信息;所述参与节点根据所述主控节点或者协调节点所发起的状态查询信息,反馈当前所述参与节点已有的局部事务状态集合。
本申请实施例还提供一种事务管理系统,包括主控节点、协调节点以及若干参与节点,其中:所述协调节点接收主控节点所转发的从外部发起的结构化查询语言SQL请求;所述协调节点将所述SQL请求分解为子请求SubSQL,并发送给各相应的参与节点;参与节点接收所述子请求SubSQL并处理,将所述子请求SubSQL的执行状态信息发送给协调节点和/或其他参与节点,并接收其他参与节点处理各自的子请求SubSQL的执行状态信息;所述参与节点根据所述主控节点或者协调节点所发起的状态查询信息,反馈当前所述参与节点已有的局部事务状态集合。
本申请实施例还提供一种网络设备,网络设备包括处理器、存储器及通信总线;通信总线用于实现处理器和存储器之间的连接通信;处理器用于执行存储器中存储的一个或者多个计算机程序,以实现上述的事务管理方法的步骤。
本申请实施例还提供一种计算机存储介质,计算机可读存储介质存储有一个或者多个程序,一个或者多个程序可被一个或者多个处理器执行,以实现上述的事务管理方法的步骤。
附图说明
图1为本申请实施例一提供的事务管理方法流程图;
图2为本申请实施例二提供的事务管理方法流程图;
图3为本申请实施例三提供的事务管理系统组成示意图;
图4为本申请实施例四提供的一种网络设备结构示意图。
具体实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,下面通过具体实施方式结合附图对本申请实施例作进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
在一些情形中,2PC协议存在一个关键弊端:第一阶段参与节点向事务协调器发送自身状态后,如果是“就绪”状态、则需要持续等待事务协调器的决策命令,没有超时逻辑。因为在以上协议中、各个参与节点之间没有相互通讯机制,最终“提交”或是“回退”需要由事务协调器决策。如果事务协调器故障,则参与节点需要持续等待其恢复后给予明确指令,在此过程中、参与节点上针对该事务所持有的锁定资源将不会释放,以上过程被称为“阻塞”。综上所述,两阶段提交协议下,如果事务协调器故障,则会导致阻塞、从而降低系统的事务处理能力。
本申请实施例提供的事务管理方法、系统、网络设备和可读存储介质,主要解决的技术问题:相关技术中,日志管理容易阻塞,事务处理效率低下。
实施例一:
本实施例提供了一种事务管理方法,请参考图1,该方法包括:
S101、协调节点Coordinator接收主控节点Master所转发的从外部发起的结构化查询语言SQL请求;
S102、协调节点将SQL请求分解为子请求SubSQL,并发送给各相应的参与节点Slave;
S103、参与节点接收子请求SubSQL并处理,将子请求SubSQL的执行状态信息发送给协调节点和/或其他参与节点,并接收其他参与节点处理各自的子请求SubSQL的执行状态信息;
S104、参与节点根据主控节点或者协调节点所发起的状态查询信息,反馈当前参与节点已有的局部事务状态集合。
主控节点起到了系统与外界,也就是用户之间的交互作用,通过主控节点,接收用户所发起的SQL请求,从而进一步启动本实施例中的事务管理流程。而后,主控节点可以选择性的向协调节点或者是参与节点发送查询请求,并等待其响应消息。
主控节点将SQL请求,发送给协调节点。协调节点起到了主控节点与各参与节点之间的中继的作用,协调节点会将SQL请求进行分解得到子请求SubSQL,然后将子请求SubSQL发送给各个参与节点来进行处理执行。此外,协调节点还会接收从参与节点所发来的相关执行状态信息,一方面对参与节点的状态进行记录,一方面还可以对主控节点所发起的查询请求进行响应。
参与节点接收协调节点发送的子请求SubSQL进行处理,将子请求SubSQL的执行状态信息发送给协调节点和/或其他参与节点,并且,同时可以接收其他参与节点所发送的执行状态信息。如此,参与节点自己就可以获知信息进行决策,提升了系统的灵活性,降低了系统的阻塞率。
本实施例中,主控节点、协调节点以及参与节点之间可能存在的各种消息原语,包括但不限于以下内容:
“全局事务启动”消息:由主控节点Master向事务协调器Coordinator发送,包含SQL请求和事务序列号TX。
“全局事务完成”消息:由参与节点Slave向主控节点Master发送。包含TX、全局标记GlobalFlag(其中“Success”表示全局成功,“Fail”表示全局失败)。
“局部事务启动”消息:由事务协调器Coordinator通过TXmsgMgr向Slave发送。包含TX、子请求SubSQL(全局事务SQL请求被Coordinator切分后得到)、本次事务向Master反馈全局结果的Slave、TXLogMgr的参数P1、TXmsgMgr的参数P2、超时时间。
“局部事务状态通知”消息:由Slave通过TXmsgMgr向其它Slave和/或Coordinator发送。包括TX、Slave标示ID、Status(“Prepare”表示本地就绪,“Abort”表示本地中止)。其中,StatusSet表示事务TX的数据集合,该集合中每个元素表示该TX在某个参与者上的状态(“就绪”或者“中止”)。
“全局事务状态查询”消息:由Slave/Master向Coordinator/Slave发送。包含TX。
“全局事务状态响应”消息:由Coordinator/Slave向Slave/Master发送。包含TX、StatusSet(迄今为止,在其本地存储的、序号为TX的全局事务在各个节点的局部事务状态集合)。
“超时通知”消息:由Slave设置的超时定时器发送给其自身。包含TX。
“预警通知”消息:由Master/Slave设置的预警定时器发送给其自身。包含TX。
参与节点在事务处理过程中,具有以下动作:
本地事务执行操作OpExecute:首先通过TXLogMgr组件向本地存储设备写入“TXBegin”记录,其次执行SQL请求操作获取本地锁资源、期间通过TXLogMgr组件向本地存储设备写入数据变化信息。
本地事务提交操作OpCommit:首先释放本地锁资源、其次通过TXLogMgr组件向本地存储设备写入“Commit”记录;额外地,如果本Slave被指定向Master返回应答,则向Master发送“全局事务完成”消息,令GlobalFlag为“全局成功Success”。
本地事务回退操作OpRollback:首先读取本地存储设备信息,利用本事务数据变化信息进行数据覆盖、其次释放本地锁资源、最后通过TXLogMgr组件向本地存储设备写入“Rollback”记录;额外地,如果本Slave被指定向Master返回应答,则向Master发送“全局事务完成”消息,令GlobalFlag为“全局失败Fail”。
在一些实施例中,协调节点接收主控节点所转发的从外部发起的结构化查询语言SQL请求中,主控节点在转发SQL请求时,还可以包括:
启动预警定时器。
在一些实施例中,协调节点将SQL请求分解为子请求SubSQL,并发送给各相应的参与节点可以包括:
协调节点为各参与节点分解SQL请求为子请求SubSQL,并设置参与节点的网络参数,网络参数包括日志TXLogMgr参数、消息TXmsgMgr参数、超时时间点信息中的至少一种。合适的网络参数,可以提升系统的事务处理效率。其中:
TXLogMgr:处于协调节点和参与节点的程序中,处理本程序的日志读写操作。TXLogMgr组件写入的目标介质可以是磁盘或者非易丢失性存储设备,例如NAND闪存或者PCM相位存储器;TXLogMgr收到写请求时进行本地缓冲,缓冲时间为“写间隔参数”P1,缓冲到期才真正向目标介质写入。也就是说,TXLogMgr参数指的是写间隔参数P1。
TXmsgMgr:处于协调节点和参与节点的程序中,处理本程序的网络通讯操作。TXmsgMgr组件可以利用传统通讯设备或者远程直接数据存取(Remote Direct Memory Access,RDMA)协议支持的通讯设备进行通讯,例如RDMA协议支持的通讯设备;TXmsgMgr组件的通讯,例如采用组播协议、也可以使用单播;TXmsgMgr收到发送请求时进行本地缓冲,缓冲时间为“发送间隔参数”P2,缓冲到期才真正发送。也就是说,TXmsgMgr参数指的是发送间隔参数P2。
在一些实施例中,参与节点的网络参数还可以包括:协调节点从参与节点中,指定回复主控节点的特定参与节点信息。参与节点可以直接回复主控节点发起的查询请求,而协调节点在此之前可以从众多参与节点中,指定回复主控 节点的特定参与节点。
在一些实施例中,协调节点通过TXmsgMgr将网络参数发送给相应的参与节点。
在一些实施例中,参与节点接收子请求SubSQL并处理可以包括:
参与节点进行本地事务执行操作,直至抵达就绪状态或中止状态。
在一些实施例中,参与节点进行本地事务执行操作中,当抵达中止状态时,还包括:
参与节点执行回退rollback动作。
在一些实施例中,参与节点进行本地事务执行操作中,当抵达就绪状态时,还可以包括:
将就绪状态向协调节点和/或其他参与节点发送对应于就绪状态的执行状态信息,并将就绪状态写入本地存储。
在一些实施例中,接收其他参与节点处理各自的子请求SubSQL的执行状态信息之后,还可以包括:
将本地的执行状态信息,与接收到的其他节点所处理子请求SubSQL的执行状态信息进行合并入局部事务状态集合中,并写入本地存储。
在一些实施例中,还可以包括:
参与节点向主控节点和/或协调节点发起全局事务状态查询消息,主动查询事务TX的最新状态。
在一些实施例中,在协调节点接收主控节点所转发的从外部发起的结构化查询语言SQL请求之前,还包括:
对系统进行初始化;
将主控节点、协调节点以及参与节点加入组播组;
统计在预设时长内的系统启动和完成事务的情况;
基于系统启动和完成事务的情况,设置日志TXLogMgr参数、消息 TXmsgMgr参数的值。
对于分布式事务的恢复流程,需要确保参与者Slave的行为符合事务一致性。
遍历TXLogMgr写入的Slave日志,对于每个事务:
如果有“TXBegin”和“Prepare”、“Commit”记录:无需操作;
如果有“TXBegin”和“Prepare”、“Rollback”记录:无需操作;
如果只有“TXBegin”和“Rollback”记录:无需操作;
如果只有“TXBegin”记录:执行本地事务回退操作OpRollback;
如果只有“TXBegin”和“Prepare”记录:通过TXmsgMgr向协调者和其它参与者发出“全局事务状态查询”消息、直到全部参与者状态均被获取;如果TX全部参与者都处于“就绪”状态,则执行本地事务提交操作OpCommit、否则执行本地事务回退操作OpRollback。
本实施提供了一种事务管理方法,协调节点接收主控节点所转发的从外部发起的结构化查询语言SQL请求;协调节点将SQL请求分解为子请求SubSQL,并发送给各相应的参与节点;参与节点接收子请求SubSQL并处理,将子请求SubSQL的执行状态信息发送给协调节点和/或其他参与节点,并接收其他参与节点处理各自的子请求SubSQL的执行状态信息;参与节点根据主控节点或者协调节点所发起的状态查询信息,反馈当前参与节点已有的局部事务状态集合。从而通过各参与节点也能进行执行状态信息的独立收发,以及对状态查询信息的反馈,提升了系统的灵活性,降低了阻塞率,从而提升了事务处理效率。
实施例二
本实施例给出了一种事务处理方法以及对应的事务处理系统,请参考图2,首先给出如下定义:
令Ps为系统本周期内启动写事务数的离散空间,|P|为Ps空间的规模;
p为系统本周期内启动的写事务数所在Ps区间的编号,其中|P|>p>=0;
令Fs为系统本周期内完成写事务数的离散空间,|F|为Fs空间的规模;
f为系统本周期内完成的写事务数所在Fs区间的编号,其中|F|>f>=0;
令Es为系统提升TXLogMgr写日志间隔比率的离散空间,|E|为Es的规模;
e为系统相关行为在Es区间中的编号,其中|E|>e>=0;
令Ds为系统提升TXmsgMgr发送消息间隔比率的离散空间,|D|为Ds规模;
d为系统相关行为在Ds区间中的编号,其中|D|>d>=0;
状态空间S:一维离散化<Ps,Fs>,S中下标i=p*|F|+f;
行为空间A:一维离散化<Es,Ds>,A中下标j=e*|D|+d;
行为价值表Q:二维数组,其中Q[i,j]表示状态Si下行为Aj的评价得分;
奖励R:系统本周期内写事务的平均耗时加速率;
学习率LearningRate:决定对行为价值表Q的更新效率;
利用率eps:决定系统采用当前最优参数设置的概率。
该事务处理系统具有如下系统行为:
系统初始化;系统初始化中,包括如下内容:
随机初始化行为价值表Q;
根据本周期内,系统启动和完成写事务的数目,确定初始化状态Sinit;
初始化选择Ainit:根据当前状态Sinit,以eps概率选择Q表中、状态Sinit下最高评价得分所在动作Ainit;以1-eps概率随机选择S0下动作Ainit;
令Ac=Ainit;Sc=Sinit;执行Ac中的行为,设置TXLogMgr的写入间隔P1和TXmsgMgr的发送间隔P2。
定期训练行为价值表、并选择当前行为:
计算本周期内执行Ac的环境奖励R;
根据本周期内,系统启动和完成写事务的数目,确定当前状态Snext;
选择Anext:根据状态Snext,以eps概率选择Q表中、状态Snext下最高 评价得分所在动作Anext;以1-eps概率随机选择Snext下动作Anext;
行为价值学习:
Q[Sc,Ac]=Q[Sc,Ac]+LearningRate*(R+0.5*Q[Snext,Anext]-Q[Sc,Ac])
令Ac=Anext;Sc=Snext;执行Ac中的行为,调整TXLogMgr的写入间隔P1和TXmsgMgr的发送间隔P2。
定义状态空间S,如表1:
表1
Figure PCTCN2020119646-appb-000001
定义行为空间S,如表2:
表2
Figure PCTCN2020119646-appb-000002
定义行为价值表Q,随机正态初始化:Q[i,j]为状态Si下行为Aj的价值;参考表3:
表3
  A0 A1 A2 A3 A4 A5 A6 A7 A8
S0 Q[0,0] Q[0,1] Q[0,2] Q[0,3] Q[0,4] Q[0,5] Q[0,6] Q[0,7] Q[0,8]
S1 Q[1,0] Q[1,1] Q[1,2] Q[1,3] Q[1,4] Q[1,5] Q[1,6] Q[1,7] Q[1,8]
S2 Q[2,0] Q[2,1] Q[2,2] Q[2,3] Q[2,4] Q[2,5] Q[2,6] Q[2,7] Q[2,8]
S3 Q[3,0] Q[3,1] Q[3,2] Q[3,3] Q[3,4] Q[3,5] Q[3,6] Q[3,7] Q[3,8]
S4 Q[4,0] Q[4,1] Q[4,2] Q[4,3] Q[4,4] Q[4,5] Q[4,6] Q[4,7] Q[4,8]
S5 Q[5,0] Q[5,1] Q[5,2] Q[5,3] Q[5,4] Q[5,5] Q[5,6] Q[5,7] Q[5,8]
S6 Q[6,0] Q[6,1] Q[6,2] Q[6,3] Q[6,4] Q[6,5] Q[6,6] Q[6,7] Q[6,8]
S7 Q[7,0] Q[7,1] Q[7,2] Q[7,3] Q[7,4] Q[7,5] Q[7,6] Q[7,7] Q[7,8]
S8 Q[8,0] Q[8,1] Q[8,2] Q[8,3] Q[8,4] Q[8,5] Q[8,6] Q[8,7] Q[8,8]
定义学习率LearningRate为0.1;
定义利用率eps为0.7;
设置TXLogMgr写入间隔为150us;
设置TXmsgMgr发送间隔为30us。
S201、系统初始化:
根据本周期内,系统启动和完成写事务的数目,确定初始化状态Sinit(比如当前系统5分钟内开启事务5000,完成事务4000,则Sinit是S4);
初始化选择Ainit:根据当前状态Sinit,以eps概率选择Q表中、状态Sinit下最高评价得分所在动作Ainit;以1-eps概率随机选择S0下动作Ainit。(比如最后选择的Ainit是A8,则P1/P2参数分别上浮10%);
令Ac=Ainit;Sc=Sinit;执行Ac中的行为,设置TXLogMgr的写入间隔P1和TXmsgMgr的发送间隔P2;
各个网元Master/Slave/Coordinator互相建立通讯连接,在本实施例中、各个 网元采用组播通讯方式、加入同一组播组。
S02、系统执行:
TXmsgMgr组件通讯底层采用RDMA设备、以及组播通讯协议;TXLogMgr组件存储设备基于闪存设备。根据前述分布式提交协议进行事务提交,期间TXLogMgr的工作策略由P1确定、TXmsgMgr的工作策略由P2确定。
统计当前时间段事务提交的平均耗时;
统计当前时间段系统启动事务次数TXStarts;
统计当前时间段系统完成事务次数TXEnds。
S203、系统动态更新:
计算本周期内环境奖励R(系统本周期内,写事务平均耗时相对之前加速率);
根据本周期内,系统事务启动数目TXStarts和完成数目TXEnds,确定当前状态Snext;
选择Anext:根据状态Snext,以eps概率选择Q表中、状态Snext下最高评价得分所在动作Anext;以1-eps概率随机选择Snext下动作Anext。
S204、行为价值学习:
Q[Sc,Ac]=Q[Sc,Ac]+LearningRate*(R+0。5*Q[Snext,Anext]-Q[Sc,Ac])。
令Ac=Anext;Sc=Snext;执行Ac中的行为,调整TXLogMgr的写入间隔P1和TXmsgMgr的发送间隔P2。
实施例三
在本实施例中提供了一种事务管理系统,请参考图3,该系统包括主控节点31、协调节点32以及若干参与节点33,其中:
协调节点32接收主控节点31所转发的从外部发起的结构化查询语言SQL请求;
协调节点32将SQL请求分解为子请求SubSQL,并发送给各相应的参与节点33;
参与节点33接收子请求SubSQL并处理,将子请求SubSQL的执行状态信息发送给协调节点32和/或其他参与节点33,并接收其他参与节点33处理各自的子请求SubSQL的执行状态信息;
参与节点33根据主控节点31或者协调节点32所发起的状态查询信息,反馈当前参与节点33已有的局部事务状态集合。
主控节点31起到了系统与外界,也就是用户之间的交互作用,通过主控节点31,接收用户所发起的SQL请求,从而进一步启动本实施例中的事务管理流程。而后,主控节点31可以选择性的向协调节点32或者是参与节点33发送查询请求,并等待其响应消息。
主控节点31将SQL请求,发送给协调节点32。协调节点32起到了主控节点31与各参与节点33之间的中继的作用,协调节点32会将SQL请求进行分解得到子请求SubSQL,然后将子请求SubSQL发送给各个参与节点33来进行处理执行。此外,协调节点32还会接收从参与节点33所发来的相关执行状态信息,一方面对参与节点33的状态进行记录,一方面还可以对主控节点31所发起的查询请求进行响应。
参与节点33接收协调节点32发送的子请求SubSQL进行处理,将子请求SubSQL的执行状态信息发送给协调节点32和/或其他参与节点33,并且,同时可以接收其他参与节点33所发送的执行状态信息。如此,参与节点33自己就可以获知信息进行决策,提升了系统的灵活性,降低了系统的阻塞率。
在一些实施例中,协调节点32接收主控节点31所转发的从外部发起的结构化查询语言SQL请求中,主控节点31在转发SQL请求时,还可以包括:
启动预警定时器。
在一些实施例中,协调节点32将SQL请求分解为子请求SubSQL,并发送给各相应的参与节点33可以包括:
协调节点32为各参与节点33分解SQL请求为子请求SubSQL,并设置参与节点33的网络参数,网络参数包括日志TXLogMgr参数、消息TXmsgMgr参数、超时时间点信息中的至少一种。合适的网络参数,可以提升系统的事务处理效率。
在一些实施例中,参与节点33的网络参数还可以包括:协调节点32从参与节点33中,指定回复主控节点31的特定参与节点33信息。参与节点33可以直接回复主控节点31发起的查询请求,而协调节点32在此之前可以从众多参与节点33中,指定回复主控节点31的特定参与节点33。
在一些实施例中,协调节点32通过TXmsgMgr将网络参数发送给相应的参与节点33。
在一些实施例中,参与节点33接收子请求SubSQL并处理可以包括:
参与节点33进行本地事务执行操作,直至抵达就绪状态或中止状态。
在一些实施例中,参与节点33进行本地事务执行操作中,当抵达中止状态时,还包括:
参与节点33执行回退rollback动作。
在一些实施例中,参与节点33进行本地事务执行操作中,当抵达就绪状态时,还可以包括:
将就绪状态向协调节点32和/或其他参与节点33发送对应于就绪状态的执行状态信息,并将就绪状态写入本地存储。
在一些实施例中,接收其他参与节点33处理各自的子请求SubSQL的执行状态信息之后,还可以包括:
将本地的执行状态信息,与接收到的其他节点所处理子请求SubSQL的执行状态信息进行合并入局部事务状态集合中,并写入本地存储。
在一些实施例中,还可以包括:
参与节点33向主控节点31和/或协调节点32发起全局事务状态查询消息,主动查询事务TX的最新状态。
在一些实施例中,在协调节点32接收主控节点31所转发的从外部发起的结构化查询语言SQL请求之前,还包括:
对系统进行初始化;
将主控节点31、协调节点32以及参与节点33加入组播组;
统计在预设时长内的系统启动和完成事务的情况;
基于系统启动和完成事务的情况,设置日志TXLogMgr参数、消息TXmsgMgr参数的值。
本实施提供了一种事务管理系统,协调节点32接收主控节点31所转发的从外部发起的结构化查询语言SQL请求;协调节点32将SQL请求分解为子请求SubSQL,并发送给各相应的参与节点33;参与节点33接收子请求SubSQL并处理,将子请求SubSQL的执行状态信息发送给协调节点32和/或其他参与节点33,并接收其他参与节点33处理各自的子请求SubSQL的执行状态信息;参与节点33根据主控节点31或者协调节点32所发起的状态查询信息,反馈当前参与节点33已有的局部事务状态集合。从而通过各参与节点33也能进行执行状态信息的独立收发,以及对状态查询信息的反馈,提升了系统的灵活性,降低了阻塞率,从而提升了事务处理效率。
实施例四
本实施例还提供了一种网络设备,参见图4所示,其包括处理器41、存储器42及通信总线43,其中:
通信总线43用于实现处理器41和存储器42之间的连接通信;
处理器41用于执行存储器42中存储的一个或者多个计算机程序,以实现上述各实施例中的事务管理方法的步骤,这里不再赘述。
本实施例还提供了一种计算机可读存储介质,该计算机可读存储介质包括在用于存储信息(诸如计算机可读指令、数据结构、计算机程序模块或其他数据) 的任何方法或技术中实施的易失性或非易失性、可移除或不可移除的介质。计算机可读存储介质包括但不限于RAM(Random Access Memory,随机存取存储器),ROM(Read-Only Memory,只读存储器),EEPROM(Electrically Erasable Programmable read only memory,带电可擦可编程只读存储器)、闪存或其他存储器技术、CD-ROM(Compact Disc Read-Only Memory,光盘只读存储器),数字多功能盘(DVD)或其他光盘存储、磁盒、磁带、磁盘存储或其他磁存储系统、或者可以用于存储期望的信息并且可以被计算机访问的任何其他的介质。
本实施例中的计算机可读存储介质可用于存储一个或者多个计算机程序,其存储的一个或者多个计算机程序可被处理器执行,以实现上述各实施例中的事务管理方法的至少一个步骤。
本实施例还提供了一种计算机程序(或称计算机软件),该计算机程序可以分布在计算机可读介质上,由可计算系统来执行,以实现上述各实施例中的事务管理方法的至少一个步骤。
本实施例还提供了一种计算机程序产品,包括计算机可读系统,该计算机可读系统上存储有如上所示的计算机程序。本实施例中该计算机可读系统可包括如上所示的计算机可读存储介质。
可见,本领域的技术人员应该明白,上文中所公开方法中的全部或某些步骤、系统、系统中的功能模块/单元可以被实施为软件(可以用计算系统可执行的计算机程序代码来实现)、固件、硬件及其适当的组合。在硬件实施方式中,在以上描述中提及的功能模块/单元之间的划分不一定对应于物理组件的划分;例如,一个物理组件可以具有多个功能,或者一个功能或步骤可以由若干物理组件合作执行。某些物理组件或所有物理组件可以被实施为由处理器,如中央处理器、数字信号处理器或微处理器执行的软件,或者被实施为硬件,或者被实施为集成电路,如专用集成电路。
此外,本领域普通技术人员公知的是,通信介质通常包含计算机可读指令、数据结构、计算机程序模块或者诸如载波或其他传输机制之类的调制数据信号 中的其他数据,并且可包括任何信息递送介质。所以,本申请不限制于任何特定的硬件和软件结合。
以上内容是结合具体的实施方式对本申请实施例所作的进一步详细说明,不能认定本申请的具体实施只局限于这些说明。对于本申请所属技术领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干简单推演或替换,都应当视为属于本申请的保护范围。

Claims (14)

  1. 一种事务管理方法,包括:
    协调节点接收主控节点所转发的从外部发起的结构化查询语言SQL请求;
    所述协调节点将所述SQL请求分解为子请求SubSQL,并发送给各相应的参与节点;
    参与节点接收所述子请求SubSQL并处理,将所述子请求SubSQL的执行状态信息发送给协调节点和/或其他参与节点,并接收其他参与节点处理各自的子请求SubSQL的执行状态信息;
    所述参与节点根据所述主控节点或者协调节点所发起的状态查询信息,反馈当前所述参与节点已有的局部事务状态集合。
  2. 如权利要求1所述的事务管理方法,其中,所述协调节点接收主控节点所转发的从外部发起的结构化查询语言SQL请求中,所述主控节点在转发SQL请求时,还包括:
    启动预警定时器。
  3. 如权利要求1所述的事务管理方法,其中,所述协调节点将所述SQL请求分解为子请求SubSQL,并发送给各相应的参与节点包括:
    所述协调节点为各所述参与节点分解所述SQL请求为子请求SubSQL,并设置所述参与节点的网络参数,所述网络参数包括日志TXLogMgr参数、消息TXmsgMgr参数、超时时间点信息中的至少一种。
  4. 如权利要求3所述的事务管理方法,其中,所述所述参与节点的网络参数还包括:所述协调节点从所述参与节点中,指定回复所述主控节点的特定参与节点信息。
  5. 如权利要求4所述的事务管理方法,其中,所述协调节点通过所述TXmsgMgr将所述网络参数发送给相应的所述参与节点。
  6. 如权利要求1-5任一项所述的事务管理方法,其中,所述参与节点接收所述子请求SubSQL并处理包括:
    所述参与节点进行本地事务执行操作,直至抵达就绪状态或中止状态。
  7. 如权利要求6所述的事务管理方法,其中,所述参与节点进行本地事务执行操作中,当抵达中止状态时,还包括:
    所述参与节点执行回退rollback动作。
  8. 如权利要求6所述的事务管理方法,其中,所述参与节点进行本地事务执行操作中,当抵达就绪状态时,还包括:
    将所述就绪状态向所述协调节点和/或其他参与节点发送对应于就绪状态的执行状态信息,并将所述就绪状态写入本地存储。
  9. 如权利要求8所述的事务管理方法,其中,所述接收其他参与节点处理各自的子请求SubSQL的执行状态信息之后,还包括:
    将本地的执行状态信息,与接收到的其他节点所处理子请求SubSQL的执行状态信息进行合并入所述局部事务状态集合中,并写入本地存储。
  10. 如权利要求1-5任一项所述的事务管理方法,其中,还包括:
    所述参与节点向主控节点和/或协调节点发起全局事务状态查询消息,主动查询事务TX的最新状态。
  11. 如权利要求1-5任一项所述的事务管理方法,其中,在所述协调节点接收主控节点所转发的从外部发起的结构化查询语言SQL请求之前,还包括:
    对系统进行初始化;
    将所述主控节点、协调节点以及参与节点加入组播组;
    统计在预设时长内的系统启动和完成事务的情况;
    基于所述系统启动和完成事务的情况,设置日志TXLogMgr参数、消息TXmsgMgr参数的值。
  12. 一种事务管理系统,包括主控节点、协调节点以及若干参与节点,其中:
    所述协调节点接收主控节点所转发的从外部发起的结构化查询语言SQL请 求;
    所述协调节点将所述SQL请求分解为子请求SubSQL,并发送给各相应的参与节点;
    参与节点接收所述子请求SubSQL并处理,将所述子请求SubSQL的执行状态信息发送给协调节点和/或其他参与节点,并接收其他参与节点处理各自的子请求SubSQL的执行状态信息;
    所述参与节点根据所述主控节点或者协调节点所发起的状态查询信息,反馈当前所述参与节点已有的局部事务状态集合。
  13. 一种网络设备,所述网络设备包括处理器、存储器及通信总线;
    所述通信总线用于实现处理器和存储器之间的连接通信;
    所述处理器用于执行存储器中存储的一个或者多个计算机程序,以实现如权利要求1-11中任一项所述的事务管理方法的步骤。
  14. 一种计算机可读存储介质,其中,所述计算机可读存储介质存储有一个或者多个计算机程序,所述一个或者多个计算机程序可被一个或者多个处理器执行,以实现如权利要求1-11中任一项所述的事务管理方法的步骤。
PCT/CN2020/119646 2019-10-11 2020-09-30 事务管理方法、系统、网络设备和可读存储介质 WO2021068850A1 (zh)

Priority Applications (4)

Application Number Priority Date Filing Date Title
EP20873872.4A EP4024236A4 (en) 2019-10-11 2020-09-30 TRANSACTION MANAGEMENT METHOD AND SYSTEM, NETWORK DEVICE AND READABLE STORAGE MEDIA
KR1020227014341A KR20220065072A (ko) 2019-10-11 2020-09-30 트랜잭션 관리 방법, 시스템, 네트워크 기기 및 판독 가능 저장 매체
US17/767,432 US20240095236A1 (en) 2019-10-11 2020-09-30 Method and system for transaction management, network device, and readable storage medium
JP2022519425A JP7461468B2 (ja) 2019-10-11 2020-09-30 トランザクション管理方法およびシステム

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910965337.9A CN112650561B (zh) 2019-10-11 2019-10-11 事务管理方法、系统、网络设备和可读存储介质
CN201910965337.9 2019-10-11

Publications (1)

Publication Number Publication Date
WO2021068850A1 true WO2021068850A1 (zh) 2021-04-15

Family

ID=75342807

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/119646 WO2021068850A1 (zh) 2019-10-11 2020-09-30 事务管理方法、系统、网络设备和可读存储介质

Country Status (6)

Country Link
US (1) US20240095236A1 (zh)
EP (1) EP4024236A4 (zh)
JP (1) JP7461468B2 (zh)
KR (1) KR20220065072A (zh)
CN (1) CN112650561B (zh)
WO (1) WO2021068850A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113807924A (zh) * 2021-09-24 2021-12-17 华院分析技术(上海)有限公司 基于批量处理算法的业务处理分配方法、系统、存储介质及设备

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090150566A1 (en) * 2007-12-07 2009-06-11 Microsoft Corporation Virtually synchronous paxos
CN105183544A (zh) * 2015-09-17 2015-12-23 中国科学院计算技术研究所 一种非阻塞式容错的分布式事务提交方法及系统
CN106445644A (zh) * 2016-08-30 2017-02-22 中国民生银行股份有限公司 基于改进的一阶段提交的分布式事务的处理方法和装置
CN106649418A (zh) * 2015-11-04 2017-05-10 江苏引跑网络科技有限公司 一种在驱动中直连分片实现分布式数据库数据导入的高性能方法

Family Cites Families (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04199339A (ja) * 1990-11-29 1992-07-20 Hitachi Ltd 分散処理システムの分散トランザクションファイル制御方法
US6081801A (en) * 1997-06-30 2000-06-27 International Business Machines Corporation Shared nothing parallel execution of procedural constructs in SQL
JP4199339B2 (ja) 1998-10-20 2008-12-17 株式会社小松製作所 パルスレーザ用電源装置
CN100429622C (zh) * 2003-08-01 2008-10-29 甲骨文国际公司 数据管理方法
US7900085B2 (en) * 2008-05-29 2011-03-01 Red Hat, Inc. Backup coordinator for distributed transactions
JP5480046B2 (ja) * 2010-07-12 2014-04-23 日本電信電話株式会社 分散トランザクション処理システム、装置、方法およびプログラム
US9471593B1 (en) * 2010-12-30 2016-10-18 Emc Corporation Method and apparatus for ensuring consistent ordering of writes in a distributed database storage system
US9576026B2 (en) * 2013-03-13 2017-02-21 Futurewei Technologies, Inc. System and method for distributed SQL join processing in shared-nothing relational database clusters using self directed data streams
CN105608086B (zh) * 2014-11-17 2021-07-27 中兴通讯股份有限公司 分布式数据库系统的事务处理方法及装置
US9953053B2 (en) * 2014-12-18 2018-04-24 International Business Machines Corporation Reliability improvement of distributed transaction processing optimizations based on connection status
CN106547796B (zh) * 2015-09-23 2022-01-25 南京中兴新软件有限责任公司 数据库的执行方法及装置
US10185755B2 (en) * 2015-12-28 2019-01-22 Business Objects Software Limited Orchestration of data query processing in a database system
CN105824957B (zh) * 2016-03-30 2019-09-03 电子科技大学 分布式内存列式数据库的查询引擎系统及查询方法
US10409811B1 (en) * 2017-01-27 2019-09-10 Intuit, Inc. Decomposition of queries
US10936578B2 (en) * 2017-06-01 2021-03-02 Sap Se Client-driven commit of distributed write transactions in a database environment
US10698897B2 (en) * 2017-09-25 2020-06-30 Splunk Inc. Executing a distributed execution model with untrusted commands
CN109783204A (zh) * 2018-12-28 2019-05-21 咪咕文化科技有限公司 一种分布式事务处理方法、装置及存储介质
CN109710388B (zh) * 2019-01-09 2022-10-21 腾讯科技(深圳)有限公司 数据读取方法、装置、电子设备以及存储介质
CN109977171B (zh) * 2019-02-02 2023-04-28 中国人民大学 一种保证事务一致性和线性一致性的分布式系统和方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090150566A1 (en) * 2007-12-07 2009-06-11 Microsoft Corporation Virtually synchronous paxos
CN105183544A (zh) * 2015-09-17 2015-12-23 中国科学院计算技术研究所 一种非阻塞式容错的分布式事务提交方法及系统
CN106649418A (zh) * 2015-11-04 2017-05-10 江苏引跑网络科技有限公司 一种在驱动中直连分片实现分布式数据库数据导入的高性能方法
CN106445644A (zh) * 2016-08-30 2017-02-22 中国民生银行股份有限公司 基于改进的一阶段提交的分布式事务的处理方法和装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP4024236A4 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113807924A (zh) * 2021-09-24 2021-12-17 华院分析技术(上海)有限公司 基于批量处理算法的业务处理分配方法、系统、存储介质及设备

Also Published As

Publication number Publication date
KR20220065072A (ko) 2022-05-19
EP4024236A4 (en) 2022-10-26
US20240095236A1 (en) 2024-03-21
CN112650561A (zh) 2021-04-13
EP4024236A1 (en) 2022-07-06
JP7461468B2 (ja) 2024-04-03
CN112650561B (zh) 2023-04-11
JP2022550536A (ja) 2022-12-02

Similar Documents

Publication Publication Date Title
CN111183625B (zh) 用于在区块链网络中删除节点的系统和方法
US11550819B2 (en) Synchronization cache seeding
US7636868B2 (en) Data replication in a distributed system
US20130110781A1 (en) Server replication and transaction commitment
US9185160B2 (en) Resource reservation protocol over unreliable packet transport
US10474451B2 (en) Containerized upgrade in operating system level virtualization
WO2017219857A1 (zh) 一种数据处理方法和设备
WO2021027956A1 (zh) 一种基于区块链系统的交易处理方法及装置
CN107919977B (zh) 一种基于Paxos协议的在线扩容、在线缩容的方法和装置
US20120102355A1 (en) Consistent messaging with replication
US20090300405A1 (en) Backup coordinator for distributed transactions
CN106878382B (zh) 一种分布式仲裁集群中动态改变集群规模的方法及装置
CN103885895A (zh) 容错集群存储系统中的写入性能
JP2010061559A (ja) 情報処理システム、データ更新方法およびデータ更新プログラム
US20050193037A1 (en) Peer-to-peer replication member initialization and deactivation
CN112148798A (zh) 应用于分布式系统的数据处理方法及装置
JP2020161152A (ja) 分散データグリッドにおける分散データ構造をサポートするためのシステムおよび方法
WO2021068850A1 (zh) 事务管理方法、系统、网络设备和可读存储介质
CN110417882B (zh) 主节点的确定方法、装置和存储介质
WO2023065788A1 (zh) 升级区块链系统的方法、装置及终端设备
US11522966B2 (en) Methods, devices and systems for non-disruptive upgrades to a replicated state machine in a distributed computing environment
US20130144842A1 (en) Failover and resume when using ordered sequences in a multi-instance database environment
WO2023274409A1 (zh) 在区块链系统中执行交易的方法和区块链节点
US11422715B1 (en) Direct read in clustered file systems
CN112527561B (zh) 基于物联网云存储的数据备份方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20873872

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2022519425

Country of ref document: JP

Kind code of ref document: A

WWE Wipo information: entry into national phase

Ref document number: 17767432

Country of ref document: US

ENP Entry into the national phase

Ref document number: 2020873872

Country of ref document: EP

Effective date: 20220330

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 20227014341

Country of ref document: KR

Kind code of ref document: A