CN113220669B - 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
CN113220669B
CN113220669B CN202110645867.2A CN202110645867A CN113220669B CN 113220669 B CN113220669 B CN 113220669B CN 202110645867 A CN202110645867 A CN 202110645867A CN 113220669 B CN113220669 B CN 113220669B
Authority
CN
China
Prior art keywords
service data
service
version
database
version identifier
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.)
Active
Application number
CN202110645867.2A
Other languages
Chinese (zh)
Other versions
CN113220669A (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

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 service data processing method, a device and electronic equipment, which can be applied to a first node in a cluster service system, wherein the method comprises the following steps: receiving a modification request sent by a terminal device, wherein the modification request comprises: the identification of the first service data to be modified, the modification content of the first service data, and the first version identification based on the modification of the first service data; according to the identification of the first service data, a second version identification corresponding to the first service data is obtained from a cache database corresponding to the first node, and the cache databases corresponding to different nodes in the cluster service system are different; and if the first version identifier is determined to be the same as the second version identifier, updating the modified content of the first service data into the service database. The method and the device can reduce the access times to 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 invention 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 cluster-based business systems, business data is stored in a business database. Each node in the cluster can access the service database and perform operations such as inquiring, modifying, deleting and the like on the service data. In practical applications, the situation that multiple nodes modify the same service data often occurs, so that the modifications of different nodes to the service data are mutually covered.
In the related art, the version control of the service data can be performed in a database optimistic lock mode. Specifically, a latest version identifier 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 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 queried again from the service database, and the modified content is stored only when the version identification queried at this time is consistent with the version identification queried last time.
However, the inventor finds that in the process of implementing the application, the concurrency of service data modification in the cluster scene is higher, and the adoption of the database optimistic lock mode can cause higher access frequency of the service database and consume more 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 service data processing method, a device 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 trunking service system, where the method includes:
receiving a modification request sent by a terminal device, wherein the modification request comprises: an identification of first service data to be modified, a modification content of the first service data, and a first version identification on which the modification of the first service data is based;
according to the identification of the first service data, a second version identification corresponding to the first service data is obtained from a cache database corresponding to the first node, and the cache databases corresponding to different nodes in the cluster service system are different;
and if the first version identifier is determined to be the same as the second version identifier, 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 into a service database includes:
setting the state of the first service data to a locked state;
Updating the modified content of the first service data into 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 manner, 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 information to the terminal equipment.
In a possible implementation manner, the method further includes:
if the first version identifier is different from the second version identifier, 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 information to the terminal equipment.
In a possible implementation manner, after updating the modified content of the first service data into a service database, the method further includes:
Generating a third version identifier corresponding to the first service data;
updating the second version identifier stored in the cache database to the third version identifier.
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 the response message comprises the third version identifier when the type of the modification request is a preset type;
and sending the response message to the terminal equipment.
In a possible implementation manner, before receiving the modification request sent by the terminal device, the method further includes:
receiving a query request sent by the terminal equipment, wherein the query 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 identification 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 first node is deployed with an interception program and a service application program, and receives a modification request sent by a terminal device, where the modification request includes:
intercepting a modification request sent by the terminal equipment through the interception program;
according to the identification of the first service data, a second version identification corresponding to the first service data is obtained from a cache database corresponding to the first node, and the method comprises the following steps:
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 through the interception program;
if the first version identifier is the same as the second version identifier, updating the modified content of the first service data into a service database, including:
and if the interception program determines that the first version identifier is the same as the second version identifier, updating the modified content of the first service data into a service database through the service application program.
In a second aspect, the present application provides a processing apparatus for service data, applied to a first node in a trunking service system, where the apparatus includes:
The receiving module is used for receiving a modification request sent by the terminal equipment, and the modification request comprises: an identification of first service data to be modified, a modification content of the first service data, and a first version identification on which the modification of the first service data is based;
the acquisition module is used for 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 the processing module is used for updating the modified content of the first service data into a service database if the first version identifier is determined to be the same as the second version identifier.
In a possible implementation manner, the processing module is specifically configured to:
setting the state of the first service data to a locked state;
updating the modified content of the first service data into 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, which is used for sending the first prompt information to the terminal equipment.
In a possible implementation manner, the processing module is further configured to: if the first version identifier is different from the second version identifier, 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, which is used for sending the second prompt information to the terminal equipment.
In a possible implementation manner, the processing module is further configured to:
generating a third version identifier corresponding to the first service data;
updating the second version identifier stored in the cache database to the third version identifier.
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 the response message comprises the third version identifier when the type of the modification request is a preset type;
The apparatus 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 a query request sent by the terminal equipment, wherein the query 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 identification 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 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, the first node is deployed with an interception program and a service application program, 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 through the interception program;
The processing module is specifically configured to: and if the interception program determines that the first version identifier is the same as the second version identifier, updating the modified content of the first service data into 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 one of the first aspects.
In a fourth aspect, the present application provides a computer-readable storage medium comprising: a computer program which, when executed by a processor, implements the method according to any of the first aspects.
In a fifth aspect, the present application provides a computer program product comprising: a computer program which, when executed by a processor, implements the method according to any of the first aspects.
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 identification of the first service data to be modified, the modification content of the first service data, and the first version identification based on the modification of the first service data; according to the identification of the first service data, a second version identification corresponding to the first service data is obtained from a cache database corresponding to the first node, and the cache databases corresponding to different nodes in the cluster service system are different; and if the first version identifier is determined to be the same as the second version identifier, updating the modified content of the first service data into the service database. In the process, each node can inquire from the corresponding cache database when the latest version identification of the service data is required to be inquired, and the service database is not required to be inquired, so that the access times to the service database are reduced, and the resource consumption of the service database is reduced. Furthermore, the query pressure of the version identification is dispersed to different cache databases due to the fact that the cache databases corresponding to different nodes are different, and resource consumption of each cache database is reduced. Even if one of the cache databases fails, only the corresponding node is affected, and other nodes are not affected, so that the problem of breakdown of the whole cluster service system is avoided, 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 that are required in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive faculty for a person skilled in the art.
FIG. 1 is a schematic diagram of a cluster service system architecture;
fig. 2 is a schematic diagram of a trunking service system according to an embodiment of the present application;
fig. 3 is a flow chart of a method for processing service data according to an embodiment of the present application;
fig. 4 is a flow chart of another method for processing service data 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 still another service data modification scenario provided in an embodiment of the present application;
fig. 8 is a flow chart of another method for processing service data according to an embodiment of the present application;
Fig. 9 is a schematic structural diagram of a processing device for service data 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 following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
The terms "first," "second," "third," "fourth" and the like in the description and in the claims of this application and in the above-described figures, if any, are used for distinguishing between similar objects 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.
Technical terms involved in the embodiments of the present application will be explained first.
Optimistic lock: the optimistic locking mechanism takes a more relaxed locking mechanism than the pessimistic lock. Pessimistic locks are mostly implemented by means of a database lock mechanism to guarantee the maximum degree of exclusivity of operations. But with the consequent substantial overhead in database performance, which is often not tolerated, especially for long transactions. While the optimistic lock mechanism solves this problem to some extent. Optimistic locks are mostly implemented based on a Version of data (Version) recording mechanism. What is a version of the data? That is, adding a version identifier to the data is typically accomplished by adding a "version" field to the database table in a version solution based on the database table. When the data is read out, the version number is read out together, and then when the data is updated, the version number is added by one. At this time, comparing the version data of the submitted data with the current version information recorded corresponding to the database table, if the version number of the submitted data is equal to the current version number of the database table, updating, otherwise, considering the data as the outdated data.
Pessimistic locks: has strong exclusive and exclusive properties. It refers to the conservation of data modification by the outside world (including other transactions of the present system, and transactions from external systems), thus placing the data in a locked state throughout the data processing. Pessimistic lock implementation often depends on a lock mechanism provided by a database (only the lock mechanism provided by a database layer can really guarantee the exclusivity of data access, otherwise, even if a locking mechanism is implemented in the system, an external system cannot be guaranteed not to modify data).
Custom notes: annotations, which may also be referred to as labels, are special syntax metadata that JDK version 5.0 begins to support joining source code. Classes, methods, variables, parameters, packages, etc. in the Java language can be annotated. Unlike Java doc, java labels can obtain label content through reflection. When the compiler generates a class file, the callout may be embedded in the bytecode. The Java virtual machine can reserve the labeling content, and can acquire the labeling content during operation. It also supports custom Java markup, of course.
Cutting: for a packaged class, the class can be cut during compiling or running, the cube is cut, new codes are added (woven) into the original method, and the original method codes are subjected to one-time enhancement treatment. And those codes of the enhancement portions are called slices.
Annotation class: is a special way of tool encapsulation, only callable, its constructors are encapsulated.
@ Retention: an annotation of spring defines how long an annotation annotated by it remains.
@ Target: an annotation of spring, the acting target of the annotation can be a class, a method and the like.
Redis: a key-value pair based storage system is a cross-platform non-relational database.
The incr method: atomic self-increment operation of Redis.
For the convenience of understanding the technical solution of the present application, the architecture of the trunking service system is first described with reference to fig. 1.
Fig. 1 is a schematic architecture diagram of a trunking service system, which includes a plurality of nodes and a service database as shown in fig. 1. The service database is used for storing service data. The terminal device and the cluster service system can be in communication connection. Each node in the cluster service system may provide services to the terminal devices. The terminal device may include, but is not limited to: smart phones, tablet computers, notebook computers, desktop computers, smart wearable devices, smart home devices, vehicle-mounted devices, and the like.
In some scenarios, a node in a clustered business system may be referred to as a server or 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 clustered business system described above may be applied in a variety of business scenarios, such as, for example, a business scenario, a financial business scenario, a social business scenario, and the like. This embodiment is not limited thereto.
In some business scenarios, the business data is business data that is configurable by the user. As shown in fig. 1, a user may access the trunking service system through a terminal device, and perform operations such as querying, modifying, deleting, etc. on service data.
For example, the user a sends a service data modification request through the terminal device 1, the node 1 in the cluster service system processes the modification request, and the node 1 can modify the corresponding service data in the service database according to the modification request. The user B sends a service data modification request through the terminal equipment 2, the node 2 in the cluster service system processes the modification request, and the node 2 can modify 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, the cluster service system may further be provided with a load balancing node, and after receiving a service data modification request sent by a user, a target node is selected from 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 modifications of different nodes to the service data are mutually covered, and the data in the service database are inconsistent with expectations.
In one related technique, the version control of the business data may be performed in a database optimistic lock manner. Specifically, an up-to-date version identification is maintained for each business datum in the business database. Before each node modifies the service data, the current version identification of the service data is obtained by inquiring 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 queried again from the service database, and the modified content is stored only when the version identification queried at this time is consistent with the version identification queried last time. Thus, the problem that the modification contents are mutually covered caused by the fact that different nodes modify the same service data at the same time can be avoided.
However, the inventor finds that the concurrency of the service data modification in the cluster scene is high, and the version identification of the service data needs to be queried by accessing the service database at least twice each time the service data is modified by adopting the database optimistic lock mode. In this way, 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 further reduced. Furthermore, when the service database fails due to more resource consumption, the whole cluster service system is crashed and cannot work normally.
In order to solve the technical problems, the application provides a service data processing method, a device and electronic equipment. The inventive concept of the technical scheme of the present application will be described with reference to fig. 2.
Fig. 2 is a schematic diagram of a trunking service system according to an embodiment of the present application. As shown in fig. 2, a cache database is set for each node on the basis of the cluster service system shown in fig. 1. The cache database is used for storing the latest version identification of the service data. The service database is used for storing service data without maintaining the latest version identification of the service data.
The cache database may be disposed in a node, or may be disposed in an electronic device independent of the node, which is not limited in this embodiment.
In the technical scheme, each node can inquire from the corresponding cache database when the latest version identification of the service data is required to be inquired, and the service database is not required to be inquired, so that the access times to the service database are reduced, and the resource consumption of the service database is reduced. Furthermore, the query pressure of the version identification is dispersed to different cache databases due to the fact that the cache databases corresponding to different nodes are different, and resource consumption of each cache database is reduced. Even if one of the cache databases fails, only the corresponding node is affected, and other nodes are not affected, so that the problem of breakdown of the whole cluster service system is avoided, and the performance of the cluster service system is improved.
The technical scheme of the present application is described in detail below with specific examples. The following embodiments may be combined with each other, and some embodiments may not be repeated for the same or similar concepts or processes.
Fig. 3 is a flow chart 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 trunking service system, and for convenience of description, the execution body of this embodiment will be referred to as a first node hereinafter. 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: an identification of first service data to be modified, a modification content of the first service data, and a first version identification on which the modification of the first service data is based.
In this embodiment, a modification procedure of the first service data by the first node is described as an example. The first service data may be any one of the service data in the service database.
In the application scenario of this embodiment, when the user determines that the first service data needs to be modified, a query request may be sent to the first node through the terminal device 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 modifies 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. I.e. the first version identification is the version identification on which the current 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 modification content of the first service data into the service database. The terminal device carries the following contents in the modification request: the identification of the first service data, the modified content of the first service data, the first version identification 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 identifier is determined to be the same as the second version identifier, 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 trunking service system. The cache databases corresponding to different nodes are different. The cache database is used for storing the latest version identification of the service data. Optionally, the cache database may be used to store the service data in addition to the latest version identification of the service data.
The version identification of the service data in this embodiment refers to information for identifying different versions of the service data. The present embodiment is not limited to the form of the version identifier of the service data, and may be, for example, a character string form, a numerical value form, or a time stamp form.
By adopting the cache database to store the latest version identification of the service data, the service database does not need to maintain the latest version identification of the service data, and when the latest version identification of the service data needs to be inquired, the service database does not need to be accessed, but can be directly inquired from the cache database corresponding to the node, so that the access times of the service database can be effectively reduced, and the resource consumption of the service database can be reduced.
In some examples, the services provided by the nodes in the trunking service system may be peer-to-peer, so that after the trunking service system receives the modification request of the terminal device, the modification request may be distributed to a certain node according to the principle of responsible balancing. In this scenario, the cache database corresponding to each node may be used to maintain the latest version identifiers of all service data. And a synchronization mechanism is arranged among different cache databases, and when one cache database updates the version identification of the first service data, the updated version identification can be synchronized to other cache databases. Thus, the accuracy of the obtained version identification can be ensured no matter which node is used for inquiring the version identification of the first service data in the follow-up process.
In other examples, the services provided by the nodes in the clustered business system may be unequal. For example, different nodes are responsible for processing different traffic data. In this way, the cache database corresponding to each node can be used for maintaining the latest version identification of the service data responsible for the node.
Alternatively, the cache database may be a remote dictionary service (Remote Dictionary Server, redis) database. The Redis database is a network-supported database which can be based on a memory or can be persistent log and is stored in a Key-Value pair (Key-Value) mode.
When the cache database adopts the 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 the latest version of the service data.
Thus, after receiving the modification request, the first node can 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 illustration, in this embodiment, after the first node receives the query request, the latest version identifier of the first service data queried by the first node from the cache database for the first time is referred to as a first version identifier. After the first node receives the modification request, the latest version identifier of the first service data queried from the cache database for the second time by the first node is called a second version identifier.
It can be appreciated that if no other node is present to modify the first service data between the first query and the second query of the first node, the first version identifier of the first query is the same as the second version identifier of the second query. If there is another node modifying the first service data between the first query and the second query of the first node, since the latest version identifier of the first service data is updated in the cache database after the other node modifies the first service data, the first version identifier queried for the first time is different from the second version identifier queried for the second time.
Therefore, in the embodiment of the present application, when the first version identifier is determined to be the same as the second version identifier, it is indicated that no other node exists between the first query and the second query to modify the first service data, that is, the modification content of the first service data is valid by the current modification request, so that the modification content of the first service data may 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 to the service database under the condition that the first version identifier and the second version identifier are identical, the problem that different nodes mutually cover the modified content of the first service data can be avoided.
The processing method of service data provided in this embodiment is applied to any 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 identification of the first service data to be modified, the modification content of the first service data, and the first version identification based on the modification of the first service data; according to the identification of the first service data, a second version identification corresponding to the first service data is obtained from a cache database corresponding to the node, and the cache databases corresponding to different nodes in the cluster service system are different; and if the first version identifier is determined to be the same as the second version identifier, updating the modified content of the first service data into the service database. In the process, each node can inquire from the corresponding cache database when the latest version identification of the service data is required to be inquired, and the service database is not required to be inquired, so that the access times to the service database are reduced, and the resource consumption of the service database is reduced. Furthermore, the query pressure of the version identification is dispersed to different cache databases due to the fact that the cache databases corresponding to different nodes are different, and resource consumption of each cache database is reduced. Even if one of the cache databases fails, only the corresponding node is affected, and other nodes are not affected, so that the problem of breakdown of the whole cluster service system is avoided, and the performance of the cluster service system is improved.
Based on the foregoing embodiment, the following describes the technical solution of the present application in detail in connection with a more specific embodiment.
Fig. 4 is a flow chart of another method for processing service data according to an embodiment of the present application. As shown in fig. 4, the method of the present embodiment includes:
s401: the terminal device sends a query request, wherein the query request comprises an identifier 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 sent to the first node through the terminal device 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 a query request sent by the terminal equipment.
S402: the first node obtains the current content of the first service data from the service database or the cache database corresponding to the first node according to the identification 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 acquired from the cache database. And when the service data is not stored in the cache database, acquiring the current content of the first service data from the service database.
S403: and the first node acquires the current version identification of the first service data from the cache database corresponding to the first node according to the identification of the first service data.
S404: 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 device.
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 modifies 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. I.e. the first version identification is the version identification on which the current 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 modifies the first service data, the terminal device sends a modification request to the first node, where the modification request is used to request the first node to update the modification content of the first service data into the service database. The terminal device carries the following contents in the modification request: identification of the first service data, modified content of the first service data, first version identification on which the modification of the first service data is based
It can be understood that the first version identifier based on which the modification to the first service data is based 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 determines whether the first version identification is the same as the second version identification.
It should be understood that the specific implementation of S406 and S407 may refer to the embodiment shown in fig. 3, which is not described herein.
If the same, S408 to S415 are performed.
If not, S416 to S417 are performed.
S408: the first node obtains a state of the first service data.
In this embodiment, the status of each service data includes: an unlocked state and a locked state. If the state of one service data is an unlocked state, it is indicated that the service data is not currently modified by any node. If the state of a service data is a locked state, it is indicated that the service data is currently being modified by a node.
S409: if the state of the first service data is an unlocked state, the first node sets the state of the first service data to a locked state.
S410: the first node updates the modified content of the first service data into the service database.
That is, only when the state of the first service data is in the unlocked state, the present embodiment updates the modified content of the first service data to 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.
S411: the first node sets the state of the first traffic 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: the first node generates a third version identifier corresponding to the first service data, and updates the second version identifier stored in the cache database to the third version identifier.
In this embodiment, after updating the first service data in the service database, the current version identifier of the first service data needs to be updated in the cache database (i.e., the second version identifier is updated to the third version identifier), so that the latest version identifier of the first service data is stored in the cache database, so that the subsequent version control process of the first service data is facilitated.
Alternatively, when the cache database adopts a redis database and the version identifier adopts a numerical form, the redis incr command may be used to update the version identifier of the first service data.
S413: 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 a 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 wishes to obtain the version identifier after the first service data is updated. And when the type of the modification request is a preset type, the first node carries a third version identifier in a response message sent to the terminal equipment. And when the type of the modification request is not the preset type, the first node does not carry the third version identification in the 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 is indicated that the first service data is being modified by other nodes. In this case, if the first node also modifies the first service data, the modified content of the other node may be covered, or the modified content of the first node may be covered 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 the first prompting information is sent to the terminal device to prompt the user that the first service data is being modified by other nodes. For example, the first hint information may be "current data is being manipulated, please be later.
S417: the first node generates second prompt information, and the second prompt information is used for prompting the user that the content of the first service data is modified by other nodes.
S418: the first node sends second prompt information to the terminal equipment.
In this embodiment, when the first version identifier is different from the second version identifier, it is described 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 override the modified content of the other nodes if the first service data is still modified based on the first version identification. 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 the second prompting information is sent to the terminal device, so as to prompt the user that the first service data has been modified by other nodes. For example, the second hint information may be "current data has been edited, please refresh".
In this embodiment, the controlling process of locking and unlocking the first service data in S409 and S411 may be implemented by using a concurrent locking mechanism of the redis cache database, or may be implemented by using a pessimistic locking mechanism of the database, which is not limited in this embodiment.
The following is illustrative 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 inquires the first service data to acquire the current content of the first service data and the current version identification of the first service data, and the current version identification is assumed to be V1. And after the modification is completed, the user A sends a modification request to the first node through the terminal equipment, wherein the modification request carries modification content of the first service data and a version identifier (namely V1) based on the modification of the first service data.
After receiving the modification request, the first node acquires the version identifier of the first service data from the cache database before updating the modification content of the first service data into the service database, and if V1 is still assumed, 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, if so, the first node updates the state of the first service data to a locked state, and determines that the locking authority of the first service data is successfully acquired). After the first node locks the first service data successfully, 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 to acquire 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 to acquire 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, the user B modifies the queried first service data. Suppose user a modifies completion before user B.
After the modification of the user a is completed, the user a sends a modification request to the first node through the terminal device, wherein the modification request carries the modification content of the first service data and the version identifier (i.e. V1) based on the modification of the first service data. After receiving the modification request sent by the user a, the first node completes the update procedure of the first service data according to the modification request (the specific modification procedure is similar to the first example, and will not be described here again).
After the first node completes the updating process of the first service data according to the modification request of the user a, it is assumed that the modification of the first service data by the user B is completed, and the user B sends a modification request to the first node through the terminal device, where the modification request carries modification content of the first service data and a version identifier (i.e. V1) on which the modification of the first service data is based. After receiving the modification request sent by the user B, the first node obtains the version identifier of the first service data from the cache database, and when the version identifier is V2 (because the user a has modified the first service data, the version identifier is updated to V2), 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 the user B is prompted to refresh the first service data" to the terminal device, and modifies the first service data based on the refreshed first service data, so as to avoid the coverage of the modification content of the user B to the user a.
Example three, fig. 7 is a schematic diagram of yet another service data modification scenario provided in an embodiment of the present application. As shown in fig. 7, it is assumed that both the user a and the user C need to modify the first service data. The user A queries the first service data to acquire 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.
The user A modifies the queried first service data. And, the user C modifies the queried first service data. Suppose user a is finished modifying earlier than user C.
After the modification of the user a is completed, the user a sends a modification request to the first node through the terminal device, wherein the modification request carries the modification content of the first service data and the version identifier (i.e. V1) based on the modification of the first service data. After receiving the modification request sent by the user a, the first node completes the update procedure of the first service data according to the modification request (the specific modification procedure is similar to the first example, and will not be 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 modification of the first service data by the user C is completed, the user C sends a modification request to the second node through the terminal device, where the modification request carries modification content of the first service data and a version identifier (i.e. V1) on which the modification of the first service data is based. After receiving the modification request sent by the user C, the second node obtains the version identifier of the first service data from the cache database, where V1 is the version identifier (the version identifier is still V1 because the user a has not completed updating the first service data yet), and 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 locking of the first traffic data, and the second node fails to lock the first traffic data because the first traffic data is already locked by the first node at this time. In this case, the second node sends a prompt message "the current data is being operated, please be later" to the terminal device, prompts the user C to refresh the first service data later, and modifies 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 if 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 into the service database; and under the condition that the first node determines that the first version identifier is different from the second version identifier 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, and outputs corresponding prompt information to the terminal equipment. Thus, the problem that the 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 acquire the reason of the failure and the operation required to be performed according to the prompt information, so that the user experience is improved.
The above embodiments describe a process for processing service data, where a process for processing service data includes: an update process for the business data in the business database, and a version control process for the business data. In some possible implementations of the present application, the above two processes may also 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 connection with fig. 8.
Fig. 8 is a flow chart of another 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. The service application refers to a program for realizing the functions of the service 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 a terminal device through an interception program, wherein the modification request comprises the following steps: an identification of first service data to be modified, a modification content of the first service data, and a first version identification on which the modification of the first service data is based.
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. When the first node receives the interception request through the service application program, the modification request can be intercepted through the interception program, and the interception program executes the version control process of the first service data.
Optionally, the interception program can be implemented by adopting a custom annotation section programming mode.
By way of example, the creation of custom annotation classes may be accomplished using the annotations @ Retention and @ Target. The custom annotation class can be used on any eligible method. The custom annotation class defines attribute fields such as a cache prefix, an identification of service data, a version field, whether the version is checked, whether the version is not to be prompted, whether the lock is locked, whether the lock cannot acquire the prompt, whether the version is backfilled, and the like.
The cache prefix and the identifier of the service data can be used for indicating a key value corresponding to the version identifier of the service data in the cache database. Version field default value is "version"; whether the version check default value is "false"; version no-pair hint default is "current data has been edited, please refresh"; whether the locking default value is "false"; the lock cannot acquire a prompt default value of "current data is being operated, please be later"; whether the backfill version default is "false". The values of the attribute fields may be updated in the section code according to the 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 interception program, the corresponding section code may 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 by an interception program according to the identifier of the first service data.
In this embodiment, annotations may be added to the interface method for receiving the modification request in the business application. After the modification request is intercepted, the section code corresponding to the annotation can be executed through the 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 performing splicing processing on 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, acquiring a second version identifier corresponding to the first service data from the cache database.
S803: and if the first version identifier is determined to be the same as the second version identifier through the interception program, updating the modified content of the first service data into a service database through the service application program.
Optionally, if the first version identifier is determined to be different from the second version identifier by the interception program, generating second prompt information by the interception program according to the attribute field of 'version not pair prompt' in the custom annotation class, and sending the second prompt information to the terminal device.
Optionally, when the interception program determines that the first version identifier is the same as the second version identifier, the interception program may lock the first service data, and if the locking fails, the interception program generates first prompt information according to the attribute field that the lock in the custom annotation class cannot acquire, and sends the first prompt information to the terminal device.
Optionally, after updating the modified content of the first service data into the service database by the service application program, the interception program may also generate a third version identifier of the first service data, and update the second version identifier of the first service data stored in the cache database to the third version identifier.
In this embodiment, the interception program is implemented by adopting a custom annotation programming mode, and the interception program implements the version control function of the service data, so that the version control process of the service data is completely decoupled from the service system, and the version control process of the service data is implemented without modifying the code of the service system.
Fig. 9 is a schematic structural diagram of a processing device for service data according to an embodiment of the present application. The apparatus may be in the form of software and/or hardware. The apparatus may be deployed in a first node of a clustered business system. As shown in fig. 9, the processing apparatus 900 for service data provided in this embodiment may include: a receiving module 901, an acquiring 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: an identification of first service data to be modified, a modification content of the first service data, and a first version identification on which the 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 cluster service system are different;
And the processing module 903 is 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 a locked state;
updating the modified content of the first service data into 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 comprises a sending module (not shown) for sending 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 identifier is different from the second version identifier, 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 comprises a sending module (not shown) for sending 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 identifier corresponding to the first service data; updating the second version identifier stored in the cache database to the third version identifier.
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 the response message comprises the third version identifier when the type of the modification request is a preset type;
the apparatus further comprises a sending module (not shown) for sending the response message to the terminal device.
In a possible implementation manner, the receiving module 901 is further configured to: receiving a query request sent by the terminal equipment, wherein the query 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 identification 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 comprises a transmitting module (not shown) for transmitting the current content of the first service data and the current version identification of the first service data to the terminal device.
In a possible implementation manner, the first node is deployed with an interception program and a service application program, 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 through the interception program;
the processing module 903 is specifically configured to: and if the interception program determines that the first version identifier is the same as the second version identifier, updating the modified content of the first service data into a service database through the service application program.
The processing device for service data provided in this embodiment may be used to execute the processing method for service data in any of the above method embodiments, and its implementation principle and technical effects are similar, and are not described here again.
Fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application. The electronic equipment can be used as any node in the cluster service system. As shown in fig. 10, the electronic device 1000 includes: processor 1001 and memory 1002.
Wherein the memory 1002 is for storing a computer program; a processor 1001 for executing computer programs stored in a memory to implement one or more steps of the method for processing service data in the above embodiment. The specific reference may be made to the related descriptions in the foregoing method embodiments, where the implementation principle and the technical effect are similar, and the description of this embodiment is omitted here.
Alternatively, the memory 1002 may be separate or integrated with the processor 1001.
When the memory 1002 is a device separate from the processor 1001, the electronic apparatus 1000 may further include: a bus 1003 connecting the memory 1002 and the processor 1001.
The embodiments of the present application further provide a computer readable storage medium, where the computer readable storage medium includes a computer program, where the computer program is configured to implement one or more steps in the method for processing service data provided in any one of the method embodiments, and the implementation principle and technical effects are similar, and are not repeated herein.
The embodiment of the application also provides a chip, which comprises: the system comprises a memory and a processor, wherein the memory stores a computer program, and the processor runs the computer program to execute one or more steps in the service data processing method provided by any method embodiment, so that the implementation principle and technical effects are similar, and the details are not repeated here.
The embodiments of the present application further provide a computer program product, including a computer program, where the computer program is executed by a processor to implement one or more steps in the method for processing service data provided in any of the foregoing method embodiments, and implementation principles and technical effects are similar, and are not repeated herein.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be additional divisions when actually implemented, for example, multiple modules may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or modules, which may be in electrical, mechanical, or other forms.
The modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, may be located in one place, or may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional module in each embodiment of the present application may be integrated in one processing unit, or each module may exist alone physically, or two or more modules may be integrated in one unit. The units formed by the modules can be realized in a form of hardware or a form of hardware and software functional units.
The integrated modules, which are implemented in the form of software functional modules, may be stored in a computer readable storage medium. The software functional module is stored in a storage medium, and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (english: processor) to perform some of the steps of the methods described in the embodiments of the present application.
It should be understood that the above processor may be a central processing unit (english: central Processing Unit, abbreviated as CPU), or may be other general purpose processors, digital signal processors (english: digital Signal Processor, abbreviated as DSP), application specific integrated circuits (english: application Specific Integrated Circuit, abbreviated as ASIC), or the like. 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 connection with the present application may be embodied directly in a hardware processor for execution, or in a combination of hardware and software modules in a processor for execution.
The memory may comprise a high-speed RAM memory, and may further comprise a non-volatile memory NVM, such as at least one magnetic disk memory, and may also be a U-disk, a removable hard disk, a read-only memory, a magnetic disk or optical disk, etc.
The bus may be an industry standard architecture (Industry Standard Architecture, ISA) bus, an external device interconnect (Peripheral Component, PCI) bus, or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, among others. The buses may be divided into address buses, data buses, control buses, etc. For ease of illustration, the buses in the drawings 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 nonvolatile 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 disk. 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. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an application specific integrated circuit (Application Specific Integrated Circuits, ASIC for short). It is also possible that the processor and the storage medium reside as discrete components in an electronic device or a master device.
Those of ordinary skill in the art will appreciate that: all or part of the steps for implementing the method embodiments described above may be performed by hardware associated with program instructions. The foregoing program may be stored in a computer readable storage medium. The program, when executed, performs steps including the method embodiments described above; and the aforementioned storage medium includes: various media that can store program code, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution 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 scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.

Claims (12)

1. A method for processing service data, applied to a first node in a trunking service system, the method comprising:
receiving a modification request sent by a terminal device, wherein the modification request comprises: an identification of first service data to be modified, a modification content of the first service data, and a first version identification on which the 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; cache databases corresponding to different nodes in the cluster service system are different;
if the first version identifier is the same as the second version identifier, updating the modified content of the first service data into a service database;
after updating the modified content of the first service data into the service database, the method further comprises:
generating a third version identifier corresponding to the first service data;
updating the second version identifier stored in the cache database to the third version identifier;
and after one of the cache databases updates the version identification of the first service data, synchronizing the updated version identification to the other cache databases.
2. The method of claim 1, wherein updating the modified content of the first business data into a business database comprises:
setting the state of the first service data to a locked state;
updating the modified content of the first service data into 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 the 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. A method according to claim 3, characterized in that the method further comprises:
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 information to the terminal equipment.
5. The method according to claim 1, wherein the method further comprises:
if the first version identifier is different from the second version identifier, 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 information to the terminal equipment.
6. The method of claim 1, further comprising, after updating the second version identification stored in the cache database to the third version identification:
Generating a response message corresponding to the modification request according to the type of the modification request, wherein the response message comprises the third version identifier when the type of the modification request is a preset type;
and sending the response message to the terminal equipment.
7. The method according to any one of claims 1 to 4, further comprising, before receiving the modification request sent by the terminal device:
receiving a query request sent by the terminal equipment, wherein the query 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 identification 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.
8. The method according to any one of claims 1 to 4, wherein the first node is deployed with an interception program and a service application program, and the receiving the modification request sent by the terminal device includes:
Intercepting a modification request sent by the terminal equipment through the interception program;
according to the identification of the first service data, a second version identification corresponding to the first service data is obtained from a cache database corresponding to the first node, and the method comprises the following steps:
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 through the interception program;
if the first version identifier is the same as the second version identifier, updating the modified content of the first service data into a service database, including:
and if the interception program determines that the first version identifier is the same as the second version identifier, updating the modified content of the first service data into a service database through the service application program.
9. A service data processing device, applied to a first node in a trunking service system, the device comprising:
the receiving module is used for receiving a modification request sent by the terminal equipment, and the modification request comprises: an identification of first service data to be modified, a modification content of the first service data, and a first version identification on which the modification of the first service data is based;
The acquisition module is used for 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;
the processing module is used for updating the modified content of the first service data into a service database if the first version identifier is determined to be the same as the second version identifier;
the processing module is further configured to generate a third version identifier corresponding to the first service data; updating the second version identifier stored in the cache database to the third version identifier;
and after one of the cache databases updates the version identification of the first service data, synchronizing the updated version identification to the other cache databases.
10. 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 8.
11. A computer-readable storage medium, comprising: computer program which, when executed by a processor, implements the method according to any one of claims 1 to 8.
12. A computer program product, comprising: computer program which, when executed by a processor, implements the method according to any one of claims 1 to 8.
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 CN113220669A (en) 2021-08-06
CN113220669B true 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)

Families Citing this family (3)

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

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9684686B1 (en) * 2013-09-04 2017-06-20 Amazon Technologies, Inc. Database system recovery using non-volatile system memory
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

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10747746B2 (en) * 2013-04-30 2020-08-18 Amazon Technologies, Inc. Efficient read replicas
US10585873B2 (en) * 2017-05-08 2020-03-10 Sap Se Atomic processing of compound database transactions that modify a metadata entity

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
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

Also Published As

Publication number Publication date
CN113220669A (en) 2021-08-06

Similar Documents

Publication Publication Date Title
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
US10261996B2 (en) Content localization using fallback translations
CN108959341B (en) Data synchronization method, device and equipment
US20180060143A1 (en) Distributed shared log storage system having an adapter for heterogenous big data workloads
CN109766330B (en) Data slicing method and device, electronic equipment and storage medium
EP1788493A1 (en) Detecting changes in data
KR20110128846A (en) Programming model for synchronizing browser caches across devices and web services
WO2009017534A1 (en) Persistent query system for automatic on-demand data subscriptions from mobile devices
US11392567B2 (en) Just-in-time multi-indexed tables in a shared log
CN103514298A (en) Method for achieving file lock and metadata server
CN110377649B (en) Construction and query methods, devices, equipment and storage medium of tagged data
US10776378B2 (en) System and method for use of immutable accessors with dynamic byte arrays
US11018860B2 (en) Highly available and reliable secret distribution infrastructure
CN112363979A (en) Distributed index method and system based on graph database
CN108459913B (en) Data parallel processing method and device and server
JP6134390B2 (en) Dynamic firmware update
CN104423982A (en) Request processing method and device
US20200012456A1 (en) Stale block resynchronization in nvm based systems
CN107391539B (en) Transaction processing method, server and storage medium
US20190087458A1 (en) Interception of database queries for delegation to an in memory data grid
CN108153799B (en) Database access control method and device and database system
US10114864B1 (en) List element query support and processing
CN112612530B (en) Class query method and device

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