[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

WO2017071384A1 - Message processing method and apparatus - Google Patents

Message processing method and apparatus Download PDF

Info

Publication number
WO2017071384A1
WO2017071384A1 PCT/CN2016/096270 CN2016096270W WO2017071384A1 WO 2017071384 A1 WO2017071384 A1 WO 2017071384A1 CN 2016096270 W CN2016096270 W CN 2016096270W WO 2017071384 A1 WO2017071384 A1 WO 2017071384A1
Authority
WO
WIPO (PCT)
Prior art keywords
request message
processing
message
request
client
Prior art date
Application number
PCT/CN2016/096270
Other languages
French (fr)
Chinese (zh)
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 中兴通讯股份有限公司
Publication of WO2017071384A1 publication Critical patent/WO2017071384A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/40Support for services or applications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0654Management of faults, events, alarms or notifications using network fault recovery
    • H04L41/0668Management of faults, events, alarms or notifications using network fault recovery by dynamic selection of recovery network elements, e.g. replacement by the most appropriate element after failure
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]

Definitions

  • the present invention relates to the field of communications, and in particular, to a packet processing method and apparatus.
  • Cloud Computing is Grid Computing, Distributed Computing, Parallel Computing, Utility Computing, Network Storage Technologies, and Virtualization. And the integration of traditional computer technology and network technology such as load balancing (Load Balance). It aims to integrate multiple relatively low-cost computing entities into a system with powerful computing power through the network.
  • Distributed storage is an area in the field of cloud computing. Its role is to provide distributed storage services for massive data and high-speed read and write access.
  • a distributed storage system is composed of a plurality of server nodes (hereinafter referred to as “nodes” or “service nodes”) and clients connected to each other.
  • nodes server nodes
  • service nodes when a client sends a message to a service node to perform a data self-increment operation, the service node failure may cause the client to fail to determine whether retransmission is possible. This operation has non-retransmission.
  • This process contains two problems to be solved. One is how to ensure that the service is not interrupted when the service node fails, and the other is how to ensure that the critical message that has been processed but not returned is correctly re-executed.
  • the service node is generally divided into several service groups, each group consisting of a primary node and multiple standby nodes.
  • the client records the service group node list.
  • the request message is sent to the standby node for processing, and the service is uninterrupted, but this method does not guarantee the correctness of the non-idempotent operation (such as self-increment) after retransmission. . If the current value of data A is 5, if the node fails before the message is processed but the message is not returned, the resend self-increment will cause A to increase to 7. This is an error.
  • the present invention provides a message processing method and apparatus to at least solve the problem of repeatedly performing the same processing existing in the related art, thereby causing data errors.
  • a method for processing a message comprising: receiving a first request message from a client, wherein the first request message is used to request processing of predetermined data; Whether the second request message that is the same as the first request message is received before the first request message; and if the result of the determination is that the second request message is received, according to the second The processing status of the request message processes the first request message.
  • determining whether the first request message is received before receiving the first request message includes: obtaining the first packet identifier of the first request packet; determining whether the stored first identifier of the one or more third request packets is the same as the first packet If the judgment result is yes, it is determined that the second request message is received; and/or, if the determination result is no, it is determined that the second request is not received. Message.
  • the packet identifier includes an identifier of the client and a local unique number used to identify the request packet.
  • processing the first request packet according to the processing status of the second request packet if the processing status of the second request packet is unprocessed, according to the first Requesting the message to process the predetermined data; or, if the processing status of the second request message is processed, ignoring the first request message, and sending the message to the client The processing result of processing the predetermined data.
  • the second request packet is sent by the original primary node, where the original primary node is configured to receive and process the client sending before receiving the first request packet from the client.
  • the node of the request message is configured to receive and process the client sending before receiving the first request packet from the client.
  • an apparatus for packet processing comprising: a receiving module, configured to receive a first request message from a client, wherein the first request message is used to request a subscription The data is processed; the determining module is configured to determine whether the second request message that is the same as the first request message is received before receiving the first request message; and the processing module is configured to be in the determining module If the second request message is received, the first request message is processed according to the processing status of the second request message.
  • the determining module includes: an obtaining unit, configured to acquire a first packet identifier of the first request packet; and a determining unit, configured to determine the stored one or more third request packets received in advance Whether the message identifier of the first packet identifier is the same as the identifier of the first packet identifier; the first determining unit is configured to determine that the second packet is received if the judgment result of the determining unit is yes Requesting a message; and/or, the second determining unit is configured to determine that the second request message has not been received if the determination result of the determining unit is negative.
  • the packet identifier includes an identifier of the client and a local unique number used to identify the request packet.
  • the processing module includes: a first processing unit, configured to process the predetermined data according to the first request message if a processing status of the second request message is unprocessed Or the second processing unit is configured to ignore the first request message and send the predetermined data to the client if the processing status of the second request message is processed. The processing result of the processing.
  • the second request packet is sent by the original primary node, where the original primary node is configured to receive and process the client sending before receiving the first request packet from the client.
  • the node of the request message is configured to receive and process the client sending before receiving the first request packet from the client.
  • the first request message is received from the client, wherein the first request message is used to request processing of the predetermined data; and it is determined whether the first request message is received before receiving the first request message.
  • the second request message having the same text; if the result of the judgment is that the second request message is received, the method for processing the first request message according to the processing state of the second request message is because The second request packet that is the same as the first request packet is judged, and the first request packet is processed according to the processing state of the second request packet, thereby avoiding the problem of performing multiple processing on the same packet. Resolving the same processing that exists in the related art repeatedly, resulting in data The wrong problem, in turn, achieves the effect of improving execution efficiency and accuracy and reducing system overhead.
  • FIG. 1 is a flowchart of a method of message processing according to an embodiment of the present invention.
  • FIG. 2 is a structural block diagram of an apparatus for processing a message according to an embodiment of the present invention
  • FIG. 3 is a structural block diagram of a determining module 24 in a message processing apparatus according to an embodiment of the present invention.
  • FIG. 4 is a structural block diagram of a processing module 26 in a message processing apparatus according to an embodiment of the present invention.
  • FIG. 5 is a schematic diagram of a connection between a distributed storage system and a client according to an embodiment of the present invention
  • FIG. 6 is a flowchart of a method of requesting processing of a message according to an embodiment of the present invention.
  • FIG. 8 is a flow chart 1 of message processing of a primary service node failure according to an embodiment of the present invention.
  • FIG. 9 is a second flowchart of message processing of a primary service node failure in accordance with an embodiment of the present invention.
  • FIG. 1 is a flowchart of a method for processing a message according to an embodiment of the present invention. As shown in FIG. 1, the process includes the following steps:
  • Step S102 Receive a first request message from a client, where the first request message is used to request processing of predetermined data.
  • Step S104 determining whether a second request message that is the same as the first request message is received before receiving the first request message;
  • Step S106 If the result of the determination is that the second request message is received, the first request message is processed according to the processing state of the second request message.
  • the first request packet is processed according to the processing state of the second request packet, and the first request packet is processed according to the processing state of the second request packet.
  • the same message into The problem of multiple processing in a row solves the problem of repeatedly performing the same processing in the related art, thereby causing data errors, thereby achieving an effect of improving execution efficiency and accuracy and reducing system overhead.
  • the step S104 may include: acquiring a first packet identifier of the first request packet, and determining whether the stored packet identifier of the one or more third request packets received in advance exists. The same message identifier as the first message identifier; if the judgment result is yes, it is determined that the second request message is received; and/or, if the determination result is negative, it is determined that the second request has not been received. Message.
  • the packet identifier of the one or more third request packets received in advance and searching for the presence of the second request packet in the third request packet, it may be determined whether the packet is received before.
  • the second request message is the same as the first request message.
  • the packet identifier in the foregoing optional embodiment may include: an identifier of the client and a local unique number used to identify the request packet.
  • the packet identifier is divided into two parts: a client identifier and a local unique number, which simplifies the complexity of the packet identifier and facilitates searching for the packet identifier.
  • step S106 may include: processing the predetermined data according to the first request message if the processing status of the second request message is unprocessed; or, in the second request message When the processing status is processed, the first request message is ignored, and the processing result of processing the predetermined data is sent to the client.
  • the first request packet may be directly ignored, and the processing result of the second request packet is returned to the client, thereby avoiding Data error caused by processing the processed request message again.
  • the second request message in the foregoing embodiment and the optional embodiment may be sent by the client.
  • the second request message may be sent by the original master node, where the original master node is receiving The node for receiving and processing the request message sent by the client before the first request message from the client.
  • the original primary node receives the second request message during normal operation and forwards the second request message to other nodes for processing, but has not returned the response of the second request message to the client. A failure occurred while the message was in progress. However, the other node has not failed, and the second request packet has been processed.
  • the other node may perform the processing according to the processing status. deal with.
  • the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, by hardware, but in many cases, the former is A better implementation.
  • the technical solution of the present invention which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk,
  • the optical disc includes a number of instructions for causing a terminal device (which may be a cell phone, a computer, a server, or a network device, etc.) to perform the methods described in various embodiments of the present invention.
  • a device for processing a message is provided, which is used to implement the foregoing embodiments and preferred embodiments, and details are not described herein.
  • the term "module” may implement a combination of software and/or hardware of a predetermined function.
  • the apparatus described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware, is also possible and contemplated.
  • FIG. 2 is a structural block diagram of an apparatus for processing a message according to an embodiment of the present invention. As shown in FIG. 2, the apparatus includes receiving Module 22, determination module 24, and processing module 26 are described below.
  • the receiving module 22 is configured to receive a first request message from the client, where the first request message is used to request processing of the predetermined data; the determining module 24 is connected to the receiving module 22, and is configured to determine that the receiving message is Whether a second request message identical to the first request message is received before the request message is received; the processing module 26 is connected to the determining module 24, and is configured to receive the second request message at the judgment result of the determining module 24.
  • the first request message is processed according to the processing state of the second request message.
  • FIG. 3 is a structural block diagram of a determining module 24 in a message processing apparatus according to an embodiment of the present invention.
  • the determining module 24 includes an obtaining unit 32, a determining unit 34, and a first determining unit 36 and/or a Second determining unit 38, the determining module 24 will be described below.
  • the obtaining unit 32 is configured to obtain the first packet identifier of the first request packet, and the determining unit 34 is connected to the obtaining unit 32, and is configured to determine the stored pre-received one or more third request packet reports.
  • the message identifier is the same as the first message identifier in the text identifier
  • the first determining unit 36 is connected to the determining unit 34, and is configured to determine that the second receiving unit is received if the determining result of the determining unit 34 is YES.
  • the request message; and/or the second determining unit 38 is connected to the determining unit 34, and is configured to determine that the second request message has not been received if the determining result of the determining unit 34 is negative.
  • the packet identifier in the foregoing embodiment and the optional embodiment may include an identifier of the client and a local unique number for identifying the request packet.
  • FIG. 4 is a structural block diagram of a processing module 26 in a message processing apparatus according to an embodiment of the present invention. As shown in FIG. 4, the processing module 26 includes a first processing unit 42 or a second processing unit 44, and the processing module is provided below. 26 for explanation.
  • the first processing unit 42 is configured to process the predetermined data according to the first request message if the processing status of the second request message is unprocessed; or the second processing unit 44 is configured to be in the second request When the processing status of the message is processed, the first request message is ignored, and the processing result of processing the predetermined data is sent to the client.
  • the second request message in the foregoing embodiment and the optional embodiment may be sent by the original primary node, where the original primary node is configured to receive and process the request report sent by the client before receiving the first request message from the client.
  • the node of the text may be sent by the original primary node, where the original primary node is configured to receive and process the request report sent by the client before receiving the first request message from the client.
  • a method and an apparatus for processing a message according to an embodiment of the present invention are described by taking a distributed storage system as an example.
  • the embodiment of the present invention can ensure seamless handover of services and retransmission of messages when a node fails.
  • the content of the solution of the embodiment of the present invention may include the following steps:
  • FIG. 5 is a schematic diagram of a connection between a distributed storage system and a client according to an embodiment of the present invention. As shown in FIG. 5, server nodes establish a connection with each other and operate normally, and nodes A and B respectively serve the primary service node and backup service of the client. node.
  • FIG. 6 is a flowchart of a method for processing a request message according to an embodiment of the present invention. As shown in FIG. 6, the process includes:
  • Step S602 adding a message identifier to the packet sent by the client to the server node, where the message identifier has a client identifier
  • clientID the local unique number
  • uniqueNUM the local unique number
  • Step S604 The client records the status status of each communication message to record whether the message is sent, whether it is processed, whether retransmission is required, and the like.
  • Step S606 The server uses the map structure to save the localized processing status of the received message. If the local message has been processed, the message is not processed when the resend message is received, and the non-reproducibility of some operations is avoided (for example, Increase/decrease).
  • Step S608 The client waits for the return message to time out due to the failure of the master node, and the client retransmits the message to the standby node, and the standby node processes the message.
  • Step S610 After the original primary node fails to recover, the latest data is synchronized from the new primary node (ie, the original standby node) to achieve data consistency.
  • the message when the service node in the system fails, the message can be retransmitted and the service can be seamlessly switched.
  • the embodiments of the present invention ensure seamless switching of distributed system services, and unresponsive messages can be retransmitted without causing data errors. To ensure system availability and data consistency.
  • the service node in the distributed storage system is divided into a primary server node and a plurality of standby server nodes.
  • the following describes the method for processing the packet according to the embodiment of the present invention in a scenario where multiple failures occur in the primary server node.
  • a distributed storage system composed of a server node and a client is shown in FIG. 5.
  • Each node in the cluster is connected to each other.
  • Each group consists of one master node and multiple standby nodes.
  • the data of the master node and the standby node are strongly consistent.
  • the client sends a request message to the master node and forwards the message to the master node.
  • the standby node is returned to the client by the master node after all nodes are successfully processed.
  • FIG. 7 is a flow chart of message processing in a normal case according to an embodiment of the present invention
  • FIG. 8 is a flow chart 1 of message processing of a failure of a primary service node according to an embodiment of the present invention
  • FIG. 9 is a main service node according to an embodiment of the present invention.
  • Fault message processing flow chart 2 the following describes the entire implementation method in detail with reference to FIG. 7-9, including the following steps:
  • Pre-step The client obtains its own ClientID by assisting the server or its own algorithm, and the client has selected the service group to establish a connection with the active and standby nodes.
  • step S1 the client sends the data change request to the primary service node by using the client ID and the local unique number as the message unique identifier ⁇ clientID, uniqueNUM ⁇ (corresponding to S702 in FIG. 7, S802 in FIG. 8, S902 in FIG. 9). );
  • step S2 the primary server node receives the request packet. If the master node fails to go to step S7 at this time (equivalent to S804 in Fig. 8);
  • step S3 the master node processes the request message, records the message ID and the processing status (equivalent to S706 in FIG. 7), and simultaneously forwards the data to the standby node (corresponding to S704 in FIG. 7). If the master node fails to go to step S10 at this time (equivalent to S906 in Fig. 9);
  • Step S4 the standby node receives the request message, processes the message, and locally records the message ID and the processing status (corresponding to S708 in FIG. 7);
  • step S5 the standby node returns the processing result to the master node (equivalent to S710 in FIG. 7);
  • Step S6 after receiving the node processing result, the master node returns the final result of the message processing to the client, and jumps to step 14 (equivalent to S712 in FIG. 7);
  • Step S7 the client waits for the return message to time out, determines that the primary node is faulty, and selects one of the standby nodes as a new primary node (equivalent to S806 in FIG. 8);
  • Step S8 the client resends the message to the new primary node (ie, the original standby node) (equivalent to S808 in FIG. 8);
  • Step S9 the standby node processes the data change request, and returns the result to the client, and proceeds to step S14 (equivalent to S810-S812 in FIG. 8);
  • Step S10 after receiving the request message, the standby node processes the message, and records the processing result of the message (equivalent to S906 in FIG. 9);
  • Step S11 the client waits for the return message to time out, determines that the primary node is faulty, and selects one of the standby nodes as the new primary node (equivalent to S910 in FIG. 9);
  • Step S12 the client resends the message to the new primary node (ie, the original standby node) (equivalent to S912 in FIG. 9);
  • step S13 the standby node finds that the message has been processed, and will not process the result, and directly returns the result to the client (equivalent to S914-S916 in FIG. 9);
  • Step S14 the entire message processing flow ends.
  • the embodiment of the invention is in the distributed storage system of the cloud computing domain.
  • the request message can be seamlessly processed correctly, which increases the robustness and availability of the system.
  • each of the above modules may be implemented by software or hardware.
  • the foregoing may be implemented by, but not limited to, the foregoing modules are all located in the same processor; or, the modules are located in multiple In the processor.
  • Embodiments of the present invention also provide a storage medium.
  • the foregoing storage medium may be configured to store program code for performing the following steps:
  • S21 Receive a first request message from a client, where the first request message is used to request processing of predetermined data.
  • the foregoing storage medium may include, but is not limited to, a USB flash drive, a Read-Only Memory (ROM), and a Random Access Memory (RAM).
  • ROM Read-Only Memory
  • RAM Random Access Memory
  • the processor executes S21-S23 according to the stored program code in the storage medium.
  • modules or steps of the present invention described above can be implemented by a general-purpose computing device that can be centralized on a single computing device or distributed across a network of multiple computing devices. Alternatively, they may be implemented by program code executable by the computing device such that they may be stored in the storage device by the computing device and, in some cases, may be different from the order herein.
  • the steps shown or described are performed, or they are separately fabricated into individual integrated circuit modules, or a plurality of modules or steps thereof are fabricated as a single integrated circuit module.
  • the invention is not limited to any specific combination of hardware and software.
  • the method and apparatus for processing a message according to an embodiment of the present invention have the following beneficial effects: solving the problem of repeatedly performing the same processing in the related art, thereby causing data errors, thereby improving execution efficiency. And accuracy, reducing the effect of system overhead.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Multimedia (AREA)
  • Computer And Data Communications (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

Provided in the present invention are a message processing method and apparatus, the method comprising: receiving a first request message from a client terminal, the first request message being used for requesting processing of predetermined data; determining whether a second request message identical to the first request message has been received prior to receiving the first request message; and when determining that the second request message has been received, implementing processing of the first request message on the basis of the processing state of the second request message. The present invention solves the problem in the prior art of data error caused by repeating the same processing, and achieves the effect of improving execution efficiency and accuracy and reducing system overheads.

Description

报文处理的方法及装置Message processing method and device 技术领域Technical field
本发明涉及通信领域,具体而言,涉及一种报文处理的方法及装置。The present invention relates to the field of communications, and in particular, to a packet processing method and apparatus.
背景技术Background technique
云计算(Cloud Computing)是网格计算(Grid Computing)、分布式计算(Distributed Computing)、并行计算(Parallel Computing)、效用计算(Utility Computing)、网络存储(Network Storage Technologies)、虚拟化(Virtualization)、负载均衡(Load Balance)等传统计算机技术和网络技术发展融合的产物。它旨在通过网络把多个成本相对较低的计算实体整合成一个具有强大计算能力的系统。分布式存储是云计算范畴中的一个领域,其作用是提供海量数据的分布式存储服务以及高速读写访问的能力。Cloud Computing is Grid Computing, Distributed Computing, Parallel Computing, Utility Computing, Network Storage Technologies, and Virtualization. And the integration of traditional computer technology and network technology such as load balancing (Load Balance). It aims to integrate multiple relatively low-cost computing entities into a system with powerful computing power through the network. Distributed storage is an area in the field of cloud computing. Its role is to provide distributed storage services for massive data and high-speed read and write access.
分布式存储系统是由若干服务器节点(以下简称“节点”或“服务节点”)和客户端互相连接构成的。在分布式存储系统中,当客户端给服务节点发送消息进行某数据自增操作过程中,服务节点故障会导致客户端无法判断是否可以重发,此操作具有不可重发性。这个过程中包含两个需要解决的问题,一是服务节点故障时如何保证服务不中断,二是如何保证已处理但未返回的临界消息如何被正确重新执行。A distributed storage system is composed of a plurality of server nodes (hereinafter referred to as "nodes" or "service nodes") and clients connected to each other. In a distributed storage system, when a client sends a message to a service node to perform a data self-increment operation, the service node failure may cause the client to fail to determine whether retransmission is possible. This operation has non-retransmission. This process contains two problems to be solved. One is how to ensure that the service is not interrupted when the service node fails, and the other is how to ensure that the critical message that has been processed but not returned is correctly re-executed.
对于节点故障时保证服务不间断的解决方法,一般是将服务节点划分为若干服务组,每组由主节点和多个备节点组成。客户端记录服务组节点列表,当主节点故障时,将请求消息发送给备节点进行处理,达到服务不间断,但是这种方法并不能保证非幂等操作(如自增)重发后的正确性。如数据A当前值是5,如果节点在已处理操作但未返回报文前故障,重发自增操作会导致A增加到7。这样就出现了错误。For a solution to ensure uninterrupted service when a node fails, the service node is generally divided into several service groups, each group consisting of a primary node and multiple standby nodes. The client records the service group node list. When the master node fails, the request message is sent to the standby node for processing, and the service is uninterrupted, but this method does not guarantee the correctness of the non-idempotent operation (such as self-increment) after retransmission. . If the current value of data A is 5, if the node fails before the message is processed but the message is not returned, the resend self-increment will cause A to increase to 7. This is an error.
针对相关技术中存在的重复执行相同的处理,从而导致数据错误的问题,目前尚未提出有效的解决方案。An effective solution has not been proposed for the problem of data error caused by repeated execution of the same processing existing in the related art.
发明内容Summary of the invention
本发明提供了一种报文处理的方法及装置,以至少解决相关技术中存在的重复执行相同的处理,从而导致数据错误的问题。The present invention provides a message processing method and apparatus to at least solve the problem of repeatedly performing the same processing existing in the related art, thereby causing data errors.
根据本发明的一个方面,提供了一种报文处理的方法,包括:接收来自客户端的第一请求报文,其中,所述第一请求报文用于请求对预定数据进行处理;判断在接收所述第一请求报文之前,是否接收过与所述第一请求报文相同的第二请求报文;在判断结果为接收过所述第二请求报文的情况下,根据所述第二请求报文的处理状态对所述第一请求报文进行处理。According to an aspect of the present invention, a method for processing a message, comprising: receiving a first request message from a client, wherein the first request message is used to request processing of predetermined data; Whether the second request message that is the same as the first request message is received before the first request message; and if the result of the determination is that the second request message is received, according to the second The processing status of the request message processes the first request message.
可选地,判断在接收所述第一请求报文之前,是否接收过与所述第一请求报文相同的第 二请求报文包括:获取所述第一请求报文的第一报文标识;判断存储的预先接收到的一个或多个第三请求报文的报文标识中是否存在与所述第一报文标识相同的报文标识;在判断结果为是的情况下,确定接收过所述第二请求报文;和/或,在判断结果为否的情况下,确定未接收过所述第二请求报文。Optionally, determining whether the first request message is received before receiving the first request message The second request packet includes: obtaining the first packet identifier of the first request packet; determining whether the stored first identifier of the one or more third request packets is the same as the first packet If the judgment result is yes, it is determined that the second request message is received; and/or, if the determination result is no, it is determined that the second request is not received. Message.
可选地,所述报文标识包括所述客户端的标识和用于标识请求报文的本地唯一数。Optionally, the packet identifier includes an identifier of the client and a local unique number used to identify the request packet.
可选地,根据所述第二请求报文的处理状态对所述第一请求报文进行处理包括:在所述第二请求报文的处理状态为未处理的情况下,根据所述第一请求报文对所述预定数据进行处理;或者,在所述第二请求报文的处理状态为已处理的情况下,忽略所述第一请求报文,并向所述客户端发送对所述预定数据进行处理的处理结果。Optionally, processing the first request packet according to the processing status of the second request packet, if the processing status of the second request packet is unprocessed, according to the first Requesting the message to process the predetermined data; or, if the processing status of the second request message is processed, ignoring the first request message, and sending the message to the client The processing result of processing the predetermined data.
可选地,所述第二请求报文为原主节点发送的,其中,所述原主节点为在接收来自所述客户端的所述第一请求报文之前,用于接收并处理所述客户端发送的请求报文的节点。Optionally, the second request packet is sent by the original primary node, where the original primary node is configured to receive and process the client sending before receiving the first request packet from the client. The node of the request message.
根据本发明的另一个方面,还提供了一种报文处理的装置,包括:接收模块,设置为接收来自客户端的第一请求报文,其中,所述第一请求报文用于请求对预定数据进行处理;判断模块,设置为判断在接收所述第一请求报文之前,是否接收过与所述第一请求报文相同的第二请求报文;处理模块,设置为在所述判断模块的判断结果为接收过所述第二请求报文的情况下,根据所述第二请求报文的处理状态对所述第一请求报文进行处理。According to another aspect of the present invention, an apparatus for packet processing is provided, comprising: a receiving module, configured to receive a first request message from a client, wherein the first request message is used to request a subscription The data is processed; the determining module is configured to determine whether the second request message that is the same as the first request message is received before receiving the first request message; and the processing module is configured to be in the determining module If the second request message is received, the first request message is processed according to the processing status of the second request message.
可选地,所述判断模块包括:获取单元,设置为获取所述第一请求报文的第一报文标识;判断单元,用于判断存储的预先接收到的一个或多个第三请求报文的报文标识中是否存在与所述第一报文标识相同的报文标识;第一确定单元,设置为在所述判断单元的判断结果为是的情况下,确定接收过所述第二请求报文;和/或,第二确定单元,设置为在所述判断单元的判断结果为否的情况下,确定未接收过所述第二请求报文。Optionally, the determining module includes: an obtaining unit, configured to acquire a first packet identifier of the first request packet; and a determining unit, configured to determine the stored one or more third request packets received in advance Whether the message identifier of the first packet identifier is the same as the identifier of the first packet identifier; the first determining unit is configured to determine that the second packet is received if the judgment result of the determining unit is yes Requesting a message; and/or, the second determining unit is configured to determine that the second request message has not been received if the determination result of the determining unit is negative.
可选地,所述报文标识包括所述客户端的标识和用于标识请求报文的本地唯一数。Optionally, the packet identifier includes an identifier of the client and a local unique number used to identify the request packet.
可选地,所述处理模块包括:第一处理单元,设置为在所述第二请求报文的处理状态为未处理的情况下,根据所述第一请求报文对所述预定数据进行处理;或者,第二处理单元,设置为在所述第二请求报文的处理状态为已处理的情况下,忽略所述第一请求报文,并向所述客户端发送对所述预定数据进行处理的处理结果。Optionally, the processing module includes: a first processing unit, configured to process the predetermined data according to the first request message if a processing status of the second request message is unprocessed Or the second processing unit is configured to ignore the first request message and send the predetermined data to the client if the processing status of the second request message is processed. The processing result of the processing.
可选地,所述第二请求报文为原主节点发送的,其中,所述原主节点为在接收来自所述客户端的所述第一请求报文之前,用于接收并处理所述客户端发送的请求报文的节点。Optionally, the second request packet is sent by the original primary node, where the original primary node is configured to receive and process the client sending before receiving the first request packet from the client. The node of the request message.
通过本发明,采用接收来自客户端的第一请求报文,其中,该第一请求报文用于请求对预定数据进行处理;判断在接收第一请求报文之前,是否接收过与第一请求报文相同的第二请求报文;在判断结果为接收过第二请求报文的情况下,根据第二请求报文的处理状态对第一请求报文进行处理的方法,由于对于之前是否接收过与第一请求报文相同的第二请求报文进行了判断,可以根据对第二请求报文的处理状态对第一请求报文进行处理,避免了对相同的报文进行多次处理的问题,解决了相关技术中存在的重复执行相同的处理,从而导致数据 错误的问题,进而达到了提高执行效率和准确性,减少系统开销的效果。According to the present invention, the first request message is received from the client, wherein the first request message is used to request processing of the predetermined data; and it is determined whether the first request message is received before receiving the first request message. The second request message having the same text; if the result of the judgment is that the second request message is received, the method for processing the first request message according to the processing state of the second request message is because The second request packet that is the same as the first request packet is judged, and the first request packet is processed according to the processing state of the second request packet, thereby avoiding the problem of performing multiple processing on the same packet. Resolving the same processing that exists in the related art repeatedly, resulting in data The wrong problem, in turn, achieves the effect of improving execution efficiency and accuracy and reducing system overhead.
附图说明DRAWINGS
此处所说明的附图用来提供对本发明的进一步理解,构成本申请的一部分,本发明的示意性实施例及其说明用于解释本发明,并不构成对本发明的不当限定。在附图中:The drawings described herein are intended to provide a further understanding of the invention, and are intended to be a part of the invention. In the drawing:
图1是根据本发明实施例的报文处理的方法的流程图;1 is a flowchart of a method of message processing according to an embodiment of the present invention;
图2是根据本发明实施例的报文处理的装置的结构框图;2 is a structural block diagram of an apparatus for processing a message according to an embodiment of the present invention;
图3是根据本发明实施例的报文处理的装置中判断模块24的结构框图;FIG. 3 is a structural block diagram of a determining module 24 in a message processing apparatus according to an embodiment of the present invention;
图4是根据本发明实施例的报文处理的装置中处理模块26的结构框图;4 is a structural block diagram of a processing module 26 in a message processing apparatus according to an embodiment of the present invention;
图5是根据本发明实施例的分布式存储系统与客户端的连接示意图;FIG. 5 is a schematic diagram of a connection between a distributed storage system and a client according to an embodiment of the present invention; FIG.
图6是根据本发明实施例的请求报文的处理的方法的流程图;6 is a flowchart of a method of requesting processing of a message according to an embodiment of the present invention;
图7是根据本发明实施例的正常情况下的消息处理流程图;7 is a flow chart of message processing under normal conditions according to an embodiment of the present invention;
图8是根据本发明实施例的主服务节点故障的消息处理流程图一;8 is a flow chart 1 of message processing of a primary service node failure according to an embodiment of the present invention;
图9是根据本发明实施例的主服务节点故障的消息处理流程图二。9 is a second flowchart of message processing of a primary service node failure in accordance with an embodiment of the present invention.
具体实施方式detailed description
下文中将参考附图并结合实施例来详细说明本发明。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。The invention will be described in detail below with reference to the drawings in conjunction with the embodiments. It should be noted that the embodiments in the present application and the features in the embodiments may be combined with each other without conflict.
需要说明的是,本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。It is to be understood that the terms "first", "second" and the like in the specification and claims of the present invention are used to distinguish similar objects, and are not necessarily used to describe a particular order or order.
在本实施例中提供了一种报文处理的方法,图1是根据本发明实施例的报文处理的方法的流程图,如图1所示,该流程包括如下步骤:A method for processing a message is provided in this embodiment. FIG. 1 is a flowchart of a method for processing a message according to an embodiment of the present invention. As shown in FIG. 1, the process includes the following steps:
步骤S102,接收来自客户端的第一请求报文,其中,该第一请求报文用于请求对预定数据进行处理;Step S102: Receive a first request message from a client, where the first request message is used to request processing of predetermined data.
步骤S104,判断在接收第一请求报文之前,是否接收过与第一请求报文相同的第二请求报文;Step S104, determining whether a second request message that is the same as the first request message is received before receiving the first request message;
步骤S106,在判断结果为接收过第二请求报文的情况下,根据第二请求报文的处理状态对第一请求报文进行处理。Step S106: If the result of the determination is that the second request message is received, the first request message is processed according to the processing state of the second request message.
通过上述步骤,由于对于之前是否接收过与第一请求报文相同的第二请求报文进行了判断,可以根据对第二请求报文的处理状态对第一请求报文进行处理,避免了对相同的报文进 行多次处理的问题,解决了相关技术中存在的重复执行相同的处理,从而导致数据错误的问题,进而达到了提高执行效率和准确性,减少系统开销的效果。After the foregoing step is performed, the first request packet is processed according to the processing state of the second request packet, and the first request packet is processed according to the processing state of the second request packet. The same message into The problem of multiple processing in a row solves the problem of repeatedly performing the same processing in the related art, thereby causing data errors, thereby achieving an effect of improving execution efficiency and accuracy and reducing system overhead.
在一个可选的实施例中,步骤S104可以包括:获取第一请求报文的第一报文标识;判断存储的预先接收到的一个或多个第三请求报文的报文标识中是否存在与第一报文标识相同的报文标识;在判断结果为是的情况下,确定接收过第二请求报文;和/或,在判断结果为否的情况下,确定未接收过第二请求报文。在该可选实施例中,通过对预先接收到的一个或者多个第三请求报文的报文标识进行存储,查找第三请求报文中是否存在第二请求报文,可以确定之前是否接收过与第一请求报文相同的第二请求报文。In an optional embodiment, the step S104 may include: acquiring a first packet identifier of the first request packet, and determining whether the stored packet identifier of the one or more third request packets received in advance exists. The same message identifier as the first message identifier; if the judgment result is yes, it is determined that the second request message is received; and/or, if the determination result is negative, it is determined that the second request has not been received. Message. In this optional embodiment, by storing the packet identifier of the one or more third request packets received in advance, and searching for the presence of the second request packet in the third request packet, it may be determined whether the packet is received before. The second request message is the same as the first request message.
上述可选实施例中的报文标识,可以包括:客户端的标识和用于标识请求报文的本地唯一数。在该可选实施例中,将报文标识分为两部分:客户端标识和本地唯一数,简化了报文标识的复杂度,同时方便查找报文标识。The packet identifier in the foregoing optional embodiment may include: an identifier of the client and a local unique number used to identify the request packet. In this optional embodiment, the packet identifier is divided into two parts: a client identifier and a local unique number, which simplifies the complexity of the packet identifier and facilitates searching for the packet identifier.
在一个可选的实施例中,步骤S106可以包括:在第二请求报文的处理状态为未处理的情况下,根据第一请求报文对预定数据进行处理;或者,在第二请求报文的处理状态为已处理的情况下,忽略第一请求报文,并向客户端发送对预定数据进行处理的处理结果。在该可选实施例中,当第二请求报文的处理状态为已处理的情况下,可以直接忽略该第一请求报文,向客户端返回对第二请求报文的处理结果,避免了对已处理的请求报文进行再次处理而导致的数据错误。In an optional embodiment, step S106 may include: processing the predetermined data according to the first request message if the processing status of the second request message is unprocessed; or, in the second request message When the processing status is processed, the first request message is ignored, and the processing result of processing the predetermined data is sent to the client. In the optional embodiment, when the processing status of the second request packet is processed, the first request packet may be directly ignored, and the processing result of the second request packet is returned to the client, thereby avoiding Data error caused by processing the processed request message again.
上述实施例及可选实施例中的第二请求报文可以为客户端发送的,在一个可选的实施例中,第二请求报文可以为原主节点发送的,其中,原主节点为在接收来自客户端的第一请求报文之前,用于接收并处理客户端发送的请求报文的节点。在该可选实施例中,原主节点在正常工作时接收到第二请求报文并将第二请求报文转发给其他节点进行处理,但是再还未向客户端返回第二请求报文的响应消息时,发生了故障。但其他节点没有发生故障并且已经对该第二请求报文进行了处理,当其他节点接收到客户端发送的与该第二请求报文相同的第一请求报文时,可以根据处理状态做出处理。The second request message in the foregoing embodiment and the optional embodiment may be sent by the client. In an optional embodiment, the second request message may be sent by the original master node, where the original master node is receiving The node for receiving and processing the request message sent by the client before the first request message from the client. In this optional embodiment, the original primary node receives the second request message during normal operation and forwards the second request message to other nodes for processing, but has not returned the response of the second request message to the client. A failure occurred while the message was in progress. However, the other node has not failed, and the second request packet has been processed. When the other node receives the first request packet sent by the client and is the same as the second request packet, the other node may perform the processing according to the processing status. deal with.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到根据上述实施例的方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本发明各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, by hardware, but in many cases, the former is A better implementation. Based on such understanding, the technical solution of the present invention, which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk, The optical disc includes a number of instructions for causing a terminal device (which may be a cell phone, a computer, a server, or a network device, etc.) to perform the methods described in various embodiments of the present invention.
在本实施例中还提供了一种报文处理的装置,该装置用于实现上述实施例及优选实施方式,已经进行过说明的不再赘述。如以下所使用的,术语“模块”可以实现预定功能的软件和/或硬件的组合。尽管以下实施例所描述的装置较佳地以软件来实现,但是硬件,或者软件和硬件的组合的实现也是可能并被构想的。In the embodiment, a device for processing a message is provided, which is used to implement the foregoing embodiments and preferred embodiments, and details are not described herein. As used below, the term "module" may implement a combination of software and/or hardware of a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware, or a combination of software and hardware, is also possible and contemplated.
图2是根据本发明实施例的报文处理的装置的结构框图,如图2所示,该装置包括接收 模块22、判断模块24和处理模块26,下面对该装置进行说明。2 is a structural block diagram of an apparatus for processing a message according to an embodiment of the present invention. As shown in FIG. 2, the apparatus includes receiving Module 22, determination module 24, and processing module 26 are described below.
接收模块22,设置为接收来自客户端的第一请求报文,其中,该第一请求报文用于请求对预定数据进行处理;判断模块24,连接于上述接收模块22,设置为判断在接收第一请求报文之前,是否接收过与第一请求报文相同的第二请求报文;处理模块26,连接于上述判断模块24,设置为在判断模块24的判断结果为接收过第二请求报文的情况下,根据第二请求报文的处理状态对第一请求报文进行处理。The receiving module 22 is configured to receive a first request message from the client, where the first request message is used to request processing of the predetermined data; the determining module 24 is connected to the receiving module 22, and is configured to determine that the receiving message is Whether a second request message identical to the first request message is received before the request message is received; the processing module 26 is connected to the determining module 24, and is configured to receive the second request message at the judgment result of the determining module 24. In the case of the text, the first request message is processed according to the processing state of the second request message.
图3是根据本发明实施例的报文处理的装置中判断模块24的结构框图,如图3所示,判断模块24包括获取单元32、判断单元34,以及第一确定单元36和/或第二确定单元38,下面对该判断模块24进行说明。FIG. 3 is a structural block diagram of a determining module 24 in a message processing apparatus according to an embodiment of the present invention. As shown in FIG. 3, the determining module 24 includes an obtaining unit 32, a determining unit 34, and a first determining unit 36 and/or a Second determining unit 38, the determining module 24 will be described below.
获取单元32,设置为获取第一请求报文的第一报文标识;判断单元34,连接于上述获取单元32,设置为判断存储的预先接收到的一个或多个第三请求报文的报文标识中是否存在与第一报文标识相同的报文标识;第一确定单元36,连接于上述判断单元34,设置为在判断单元34的判断结果为是的情况下,确定接收过第二请求报文;和/或,第二确定单元38,连接于上述判断单元34,设置为在判断单元34的判断结果为否的情况下,确定未接收过第二请求报文。The obtaining unit 32 is configured to obtain the first packet identifier of the first request packet, and the determining unit 34 is connected to the obtaining unit 32, and is configured to determine the stored pre-received one or more third request packet reports. Whether the message identifier is the same as the first message identifier in the text identifier; the first determining unit 36 is connected to the determining unit 34, and is configured to determine that the second receiving unit is received if the determining result of the determining unit 34 is YES. The request message; and/or the second determining unit 38 is connected to the determining unit 34, and is configured to determine that the second request message has not been received if the determining result of the determining unit 34 is negative.
上述实施例及可选实施例中的报文标识可以包括客户端的标识和用于标识请求报文的本地唯一数。The packet identifier in the foregoing embodiment and the optional embodiment may include an identifier of the client and a local unique number for identifying the request packet.
图4是根据本发明实施例的报文处理的装置中处理模块26的结构框图,如图4所示,处理模块26包括第一处理单元42或者第二处理单元44,下面对该处理模块26进行说明。4 is a structural block diagram of a processing module 26 in a message processing apparatus according to an embodiment of the present invention. As shown in FIG. 4, the processing module 26 includes a first processing unit 42 or a second processing unit 44, and the processing module is provided below. 26 for explanation.
第一处理单元42,设置为在第二请求报文的处理状态为未处理的情况下,根据第一请求报文对预定数据进行处理;或者,第二处理单元44,设置为在第二请求报文的处理状态为已处理的情况下,忽略第一请求报文,并向客户端发送对预定数据进行处理的处理结果。The first processing unit 42 is configured to process the predetermined data according to the first request message if the processing status of the second request message is unprocessed; or the second processing unit 44 is configured to be in the second request When the processing status of the message is processed, the first request message is ignored, and the processing result of processing the predetermined data is sent to the client.
上述实施例及可选实施例中的第二请求报文可以为原主节点发送的,其中,原主节点为在接收来自客户端的第一请求报文之前,用于接收并处理客户端发送的请求报文的节点。The second request message in the foregoing embodiment and the optional embodiment may be sent by the original primary node, where the original primary node is configured to receive and process the request report sent by the client before receiving the first request message from the client. The node of the text.
以在分布式存储系统中为例,对本发明实施例的报文处理的方法及装置进行说明。A method and an apparatus for processing a message according to an embodiment of the present invention are described by taking a distributed storage system as an example.
本发明实施例在分布式存储系统中在节点故障时,能保障服务的无缝切换和消息的可重发性。本发明实施例的方案内容可以包括如下步骤:In the distributed storage system, the embodiment of the present invention can ensure seamless handover of services and retransmission of messages when a node fails. The content of the solution of the embodiment of the present invention may include the following steps:
前置步骤:客户端与分布式存储系统中多个服务器节点(假设为节点A、节点B)建立连接。图5是根据本发明实施例的分布式存储系统与客户端的连接示意图,如图5所示,服务器节点间互相建立连接并且运行正常,节点A和B分别为此客户端的主服务节点和备服务节点。Pre-step: The client establishes a connection with multiple server nodes (assumed node A, node B) in the distributed storage system. FIG. 5 is a schematic diagram of a connection between a distributed storage system and a client according to an embodiment of the present invention. As shown in FIG. 5, server nodes establish a connection with each other and operate normally, and nodes A and B respectively serve the primary service node and backup service of the client. node.
图6是根据本发明实施例的请求报文的处理的方法的流程图,如图6所示,该流程包括:FIG. 6 is a flowchart of a method for processing a request message according to an embodiment of the present invention. As shown in FIG. 6, the process includes:
步骤S602:客户端发送给服务端节点的报文中增加报文标识符,报文标识符有客户标识 符(clientID)和本地唯一数(uniqueNUM)组合而成,即{clientID,uniqueNUM}。Step S602: adding a message identifier to the packet sent by the client to the server node, where the message identifier has a client identifier The combination of the (clientID) and the local unique number (uniqueNUM), ie {clientID, uniqueNUM}.
步骤S604:客户端会记录每一个通信报文状态标志状态(status),以记录此报文是否被发送,是否被处理,是否需要重发等等。Step S604: The client records the status status of each communication message to record whether the message is sent, whether it is processed, whether retransmission is required, and the like.
步骤S606:服务端使用map结构保存收到的消息在本地的处理状态,如果本地已处理此消息,收到重发消息时就不再处理,避免了某些操作的不可重做性(如自增/自减)。Step S606: The server uses the map structure to save the localized processing status of the received message. If the local message has been processed, the message is not processed when the resend message is received, and the non-reproducibility of some operations is avoided (for example, Increase/decrease).
步骤S608:由主节点故障导致客户端等待返回消息超时,客户端会将消息重发到备节点,由备节点进行处理。Step S608: The client waits for the return message to time out due to the failure of the master node, and the client retransmits the message to the standby node, and the standby node processes the message.
步骤S610:等原主节点故障恢复后,将从新的主节点(即原备节点)同步最新数据,以达到数据一致性。Step S610: After the original primary node fails to recover, the latest data is synchronized from the new primary node (ie, the original standby node) to achieve data consistency.
通过上述实施例,当系统中服务节点故障时,保证消息可重发,服务无缝切换。本发明实施例确保了分布式系统服务无缝切换,且未响应消息可重发,不会导致数据错误。对于保证系统的可用性、数据一致性有提升。Through the above embodiment, when the service node in the system fails, the message can be retransmitted and the service can be seamlessly switched. The embodiments of the present invention ensure seamless switching of distributed system services, and unresponsive messages can be retransmitted without causing data errors. To ensure system availability and data consistency.
下面对分布式存储系统中的服务节点分为一个主服务器节点和多个备服务器节点,下面在主服务器节点多个发生故障的场景下,对本发明实施例的报文处理的方法进行说明。In the following, the service node in the distributed storage system is divided into a primary server node and a plurality of standby server nodes. The following describes the method for processing the packet according to the embodiment of the present invention in a scenario where multiple failures occur in the primary server node.
本发明实施例中,由服务器节点和客户端构成的分布式存储系统如图5所示。集群中各节点相互连接,每组由一个主节点和多个备节点组成,主节点和备节点数据为强一致性的,客户端将请求消息发送到主节点并由主节点将消息转发给所有备节点,所有节点处理成功后由主节点返回给客户端。In the embodiment of the present invention, a distributed storage system composed of a server node and a client is shown in FIG. 5. Each node in the cluster is connected to each other. Each group consists of one master node and multiple standby nodes. The data of the master node and the standby node are strongly consistent. The client sends a request message to the master node and forwards the message to the master node. The standby node is returned to the client by the master node after all nodes are successfully processed.
图7是根据本发明实施例的正常情况下的消息处理流程图,图8是根据本发明实施例的主服务节点故障的消息处理流程图一,图9是根据本发明实施例的主服务节点故障的消息处理流程图二,下面结合图7-9,详细描述整个实现方法,包括如下步骤:7 is a flow chart of message processing in a normal case according to an embodiment of the present invention, FIG. 8 is a flow chart 1 of message processing of a failure of a primary service node according to an embodiment of the present invention, and FIG. 9 is a main service node according to an embodiment of the present invention. Fault message processing flow chart 2, the following describes the entire implementation method in detail with reference to FIG. 7-9, including the following steps:
前置步骤:客户端通过协助服务器或自身算法已获得属于自己的ClientID,并且客户端已选中服务组,与主备节点建立了连接。Pre-step: The client obtains its own ClientID by assisting the server or its own algorithm, and the client has selected the service group to establish a connection with the active and standby nodes.
步骤S1,客户端将clientID和本地唯一数作为消息唯一标识{clientID,uniqueNUM},将数据变更请求发送给主服务节点(相当于图7中的S702,图8中的S802,图9中的S902);In step S1, the client sends the data change request to the primary service node by using the client ID and the local unique number as the message unique identifier {clientID, uniqueNUM} (corresponding to S702 in FIG. 7, S802 in FIG. 8, S902 in FIG. 9). );
步骤S2,主服务器节点收到请求报文。如果此时主节点故障转至步骤S7(相当于图8中的S804);In step S2, the primary server node receives the request packet. If the master node fails to go to step S7 at this time (equivalent to S804 in Fig. 8);
步骤S3,主节点处理请求报文,并记录此报文ID和处理状态(相当于图7中的S706),并同时将数据转发给备节点(相当于图7中的S704)。如果此时主节点故障转至步骤S10(相当于图9中的S906);In step S3, the master node processes the request message, records the message ID and the processing status (equivalent to S706 in FIG. 7), and simultaneously forwards the data to the standby node (corresponding to S704 in FIG. 7). If the master node fails to go to step S10 at this time (equivalent to S906 in Fig. 9);
步骤S4,备节点收到请求报文,处理消息并在本地记录此报文ID和处理状态(相当于图7中的S708); Step S4, the standby node receives the request message, processes the message, and locally records the message ID and the processing status (corresponding to S708 in FIG. 7);
步骤S5,备节点将处理结果返回给主节点(相当于图7中的S710);In step S5, the standby node returns the processing result to the master node (equivalent to S710 in FIG. 7);
步骤S6,主节点收到节点处理结果后,将消息处理的最终结果返回给客户端,跳转至步骤14(相当于图7中的S712);Step S6, after receiving the node processing result, the master node returns the final result of the message processing to the client, and jumps to step 14 (equivalent to S712 in FIG. 7);
步骤S7,客户端等待返回消息超时,判断主节点故障,并从备节点中选择一个作为新的主节点(相当于图8中的S806);Step S7, the client waits for the return message to time out, determines that the primary node is faulty, and selects one of the standby nodes as a new primary node (equivalent to S806 in FIG. 8);
步骤S8,客户端将消息重发至新的主节点(即原备节点)(相当于图8中的S808);Step S8, the client resends the message to the new primary node (ie, the original standby node) (equivalent to S808 in FIG. 8);
步骤S9,备节点处理此数据变更请求,并将结果返回给客户端,跳转至步骤S14(相当于图8中的S810-S812);Step S9, the standby node processes the data change request, and returns the result to the client, and proceeds to step S14 (equivalent to S810-S812 in FIG. 8);
步骤S10,备节点收到请求报文后,处理消息,并记录此条消息的处理结果(相当于图9中的S906);Step S10, after receiving the request message, the standby node processes the message, and records the processing result of the message (equivalent to S906 in FIG. 9);
步骤S11,客户端等待返回消息超时,判断主节点故障,并从备节点中选择一个作为新的主节点(相当于图9中的S910);Step S11, the client waits for the return message to time out, determines that the primary node is faulty, and selects one of the standby nodes as the new primary node (equivalent to S910 in FIG. 9);
步骤S12,客户端将消息重发至新的主节点(即原备节点)(相当于图9中的S912);Step S12, the client resends the message to the new primary node (ie, the original standby node) (equivalent to S912 in FIG. 9);
步骤S13,备节点发现此消息报文已处理过,将不再处理,直接将结果返回给客户端(相当于图9中的S914-S916);In step S13, the standby node finds that the message has been processed, and will not process the result, and directly returns the result to the client (equivalent to S914-S916 in FIG. 9);
步骤S14,至此整个消息处理流程结束。Step S14, the entire message processing flow ends.
本发明实施例是在云计算领域分布式存储系统中,解决节点(主要是主服务节点)故障时,请求消息可无缝继续被正确处理,增加了系统的健壮性,可用性。The embodiment of the invention is in the distributed storage system of the cloud computing domain. When the fault of the node (mainly the primary service node) is solved, the request message can be seamlessly processed correctly, which increases the robustness and availability of the system.
需要说明的是,上述各个模块是可以通过软件或硬件来实现的,对于后者,可以通过以下方式实现,但不限于此:上述模块均位于同一处理器中;或者,上述模块分别位于多个处理器中。It should be noted that each of the above modules may be implemented by software or hardware. For the latter, the foregoing may be implemented by, but not limited to, the foregoing modules are all located in the same processor; or, the modules are located in multiple In the processor.
本发明的实施例还提供了一种存储介质。可选地,在本实施例中,上述存储介质可以被设置为存储用于执行以下步骤的程序代码:Embodiments of the present invention also provide a storage medium. Optionally, in the embodiment, the foregoing storage medium may be configured to store program code for performing the following steps:
S21,接收来自客户端的第一请求报文,其中,该第一请求报文用于请求对预定数据进行处理;S21. Receive a first request message from a client, where the first request message is used to request processing of predetermined data.
S22,判断在接收第一请求报文之前,是否接收过与第一请求报文相同的第二请求报文;S22. Determine whether a second request message that is the same as the first request message is received before receiving the first request message.
S23,在判断结果为接收过第二请求报文的情况下,根据第二请求报文的处理状态对第一请求报文进行处理。S23. If the result of the determination is that the second request message is received, the first request message is processed according to the processing state of the second request message.
可选地,在本实施例中,上述存储介质可以包括但不限于:U盘、只读存储器(Read-Only Memory,简称为ROM)、随机存取存储器(Random Access Memory,简称为RAM)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。 Optionally, in the embodiment, the foregoing storage medium may include, but is not limited to, a USB flash drive, a Read-Only Memory (ROM), and a Random Access Memory (RAM). A variety of media that can store program code, such as a hard disk, a disk, or an optical disk.
可选地,在本实施例中,处理器根据存储介质中已存储的程序代码执行S21-S23。Optionally, in the embodiment, the processor executes S21-S23 according to the stored program code in the storage medium.
可选地,本实施例中的具体示例可以参考上述实施例及可选实施方式中所描述的示例,本实施例在此不再赘述。For example, the specific examples in this embodiment may refer to the examples described in the foregoing embodiments and the optional embodiments, and details are not described herein again.
显然,本领域的技术人员应该明白,上述的本发明的各模块或各步骤可以用通用的计算装置来实现,它们可以集中在单个的计算装置上,或者分布在多个计算装置所组成的网络上,可选地,它们可以用计算装置可执行的程序代码来实现,从而,可以将它们存储在存储装置中由计算装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本发明不限制于任何特定的硬件和软件结合。It will be apparent to those skilled in the art that the various modules or steps of the present invention described above can be implemented by a general-purpose computing device that can be centralized on a single computing device or distributed across a network of multiple computing devices. Alternatively, they may be implemented by program code executable by the computing device such that they may be stored in the storage device by the computing device and, in some cases, may be different from the order herein. The steps shown or described are performed, or they are separately fabricated into individual integrated circuit modules, or a plurality of modules or steps thereof are fabricated as a single integrated circuit module. Thus, the invention is not limited to any specific combination of hardware and software.
以上所述仅为本发明的优选实施例而已,并不用于限制本发明,对于本领域的技术人员来说,本发明可以有各种更改和变化。凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。The above description is only the preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes can be made to the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and scope of the present invention are intended to be included within the scope of the present invention.
工业实用性Industrial applicability
如上所述,本发明实施例提供的一种报文处理的方法及装置具有以下有益效果:解决了相关技术中存在的重复执行相同的处理,从而导致数据错误的问题,进而达到了提高执行效率和准确性,减少系统开销的效果。 As described above, the method and apparatus for processing a message according to an embodiment of the present invention have the following beneficial effects: solving the problem of repeatedly performing the same processing in the related art, thereby causing data errors, thereby improving execution efficiency. And accuracy, reducing the effect of system overhead.

Claims (10)

  1. 一种报文处理的方法,包括:A method for processing a message, comprising:
    接收来自客户端的第一请求报文,其中,所述第一请求报文用于请求对预定数据进行处理;Receiving a first request message from the client, where the first request message is used to request processing of the predetermined data;
    判断在接收所述第一请求报文之前,是否接收过与所述第一请求报文相同的第二请求报文;Determining whether a second request message that is the same as the first request message is received before receiving the first request message;
    在判断结果为接收过所述第二请求报文的情况下,根据所述第二请求报文的处理状态对所述第一请求报文进行处理。If the result of the determination is that the second request message is received, the first request message is processed according to the processing state of the second request message.
  2. 根据权利要求1所述的方法,其中,判断在接收所述第一请求报文之前,是否接收过与所述第一请求报文相同的第二请求报文包括:The method of claim 1, wherein determining whether the second request message that is the same as the first request message is received before receiving the first request message includes:
    获取所述第一请求报文的第一报文标识;Obtaining a first packet identifier of the first request packet;
    判断存储的预先接收到的一个或多个第三请求报文的报文标识中是否存在与所述第一报文标识相同的报文标识;Determining, by the stored message identifier of the one or more third request messages that are received in advance, whether the same message identifier as the first message identifier exists;
    在判断结果为是的情况下,确定接收过所述第二请求报文;和/或,在判断结果为否的情况下,确定未接收过所述第二请求报文。If the determination result is yes, it is determined that the second request message is received; and/or, if the determination result is no, it is determined that the second request message is not received.
  3. 根据权利要求2所述的方法,其中,所述报文标识包括所述客户端的标识和用于标识请求报文的本地唯一数。The method of claim 2, wherein the message identifier comprises an identifier of the client and a local unique number for identifying the request message.
  4. 根据权利要求1所述的方法,其中,根据所述第二请求报文的处理状态对所述第一请求报文进行处理包括:The method of claim 1, wherein processing the first request message according to a processing status of the second request message comprises:
    在所述第二请求报文的处理状态为未处理的情况下,根据所述第一请求报文对所述预定数据进行处理;或者,If the processing status of the second request message is unprocessed, processing the predetermined data according to the first request message; or
    在所述第二请求报文的处理状态为已处理的情况下,忽略所述第一请求报文,并向所述客户端发送对所述预定数据进行处理的处理结果。When the processing status of the second request message is processed, the first request message is ignored, and the processing result of processing the predetermined data is sent to the client.
  5. 根据权利要求1至4中任一项所述的方法,其中,所述第二请求报文为原主节点发送的,其中,所述原主节点为在接收来自所述客户端的所述第一请求报文之前,用于接收并处理所述客户端发送的请求报文的节点。The method according to any one of claims 1 to 4, wherein the second request message is sent by an original primary node, wherein the original primary node is receiving the first request message from the client Before the text, a node for receiving and processing the request message sent by the client.
  6. 一种报文处理的装置,包括:A device for processing a message, comprising:
    接收模块,设置为接收来自客户端的第一请求报文,其中,所述第一请求报文用于请求对预定数据进行处理;a receiving module, configured to receive a first request message from a client, where the first request message is used to request processing of predetermined data;
    判断模块,设置为判断在接收所述第一请求报文之前,是否接收过与所述第一请求报文相同的第二请求报文; The determining module is configured to determine whether the second request message that is the same as the first request message is received before receiving the first request message;
    处理模块,设置为在所述判断模块的判断结果为接收过所述第二请求报文的情况下,根据所述第二请求报文的处理状态对所述第一请求报文进行处理。The processing module is configured to process the first request message according to the processing state of the second request message if the judgment result of the determining module is that the second request message is received.
  7. 根据权利要求6所述的装置,其中,所述判断模块包括:The apparatus of claim 6, wherein the determining module comprises:
    获取单元,设置为获取所述第一请求报文的第一报文标识;An acquiring unit, configured to obtain a first packet identifier of the first request packet;
    判断单元,设置为判断存储的预先接收到的一个或多个第三请求报文的报文标识中是否存在与所述第一报文标识相同的报文标识;a determining unit, configured to determine, in the message identifier of the stored one or more third request messages, whether the same message identifier as the first message identifier exists;
    第一确定单元,设置为在所述判断单元的判断结果为是的情况下,确定接收过所述第二请求报文;和/或,第二确定单元,设置为在所述判断单元的判断结果为否的情况下,确定未接收过所述第二请求报文。a first determining unit, configured to determine that the second request message is received if the determination result of the determining unit is yes; and/or the second determining unit is configured to be determined by the determining unit If the result is no, it is determined that the second request message has not been received.
  8. 根据权利要求7所述的装置,其中,所述报文标识包括所述客户端的标识和用于标识请求报文的本地唯一数。The apparatus of claim 7, wherein the message identification comprises an identification of the client and a local unique number for identifying the request message.
  9. 根据权利要求6所述的装置,其中,所述处理模块包括:The apparatus of claim 6 wherein said processing module comprises:
    第一处理单元,设置为在所述第二请求报文的处理状态为未处理的情况下,根据所述第一请求报文对所述预定数据进行处理;或者,The first processing unit is configured to process the predetermined data according to the first request message if the processing status of the second request message is unprocessed; or
    第二处理单元,设置为在所述第二请求报文的处理状态为已处理的情况下,忽略所述第一请求报文,并向所述客户端发送对所述预定数据进行处理的处理结果。a second processing unit, configured to ignore the first request message and send a process for processing the predetermined data to the client if the processing status of the second request message is processed result.
  10. 根据权利要求6至9中任一项所述的装置,其中,所述第二请求报文为原主节点发送的,其中,所述原主节点为在接收来自所述客户端的所述第一请求报文之前,用于接收并处理所述客户端发送的请求报文的节点。 The apparatus according to any one of claims 6 to 9, wherein the second request message is sent by an original primary node, wherein the original primary node is receiving the first request message from the client Before the text, a node for receiving and processing the request message sent by the client.
PCT/CN2016/096270 2015-10-30 2016-08-22 Message processing method and apparatus WO2017071384A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510731553.9 2015-10-30
CN201510731553.9A CN106657187A (en) 2015-10-30 2015-10-30 Message processing method and apparatus thereof

Publications (1)

Publication Number Publication Date
WO2017071384A1 true WO2017071384A1 (en) 2017-05-04

Family

ID=58629831

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/096270 WO2017071384A1 (en) 2015-10-30 2016-08-22 Message processing method and apparatus

Country Status (2)

Country Link
CN (1) CN106657187A (en)
WO (1) WO2017071384A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112015469A (en) * 2020-07-14 2020-12-01 北京淇瑀信息科技有限公司 System reconfiguration method and device and electronic equipment
CN113224851A (en) * 2021-05-28 2021-08-06 广东电网有限责任公司 Power distribution terminal state determination method and device, electronic equipment and storage medium

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109299117B (en) * 2017-07-25 2022-07-29 北京国双科技有限公司 Data request processing method and device, storage medium and processor
EP3593490A4 (en) * 2019-03-04 2020-03-25 Alibaba Group Holding Limited Updating blockchain world state merkle patricia trie subtree
WO2019101230A2 (en) 2019-03-04 2019-05-31 Alibaba Group Holding Limited Constructing blockchain world state merkle patricia trie subtree

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101047582A (en) * 2006-03-31 2007-10-03 联想(北京)有限公司 Method for setting communication link in radio coordinate network
CN101493924A (en) * 2009-03-10 2009-07-29 中体彩科技发展有限公司 Transaction processing method of transaction processing system and lottery ticket transaction processing method
EP2157512A1 (en) * 2007-05-10 2010-02-24 International Business Machines Corporation Server device operating in response to received request
CN103780679A (en) * 2014-01-03 2014-05-07 电子科技大学 Long time delay remote invocation method based on HTTP protocol

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101047582A (en) * 2006-03-31 2007-10-03 联想(北京)有限公司 Method for setting communication link in radio coordinate network
EP2157512A1 (en) * 2007-05-10 2010-02-24 International Business Machines Corporation Server device operating in response to received request
CN101493924A (en) * 2009-03-10 2009-07-29 中体彩科技发展有限公司 Transaction processing method of transaction processing system and lottery ticket transaction processing method
CN103780679A (en) * 2014-01-03 2014-05-07 电子科技大学 Long time delay remote invocation method based on HTTP protocol

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112015469A (en) * 2020-07-14 2020-12-01 北京淇瑀信息科技有限公司 System reconfiguration method and device and electronic equipment
CN112015469B (en) * 2020-07-14 2023-11-14 北京淇瑀信息科技有限公司 System reconstruction method and device and electronic equipment
CN113224851A (en) * 2021-05-28 2021-08-06 广东电网有限责任公司 Power distribution terminal state determination method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN106657187A (en) 2017-05-10

Similar Documents

Publication Publication Date Title
US10581674B2 (en) Method and apparatus for expanding high-availability server cluster
CN106330475B (en) Method and device for managing main and standby nodes in communication system and high-availability cluster
WO2017071384A1 (en) Message processing method and apparatus
CN109151045B (en) Distributed cloud system and monitoring method
US11537314B1 (en) Resynchronization of individual volumes of a consistency group (CG) within a cross-site storage solution while maintaining synchronization of other volumes of the CG
US11934670B2 (en) Performing various operations at the granularity of a consistency group within a cross-site storage solution
US10826812B2 (en) Multiple quorum witness
CN108345617B (en) Data synchronization method and device and electronic equipment
WO2016177231A1 (en) Dual-control-based active-backup switching method and device
EP3031172B1 (en) Managing data feeds
US10802896B2 (en) Rest gateway for messaging
CN111708668B (en) Cluster fault processing method and device and electronic equipment
CN114090342A (en) Storage disaster tolerance link management method, message execution node and storage control cluster
WO2015196692A1 (en) Cloud computing system and processing method and apparatus for cloud computing system
CN110737543B (en) Method, device and storage medium for recovering distributed file system data
CN110351122B (en) Disaster recovery method, device, system and electronic equipment
CN117370316A (en) High availability management method and device for database, electronic equipment and storage medium
CN103780433B (en) Self-healing type virtual resource configuration management data architecture
CN118018463A (en) Fault processing method, device, equipment and readable storage medium
CN110603798B (en) System and method for providing elastic consistency platform with high availability
US9015518B1 (en) Method for hierarchical cluster voting in a cluster spreading more than one site
CN113596195B (en) Public IP address management method, device, main node and storage medium
CN107087021B (en) Master-slave server determination method and device
CN112491633B (en) Fault recovery method, system and related components of multi-node cluster
US11757987B2 (en) Load balancing systems and methods

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: 16858821

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16858821

Country of ref document: EP

Kind code of ref document: A1