CN116185283A - Service data processing method, device, node and computer readable storage medium - Google Patents

Service data processing method, device, node and computer readable storage medium Download PDF

Info

Publication number
CN116185283A
CN116185283A CN202211642925.7A CN202211642925A CN116185283A CN 116185283 A CN116185283 A CN 116185283A CN 202211642925 A CN202211642925 A CN 202211642925A CN 116185283 A CN116185283 A CN 116185283A
Authority
CN
China
Prior art keywords
service
cache space
target
target service
abnormal
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211642925.7A
Other languages
Chinese (zh)
Inventor
张爽
王�义
刘元木
王志永
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jingdong Technology Holding Co Ltd
Original Assignee
Jingdong Technology Holding Co Ltd
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 Jingdong Technology Holding Co Ltd filed Critical Jingdong Technology Holding Co Ltd
Priority to CN202211642925.7A priority Critical patent/CN116185283A/en
Publication of CN116185283A publication Critical patent/CN116185283A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • G06F3/0613Improving I/O performance in relation to throughput
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0644Management of space entities, e.g. partitions, extents, pools
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0652Erasing, e.g. deleting, data cleaning, moving of data to a wastebasket
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/067Distributed or networked storage systems, e.g. storage area networks [SAN], network attached storage [NAS]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Retry When Errors Occur (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

The embodiment of the application discloses a business data processing method, which comprises the following steps: when a target service in a block of the block chain is processed through a service instruction corresponding to the target service, storing service data generated by the service instruction into a first cache space of the block chain; the first cache space is used for storing service data generated by a service instruction corresponding to the current service; under the condition that the target service processing is completed and the target service is abnormal, the first cache space is emptied; storing target service data corresponding to the target service in the first cache space to a second cache space of the blockchain and emptying the first cache space under the condition that the target service is determined to be not abnormal; the second buffer space is used for storing service data corresponding to a plurality of services in the block chain. The embodiment of the application also discloses a service data processing device, a node and a computer readable storage medium.

Description

Service data processing method, device, node and computer readable storage medium
Technical Field
The present disclosure relates to the field of blockchain technologies, and in particular, to a method, an apparatus, a node, and a computer readable storage medium for processing service data.
Background
In the blockchain, a plurality of services are stored in one block, and the services are generally processed in a serial mode so as to ensure the transactional property of the services and the consistency of the service data stored by each node in the blockchain. However, in the process of processing a service, a failure in processing the service, such as a failure in verifying signature information or a system failure, is likely to occur, and in this case, the processing is performed by rolling back the execution states of all the services in the entire block in which the service is stored; in the implementation process, the inventor finds that at least the following problems exist in the prior art: the manner of rolling back the execution state of all the services in the whole block storing the services affects the normal storage of the rest of the services stored in the block, and affects the throughput of the system.
Disclosure of Invention
In order to solve the above technical problems, it is desirable to provide a service data processing method, apparatus, node and computer readable storage medium, which solve the problem that in the prior art, the normal storage of the rest of the services stored in the block is affected by a rollback manner of executing all the services in the whole block storing the service, and the throughput of the system is affected.
The technical scheme of the application is realized as follows:
a business data processing method, the method comprising:
when a target service in a block of a blockchain is processed through a service instruction corresponding to the target service, storing service data generated by the service instruction into a first cache space of the blockchain; the first cache space is used for storing service data generated by a service instruction corresponding to the current service;
under the condition that the target service processing is completed and the target service is abnormal, the first cache space is emptied;
storing target business data corresponding to the target business in the first cache space to a second cache space of the blockchain and emptying the first cache space under the condition that the target business is determined to be not abnormal; the second buffer space is used for storing service data corresponding to a plurality of services in the blockchain.
In the above solution, the clearing the first buffer space when the target service processing is completed and the target service is abnormal includes:
after the target service processing is completed, determining whether the target service is abnormal or not based on the target service data in the first cache space;
Determining an anomaly type of the anomaly based on the target service data in the first cache space under the condition that the anomaly exists in the target service;
if the abnormal type is the first type, the first cache space is emptied; wherein the first type characterizes that the target service has an abnormality due to a system failure.
In the above scheme, the method further comprises:
determining a first abnormality cause corresponding to the abnormality based on the target business data in the first cache space under the condition that the abnormality type is a second type; wherein the second type characterizes that the target service is abnormal due to the fact that the target service does not accord with service processing conditions;
and storing the first abnormal reason into the second cache space, and emptying the first cache space.
In the above solution, the clearing the first buffer space when the target service processing is completed and the target service is abnormal includes:
after the target service processing is completed, storing the target service data in the first cache space into a third cache space of the blockchain; the third buffer space is used for storing service data corresponding to the current service;
Determining whether the target service is abnormal or not based on the target service data in the third cache space;
and under the condition that the target service is determined to be abnormal, the first cache space and the third cache space are emptied.
In the above solution, the emptying the first buffer space and the third buffer space when the target service is abnormal includes:
determining an anomaly type of the anomaly based on the target service data in the third cache space under the condition that the anomaly exists in the target service;
if the abnormal type is the first type, the first cache space and the third cache space are emptied; wherein the first type characterizes that the target service has an abnormality due to a system failure.
In the above scheme, the method further comprises:
determining a second abnormality cause corresponding to the abnormality based on the target business data in the third cache space under the condition that the abnormality type is a second type; wherein the second type characterizes that the target service is abnormal due to the fact that the target service does not accord with service processing conditions;
and storing the second abnormal reason into the second cache space, and emptying the first cache space and the third cache space.
In the above solution, storing the target service data corresponding to the target service in the first buffer space to the second buffer space and emptying the first buffer space when it is determined that the target service is not abnormal, includes:
and under the condition that the target service is not abnormal, storing the target service data in the third cache space into the second cache space, and emptying the first cache space and the third cache space.
In the above scheme, the method further comprises:
and after the processing of the plurality of services in the block is completed, storing the service data corresponding to the plurality of services in the second cache space into a target database in the block chain.
A traffic data processing apparatus, the apparatus comprising:
the storage unit is used for storing service data generated by the service instruction into a first cache space of the blockchain when the target service in the block of the blockchain is processed through the service instruction corresponding to the target service; the first cache space is used for storing service data generated by a service instruction corresponding to the current service;
The processing unit is used for emptying the first cache space under the condition that the target service processing is completed and the target service is abnormal;
the processing unit is further configured to store target service data corresponding to the target service in the first cache space to a second cache space of the blockchain and empty the first cache space when it is determined that the target service is not abnormal; the second buffer space is used for storing service data corresponding to a plurality of services in the blockchain.
A node, the node comprising: a processor, a memory, and a communication bus;
the communication bus is used for realizing communication connection between the processor and the memory;
the processor is configured to execute the service data processing program in the memory, so as to implement the steps of the service data processing method.
A computer readable storage medium storing one or more programs executable by one or more processors to implement the steps of the business data processing method described above.
When the target business in the block of the block chain is processed through the business instruction corresponding to the target business, storing business data generated by the business instruction into a first cache space of the block chain, and then clearing the first cache space under the condition that the target business is processed and the target business is abnormal; storing target service data corresponding to the target service in the first cache space to a second cache space of the blockchain and emptying the first cache space under the condition that the target service is determined to be not abnormal; therefore, when the target service is abnormal, the rollback of the service data corresponding to the target service can be realized by only emptying the first buffer space, the processing and storage of other services are not influenced, the problem that the normal storage of other services stored in the whole block is influenced by the rollback of the execution states of all the services stored in the block in the prior art is solved, and the throughput of the system is improved.
Drawings
Fig. 1 is a flow chart of a service data processing method provided in an embodiment of the present application;
fig. 2 is a flow chart of another service data processing method according to an embodiment of the present application;
fig. 3 is a flow chart of another service data processing method according to an embodiment of the present application;
fig. 4 is a flow chart of a service data processing method in the prior art according to an embodiment of the present application;
fig. 5 is a flow chart of a service data processing method according to another embodiment of the present application;
fig. 6 is a flow chart of another service data processing method according to another embodiment of the present application;
fig. 7 is a schematic structural diagram of a service data processing device according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a node according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application.
It should be appreciated that reference throughout this specification to "an embodiment of the present application" or "the foregoing embodiment" means that a particular feature, structure or characteristic described in connection with the embodiment is included in at least one embodiment of the present application. Thus, the appearances of the phrase "in an embodiment of the present application" or "in the foregoing embodiments" in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In various embodiments of the present application, the sequence number of each process does not mean the sequence of execution, and the execution sequence of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. The foregoing embodiment numbers of the present application are merely for describing, and do not represent advantages or disadvantages of the embodiments.
Without being specifically illustrated, the electronic device may perform any of the steps in the embodiments of the present application, and may be a processor of the electronic device performing the steps. It is further noted that the embodiments of the present application do not limit the order in which the following steps are performed by the electronic device. In addition, the manner in which the data is processed in different embodiments may be the same method or different methods. It should be further noted that any step in the embodiments of the present application may be independently executed by the electronic device, that is, when the electronic device executes any step in the embodiments described below, execution of the other step may not be dependent.
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
The embodiment of the application provides a service data processing method, which can be applied to any node of a blockchain, and the embodiment of the application uses a target node as an example to describe the service data processing method, and referring to fig. 1, the method comprises the following steps:
step 101, when a target service in a block of a blockchain is processed through a service instruction corresponding to the target service, storing service data generated by the service instruction into a first cache space of the blockchain.
The first buffer space is used for storing service data generated by a service instruction corresponding to the current service.
In the embodiment of the application, the blockchain comprises a plurality of nodes, each of the plurality of nodes can process the service, and the target node is the node which is currently processing the target service. The block of the blockchain stores a plurality of services, wherein the services can refer to transactions in the blockchain, each service corresponds to a plurality of service instructions, and the target service is the currently processed service. The processing of the target service can be realized by sequentially executing the service instructions corresponding to the target service in sequence; business instructions may include, but are not limited to, registering a user account, registering a business data account, determining a key value pair for business data, registering a contract account, and invoking a contract method; when the service data is stored, the service data can be stored in a Key Value (KV) mode, each service instruction can generate a plurality of KV, and the service data generated by each service instruction can be called a service state snapshot KV set; in one possible implementation, if the service instruction is a registered user account, the service instruction will generate a KV pair with K being the user address and V being the user identity information. The first buffer space is used for storing service data generated by service instructions corresponding to the current service, that is, the first buffer space can be used for storing execution results of each service instruction corresponding to the currently processed service; in a possible implementation manner, the first cache space may be a cache space on the target node, or may be a cache space on another node, which is not limited in this embodiment of the present application.
In one possible implementation, after determining the target node from a plurality of nodes in the blockchain and determining the target service to be processed currently from the block, the target service may be sent to the target node for processing; after receiving the target service, the target node sequentially executes service instructions corresponding to the target service in sequence, and stores service data generated by each service instruction into the first buffer space.
Step 102, under the condition that the target service processing is completed and the target service is abnormal, the first cache space is emptied.
In the embodiment of the application, the target service processing is completed, that is, the service instruction corresponding to the target service is completed by execution. In the process of processing and storing the target service, the problems of invalid signature, failure in verification of the hash value of the service, failure in passing through security authority, system failure and the like may occur, so that after the processing of the target service is completed, whether the target service is abnormal needs to be judged, and the abnormal service is prevented from affecting the normal processing and storage of other services and affecting the throughput of the system. The target service is abnormal, which indicates that the processing of the target service fails, and at the moment, the service data corresponding to the target service cannot be stored in the blockchain, and the service data corresponding to the target service needs to be rolled back.
In a feasible implementation manner, after the target service is processed, the service data generated by each service instruction corresponding to the target service stored in the first cache space can be analyzed to determine whether the target service is abnormal and the cause of the abnormality, and the first cache space is emptied in time when the target service is abnormal, so that the service data corresponding to the target service is rolled back when the target service is abnormal, and normal processing and normal storage of other services are not affected by the target service.
And step 103, storing the target service data corresponding to the target service in the first cache space to the second cache space of the blockchain and emptying the first cache space under the condition that the target service is determined to be not abnormal.
The second buffer space is used for storing service data corresponding to a plurality of services in the block chain.
In this embodiment of the present application, the target service data is service data corresponding to the target service stored in the first buffer space. The second buffer space is used for storing service data corresponding to a plurality of services in the block; in a possible implementation manner, the second buffer space may be a buffer space on the target node or may be a buffer space on another node, and the size of the second buffer space may be larger than that of the first buffer space, so that there is enough space to store service data corresponding to a plurality of services. The target service is not abnormal, which indicates that the target service is normally processed, at the moment, the target service data in the first cache space can be stored into the second cache space of the blockchain, and then the first cache space is emptied; in this case, the first buffer space is emptied to facilitate the processing of the next service, that is, the service data generated by the service instruction corresponding to the next service is stored in the first buffer space.
In the embodiment of the application, the service data generated by each service instruction corresponding to the target service are stored in the first cache space, and under the condition that the abnormality exists in the target service, the data in the first cache space is timely emptied, so that rollback of the service data corresponding to the target service can be realized only by emptying the first cache space, the processing and storage of other services are not influenced, and the throughput of a system is improved; and under the condition that the target service is not abnormal, storing the service data corresponding to the target service in the first cache space into the second cache space, so that the safety of the service data stored in the blockchain is ensured.
According to the business data processing method provided by the embodiment of the invention, whether the target business is abnormal or not is determined after the business data corresponding to the target business is stored in the first buffer space and before the business data corresponding to the target business is stored in the second buffer space, so that when the target business is abnormal, the rollback of the business data corresponding to the target business can be realized by only emptying the first buffer space, the processing and storage of other businesses are not affected, the problem that the normal storage of other businesses stored in the whole block in which the business is stored is affected by the rollback of the execution state of all businesses in the whole block in the prior art is solved, and the throughput of a system is improved.
Based on the foregoing embodiments, an embodiment of the present application provides a service data processing method, referring to fig. 2, including the following steps:
step 201, when the target node processes the target service in the block of the blockchain through the service instruction corresponding to the target service, the target node stores the service data generated by the service instruction into the first buffer space of the blockchain.
The first buffer space is used for storing service data generated by a service instruction corresponding to the current service.
Step 202, after the target service processing is completed, the target node determines whether the target service is abnormal or not based on the target service data in the first buffer space.
In this embodiment of the present application, after execution of each service instruction is completed, an execution result is generated, so that whether the target service has an exception can be determined according to the execution result corresponding to each service instruction stored in the first cache space. If the service instruction is to verify the signature information, the execution result of the service instruction can be an invalid signature, so that it can be determined that the target service is abnormal and the reason for the abnormality is that the signature is invalid; if the business instruction is to check the user account, the execution result of the business instruction may be that the account does not exist, so that it may be determined that the target business is abnormal and the reason for the abnormality is that the account does not exist.
It should be noted that, after step 202 is performed, step 203 or step 207 may be performed.
In step 203, under the condition that the target service is determined to be abnormal, the target node determines the abnormal type of the abnormality based on the target service data in the first cache space.
In the embodiment of the application, the exception types can be divided according to the serious condition of the exception generated in the execution process of the service, and the exception types can comprise a first type and a second type; wherein, the first type represents the target business and has abnormality because of the systematic fault, the second type represents the target business and has abnormality because of not conforming to the business process condition; in one possible implementation, the anomaly corresponding to the first type may be an invalid signature, an absence of an account, a non-compliance with a security policy, an insufficient account balance, etc.; the second type of corresponding anomaly may be a system failure, a storage failure, a transaction repetition, a consensus error, a database access failure, etc.
In one possible implementation manner, the exception type corresponding to each exception may be preset, so that if it is determined that the target service has an exception, the exception type of the exception may be determined.
After step 203 is performed, step 204 or steps 205 to 206 may be performed.
Step 204, in the case that the exception type is the first type, the target node empties the first cache space.
Wherein the first type characterizes that the target service has abnormality due to system failure.
In the embodiment of the application, the first type represents that the target service has an abnormality due to system failure, and the abnormality is serious, and the first cache space can be directly under the condition; furthermore, the first type of exception does not have any assistance in the handling of subsequent traffic and therefore does not require storage.
Step 205, when the anomaly type is the second type, the target node determines a first anomaly cause corresponding to the anomaly based on the target service data in the first cache space.
Wherein, the second type representation target service is abnormal because of not conforming to the service processing condition.
In the embodiment of the present application, the first exception cause is an exception that a service instruction corresponding to a target service exists in an execution process or an exception that an execution result of the service instruction is stored. The second type represents the target business and has the abnormality because of not conforming to the business process condition, this abnormality is abnormality in the business process, the possible abnormality is caused by user account have mistake, invalid signature, not accord with the situation such as the security policy, can confirm the reason of abnormality correspondent abnormality at this moment, facilitate knowing the abnormal condition of the target business subsequently, and deal with in time in order to report the business again; in addition, the second type of abnormality is an abnormality in the process of processing the service, and references and warnings are provided for the processing of the subsequent service, so that the first abnormality cause corresponding to the abnormality can be determined.
Step 206, the target node stores the first exception reason in the second buffer space, and empties the first buffer space.
In the embodiment of the application, the abnormality and the first abnormality cause can be stored in the second cache space, so that the subsequent acquisition of the abnormality condition of the target service is facilitated, and the processing is timely carried out to report the target service again. And storing the first abnormal reason into the second buffer space, and then emptying the first buffer space so as to facilitate the subsequent processing of the next service. In one possible implementation, the anomalies and the first cause of the anomaly may be stored to the second cache space in KV pairs.
Step 207, under the condition that it is determined that the target service is not abnormal, the target node stores target service data corresponding to the target service in the first cache space into the second cache space of the blockchain, and empties the first cache space.
The second buffer space is used for storing service data corresponding to a plurality of services in the block chain.
In the embodiment of the application, the abnormality existing in the target service is divided into different abnormality types, different processing modes are adopted for the different abnormality types, and the service data corresponding to the target service can be directly emptied for the abnormality existing in the target service due to the system fault, so that the buffer space can be saved; for the abnormality of the target service due to the fact that the target service does not accord with the service processing conditions, determining a first abnormality reason of the abnormality, storing the first abnormality reason into a second buffer space, facilitating the follow-up acquisition of the abnormality of the target service, and timely processing to re-report the target service.
It should be noted that, in this embodiment, the descriptions of the same steps and the same content as those in other embodiments may refer to the descriptions in other embodiments, and are not repeated here.
According to the business data processing method provided by the embodiment of the invention, whether the target business is abnormal or not is determined after the business data corresponding to the target business is stored in the first buffer space and before the business data corresponding to the target business is stored in the second buffer space, so that when the target business is abnormal, the rollback of the business data corresponding to the target business can be realized by only emptying the first buffer space, the processing and storage of other businesses are not affected, the problem that the normal storage of other businesses stored in the whole block in which the business is stored is affected by the rollback of the execution state of all businesses in the whole block in the prior art is solved, and the throughput of a system is improved.
Based on the foregoing embodiments, an embodiment of the present application provides a service data processing method, referring to fig. 3, including the following steps:
step 301, when the target node processes the target service in the block of the blockchain through the service instruction corresponding to the target service, the target node stores the service data generated by the service instruction into the first buffer space of the blockchain.
The first buffer space is used for storing service data generated by a service instruction corresponding to the current service.
Step 302, after the target service processing is completed, the target node stores the target service data in the first buffer space into a third buffer space of the blockchain.
The third buffer space is used for storing service data corresponding to the current service.
In the embodiment of the application, the first buffer space stores service data generated by each service instruction corresponding to the target service, namely the first buffer space aims at the service instruction, and isolation of the service data of the service instruction is realized; the third buffer space stores target service data in the first buffer space, namely the third buffer space aims at target service, and isolation of service data corresponding to the service is realized, so that the safety of the service data is further ensured.
Step 303, the target node determines whether the target service is abnormal or not based on the target service data in the third buffer space.
In the embodiment of the application, whether the target service is abnormal or not is determined based on the target service data in the third cache space, so that the risk of system faults can be eliminated, and the safety of the service data is further ensured.
In one possible implementation manner, whether the target service is abnormal or not may be determined based on an execution result corresponding to each service instruction stored in the third buffer space; if there is an exception in submitting the target data from the first cache space to the second cache space, then the stored results may be reported at this time.
It should be noted that, after step 303 is performed, step 304 or step 305 may be performed.
Step 304, under the condition that the target service is determined to be abnormal, the target node empties the first cache space and the third cache space.
In the embodiment of the application, whether the target service is abnormal or not is determined through the target service data in the third buffer space, and only the first buffer space and the second buffer space have data at the moment, so that the first buffer space and the third buffer space can be emptied under the condition that the target service is determined to be abnormal, the safety of a system is ensured, and the processing and storage of other services are prevented from being influenced by the abnormal service.
Wherein step 304 may be implemented by:
step 304a, the target node determines an abnormal type of the abnormality based on the target service data in the third buffer space under the condition that the target service is determined to have the abnormality.
In one possible manner, the anomaly type corresponding to each anomaly may be preset, so that when it is determined that the target service has an anomaly, the anomaly type of the anomaly may be determined.
After step 304a is performed, step 304b or steps 304c to 304d may be performed.
Step 304b, the target node empties the first buffer space and the third buffer space when the exception type is the first type.
Wherein the first type characterizes that the target service has abnormality due to system failure.
In the embodiment of the present application, the first type characterizes that the target service has an abnormality due to a system failure, where the abnormality is a serious abnormality, all data related to the target service needs to be cleared at this time, and only the first buffer space and the third buffer space have data at this time, so that the first buffer space and the third buffer space can be cleared.
And step 304c, determining a second abnormality cause corresponding to the abnormality based on the target service data in the third cache space when the abnormality type is the second type.
Wherein, the second type representation target service is abnormal because of not conforming to the service processing condition.
In the embodiment of the application, the second type representation target service is abnormal due to the fact that the second type representation target service does not accord with the service processing conditions, and reference and warning can be provided for the processing of the subsequent service, so that a second abnormality reason corresponding to the abnormality can be determined.
It should be noted that, since the first abnormality cause is determined directly by the service data in the first buffer space, and the second abnormality cause is determined by the service data in the second buffer space, an abnormality may occur when data is submitted from the first buffer space to the second buffer space, and thus the second abnormality cause may be different from the first abnormality cause.
And step 304d, the target node stores the second abnormal reason in the second cache space, and empties the first cache space and the third cache space.
The second buffer space is used for storing service data corresponding to a plurality of services in the block chain.
In the embodiment of the application, the abnormality and the first abnormality cause can be stored in the second cache space, so that the subsequent abnormal condition of the target service can be conveniently obtained, and the abnormal condition can be timely processed to report the target service again. And storing the first abnormal reason into the second buffer space, and then clearing the first buffer space and the third buffer space, so as to facilitate the subsequent processing of the next service. In one possible implementation, the exception and the second cause of the exception may be stored to the second cache space in KV pairs.
In step 305, the target node stores the target service data in the third buffer space to the second buffer space and empties the first buffer space and the third buffer space when it is determined that the target service is not abnormal.
In the embodiment of the present application, in the case that it is determined that there is no abnormality in the target service, the target service data in the third buffer space is stored in the second buffer space and the first buffer space and the third buffer space are emptied, so as to facilitate the processing of the next service, that is, the service data generated by the service instruction corresponding to the next service is stored in the first buffer space.
In other embodiments of the present application, if a system exception occurs during the process of submitting data from the third buffer space to the second buffer space, if the second buffer space already stores data, then the data in the second buffer space needs to be rolled back, and the third buffer space and the first buffer space are emptied, and since the service data in the third buffer space is stored in the second buffer space from the service perspective, the rolling back is performed for the service data of the target service, so that the processing of other services is not affected. And after passing through the first buffer memory space and the second buffer memory space, the service data corresponding to the target service is stored in the second buffer memory space, so that not only can the target service be ensured to be free from abnormality in the processing process, but also the service data can be further ensured to be free from abnormality in the storage process, the safety of the service data stored in the second buffer memory space is ensured to the greatest extent, and the safety of a blockchain system is further ensured.
In the embodiment of the application, instruction isolation is realized through the first cache space, business isolation is realized through the second cache space, block isolation is realized through the third cache space, interference and pollution of abnormal business to other businesses are reduced, repeated submission and processing of normal business caused by one-cut block rollback in the prior art are avoided, system throughput is submitted, and safety of a block chain is ensured.
In other embodiments of the present application, the service data processing method may further include the following steps:
and 306, after the target node finishes processing the plurality of services in the block, storing the service data corresponding to the plurality of services in the second cache space into a target database in the block chain.
In the embodiment of the present application, the target database may be a ledger database of a blockchain, for recording transaction status data. After the processing of the plurality of services in the block is completed, the service data corresponding to the plurality of services in the second cache space are stored into the target database, so that the block isolation can be realized, and the nodes in the subsequent block chain can be conveniently checked.
As shown in fig. 4, in the prior art, after the service instruction 1, the service instruction 2 and the service instruction 3 corresponding to the service 1 are executed, the execution result of the service instruction 1, the execution result of the service instruction 2 and the execution result of the service instruction 3 are submitted to the cache space for storage, and then after the next service is executed, the execution result of the service instruction corresponding to the service is also directly submitted to the cache space for storage, so when the service is abnormal, all data in the cache space needs to be rolled back to restore the cache space to a state when the abnormality does not occur, thereby affecting other services and reducing the throughput of the system.
In the service data processing method provided in the embodiment of the present application, as shown in fig. 5, when the service instruction 1, the service instruction 2, and the service instruction 3 corresponding to the service 1 are sequentially executed in sequence, the execution result of the service instruction 1, the execution result of the service instruction 2, and the execution result of the service instruction 3 are stored in the first buffer space, so as to realize storage of the execution result of the service instruction; after the execution of the service instruction corresponding to the service 1 is completed, that is, after the processing of the service 1 is completed, storing all the execution results corresponding to the service 1 into a third cache space, so as to realize the storage of the service execution results; and under the condition that the service 1 is not abnormal, storing an execution result corresponding to the service 1 into a second cache space, and emptying the first cache space and the second cache space. Continuing to process the next service, executing the service instruction 1 and the service instruction 2 corresponding to the service 2 in sequence, storing the execution result of the service instruction 1 and the execution result of the service instruction 2 into a first cache space, and storing all the execution results corresponding to the service 2 into a third cache space after the execution of the service instruction corresponding to the service 2 is completed; under the condition that the service 2 is not abnormal, storing the execution results corresponding to the service 2 into a second cache space, emptying the first cache space and the second cache space, and continuing to process the next service, so that the execution results of N services are stored into the second cache space, and then the execution results of N services stored in the second cache space are submitted into account book data for storage, so that each node in the block chain can conveniently check. In the process of processing the service N, if the first type of abnormality occurs, the first cache space and the third cache space can be directly emptied; if the second type of abnormality occurs, the abnormality and the cause of the abnormality corresponding to the abnormality may be determined through the traffic data in the third buffer space, and if the abnormality cause fails the signature verification, the cause of the abnormality may be stored in the second buffer space, as shown in fig. 6.
It should be noted that, in this embodiment, the descriptions of the same steps and the same content as those in other embodiments may refer to the descriptions in other embodiments, and are not repeated here.
According to the business data processing method provided by the embodiment of the invention, whether the target business is abnormal or not is determined after the business data corresponding to the target business is stored in the first buffer space and before the business data corresponding to the target business is stored in the second buffer space, so that when the target business is abnormal, the rollback of the business data corresponding to the target business can be realized by only emptying the first buffer space, the processing and storage of other businesses are not affected, the problem that the normal storage of other businesses stored in the whole block in which the business is stored is affected by the rollback of the execution state of all businesses in the whole block in the prior art is solved, and the throughput of a system is improved.
Based on the foregoing embodiments, the present embodiment provides a service data processing apparatus, which may be applied to the service data processing method provided in the embodiments corresponding to fig. 1 to 3, and referring to fig. 7, the service data processing apparatus 4 may include:
A storage unit 41, configured to store, when a target service in a block of the blockchain is processed by a service instruction corresponding to the target service, service data generated by the service instruction into a first buffer space of the blockchain; the first cache space is used for storing service data generated by a service instruction corresponding to the current service;
a processing unit 42, configured to empty the first buffer space when the target service processing is completed and there is an abnormality in the target service;
the processing unit 42 is further configured to store, in a case where it is determined that the target service does not have an abnormality, target service data corresponding to the target service in the first cache space to a second cache space of the blockchain, and empty the first cache space; the second buffer space is used for storing service data corresponding to a plurality of services in the block chain.
In other embodiments of the present application, the processing unit 42 is specifically configured to perform the following steps:
after the target service processing is completed, determining whether the target service is abnormal or not based on the target service data in the first cache space;
determining an anomaly type of the anomaly based on the target service data in the first cache space under the condition that the target service is determined to be anomalous;
Under the condition that the abnormal type is the first type, the first cache space is emptied; wherein the first type characterizes that the target service has abnormality due to system failure.
In other embodiments of the present application, the processing unit 42 is specifically configured to perform the following steps:
under the condition that the abnormality type is the second type, determining a first abnormality cause corresponding to the abnormality based on target business data in a first cache space; wherein, the second type representation target service is abnormal because of not conforming to the service processing condition;
and storing the first abnormal reason into the second cache space, and emptying the first cache space.
In other embodiments of the present application, the processing unit 42 is specifically configured to perform the following steps:
after the target service processing is completed, storing the target service data in the first cache space into a third cache space of the blockchain; the third buffer space is used for storing service data corresponding to the current service;
determining whether the target service is abnormal or not based on the target service data in the third cache space;
and under the condition that the target service is determined to be abnormal, the first cache space and the third cache space are emptied.
In other embodiments of the present application, the processing unit 42 is specifically configured to perform the following steps:
Determining an anomaly type of the anomaly based on the target service data in the third cache space under the condition that the target service is determined to be anomalous;
under the condition that the abnormal type is the first type, the first cache space and the third cache space are emptied; wherein the first type characterizes that the target service has abnormality due to system failure.
In other embodiments of the present application, the processing unit 42 is specifically configured to perform the following steps:
determining a second abnormality cause corresponding to the abnormality based on the target business data in the third cache space under the condition that the abnormality type is the second type; wherein, the second type representation target service is abnormal because of not conforming to the service processing condition;
and storing the second abnormal reason into the second cache space, and emptying the first cache space and the third cache space.
In other embodiments of the present application, the processing unit 42 is specifically configured to perform the following steps:
and under the condition that the target service is not abnormal, storing the target service data in the third buffer space into the second buffer space, and emptying the first buffer space and the third buffer space.
In other embodiments of the present application, the processing unit 42 is specifically configured to perform the following steps:
After the processing of the plurality of services in the block is completed, storing the service data corresponding to the plurality of services in the second cache space into a target database in the block chain.
It should be noted that, in the service data processing method provided by the embodiment corresponding to fig. 1 to 3, specific descriptions of steps executed by each unit may be omitted here.
According to the business data processing device provided by the embodiment of the application, whether the target business is abnormal or not is determined after the business data corresponding to the target business is stored in the first buffer memory space and before the business data corresponding to the target business is stored in the second buffer memory space, so that when the target business is abnormal, the rollback of the business data corresponding to the target business can be realized only by emptying the first buffer memory space, the processing and storage of other businesses are not affected, the problem that the normal storage of other businesses stored in the whole block in which the business is stored is affected by the rollback of the execution states of all businesses in the whole block in the prior art is solved, and the throughput of a system is improved.
Based on the foregoing embodiments, the embodiments of the present application provide a node, which may be applied to the service data processing method provided in the corresponding embodiments of fig. 1 to 3, and referring to fig. 8, the node 5 may include: a processor 51, a memory 52 and a communication bus 53, wherein:
A communication bus 53 for enabling communication connection between the processor 51 and the memory 52;
the processor 51 is configured to execute a service data processing program in the memory 52 to implement the following steps:
when a target service in a block of the block chain is processed through a service instruction corresponding to the target service, storing service data generated by the service instruction into a first cache space of the block chain; the first cache space is used for storing service data generated by a service instruction corresponding to the current service;
under the condition that the target service processing is completed and the target service is abnormal, the first cache space is emptied;
storing target service data corresponding to the target service in the first cache space to a second cache space of the blockchain and emptying the first cache space under the condition that the target service is determined to be not abnormal; the second buffer space is used for storing service data corresponding to a plurality of services in the block chain.
In other embodiments of the present application, the processor 51 is configured to execute the service data processing program in the memory 52 to empty the first buffer space in the case where the target service processing is completed and there is an exception to the target service, so as to implement the following steps:
After the target service processing is completed, determining whether the target service is abnormal or not based on the target service data in the first cache space;
determining an anomaly type of the anomaly based on the target service data in the first cache space under the condition that the target service is determined to be anomalous;
under the condition that the abnormal type is the first type, the first cache space is emptied; wherein the first type characterizes that the target service has abnormality due to system failure.
In other embodiments of the present application, the processor 51 is configured to execute the service data processing program in the memory 52, and the following steps may be implemented:
under the condition that the abnormality type is the second type, determining a first abnormality cause corresponding to the abnormality based on target business data in a first cache space; wherein, the second type representation target service is abnormal because of not conforming to the service processing condition;
and storing the first abnormal reason into the second cache space, and emptying the first cache space.
In other embodiments of the present application, the processor 51 is configured to execute the service data processing program in the memory 52 to empty the first buffer space in the case where the target service processing is completed and there is an exception to the target service, so as to implement the following steps:
After the target service processing is completed, storing the target service data in the first cache space into a third cache space of the blockchain; the third buffer space is used for storing service data corresponding to the current service;
determining whether the target service is abnormal or not based on the target service data in the third cache space;
and under the condition that the target service is determined to be abnormal, the first cache space and the third cache space are emptied.
In other embodiments of the present application, the processor 51 is configured to execute the service data processing program in the memory 52 to empty the first buffer space and the third buffer space in the case that there is an abnormality in the target service, so as to implement the following steps:
determining an anomaly type of the anomaly based on the target service data in the third cache space under the condition that the target service is determined to be anomalous;
under the condition that the abnormal type is the first type, the first cache space and the third cache space are emptied; wherein the first type characterizes that the target service has abnormality due to system failure.
In other embodiments of the present application, the processor 51 is configured to execute the service data processing program in the memory 52, and the following steps may be implemented:
Determining a second abnormality cause corresponding to the abnormality based on the target business data in the third cache space under the condition that the abnormality type is the second type; wherein, the second type representation target service is abnormal because of not conforming to the service processing condition;
and storing the second abnormal reason into the second cache space, and emptying the first cache space and the third cache space.
In other embodiments of the present application, the processor 51 is configured to execute the service data processing program in the memory 52, store the target service data corresponding to the target service in the first buffer space to the second buffer space and empty the first buffer space when it is determined that the target service is not abnormal, so as to implement the following steps:
and under the condition that the target service is not abnormal, storing the target service data in the third buffer space into the second buffer space, and emptying the first buffer space and the third buffer space.
In other embodiments of the present application, the processor 51 is configured to execute the service data processing program in the memory 52, and the following steps may be implemented:
after the processing of the plurality of services in the block is completed, storing the service data corresponding to the plurality of services in the second cache space into a target database in the block chain.
It should be noted that, in the service data processing method provided by the embodiment corresponding to fig. 1 to 3, specific descriptions of the steps executed by the processor may be omitted here.
According to the node provided by the embodiment of the invention, since whether the target service is abnormal or not is determined after the service data corresponding to the target service is stored in the first buffer space and before the service data corresponding to the target service is stored in the second buffer space, when the target service is abnormal, the rollback of the service data corresponding to the target service can be realized only by emptying the first buffer space, the processing and storage of other services are not affected, the problem that the normal storage of other services stored in the whole block in which the service is stored is affected by rollback of the execution states of all the services in the block in the prior art is solved, and the throughput of the system is improved.
Based on the foregoing embodiments, embodiments of the present application provide a computer-readable storage medium storing one or more programs executable by one or more processors to implement the steps of the service data processing method provided by the corresponding embodiments of fig. 1 to 3.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of a hardware embodiment, a software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, magnetic disk storage, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The foregoing description is only of the preferred embodiments of the present application and is not intended to limit the scope of the present application.

Claims (11)

1. A method for processing service data, the method comprising:
when a target service in a block of a blockchain is processed through a service instruction corresponding to the target service, storing service data generated by the service instruction into a first cache space of the blockchain; the first cache space is used for storing service data generated by a service instruction corresponding to the current service;
Under the condition that the target service processing is completed and the target service is abnormal, the first cache space is emptied;
storing target business data corresponding to the target business in the first cache space to a second cache space of the blockchain and emptying the first cache space under the condition that the target business is determined to be not abnormal; the second buffer space is used for storing service data corresponding to a plurality of services in the blockchain.
2. The method of claim 1, wherein the flushing the first cache space in the event that the target traffic is processed and there is an exception to the target traffic comprises:
after the target service processing is completed, determining whether the target service is abnormal or not based on the target service data in the first cache space;
determining an anomaly type of the anomaly based on the target service data in the first cache space under the condition that the anomaly exists in the target service;
if the abnormal type is the first type, the first cache space is emptied; wherein the first type characterizes that the target service has an abnormality due to a system failure.
3. The method according to claim 2, wherein the method further comprises:
determining a first abnormality cause corresponding to the abnormality based on the target business data in the first cache space under the condition that the abnormality type is a second type; wherein the second type characterizes that the target service is abnormal due to the fact that the target service does not accord with service processing conditions;
and storing the first abnormal reason into the second cache space, and emptying the first cache space.
4. The method of claim 1, wherein the flushing the first cache space in the event that the target traffic is processed and there is an exception to the target traffic comprises:
after the target service processing is completed, storing the target service data in the first cache space into a third cache space of the blockchain; the third buffer space is used for storing service data corresponding to the current service;
determining whether the target service is abnormal or not based on the target service data in the third cache space;
and under the condition that the target service is determined to be abnormal, the first cache space and the third cache space are emptied.
5. The method of claim 4, wherein the flushing the first buffer space and the third buffer space in the event of an anomaly in the target traffic comprises:
determining an anomaly type of the anomaly based on the target service data in the third cache space under the condition that the anomaly exists in the target service;
if the abnormal type is the first type, the first cache space and the third cache space are emptied; wherein the first type characterizes that the target service has an abnormality due to a system failure.
6. The method of claim 5, wherein the method further comprises:
determining a second abnormality cause corresponding to the abnormality based on the target business data in the third cache space under the condition that the abnormality type is a second type; wherein the second type characterizes that the target service is abnormal due to the fact that the target service does not accord with service processing conditions;
and storing the second abnormal reason into the second cache space, and emptying the first cache space and the third cache space.
7. The method according to claim 4, wherein storing the target service data corresponding to the target service in the first buffer space to a second buffer space and emptying the first buffer space if it is determined that the target service is not abnormal, comprises:
And under the condition that the target service is not abnormal, storing the target service data in the third cache space into the second cache space, and emptying the first cache space and the third cache space.
8. The method according to claim 1, wherein the method further comprises:
and after the processing of the plurality of services in the block is completed, storing the service data corresponding to the plurality of services in the second cache space into a target database in the block chain.
9. A traffic data processing apparatus, the apparatus comprising:
the storage unit is used for storing service data generated by the service instruction into a first cache space of the blockchain when the target service in the block of the blockchain is processed through the service instruction corresponding to the target service; the first cache space is used for storing service data generated by a service instruction corresponding to the current service;
the processing unit is used for emptying the first cache space under the condition that the target service processing is completed and the target service is abnormal;
the processing unit is further configured to store target service data corresponding to the target service in the first cache space to a second cache space of the blockchain and empty the first cache space when it is determined that the target service is not abnormal; the second buffer space is used for storing service data corresponding to a plurality of services in the blockchain.
10. A node, the node comprising: a processor, a memory, and a communication bus;
the communication bus is used for realizing communication connection between the processor and the memory;
the processor is configured to execute a service data processing program in the memory to implement the steps of the service data processing method according to any one of claims 1 to 8.
11. A computer readable storage medium storing one or more programs executable by one or more processors to implement the steps of the business data processing method of any of claims 1-8.
CN202211642925.7A 2022-12-20 2022-12-20 Service data processing method, device, node and computer readable storage medium Pending CN116185283A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211642925.7A CN116185283A (en) 2022-12-20 2022-12-20 Service data processing method, device, node and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211642925.7A CN116185283A (en) 2022-12-20 2022-12-20 Service data processing method, device, node and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN116185283A true CN116185283A (en) 2023-05-30

Family

ID=86449846

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211642925.7A Pending CN116185283A (en) 2022-12-20 2022-12-20 Service data processing method, device, node and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN116185283A (en)

Similar Documents

Publication Publication Date Title
US20180285217A1 (en) Failover response using a known good state from a distributed ledger
CN110032428B (en) Method and device for executing distributed transaction
CN110807064B (en) Data recovery device in RAC distributed database cluster system
CN110784331B (en) Consensus process recovery method and related nodes
CN110413687B (en) Distributed transaction fault processing method and related equipment based on node interaction verification
CN114253673A (en) Transaction processing method and transaction processing device of distributed system
US20080082630A1 (en) System and method of fault tolerant reconciliation for control card redundancy
CN106327140B (en) Method and device for monitoring data modification
CN111210350A (en) Block chain transaction method and device, computer equipment and storage medium
CN112613993A (en) Transaction data processing method and device, computer equipment and storage medium
CN113064759A (en) Block chain data rollback processing method and processing system thereof
CN110675247B (en) Unknown transaction processing method and system, peripheral system and core bank system
CN112436962B (en) Block chain consensus network dynamic expansion method, electronic device, system and medium
CN116185283A (en) Service data processing method, device, node and computer readable storage medium
CN117195129A (en) Exception handling method based on sandbox system and related equipment
CN104021033A (en) Method and system for hashing busy processing nodes
CN112486726B (en) Time rollback method and system for blockchain
CN115271694A (en) Order payment method and system
JPH0895868A (en) Method for judging abnormality of backup data and method for processing abnormality at abnormality time
CN110348244B (en) Arbitration-based multi-checksum verification method, system, device and storage medium
CN111475400A (en) Verification method of service platform and related equipment
CN115051913B (en) Method and device for changing Raft configuration
CN115618426B (en) Block chain data tamper-proof method and system based on check points
US9081723B2 (en) Data processing device
CN117689458A (en) Service processing method and device of heterogeneous system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination