CN113220669A - Service data processing method and device and electronic equipment - Google Patents

Service data processing method and device and electronic equipment Download PDF

Info

Publication number
CN113220669A
CN113220669A CN202110645867.2A CN202110645867A CN113220669A CN 113220669 A CN113220669 A CN 113220669A CN 202110645867 A CN202110645867 A CN 202110645867A CN 113220669 A CN113220669 A CN 113220669A
Authority
CN
China
Prior art keywords
service data
service
database
version
node
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.)
Granted
Application number
CN202110645867.2A
Other languages
Chinese (zh)
Other versions
CN113220669B (en
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 CN202110645867.2A priority Critical patent/CN113220669B/en
Publication of CN113220669A publication Critical patent/CN113220669A/en
Application granted granted Critical
Publication of CN113220669B publication Critical patent/CN113220669B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/219Managing data history or versioning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a method, a device and an electronic device for processing service data, which can be applied to a first node in a cluster service system, and the method comprises the following steps: receiving a modification request sent by a terminal device, wherein the modification request comprises: the method comprises the steps of identifying first service data to be modified, modifying content of the first service data and a first version identification on which modification of the first service data is based; acquiring a second version identifier corresponding to the first service data from a cache database corresponding to the first node according to the identifier of the first service data, wherein the cache databases corresponding to different nodes in the cluster service system are different; and if the first version identification is determined to be the same as the second version identification, updating the modified content of the first service data into the service database. The method and the device for the cluster service database access can reduce the access times of the service database, reduce the resource consumption of the service database and improve the performance of the cluster service system.

Description

Service data processing method and device and electronic equipment
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a method and an apparatus for processing service data, and an electronic device.
Background
In a cluster-based business system, business data is stored in a business database. Each node in the cluster can access the service database and perform operations such as query, modification, deletion and the like on the service data. In practical application, the condition that multiple nodes modify the same service data often occurs, so that the modification of the service data by different nodes is mutually overlapped.
In the related art, version control can be performed on business data in a database optimistic lock mode. Specifically, a latest version id is maintained for each service data in the service database. Before each node modifies the service data, the current version identification of the service data is obtained by inquiring from the service database, and then the service data is modified. Before the modified content is stored, the current version identification of the service data is inquired from the service database again, and the modified content is stored under the condition that the version identification inquired this time is consistent with the version identification inquired last time.
However, in the process of implementing the present application, the inventor finds that the concurrency of service data modification in a cluster scene is high, and the adoption of the database optimistic lock mode results in high access frequency of a service database and high consumption of database resources, thereby reducing the service performance of the whole cluster service system, and even causing the breakdown of the whole cluster service system.
Disclosure of Invention
The application provides a method and a device for processing service data and electronic equipment, which are used for reducing resource consumption of a service database and improving service performance of a cluster service system.
In a first aspect, the present application provides a method for processing service data, which is applied to a first node in a cluster service system, and the method includes:
receiving a modification request sent by a terminal device, wherein the modification request comprises: the method comprises the steps of identifying first service data to be modified, modifying content of the first service data and a first version identification on which modification of the first service data is based;
acquiring a second version identifier corresponding to the first service data from a cache database corresponding to the first node according to the identifier of the first service data, wherein the cache databases corresponding to different nodes in the cluster service system are different;
and if the first version identification is determined to be the same as the second version identification, updating the modified content of the first service data into a service database.
In a possible implementation manner, updating the modified content of the first service data to a service database includes:
setting the state of the first service data to be a locked state;
updating the modified content of the first service data to a service database;
and setting the state of the first service data to be an unlocked state.
In a possible implementation manner, setting the state of the first service data to a locked state includes:
and if the state of the first service data is an unlocked state, setting the state of the first service data to be a locked state.
In a possible implementation, the method further includes:
if the state of the first service data is a locked state, generating first prompt information, wherein the first prompt information is used for prompting a user that the first service data is being modified by other nodes;
and sending the first prompt message to the terminal equipment.
In a possible implementation, the method further includes:
if the first version identification is different from the second version identification, generating second prompt information, wherein the second prompt information is used for indicating that the content of the first service data of the user is modified by other nodes;
and sending the second prompt message to the terminal equipment.
In a possible implementation manner, after the updating the modified content of the first service data to the service database, the method further includes:
generating a third version identification corresponding to the first service data;
updating the second version identification stored in the cache database to the third version identification.
In a possible implementation manner, after updating the second version identifier stored in the cache database to the third version identifier, the method further includes:
generating a response message corresponding to the modification request according to the type of the modification request, wherein when the type of the modification request is a preset type, the response message comprises the third version identification;
and sending the response message to the terminal equipment.
In a possible implementation manner, before receiving a modification request sent by a terminal device, the method further includes:
receiving an inquiry request sent by the terminal equipment, wherein the inquiry request comprises an identifier of the first service data;
acquiring the current content of the first service data from the service database or the cache database according to the identifier of the first service data;
acquiring a current version identifier of the first service data from the cache database according to the identifier of the first service data;
and sending the current content of the first service data and the current version identification of the first service data to the terminal equipment.
In a possible implementation manner, the deploying of the interception program and the service application program in the first node, and receiving a modification request sent by a terminal device, includes:
intercepting a modification request sent by the terminal equipment through the interception program;
acquiring a second version identifier corresponding to the first service data from a cache database corresponding to the first node according to the identifier of the first service data, including:
acquiring a second version identifier corresponding to the first service data from a cache database corresponding to the first node according to the identifier of the first service data by the interception program;
if the first version identification is determined to be the same as the second version identification, updating the modified content of the first service data to a service database, including:
and if the interception program determines that the first version identification is the same as the second version identification, updating the modified content of the first service data to a service database through the service application program.
In a second aspect, the present application provides a device for processing service data, which is applied to a first node in a cluster service system, where the device includes:
a receiving module, configured to receive a modification request sent by a terminal device, where the modification request includes: the method comprises the steps of identifying first service data to be modified, modifying content of the first service data and a first version identification on which modification of the first service data is based;
an obtaining module, configured to obtain, according to the identifier of the first service data, a second version identifier corresponding to the first service data from a cache database corresponding to the first node, where cache databases corresponding to different nodes in the trunking service system are different;
and the processing module is used for updating the modified content of the first service data to a service database if the first version identification is determined to be the same as the second version identification.
In a possible implementation manner, the processing module is specifically configured to:
setting the state of the first service data to be a locked state;
updating the modified content of the first service data to a service database;
and setting the state of the first service data to be an unlocked state.
In a possible implementation manner, the processing module is specifically configured to: and if the state of the first service data is an unlocked state, setting the state of the first service data to be a locked state.
In a possible implementation manner, the processing module is further configured to: if the state of the first service data is a locked state, generating first prompt information, wherein the first prompt information is used for prompting a user that the first service data is being modified by other nodes;
the device also comprises a sending module used for sending the first prompt message to the terminal equipment.
In a possible implementation manner, the processing module is further configured to: if the first version identification is different from the second version identification, generating second prompt information, wherein the second prompt information is used for indicating that the content of the first service data of the user is modified by other nodes;
the device also comprises a sending module used for sending the second prompt message to the terminal equipment.
In a possible implementation manner, the processing module is further configured to:
generating a third version identification corresponding to the first service data;
updating the second version identification stored in the cache database to the third version identification.
In a possible implementation manner, the processing module is further configured to: generating a response message corresponding to the modification request according to the type of the modification request, wherein when the type of the modification request is a preset type, the response message comprises the third version identification;
the device further comprises: and the sending module is used for sending the response message to the terminal equipment.
In a possible implementation manner, the receiving module is further configured to: receiving an inquiry request sent by the terminal equipment, wherein the inquiry request comprises an identifier of the first service data;
the acquisition module is further configured to: acquiring the current content of the first service data from the service database or the cache database according to the identifier of the first service data; acquiring a current version identifier of the first service data from the cache database according to the identifier of the first service data;
the device further comprises: and the sending module is used for sending the current content of the first service data and the current version identification of the first service data to the terminal equipment.
In a possible implementation manner, an interception program and a service application program are deployed in the first node, and the receiving module is specifically configured to: intercepting a modification request sent by the terminal equipment through the interception program;
the acquisition module is specifically configured to: acquiring a second version identifier corresponding to the first service data from a cache database corresponding to the first node according to the identifier of the first service data by the interception program;
the processing module is specifically configured to: and if the interception program determines that the first version identification is the same as the second version identification, updating the modified content of the first service data to a service database through the service application program.
In a third aspect, the present application provides an electronic device, comprising: a memory for storing a computer program and a processor for executing the computer program to implement the method according to any of the first aspect.
In a fourth aspect, the present application provides a computer-readable storage medium comprising: a computer program implementing the method according to any one of the first aspect when executed by a processor.
In a fifth aspect, the present application provides a computer program product comprising: a computer program implementing the method according to any one of the first aspect when executed by a processor.
The method, the device and the electronic equipment for processing the service data can be applied to a first node in a cluster service system, and the method comprises the following steps: receiving a modification request sent by a terminal device, wherein the modification request comprises: the method comprises the steps of identifying first service data to be modified, modifying content of the first service data and a first version identification on which modification of the first service data is based; acquiring a second version identifier corresponding to the first service data from a cache database corresponding to the first node according to the identifier of the first service data, wherein the cache databases corresponding to different nodes in the cluster service system are different; and if the first version identification is determined to be the same as the second version identification, updating the modified content of the first service data into the service database. In the process, when the latest version identification of the service data needs to be queried, each node can query from the corresponding cache database without querying through the service database, so that the access times of the service database are reduced, and the resource consumption of the service database is reduced. Furthermore, because the cache databases corresponding to different nodes are different, the query pressure of the version identification is dispersed to different cache databases, and the resource consumption of each cache database is reduced. Even if one cache database fails, only the corresponding node is affected, and other nodes are not affected, so that the problem of crash of the whole cluster service system is solved, and the performance of the cluster service system is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
FIG. 1 is a schematic diagram of a cluster service system;
fig. 2 is a schematic diagram of a cluster service system according to an embodiment of the present application;
fig. 3 is a schematic flowchart of a method for processing service data according to an embodiment of the present application;
fig. 4 is a schematic flowchart of another service data processing method according to an embodiment of the present application;
fig. 5 is a schematic diagram of a service data modification scenario provided in an embodiment of the present application;
fig. 6 is a schematic diagram of another service data modification scenario provided in an embodiment of the present application;
fig. 7 is a schematic diagram of another service data modification scenario provided in an embodiment of the present application;
fig. 8 is a schematic flowchart of another service data processing method according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a service data processing apparatus according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of an electronic device 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, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims of the present application and in the above-described drawings (if any) are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
First, technical terms related to the embodiments of the present application will be explained.
An optimistic lock: the optimistic locking mechanism adopts a more loose locking mechanism than the pessimistic lock. Pessimistic locks are most often implemented by means of the locking mechanism of the database to ensure maximum degree of independence of operations. This is accompanied by a significant overhead in database performance, which is often unbearable, especially for long transactions. And optimistic locking mechanisms solve this problem to some extent. Optimistic locks are mostly implemented based on a data Version (Version) recording mechanism. What is the data version? That is, adding a version identification to the data, in a version solution based on a database table, it is generally implemented by adding a "version" field to the database table. When data is read out, the version number is read out together, and when data is updated later, the version number is increased by one. At the moment, the version data of the submitted data is compared with the current version information of the corresponding record of the database table, if the version number of the submitted data is equal to the current version number of the database table, the submitted data is updated, and if not, the submitted data is regarded as overdue data.
Pessimistic locks: with strong exclusivity and exclusivity characteristics. It refers to keeping the data conservative of being modified by the outside world (including other current transactions of the system and transactions from external systems), so that the data is in a locked state in the whole data processing process. Pessimistic lock implementations often rely on the lock mechanism provided by the database (the exclusivity of data access can only be really guaranteed by the lock mechanism provided by the database layer, otherwise, even if the lock mechanism is implemented in the present system, it cannot be guaranteed that the external system will not modify the data).
Self-defined annotation: annotations, which may also be referred to as annotations, are special syntax metadata that the JDK5.0 version begins to support adding source code. Classes, methods, variables, parameters, packets, etc. in the Java language may be labeled. Unlike Java doc, Java annotations can obtain annotation content through reflection. The annotations may be embedded in the bytecode when the compiler generates the class file. The Java virtual machine can keep the annotation content and can obtain the annotation content during running. It of course also supports custom Java annotations.
Cutting into noodles: for a packaged class, it can be cut during compiling or running, the cube is cut, some new codes are added (woven) in the original method, and the original method codes are subjected to an enhancement treatment. And the code of those enhancement parts is called the slice.
Annotation classes: is a special method for tool packaging, can only be called, and the constructor of the tool packaging is packaged.
@ Retention: an annotation for spring defines how long the annotation it annotates is kept.
@ Target: an annotation of spring, the action target of the annotation, may be a class, a method, etc.
Redis: one type of key-value based storage system is a cross-platform non-relational database.
The incr method: atomic auto-increment operations of Redis.
To facilitate understanding of the technical solution of the present application, first, an architecture of a cluster service system is described with reference to fig. 1.
Fig. 1 is a schematic structural diagram of a cluster service system, as shown in fig. 1, the cluster service system includes a plurality of nodes and a service database. The service database is used for storing service data. The terminal device and the cluster service system can be connected in a communication mode. Each node in the cluster service system may provide services to the end devices. The terminal device may include, but is not limited to: smart phones, tablet computers, notebook computers, desktop computers, intelligent wearable devices, intelligent home devices, vehicle-mounted devices, and the like.
In some scenarios, a node in a clustered service system may be referred to as a server or a node server. Different nodes in the cluster service system may correspond to different services, or each node in the cluster service system may also correspond to the same service.
It should be appreciated that the above-described cluster service system may be applied in a variety of service scenarios, such as e-commerce service scenarios, financial service scenarios, social service scenarios, and the like. This embodiment is not limited to this.
In some service scenarios, the service data is service data that is configurable by a user. As shown in fig. 1, a user may access the cluster service system through a terminal device, and perform operations such as query, modification, deletion, and the like on service data.
Illustratively, a user a sends a service data modification request through a terminal device 1, a node 1 in the cluster service system processes the modification request, and the node 1 may modify corresponding service data in a service database according to the modification request. The user B sends a service data modification request through the terminal device 2, the node 2 in the cluster service system processes the modification request, and the node 2 can modify the corresponding service data in the service database according to the modification request. The user C sends a service data modification request through the terminal device 3, the node 3 in the cluster service system processes the modification request, and the node 3 can modify the corresponding service data in the service database according to the modification request.
Optionally, a load balancing node may be further disposed in the cluster service system, and after receiving a service data modification request sent by a user, a target node is selected from the multiple nodes according to a load balancing principle, and the target node processes the service data modification request.
In practical application, the condition that a plurality of nodes modify the same service data often occurs, so that the modification of the service data by different nodes is mutually overlapped, and the data in the service database is inconsistent with the expectation.
In a related technology, a database optimistic lock mode may be used to perform version control on business data. Specifically, a latest version id is maintained for each service data in the service database. Before each node modifies the service data, the current version identification of the service data is obtained by inquiring from the service database, and then the service data is modified. Before the modified content is stored, the current version identification of the service data is inquired from the service database again, and the modified content is stored under the condition that the version identification inquired this time is consistent with the version identification inquired last time. Therefore, the problem that the modified contents are mutually covered due to the fact that different nodes modify the same service data at the same time can be solved.
However, in the process of implementing the present application, the inventor finds that the concurrency of service data modification in a cluster scene is high, and by adopting the database optimistic lock mode, the service database needs to be accessed at least twice to query the version identifier of the service data each time the service data is modified. Therefore, in a high concurrency scene, the access frequency of the service database is high, more service database resources are consumed, and the service performance of the whole cluster system is reduced. Further, when the service database fails due to a large resource consumption, the whole cluster service system may crash and fail to work normally.
In order to solve the technical problem, the present application provides a method and an apparatus for processing service data, and an electronic device. The inventive concept of the present solution is explained below with reference to fig. 2.
Fig. 2 is a schematic diagram of a cluster service system according to an embodiment of the present application. As shown in fig. 2, on the basis of the cluster service system shown in fig. 1, a cache database is set for each node. The cache database is used for storing the latest version identification of the business data. The business database is used for storing the business data without maintaining the latest version identification of the business data.
The cache database may be disposed in the node, or may be disposed in an electronic device independent from the node, which is not limited in this embodiment.
In the technical scheme of the application, when the latest version identification of the service data needs to be inquired, each node can inquire from the corresponding cache database without inquiring through the service database, so that the access times of the service database are reduced, and the resource consumption of the service database is reduced. Furthermore, because the cache databases corresponding to different nodes are different, the query pressure of the version identification is dispersed to different cache databases, and the resource consumption of each cache database is reduced. Even if one cache database fails, only the corresponding node is affected, and other nodes are not affected, so that the problem of crash of the whole cluster service system is solved, and the performance of the cluster service system is improved.
The technical solution of the present application will be described in detail below with specific examples. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments.
Fig. 3 is a schematic flowchart of a method for processing service data according to an embodiment of the present application. The method of this embodiment may be executed by any node in the cluster service system, and for convenience of description, an execution subject of this embodiment is referred to as a first node in the following. As shown in fig. 3, the method of the present embodiment includes:
s301: receiving a modification request sent by a terminal device, wherein the modification request comprises: the service data modification method comprises the following steps of identification of first service data to be modified, modification content of the first service data and first version identification based on which the modification of the first service data is carried out.
In this embodiment, a process of modifying the first service data by the first node is described as an example. The first service data may be any one of service data in a service database.
In the application scenario of this embodiment, when the user determines that the first service data needs to be modified, the user may first send a query request to the first node through the terminal device, so as to obtain the current content of the first service data and the current version identifier of the first service data.
In one example, after receiving the current content of the first service data, the terminal device displays the current content of the first service data in the presentation interface, so that the user can modify the first service data through the presentation interface. After receiving the current version identifier of the first service data, the terminal device may use the current version identifier of the first service data as the first version identifier. That is, the first version id is the version id on which the modification is based.
After the user finishes modifying the first service data, the terminal device sends a modification request to the first node, and the modification request is used for requesting the first node to update the modified content of the first service data to the service database. The terminal equipment carries the following contents in the modification request: the identification of the first service data, the modified content of the first service data and the first version identification based on which the modification of the first service data is based.
S302: and acquiring a second version identifier corresponding to the first service data from a cache database corresponding to the first node according to the identifier of the first service data, wherein the cache databases corresponding to different nodes in the cluster service system are different.
S303: and if the first version identification is determined to be the same as the second version identification, updating the modified content of the first service data into a service database.
In this embodiment, a cache database is set for each node in the cluster service system. And the cache databases corresponding to different nodes are different. The cache database is used for storing the latest version identification of the business data. Optionally, the cache database may be used for storing the business data, in addition to the latest version identifier of the business data.
The version identifier of the service data in this embodiment refers to information for identifying different versions of the service data. The present embodiment does not limit the representation form of the version identifier of the service data, and for example, the representation form may be a character string form, a numerical value form, or a time stamp form.
The latest version identification of the business data is stored in the cache database, so that the business database does not need to be maintained again, when the latest version identification of the business data needs to be inquired, the business database does not need to be accessed, and the business database can be directly inquired from the cache database corresponding to the node, so that the access times of the business database can be effectively reduced, and the resource consumption of the business database is reduced.
In some examples, the services provided by the nodes in the trunking service system may be peer-to-peer, so that after receiving the modification request of the terminal device, the trunking service system may allocate the modification request to a certain node according to the principle of being responsible for balancing. In this scenario, the cache database corresponding to each node may be used to maintain the latest version identifiers of all the service data. And a synchronization mechanism is arranged among different cache databases, and when one cache database updates the version identifier of the first service data, the updated version identifier can be synchronized to other cache databases. Therefore, the accuracy of the acquired version identification can be ensured no matter which node queries the version identification of the first service data subsequently.
In other examples, the services provided by the nodes in the cluster service system may not be peer-to-peer. For example, different nodes are responsible for processing different traffic data. In this way, the cache database corresponding to each node may be used to maintain the latest version identifier of the service data for which the node is responsible.
Alternatively, the cache database may be a Remote Dictionary service (Redis) database. The Redis database is a network-supported, memory-based and persistent log-type database which is stored in a Key-Value pair (Key-Value) form.
When the cache database adopts a Redis database, the latest version identification of each service data can be stored in a Key-Value form. The Key may correspond to an identifier of the service data, and the Value may correspond to an identifier of a latest version of the service data.
In this way, after receiving the modification request, the first node may obtain the latest version identifier of the first service data from the cache database corresponding to the first node according to the identifier of the first service data carried in the modification request. For the purpose of illustration, in this embodiment, after the first node receives the query request, the latest version identifier of the first service data that is queried from the cache database by the first node for the first time is referred to as a first version identifier. And after the first node receives the modification request, the latest version identification of the first service data inquired from the cache database by the first node for the second time is called as a second version identification.
It can be understood that, if no other node modifies the first service data between the first query and the second query of the first node, the first version identifier obtained by the first query is the same as the second version identifier obtained by the second query. If there is other node to modify the first service data between the first query and the second query of the first node, since the other node will update the latest version identifier of the first service data in the cache database after modifying the first service data, the first version identifier obtained by the first query is different from the second version identifier obtained by the second query.
Therefore, in the embodiment of the present application, when it is determined that the first version identifier is the same as the second version identifier, it is indicated that no other node modifies the first service data between the first query and the second query, that is, the modification request is valid for the modification content of the first service data, so that the modification content of the first service data can be updated to the service database. Thus, the modification process of the first service data is completed.
By updating the modified content of the first service data into the service database under the condition that the first version identification and the second version identification are determined to be the same, the problem that the modified content of the first service data is mutually covered by different nodes can be avoided.
The method for processing service data provided by this embodiment is applied to any node in a cluster service system, and includes: receiving a modification request sent by a terminal device, wherein the modification request comprises: the method comprises the steps of identifying first service data to be modified, modifying content of the first service data and a first version identification on which modification of the first service data is based; according to the identification of the first service data, acquiring a second version identification corresponding to the first service data from a cache database corresponding to a node, wherein the cache databases corresponding to different nodes in the cluster service system are different; and if the first version identification is determined to be the same as the second version identification, updating the modified content of the first service data into the service database. In the process, when the latest version identification of the service data needs to be queried, each node can query from the corresponding cache database without querying through the service database, so that the access times of the service database are reduced, and the resource consumption of the service database is reduced. Furthermore, because the cache databases corresponding to different nodes are different, the query pressure of the version identification is dispersed to different cache databases, and the resource consumption of each cache database is reduced. Even if one cache database fails, only the corresponding node is affected, and other nodes are not affected, so that the problem of crash of the whole cluster service system is solved, and the performance of the cluster service system is improved.
On the basis of the above embodiments, the following describes the technical solution of the present application in detail with reference to a more specific embodiment.
Fig. 4 is a schematic flowchart of another service data processing method according to an embodiment of the present application. As shown in fig. 4, the method of the present embodiment includes:
s401: the terminal equipment sends an inquiry request, wherein the inquiry request comprises the identification of the first service data.
For example, when the user determines that the first service data needs to be modified, a query request may be first sent to the first node through the terminal device, so as to obtain the current content of the first service data and the current version identifier of the first service data.
Correspondingly, a first node in the cluster service system receives an inquiry request sent by the terminal device.
S402: and the first node acquires the current content of the first service data from the service database or a cache database corresponding to the first node according to the identifier of the first service data.
In this embodiment, the service database stores service data. The cache database may or may not store the service data. When the service data is stored in the cache database, the current content of the first service data can be preferentially obtained from the cache database. And when the business data is not stored in the cache database, acquiring the current content of the first business data from the business database.
S403: and the first node acquires the current version identification of the first service data from a cache database corresponding to the first node according to the identification of the first service data.
S404: and the first node sends the current content of the first service data and the current version identification of the first service data to the terminal equipment.
In one example, after receiving the current content of the first service data, the terminal device displays the current content of the first service data in the presentation interface, so that the user can modify the first service data through the presentation interface. After receiving the current version identifier of the first service data, the terminal device may use the current version identifier of the first service data as the first version identifier. That is, the first version id is the version id on which the modification is based.
S405: the terminal equipment sends a modification request, wherein the modification request comprises: the identification of the first service data, the modified content of the first service data, and the first version identification on which the modification of the first service data is based.
In this embodiment, after the user completes modification of the first service data, the terminal device sends a modification request to the first node, so as to request the first node to update the modified content of the first service data to the service database. The terminal equipment carries the following contents in the modification request: identification of first service data, modified content of first service data, and first version identification based on which modification of first service data is based
It can be understood that the first version identifier based on which the modification of the first service data is performed is the current version identifier obtained by querying from the cache database in S403.
Accordingly, the first node receives a modification request from the terminal device.
S406: and the first node acquires a second version identifier corresponding to the first service data from a cache database corresponding to the first node according to the identifier of the first service data.
S407: the first node judges whether the first version identification is the same as the second version identification.
It should be understood that specific implementations of S406 and S407 may refer to the embodiment shown in fig. 3, and are not described herein again.
If so, then S408-S415 are executed.
If not, then S416-S417 are performed.
S408: the first node acquires the state of the first service data.
In this embodiment, the state of each service data includes: an unlocked state and a locked state. If the state of one service data is the unlocked state, the service data is not modified by any node currently. If the state of one service data is the locked state, the service data is currently modified by a certain node.
S409: and if the state of the first service data is the unlocked state, the first node sets the state of the first service data to be the locked state.
S410: and the first node updates the modified content of the first service data to the service database.
That is, only when the state of the first service data is the unlocked state, the embodiment updates the modified content of the first service data into the service database, and sets the state of the first service data to the locked state before updating, so that the first service data cannot be modified by other users any more.
S411: the first node sets the state of the first service data to an unlocked state.
After the first service data is updated, the state of the first service data is set to be an unlocked state, so that other subsequent users can modify the first service data.
S412: and the first node generates a third version identification corresponding to the first service data, and updates the second version identification stored in the cache database into the third version identification.
In this embodiment, after the first service data in the service database is updated, the current version identifier of the first service data needs to be updated in the cache database (that is, the second version identifier is updated to the third version identifier), so that the latest version identifier of the first service data is ensured to be stored in the cache database, and a subsequent version control process of the first service data is facilitated.
Optionally, when the cache database adopts a redis database and the version identifier adopts a numerical value form, a redis incr command may be used to update the version identifier of the first service data.
S413: and the first node generates a response message corresponding to the modification request according to the type of the modification request, and when the type of the modification request is a preset type, the response message comprises a third version identifier.
S414: the first node sends a response message to the terminal device.
It should be understood that, in some application scenarios, after the terminal device sends the modification request to the first node, the terminal device wants to obtain the updated version identifier of the first service data. In other application scenarios, after the terminal device sends the modification request to the first node, the terminal device does not need to obtain the updated version identifier of the first service data. The preset type of the present embodiment may refer to the following types: the terminal device wants to obtain the updated version identifier of the first service data. And when the type of the modification request is a preset type, the first node carries the third version identification in a response message sent to the terminal equipment. And when the type of the modification request is not a preset type, the first node does not carry the third version identification in a response message sent to the terminal equipment.
S415: and if the state of the first service data is the locked state, generating first prompt information, wherein the first prompt information is used for prompting a user that the first service data is being modified by other nodes.
S416: the first node sends first prompt information to the terminal equipment.
In this embodiment, when the state of the first service data is the locked state, it indicates that the first service data is being modified by another node. In this case, if the first node also modifies the first service data, the modified content of the other node may be overwritten, or the modified content of the first node may be overwritten by the other node. Therefore, in this embodiment, when the state of the first service data is the locked state, the first service data in the service database is not updated, but first prompt information is sent to the terminal device to prompt the user that the first service data is being modified by another node. Illustratively, the first hint information may be "the current data is being operated, please later".
S417: and the first node generates second prompt information, wherein the second prompt information is used for prompting the user that the content of the first service data is modified by other nodes.
S418: and the first node sends second prompt information to the terminal equipment.
In this embodiment, when the first version id is different from the second version id, it indicates that the first service data has been modified by other nodes during the execution of S403 to S406. In this case, the first node may overwrite the modified content of the other node if the first service data is modified based on the first version id. Therefore, in this embodiment, when the first version identifier is different from the second version identifier, the first service data in the service database is not updated, but second prompt information is sent to the terminal device to prompt the user that the first service data has been modified by other nodes. For example, the second prompt message may be "the current data has been edited, please refresh".
In this embodiment, the locking and unlocking control process of the first service data in S409 and S411 may be implemented by a concurrent locking mechanism of a redis cache database, or may be implemented by a pessimistic locking mechanism of the database, which is not specifically limited in this embodiment.
The following is exemplified in connection with several specific examples.
Fig. 5 is a schematic diagram of a service data modification scenario provided in an embodiment of the present application. As shown in fig. 5, it is assumed that the user a needs to modify the first service data. The user a firstly queries the first service data, and obtains the current content of the first service data and the current version identifier of the first service data, which is assumed to be V1. The user a modifies the queried first service data, and after the modification is completed, the user a sends a modification request to the first node through the terminal device, where the modification request carries the modification content of the first service data and the version identifier (i.e., V1) based on which the modification of the first service data is performed.
After receiving the modification request, the first node first obtains the version identifier of the first service data from the cache database before updating the modified content of the first service data into the service database, and if the version identifier of the first service data in the cache database is still V1, the first node determines that the version identifier of the first service data in the cache database is the same as the version identifier carried in the modification request, and locks the first service data (i.e., determines whether the state of the first service data is an unlocked state, and if the state of the first service data is an unlocked state, the first node updates the state of the first service data to a locked state, and determines that the lock authority of the first service data is successfully obtained). And after the first node successfully locks the first service data, the first node updates the modified content of the first service data into the service database and unlocks the first service data. Further, the first node updates the version identification of the first service data in the cache database to V2. Thus, the user a completes the modification process of the first service data.
Fig. 6 is a schematic diagram of another service data modification scenario provided in the embodiment of the present application. As shown in fig. 6, it is assumed that both user a and user B need to modify the first service data. The user a queries the first service data, and obtains the current content of the first service data and the current version identifier of the first service data, which is assumed to be V1. The user B queries the first service data, and obtains the current content of the first service data and the current version identifier of the first service data, which is assumed to be V1.
And the user A modifies the inquired first service data. And, the user B modifies the queried first service data. Suppose that user a modifies to completion before user B.
After the user a completes the modification, the user a sends a modification request to the first node through the terminal device, where the modification request carries the modification content of the first service data and the version identifier (i.e., V1) based on which the modification of the first service data is performed. After receiving the modification request sent by the user a, the first node completes the update process of the first service data according to the modification request (the specific modification process is similar to that in the first example, and is not described here again).
After the first node completes the update process of the first service data according to the modification request of the user a, assuming that the modification of the first service data by the user B is completed, the user B sends a modification request to the first node through the terminal device, where the modification request carries the modification content of the first service data and the version identifier (i.e., V1) based on which the modification of the first service data is performed. After receiving the modification request sent by the user B, the first node first obtains the version identifier of the first service data from the cache database, which is V2 at this time (since the user a has modified the first service data, the version identifier is updated to V2), and then the first node determines that the version identifier of the first service data in the cache database is different from the version identifier carried in the modification request. In this case, the first node sends a prompt message "the current data is edited and please refresh" to the terminal device, prompting the user B to refresh the first service data, and modifying based on the refreshed first service data, thereby avoiding the coverage of the modified content of the user a by the user B.
Fig. 7 is a schematic diagram of another service data modification scenario provided in an embodiment of the present application. As shown in fig. 7, it is assumed that both user a and user C need to modify the first service data. The user a queries the first service data, and obtains the current content of the first service data and the current version identifier of the first service data, which is assumed to be V1. The user C queries the first service data, and obtains the current content of the first service data and the current version identifier of the first service data, which is assumed to be V1.
And the user A modifies the inquired first service data. And, the user C modifies the queried first service data. Suppose that user a modifies to completion before user C.
After the user a completes the modification, the user a sends a modification request to the first node through the terminal device, where the modification request carries the modification content of the first service data and the version identifier (i.e., V1) based on which the modification of the first service data is performed. After receiving the modification request sent by the user a, the first node completes the update process of the first service data according to the modification request (the specific modification process is similar to that in the first example, and is not described here again).
After the first node locks the first service data and before the first service data in the service database is updated, assuming that the user C completes modifying the first service data, the user C sends a modification request to the second node through the terminal device, where the modification request carries the modified content of the first service data and the version identifier (i.e., V1) based on which the modification of the first service data is performed. After receiving the modification request sent by the user C, the second node first obtains the version identifier of the first service data from the cache database, which is V1 at this time (because the user a has not completed updating the first service data, the version identifier is still V1), and then the second node determines that the version identifier of the first service data in the cache database is the same as the version identifier carried in the modification request. The second node requests to lock the first service data, and the second node fails to lock the first service data because the first service data is locked by the first node at the moment. In this case, the second node sends a prompt message "the current data is being operated and please later" to the terminal device, prompting the user C to refresh the first service data later, and modifying based on the refreshed first service data, thereby avoiding the user C from covering the modified content of the user a.
In this embodiment, only when the first node determines that the first version identifier is the same as the second version identifier and the first service data is not locked by other nodes, the modified content of the first service data is updated to the service database; and under the condition that the first node determines that the first version identification is different from the second version identification or the first service data is locked by other nodes, the first node does not update the modified content of the first service data into the service database, but outputs corresponding prompt information to the terminal equipment. Therefore, the problem that modified contents are mutually covered due to the fact that different nodes operate the first service data simultaneously is avoided, and the accuracy of the first service data is guaranteed. In addition, the user can intuitively know the reason of the failure and the operation required to be performed according to the prompt information, and the user experience is improved.
The foregoing embodiments describe a process for processing service data, where a process for processing service data includes: the updating process of the business data in the business database and the version control process of the business data. In some possible implementation manners of the present application, the two processes may be decoupled, so that the version control process of the service data may be implemented without modifying the code of the service system. Described below in conjunction with fig. 8.
Fig. 8 is a flowchart illustrating a further method for processing service data according to an embodiment of the present application. In this embodiment, each node is deployed with an interception program and a service application program. The business application program is a program for implementing a function of the business system. The interception program is used for realizing the version control function of the service data.
As shown in fig. 8, the method of the present embodiment includes:
s801: intercepting a modification request sent by terminal equipment through an interception program, wherein the modification request comprises: the service data modification method comprises the following steps of identification of first service data to be modified, modification content of the first service data and first version identification based on which the modification of the first service data is carried out.
In this embodiment, the terminal device sends a modification request to the first node, and the first node may receive the modification request through the service application program. When the first node receives the interception request through the business application program, the modification request can be intercepted through the interception program, and the interception program executes the version control process of the first business data.
Optionally, the interception program may be implemented in a custom annotation section programming manner.
Illustratively, the creation of custom annotation classes may be accomplished using the annotations @ Retention and @ Target. The custom annotation class can be used on top of any eligible method. The custom annotation class defines attribute fields such as a cache prefix, an identification of business data, a version field, whether the version is checked or not, whether the version is not prompted, whether locking is performed or not, whether the lock is not prompted or not, whether the version is backfilled or not and the like.
The cache prefix and the service data identifier can be used to indicate the corresponding key value of the service data version identifier in the cache database. Version field default is "version"; whether the version check default is "false"; version not to hint default value "current data has been edited, please refresh"; whether the default value of locking is 'false'; the lock not acquiring indicates that the default value is 'current data is being operated, please later'; whether the backfill version default is "false". The values of the attribute fields can be updated in the section code according to specific service application.
Annotations may be added to interface methods in the business application for receiving modification requests. When the modification request is intercepted by the interceptor, the corresponding section code can be executed according to the annotation.
S802: and acquiring a second version identifier corresponding to the first service data from a cache database corresponding to the first node through an interception program according to the identifier of the first service data.
In this embodiment, an annotation may be added to an interface method for receiving a modification request in a business application. After the modification request is intercepted, the section code corresponding to the annotation can be executed through an interception program, and each attribute field in the custom annotation class is analyzed according to the parameters carried in the modification request. And acquiring the cache prefix and the identifier of the first service data through a reflection mechanism, and splicing the cache prefix and the identifier of the first service data to obtain a key value corresponding to the first service data in a cache database. And further, according to the key value, a second version identification corresponding to the first service data is obtained from the cache database.
S803: and if the first version identification is determined to be the same as the second version identification through the interception program, updating the modified content of the first service data to a service database through a service application program.
Optionally, if it is determined by the interception program that the first version identifier is different from the second version identifier, generating, by the interception program, the second prompt information according to the "not prompt for version" attribute field in the custom annotation class, and sending the second prompt information to the terminal device.
Optionally, under the condition that the first version identifier is determined to be the same as the second version identifier by the interception program, the first service data may also be locked by the interception program, and if the locking fails, the first prompt information is generated by the interception program according to the attribute field that the lock in the custom annotation class cannot acquire the prompt, and the first prompt information is sent to the terminal device.
Optionally, after the modified content of the first service data is updated to the service database by the service application program, a third version identifier of the first service data may be generated by the interception program, and the second version identifier of the first service data stored in the cache database is updated to the third version identifier.
In the embodiment, the interception program is realized by adopting a custom annotation programming mode, and the version control function of the business data is realized by the interception program, so that the version control process of the business data is completely decoupled from the business system, and the version control process of the business data is realized without modifying the code of the business system.
Fig. 9 is a schematic structural diagram of a service data processing apparatus according to an embodiment of the present application. The means may be in the form of software and/or hardware. The apparatus may be deployed in a first node of a cluster service system. As shown in fig. 9, the apparatus 900 for processing service data provided in this embodiment may include: a receiving module 901, an obtaining module 902 and a processing module 903.
The receiving module 901 is configured to receive a modification request sent by a terminal device, where the modification request includes: the method comprises the steps of identifying first service data to be modified, modifying content of the first service data and a first version identification on which modification of the first service data is based;
an obtaining module 902, configured to obtain, according to the identifier of the first service data, a second version identifier corresponding to the first service data from a cache database corresponding to the first node, where cache databases corresponding to different nodes in the trunking service system are different;
a processing module 903, configured to update the modified content of the first service data to a service database if it is determined that the first version identifier is the same as the second version identifier.
In a possible implementation manner, the processing module 903 is specifically configured to:
setting the state of the first service data to be a locked state;
updating the modified content of the first service data to a service database;
and setting the state of the first service data to be an unlocked state.
In a possible implementation manner, the processing module 903 is specifically configured to: and if the state of the first service data is an unlocked state, setting the state of the first service data to be a locked state.
In a possible implementation manner, the processing module 903 is further configured to: if the state of the first service data is a locked state, generating first prompt information, wherein the first prompt information is used for prompting a user that the first service data is being modified by other nodes;
the apparatus further includes a sending module (not shown) configured to send the first prompt message to the terminal device.
In a possible implementation manner, the processing module 903 is further configured to: if the first version identification is different from the second version identification, generating second prompt information, wherein the second prompt information is used for indicating that the content of the first service data of the user is modified by other nodes;
the apparatus further includes a sending module (not shown) configured to send the second prompt message to the terminal device.
In a possible implementation manner, the processing module 903 is further configured to: generating a third version identification corresponding to the first service data; updating the second version identification stored in the cache database to the third version identification.
In a possible implementation manner, the processing module 903 is further configured to: generating a response message corresponding to the modification request according to the type of the modification request, wherein when the type of the modification request is a preset type, the response message comprises the third version identification;
the apparatus further comprises a sending module (not shown) configured to send the response message to the terminal device.
In a possible implementation manner, the receiving module 901 is further configured to: receiving an inquiry request sent by the terminal equipment, wherein the inquiry request comprises an identifier of the first service data;
the obtaining module 902 is further configured to: acquiring the current content of the first service data from the service database or the cache database according to the identifier of the first service data; acquiring a current version identifier of the first service data from the cache database according to the identifier of the first service data;
the apparatus further includes a sending module (not shown) configured to send the current content of the first service data and the current version identifier of the first service data to the terminal device.
In a possible implementation manner, an interception program and a service application program are deployed in the first node, and the receiving module 901 is specifically configured to: intercepting a modification request sent by the terminal equipment through the interception program;
the obtaining module 902 is specifically configured to: acquiring a second version identifier corresponding to the first service data from a cache database corresponding to the first node according to the identifier of the first service data by the interception program;
the processing module 903 is specifically configured to: and if the interception program determines that the first version identification is the same as the second version identification, updating the modified content of the first service data to a service database through the service application program.
The processing apparatus for service data provided in this embodiment may be configured to execute the method for processing service data in any of the above method embodiments, and the implementation principle and the technical effect are similar, which are not described herein again.
Fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application. The electronic device may be any node in a cluster service system. As shown in fig. 10, the electronic device 1000 includes: a processor 1001 and a memory 1002.
The memory 1002 is used for storing computer programs; the processor 1001 is configured to execute a computer program stored in the memory to implement one or more steps in the method for processing the service data in the foregoing embodiments. Specifically, reference may be made to the related descriptions in the foregoing method embodiments, which have similar implementation principles and technical effects, and this embodiment is not described herein again.
Alternatively, the memory 1002 may be separate or integrated with the processor 1001.
When the memory 1002 is a separate device from the processor 1001, the electronic device 1000 may further include: a bus 1003 for connecting the memory 1002 and the processor 1001.
An embodiment of the present application further provides a computer-readable storage medium, where the computer-readable storage medium includes a computer program, and the computer program is used to implement one or more steps in the service data processing method provided in any method embodiment, and implement principles and technical effects similar to each other, and are not described herein again.
An embodiment of the present application further provides a chip, including: the processor runs the computer program to execute one or more steps in the service data processing method provided by any one of the above method embodiments, and the implementation principle and the technical effect are similar, which are not described herein again.
An embodiment of the present application further provides a computer program product, which includes a computer program, and when executed by a processor, the computer program implements one or more steps in the service data processing method provided in any of the foregoing method embodiments, and the implementation principle and the technical effect of the computer program are similar, and details are not described here.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described device embodiments are merely illustrative, and for example, the division of the modules is only one logical division, and other divisions may be realized in practice, for example, a plurality of modules may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or modules, and may be in an electrical, mechanical or other form.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present application may be integrated into one processing unit, or each module may exist alone physically, or two or more modules are integrated into one unit. The unit formed by the modules can be realized in a hardware form, and can also be realized in a form of hardware and a software functional unit.
The integrated module implemented in the form of a software functional module may be stored in a computer-readable storage medium. The software functional module is stored in a storage medium and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to execute some steps of the methods according to the embodiments of the present application.
It should be understood that the Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in the incorporated application may be directly implemented by a hardware processor, or may be implemented by a combination of hardware and software modules in the processor.
The memory may comprise a high-speed RAM memory, and may further comprise a non-volatile storage NVM, such as at least one disk memory, and may also be a usb disk, a removable hard disk, a read-only memory, a magnetic or optical disk, etc.
The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, the buses in the figures of the present application are not limited to only one bus or one type of bus.
The storage medium may be implemented by any type or combination of volatile or non-volatile memory devices, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. Of course, the storage medium may also be integral to the processor. The processor and the storage medium may reside in an Application Specific Integrated Circuits (ASIC). Of course, the processor and the storage medium may reside as discrete components in an electronic device or host device.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

Claims (13)

1. A method for processing service data is applied to a first node in a cluster service system, and the method comprises the following steps:
receiving a modification request sent by a terminal device, wherein the modification request comprises: the method comprises the steps of identifying first service data to be modified, modifying content of the first service data and a first version identification on which modification of the first service data is based;
acquiring a second version identifier corresponding to the first service data from a cache database corresponding to the first node according to the identifier of the first service data; the cache databases corresponding to different nodes in the cluster service system are different;
and if the first version identification is determined to be the same as the second version identification, updating the modified content of the first service data into a service database.
2. The method of claim 1, wherein updating the modified content of the first service data into a service database comprises:
setting the state of the first service data to be a locked state;
updating the modified content of the first service data to a service database;
and setting the state of the first service data to be an unlocked state.
3. The method of claim 2, wherein setting the state of the first traffic data to a locked state comprises:
and if the state of the first service data is an unlocked state, setting the state of the first service data to be a locked state.
4. The method of claim 3, further comprising:
if the state of the first service data is a locked state, generating first prompt information, wherein the first prompt information is used for prompting a user that the first service data is being modified by other nodes;
and sending the first prompt message to the terminal equipment.
5. The method of claim 1, further comprising:
if the first version identification is different from the second version identification, generating second prompt information, wherein the second prompt information is used for indicating that the content of the first service data of the user is modified by other nodes;
and sending the second prompt message to the terminal equipment.
6. The method according to any one of claims 1 to 5, wherein after updating the modified content of the first service data into a service database, further comprising:
generating a third version identification corresponding to the first service data;
updating the second version identification stored in the cache database to the third version identification.
7. The method of claim 6, wherein after updating the second version identifier stored in the cache database to the third version identifier, further comprising:
generating a response message corresponding to the modification request according to the type of the modification request, wherein when the type of the modification request is a preset type, the response message comprises the third version identification;
and sending the response message to the terminal equipment.
8. The method according to any one of claims 1 to 5, wherein before receiving the modification request sent by the terminal device, the method further comprises:
receiving an inquiry request sent by the terminal equipment, wherein the inquiry request comprises an identifier of the first service data;
acquiring the current content of the first service data from the service database or the cache database according to the identifier of the first service data;
acquiring a current version identifier of the first service data from the cache database according to the identifier of the first service data;
and sending the current content of the first service data and the current version identification of the first service data to the terminal equipment.
9. The method according to any one of claims 1 to 5, wherein an interception program and a service application program are deployed in the first node, and the receiving of the modification request sent by the terminal device includes:
intercepting a modification request sent by the terminal equipment through the interception program;
acquiring a second version identifier corresponding to the first service data from a cache database corresponding to the first node according to the identifier of the first service data, including:
acquiring a second version identifier corresponding to the first service data from a cache database corresponding to the first node according to the identifier of the first service data by the interception program;
if the first version identification is determined to be the same as the second version identification, updating the modified content of the first service data to a service database, including:
and if the interception program determines that the first version identification is the same as the second version identification, updating the modified content of the first service data to a service database through the service application program.
10. A device for processing service data, which is applied to a first node in a cluster service system, the device comprising:
a receiving module, configured to receive a modification request sent by a terminal device, where the modification request includes: the method comprises the steps of identifying first service data to be modified, modifying content of the first service data and a first version identification on which modification of the first service data is based;
an obtaining module, configured to obtain, according to the identifier of the first service data, a second version identifier corresponding to the first service data from a cache database corresponding to the first node, where cache databases corresponding to different nodes in the trunking service system are different;
and the processing module is used for updating the modified content of the first service data to a service database if the first version identification is determined to be the same as the second version identification.
11. An electronic device, comprising: a memory for storing a computer program and a processor for executing the computer program to implement the method of any one of claims 1 to 9.
12. A computer-readable storage medium, comprising: computer program which, when executed by a processor, implements the method of any one of claims 1 to 9.
13. A computer program product, comprising: computer program which, when executed by a processor, implements the method of any one of claims 1 to 9.
CN202110645867.2A 2021-06-09 2021-06-09 Service data processing method and device and electronic equipment Active CN113220669B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110645867.2A CN113220669B (en) 2021-06-09 2021-06-09 Service data processing method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110645867.2A CN113220669B (en) 2021-06-09 2021-06-09 Service data processing method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN113220669A true CN113220669A (en) 2021-08-06
CN113220669B CN113220669B (en) 2024-04-16

Family

ID=77083522

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110645867.2A Active CN113220669B (en) 2021-06-09 2021-06-09 Service data processing method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN113220669B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113778975A (en) * 2021-09-15 2021-12-10 京东科技信息技术有限公司 Data processing method and device based on distributed database
CN114253944A (en) * 2021-12-16 2022-03-29 深圳壹账通科技服务有限公司 Database bidirectional synchronization method and device and electronic equipment
CN114567677A (en) * 2022-04-26 2022-05-31 北京时代亿信科技股份有限公司 Data processing method and device and nonvolatile storage medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140324785A1 (en) * 2013-04-30 2014-10-30 Amazon Technologies, Inc. Efficient read replicas
US9684686B1 (en) * 2013-09-04 2017-06-20 Amazon Technologies, Inc. Database system recovery using non-volatile system memory
US20180322156A1 (en) * 2017-05-08 2018-11-08 Sap Se Atomic processing of compound database transactions that modify a metadata entity
CN108829413A (en) * 2018-05-07 2018-11-16 北京达佳互联信息技术有限公司 Data-updating method, device and computer readable storage medium, server
CN109885786A (en) * 2019-01-23 2019-06-14 聚好看科技股份有限公司 Data buffer storage processing method, device, electronic equipment and readable storage medium storing program for executing
WO2020083189A1 (en) * 2018-10-24 2020-04-30 北京金山云网络技术有限公司 Request processing method and device, api gateway, and readable storage medium
CN112445783A (en) * 2020-12-16 2021-03-05 中国联合网络通信集团有限公司 Method, device and server for updating database
US10983981B1 (en) * 2014-12-03 2021-04-20 Amazon Technologies, Inc. Acid transaction for distributed, versioned key-value databases
CN112765182A (en) * 2021-01-28 2021-05-07 江苏视博云信息技术有限公司 Data synchronization method and device among cloud server clusters

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140324785A1 (en) * 2013-04-30 2014-10-30 Amazon Technologies, Inc. Efficient read replicas
US9684686B1 (en) * 2013-09-04 2017-06-20 Amazon Technologies, Inc. Database system recovery using non-volatile system memory
US10983981B1 (en) * 2014-12-03 2021-04-20 Amazon Technologies, Inc. Acid transaction for distributed, versioned key-value databases
US20180322156A1 (en) * 2017-05-08 2018-11-08 Sap Se Atomic processing of compound database transactions that modify a metadata entity
CN108829413A (en) * 2018-05-07 2018-11-16 北京达佳互联信息技术有限公司 Data-updating method, device and computer readable storage medium, server
WO2020083189A1 (en) * 2018-10-24 2020-04-30 北京金山云网络技术有限公司 Request processing method and device, api gateway, and readable storage medium
CN109885786A (en) * 2019-01-23 2019-06-14 聚好看科技股份有限公司 Data buffer storage processing method, device, electronic equipment and readable storage medium storing program for executing
CN112445783A (en) * 2020-12-16 2021-03-05 中国联合网络通信集团有限公司 Method, device and server for updating database
CN112765182A (en) * 2021-01-28 2021-05-07 江苏视博云信息技术有限公司 Data synchronization method and device among cloud server clusters

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113778975A (en) * 2021-09-15 2021-12-10 京东科技信息技术有限公司 Data processing method and device based on distributed database
CN113778975B (en) * 2021-09-15 2023-11-03 京东科技信息技术有限公司 Data processing method and device based on distributed database
CN114253944A (en) * 2021-12-16 2022-03-29 深圳壹账通科技服务有限公司 Database bidirectional synchronization method and device and electronic equipment
CN114253944B (en) * 2021-12-16 2022-10-04 深圳壹账通科技服务有限公司 Database bidirectional synchronization method and device and electronic equipment
CN114567677A (en) * 2022-04-26 2022-05-31 北京时代亿信科技股份有限公司 Data processing method and device and nonvolatile storage medium
CN114567677B (en) * 2022-04-26 2022-07-29 北京时代亿信科技股份有限公司 Data processing method and device and nonvolatile storage medium

Also Published As

Publication number Publication date
CN113220669B (en) 2024-04-16

Similar Documents

Publication Publication Date Title
CN107273455B (en) Block chain data access method and device
CN113220669B (en) Service data processing method and device and electronic equipment
US9251163B2 (en) File sharing system and file sharing method
US9904701B2 (en) Method and apparatus for concurrent access of mixed services
US20160246836A1 (en) Relaxing transaction serializability with statement-based data replication
US11392567B2 (en) Just-in-time multi-indexed tables in a shared log
CN103514298A (en) Method for achieving file lock and metadata server
US11899648B2 (en) Concurrency control for transactions in database systems
US11307922B2 (en) Application crash analysis techniques when memory dump and debug symbols are not co-located
US20230342353A1 (en) Targeted sweep method for key-value data storage
US11018860B2 (en) Highly available and reliable secret distribution infrastructure
CN104423982A (en) Request processing method and device
KR20220083838A (en) Method and apparatus for creating a mirror image file, and a computer-readable storage medium
CN114995948A (en) Method, device, equipment and system for downloading secure container mirror image file
US20200012456A1 (en) Stale block resynchronization in nvm based systems
CN107391539B (en) Transaction processing method, server and storage medium
US10489374B2 (en) In-place updates with concurrent reads in a decomposed state
JP6418419B2 (en) Method and apparatus for hard disk to execute application code
US20230188327A1 (en) Handling pre-existing containers under group-level encryption
US10872073B1 (en) Lock-free updates to a data retention index
CN112612530A (en) Class query method and device
CN115269207B (en) Method and system for allocating resources to vCPE network element
US11709808B1 (en) Schema evolution for the serialization of non-primary key columnar data into row-organized byte sequences
US20240126746A1 (en) Multi-lob caching and lob writing
US11704305B1 (en) Optimizations for long-lived statements in a database 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
GR01 Patent grant
GR01 Patent grant