CN117331949A - Distributed lock operation execution method, device, computer equipment and storage medium - Google Patents

Distributed lock operation execution method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN117331949A
CN117331949A CN202311193656.5A CN202311193656A CN117331949A CN 117331949 A CN117331949 A CN 117331949A CN 202311193656 A CN202311193656 A CN 202311193656A CN 117331949 A CN117331949 A CN 117331949A
Authority
CN
China
Prior art keywords
lock operation
distributed
lock
information
execution
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311193656.5A
Other languages
Chinese (zh)
Inventor
石慧彪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Bank of China Ltd
Original Assignee
Bank of China 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 Bank of China Ltd filed Critical Bank of China Ltd
Priority to CN202311193656.5A priority Critical patent/CN117331949A/en
Publication of CN117331949A publication Critical patent/CN117331949A/en
Pending legal-status Critical Current

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/23Updating
    • G06F16/2308Concurrency control
    • G06F16/2336Pessimistic concurrency control approaches, e.g. locking or multiple versions without time stamps
    • G06F16/2343Locking methods, e.g. distributed locking or locking implementation details
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Hardware Redundancy (AREA)

Abstract

The present application relates to a distributed lock operation execution method, apparatus, computer device, storage medium and computer program product, and relates to the field of computer technology. The method comprises the following steps: receiving a lock operation request through a preset first abstract interface; determining a first target component in first lock operation components corresponding to different types of distributed locks according to lock operation attribute information corresponding to the lock operation request, wherein each first lock operation component is obtained by packaging lock operation logic of the different types of distributed locks; and executing the distributed lock operation corresponding to the lock operation request according to the first target component. By adopting the method, the maintenance convenience of the financial data system can be improved.

Description

Distributed lock operation execution method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technology, and in particular, to a distributed lock operation execution method, apparatus, computer device, storage medium, and computer program product.
Background
With the development of computer technology, a distributed lock technology appears, and the problem of controlling access to shared resources in a financial data system can be solved by using the distributed lock technology.
However, because the whole financial data system is complex and huge, the situation that different application threads use different distributed locks often occurs in the financial data system, so that the code logic difference of realizing the distributed locks by each application thread in the financial data system is large, and great inconvenience is brought to the maintenance of the financial data system.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a distributed lock operation execution method, apparatus, computer device, computer-readable storage medium, and computer program product that can promote the maintenance convenience of a financial data system.
In a first aspect, the present application provides a distributed lock operation execution method. The method comprises the following steps:
receiving a lock operation request through a preset first abstract interface;
determining a first target component in first lock operation components corresponding to different types of distributed locks according to lock operation attribute information corresponding to the lock operation request, wherein each first lock operation component is obtained by packaging lock operation logic of the different types of distributed locks;
and executing the distributed lock operation corresponding to the lock operation request according to the first target component.
In one embodiment, the lock operation attribute information includes distributed lock type information and lock operation type information; the determining, according to the lock operation attribute information corresponding to the lock operation request, a first target component in first lock operation components corresponding to different types of distributed locks includes:
acquiring annotation information of the lock operation request, and determining distributed lock type information and lock operation type information corresponding to the lock operation request according to the annotation information; and determining a first target component in the first lock operation components corresponding to the distributed locks of different types according to the distributed lock type information and the lock operation type information.
In one embodiment, the determining, according to the distributed lock type information and the lock operation type information, a first target component in first lock operation components corresponding to different types of distributed locks includes:
determining each component to be selected in first lock operation components corresponding to different types of distributed locks according to the distributed lock type information and the lock operation type information; and acquiring the execution priority information of each first lock operation component, and selecting a first target component from the components to be selected according to the execution priority information.
In one embodiment, the acquiring the execution priority information of each of the first lock operation components includes:
acquiring the total execution times and the execution success times of each first lock operation assembly in a preset time period; determining the current execution success rate of each first lock operation assembly according to the execution success times and the execution total times; and generating the execution priority information of each first lock operation assembly according to each current execution success rate.
In one embodiment, the generating the execution priority information of each of the first lock operation components according to each of the current execution success rates includes:
obtaining downtime times of each first lock operation assembly in the preset time period; according to the current execution success rate and the downtime times, priority grading is carried out on each first lock operation assembly to obtain grading values; and generating the execution priority information of each first lock operation assembly according to each grading value.
In one embodiment, the method further comprises:
receiving locking failure information fed back by a preset middleware through a preset second abstract interface; determining a second target assembly in each second lock operation assembly according to the locking failure information, wherein each second lock operation assembly is obtained by packaging locking failure operation logic of different types of distributed locks; and executing the locking failure operation corresponding to the locking failure information according to the second target component.
In a second aspect, the present application also provides a distributed lock operation execution device. The device comprises:
the request receiving module is used for receiving a lock operation request through a preset first abstract interface;
the component determining module is used for determining a first target component in first lock operation components corresponding to different types of distributed locks according to lock operation attribute information corresponding to the lock operation request, wherein each first lock operation component is obtained by packaging lock operation logic of the different types of distributed locks;
and the lock operation execution module is used for executing the distributed lock operation corresponding to the lock operation request according to the first target component.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor which when executing the computer program performs the steps of:
receiving a lock operation request through a preset first abstract interface; determining a first target component in first lock operation components corresponding to different types of distributed locks according to lock operation attribute information corresponding to the lock operation request, wherein each first lock operation component is obtained by packaging lock operation logic of the different types of distributed locks; and executing the distributed lock operation corresponding to the lock operation request according to the first target component.
In a fourth aspect, the present application also provides a computer-readable storage medium. The computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
receiving a lock operation request through a preset first abstract interface; determining a first target component in first lock operation components corresponding to different types of distributed locks according to lock operation attribute information corresponding to the lock operation request, wherein each first lock operation component is obtained by packaging lock operation logic of the different types of distributed locks; and executing the distributed lock operation corresponding to the lock operation request according to the first target component.
In a fifth aspect, the present application also provides a computer program product. The computer program product comprises a computer program which, when executed by a processor, implements the steps of:
receiving a lock operation request through a preset first abstract interface; determining a first target component in first lock operation components corresponding to different types of distributed locks according to lock operation attribute information corresponding to the lock operation request, wherein each first lock operation component is obtained by packaging lock operation logic of the different types of distributed locks; and executing the distributed lock operation corresponding to the lock operation request according to the first target component.
According to the distributed lock operation execution method, the device, the computer equipment, the storage medium and the computer program product, the external lock operation requests are uniformly received through the preset first abstract interface, and as the financial data system already packages lock operation logic of different types of distributed locks at the bottom layer to form each first lock operation assembly, according to lock operation attribute information corresponding to the lock operation requests, a first target assembly can be determined in the first lock operation assemblies corresponding to different types of distributed locks, and according to the first target assembly, distributed lock operation corresponding to the lock operation requests can be executed, so that all application threads in the financial data system can automatically complete corresponding distributed lock operation only by calling the preset first abstract interface to send the lock operation requests, and the code logic of the distributed locks is basically consistent for each application thread in the financial data system, so that the maintenance convenience of the financial data system can be improved.
Drawings
FIG. 1 is a flow diagram of a distributed lock operation execution method in one embodiment;
FIG. 2 is a flow diagram of determining a first target component in one embodiment;
FIG. 3 is a flow chart of determining a first target component according to another embodiment;
FIG. 4 is a block diagram of a distributed lock operation execution device in one embodiment;
fig. 5 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
In a financial data system, a distributed lock is often used to solve the problem of accessing shared resources, and because the financial data system is complex and huge, each application thread in the financial data system is usually programmed and realized by different developers, but because the distributed lock familiar to different developers is different, the situation that different application threads use different types of distributed locks in the financial data system often occurs, which results in great difference of code logic of realizing the distributed lock by each application thread in the financial data system and brings great inconvenience to maintenance of the financial data system.
In one embodiment, as shown in FIG. 1, a distributed lock operation execution method is provided. In this embodiment, the method includes the steps of:
step 102, receiving a lock operation request through a preset first abstract interface.
The distributed lock operation execution method in the embodiment can be applied to a financial data system, lock operation logic corresponding to different types of distributed locks is packaged at the bottom layer of the financial data system, each first lock operation assembly is formed, the financial data system provides a unified preset first abstract interface for each application thread, each application thread in the financial data system can call the corresponding first lock operation assembly through the preset first abstract interface, and corresponding distributed lock operation can be achieved through executing the lock operation assembly.
As one example, the different types of distributed locks may be database DB based distributed locks, zookeeper based distributed locks, redis based distributed locks, and the like.
Step 104, determining a first target component in first lock operation components corresponding to the distributed locks of different types according to lock operation attribute information corresponding to the lock operation request, wherein each first lock operation component is obtained by packaging lock operation logic of the distributed locks of different types.
The lock operation attribute information is used for identifying the distributed operation requested to be executed by the lock operation request, wherein the lock operation attribute information can be a type tag or a character string.
As an example, step 104 includes: acquiring lock operation attribute information corresponding to the lock operation request, and inquiring a target component identifier in each component identifier by taking the lock operation attribute information as an index; and determining a first target component in first lock operation components corresponding to the distributed locks of different types according to the target component identification, wherein each first lock operation component is obtained by packaging lock operation logic of the distributed locks of different types.
As an example, the lock operation logic may be a locking logic or an unlocking logic, etc., and the locking logic may be a locking timeout logic, a locking retry logic, a locking request logic, etc.
And 106, executing the distributed lock operation corresponding to the lock operation request according to the first target component.
As an example, step 106 includes: and executing the distributed lock operation corresponding to the lock operation request by executing the first target component.
As one example, the first lock operation component may be a rule component set based on a rule engine.
As an example, the distributed operation may be a locking operation, an unlocking operation, or the like, the locking operation may be a locking timeout operation, a locking retry operation, or a locking request operation, or the like, and the unlocking operation may be an unlocking request operation, or the like.
In the above method for executing the distributed lock operation, the external lock operation request is uniformly received through the preset first abstract interface, and since the financial data system already encapsulates the lock operation logic of the distributed locks of different types at the bottom layer to form each first lock operation component, according to the lock operation attribute information corresponding to the lock operation request, the first target component can be determined in the first lock operation components corresponding to the distributed locks of different types, and according to the first target component, the distributed lock operation corresponding to the lock operation request can be executed, so that all application threads in the financial data system can automatically complete the corresponding distributed lock operation only by calling the preset first abstract interface to send the lock operation request, and the code logic of the distributed lock is basically consistent for each application thread in the financial data system, thereby improving the maintenance convenience of the financial data system.
In one embodiment, as shown in FIG. 2, the lock operation attribute information includes distributed lock type information and lock operation type information; according to lock operation attribute information corresponding to the lock operation request, determining a first target component in first lock operation components corresponding to different types of distributed locks, including:
Step 202, annotation information of the lock operation request is obtained, and distributed lock type information and lock operation type information corresponding to the lock operation request are determined according to the annotation information.
The annotation information may be declaration annotation information set based on declaration programming, the annotation information may be attribute information for representing a lock operation request, the attribute information may be distributed lock type information, lock operation type information and the like, the distributed lock type information is used for representing a distributed lock type, the lock operation type information is used for identifying a lock operation type, the distributed lock type may be a lock type such as a distributed lock based on a database DB, a distributed lock based on a zookeeper, a distributed lock based on a redis and the like, and the lock operation type may be a lock timeout operation, a lock retry operation, a lock request operation, an unlock request operation or the like.
As an example, step 202 includes: and acquiring annotation information of the lock operation request, and analyzing the annotation information to obtain distributed lock type information and lock operation type information corresponding to the lock operation request.
Step 204, determining a first target component in the first lock operation components corresponding to the distributed locks of different types according to the distributed lock type information and the lock operation type information.
As an example, step 204 includes: generating component index information according to the distributed lock type information and the lock operation type information, and positioning a first target component in first lock operation components corresponding to different types of distributed locks according to the component index information.
As an example, the distributed lock type information may be type tag a, the lock operation type information may be type tag B, and the component index information may be tag vector (a, B).
In this embodiment, by acquiring annotation information of a lock operation request, distributed lock type information and lock operation type information corresponding to the lock operation request are determined according to the annotation information; according to the distributed lock type information and the lock operation type information, the first target component is determined in the first lock operation components corresponding to different types of distributed locks, annotation information of the lock operation request can be achieved, the first target component corresponding to the lock operation request is accurately positioned in each first lock operation component packaged at the bottom layer of the financial data system, and a foundation is laid for achieving distributed lock operation corresponding to the lock operation request.
In one embodiment, as shown in fig. 3, according to the distributed lock type information and the lock operation type information, determining a first target component in first lock operation components corresponding to different types of distributed locks includes:
Step 302, determining each component to be selected in the first lock operation components corresponding to the distributed locks of different types according to the distributed lock type information and the lock operation type information.
The bottom layer of the financial data system generally encapsulates a plurality of first lock operation components, and the first lock operation components have the possibility of performing the same distributed lock operation, so that according to the distributed lock type information and the lock operation type information, a plurality of candidate components are determined from the first lock operation components.
As an example, step 302 includes: generating component index information according to the distributed lock type information and the lock operation type information, and positioning each component to be selected in the first lock operation components corresponding to the distributed locks of different types according to the component index information.
Step 304, obtaining the execution priority information of each first lock operation component, and selecting a first target component from the components to be selected according to the execution priority information.
The execution priority information may be preset priority information, which is used to determine which first lock operation component may be preferentially used as the first target component to execute the distributed lock operation, where the pre-execution priority information may be a component identifier list of each first lock operation component, and the higher the component identifier is arranged in the component identifier list, the higher the execution priority of the first lock operation component corresponding to the component identifier.
As an example, step 304 includes: acquiring execution priority information of each first lock operation assembly; selecting an execution component with the highest execution priority from all the components to be selected according to the execution priority information; if the execution component is in an idle state, the execution component is used as a first target component; if the execution component is in an occupied state, eliminating the execution component from the components to be selected, and returning to execute the step of selecting the execution component with the highest execution priority from the components to be selected and the subsequent steps thereof according to the execution priority information until the first target component is determined in the first lock operation components.
In one embodiment, obtaining execution priority information for each first lock operation component includes:
acquiring the total execution times and the execution success times of each first lock operation assembly in a preset time period; determining the current execution success rate of each first lock operation assembly according to the execution success times and the total execution times; and generating the execution priority information of each first lock operation assembly according to each current execution success rate.
The preset time period may be a period of time elapsed, the total execution times may be a total times of the first lock operation assembly executing the distributed lock operation in the preset time period, and the successful execution times may be times of the first lock operation assembly successfully executing the distributed lock operation in the preset time period.
Specifically, the total execution times and the successful execution times of the distributed lock operation executed by each first lock operation assembly in a preset time period are obtained; calculating the ratio of the execution success times of each first lock operation assembly to the total execution times assembly respectively to obtain the current execution success rate of each first lock operation assembly; and sequencing each first lock operation assembly according to each current execution success rate to obtain execution priority information of each first lock operation assembly, wherein the higher the current execution success rate is, the higher the sequencing of the corresponding first lock operation assembly is, the higher the execution priority is, and the lower the current execution success rate is, the lower the sequencing of the corresponding first lock operation assembly is, and the lower the execution priority is. In this sample embodiment, the execution priority of each component to be selected may be determined according to the execution success rate of each first lock operation component to execute the distributed lock operation, so that the first target component may be dynamically selected from each component to be selected according to the priority information, so that the selected first target component is matched with the current health status of each first distributed lock component in the financial data system, so that the selected first target component is more accurate, and the execution success rate of the distributed lock operation is improved.
In one embodiment, obtaining execution priority information for each first lock operation component includes:
and acquiring the downtime times of each first lock operation assembly in a preset time period, and sequencing each first lock operation assembly according to each downtime time to obtain the execution priority information of each first lock operation assembly, wherein the lower the downtime times are, the higher the sequencing of the corresponding first lock operation assemblies is, the higher the execution priority is, and the higher the downtime times are, the lower the sequencing of the corresponding first lock operation assemblies is, the execution priority is. In this sample embodiment, the execution priority of each component to be selected may be determined according to the downtime of each first lock operation component, so that the first target component may be dynamically selected from each component to be selected according to the execution priority information, so that the selected first target component is matched with the current health status of each first distributed lock component in the financial data system, so that the selected first target component is more accurate, and the execution success rate of the distributed lock operation is improved.
In one embodiment, generating the execution priority information of each first lock operation component according to each current execution success rate includes:
Obtaining downtime times of each first lock operation assembly in a preset time period; according to the current execution success rate and downtime times, priority grading is carried out on each first lock operation assembly to obtain grading values; and generating the execution priority information of each first lock operation assembly according to each grading value.
Specifically, the downtime times of each first lock operation assembly in a preset time period are obtained; the execution success rate and downtime times of each lock operation assembly are respectively fused, priority grading is carried out on each first lock operation assembly, and each grading value is obtained; and sequencing the first lock operation components according to the grading values of the first lock operation components to obtain the execution priority information of the first lock operation components, wherein the higher the grading value corresponding to the first lock operation is, the higher the execution priority of the first lock operation component is, and the lower the grading value corresponding to the first lock operation is, the lower the execution priority of the first lock operation component is. In this sample embodiment, the execution priority of each component to be selected can be comprehensively evaluated according to the downtime times and the execution success rate of each first lock operation component, so that the first target component can be dynamically selected in each component to be selected according to the execution priority information, the selected first target component is matched with the current health state of each first distributed lock component in the financial data system, the selected first target component is more accurate, and the execution success rate of the distributed lock operation is improved.
In the above embodiment, each component to be selected is determined in the first lock operation components corresponding to the distributed locks of different types according to the distributed lock type information and the lock operation type information; the execution priority information of each first lock operation assembly is acquired, and the first target assembly is selected from all the to-be-selected assemblies according to the execution priority information, so that the first target assembly corresponding to the lock operation request can be accurately positioned in each first lock operation assembly, the lock operation request is matched with the first target assembly which is the most suitable, the distributed lock operation corresponding to the lock operation request is executed according to the first target assembly, and the execution success rate of the distributed operation is improved.
In one embodiment, the distributed lock operation execution method further includes:
receiving locking failure information fed back by a preset middleware through a preset second abstract interface; determining a second target assembly in each second lock operation assembly according to the locking failure information, wherein each second lock operation assembly is obtained by packaging locking failure operation logic of different types of distributed locks; and executing the locking failure operation corresponding to the locking failure information according to the second target component.
Different locking failure operation logics are further packaged at the bottom layer of the financial data system to form second locking operation assemblies, the financial data system provides unified preset second abstract interfaces for preset middleware, the preset middleware can transmit locking failure information back to the financial data system through the preset second abstract interfaces, and the preset middleware is middleware for realizing distributed locking and can be, for example, rediss, a database DB, a zookeeper cluster and the like.
Specifically, locking failure information fed back by a preset middleware is received through a preset second abstract interface; analyzing annotation information of the locking failure information to obtain component identification information corresponding to the locking failure information; determining a second target component in each second lock operation component according to component identification information, wherein each second lock operation component is obtained by packaging locking failure operation logic of different types of distributed locks, and the component identification information can be the type identification of the second lock operation component; and executing the locking failure operation corresponding to the locking failure information by executing the second target component.
In the above embodiment, the locking failure information fed back by the preset middleware is received through the preset second abstract interface, and since the bottom layer of the financial data system already encapsulates the locking failure operation logic of the distributed locks of different types, according to the locking failure information, the second target component can be determined in each second locking operation component, and according to the second target component, the locking failure operation corresponding to the locking failure information can be performed, so that the financial data system only needs to set a unified preset second abstract interface, and can uniformly process the locking failure information fed back by all preset middleware, and the locking failure code logic of each preset middleware in the financial data system is basically consistent, thereby improving the maintenance convenience of the financial data system.
In one embodiment, a lock operation request is received through a preset first abstract interface, annotation information of the lock operation request is obtained, and the annotation information is analyzed to obtain distributed lock type information and lock operation type information corresponding to the lock operation request; generating component index information according to the distributed lock type information and the lock operation type information, and positioning each component to be selected in the first lock operation components corresponding to the distributed locks of different types according to the component index information.
After determining each component to be selected, acquiring the total execution times and the successful execution times of each first lock operation component for executing the distributed lock operation in a preset time period; calculating the ratio of the execution success times of each first lock operation assembly to the total execution times assembly respectively to obtain the current execution success rate of each first lock operation assembly; obtaining downtime times of each first lock operation assembly in a preset time period; according to the current execution success rate and downtime times, priority grading is carried out on each first lock operation assembly to obtain grading values; generating execution priority information of each first lock operation assembly according to each grading value; and selecting a first target component from the components to be selected according to the execution priority information. Therefore, the execution priority of each component to be selected can be comprehensively evaluated according to the downtime times and the execution success rate of each first lock operation component, and the first target component can be dynamically selected from the components to be selected according to the execution priority information, so that the selected first target component is matched with the current health state of each first distributed lock component in the financial data system, the selected first target component is more accurate, and the execution success rate of the distributed lock operation is improved.
Furthermore, according to the first target component, the distributed lock operation corresponding to the lock operation request can be executed, so that all application threads in the financial data system can automatically complete the corresponding distributed lock operation only by calling a preset first abstract interface to send the lock operation request, and the code logic of each application thread in the financial data system for realizing the distributed lock is basically consistent, thereby improving the maintenance convenience of the financial data system.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a distributed lock operation executing device for realizing the above related distributed lock operation executing method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in the embodiments of the distributed lock operation execution device or devices provided below may refer to the limitation of the distributed lock operation execution method hereinabove, and will not be repeated herein.
In one embodiment, as shown in fig. 4, there is provided a distributed lock operation execution apparatus including: a request receiving module, a component determining module and a lock operation executing module, wherein:
the request receiving module is used for receiving a lock operation request through a preset first abstract interface.
The component determining module is used for determining a first target component in first lock operation components corresponding to different types of distributed locks according to lock operation attribute information corresponding to the lock operation request, wherein each first lock operation component is obtained by packaging lock operation logic of the different types of distributed locks.
And the lock operation execution module is used for executing the distributed lock operation corresponding to the lock operation request according to the first target component.
In one embodiment, the lock operation attribute information includes distributed lock type information and lock operation type information; the component determination module is further to:
acquiring annotation information of the lock operation request, and determining distributed lock type information and lock operation type information corresponding to the lock operation request according to the annotation information; and determining a first target component in the first lock operation components corresponding to the distributed locks of different types according to the distributed lock type information and the lock operation type information.
In one embodiment, the component determination module is further to:
determining each component to be selected in first lock operation components corresponding to different types of distributed locks according to the distributed lock type information and the lock operation type information; and acquiring the execution priority information of each first lock operation component, and selecting a first target component from the components to be selected according to the execution priority information.
In one embodiment, the component determination module is further to:
acquiring the total execution times and the execution success times of each first lock operation assembly in a preset time period; determining the current execution success rate of each first lock operation assembly according to the execution success times and the execution total times; and generating the execution priority information of each first lock operation assembly according to each current execution success rate.
In one embodiment, the component determination module is further to:
obtaining downtime times of each first lock operation assembly in the preset time period; according to the current execution success rate and the downtime times, priority grading is carried out on each first lock operation assembly to obtain grading values; and generating the execution priority information of each first lock operation assembly according to each grading value.
In one embodiment, the distributed lock operation execution device further includes:
the locking failure operation module is used for receiving locking failure information fed back by a preset middleware through a preset second abstract interface; determining a second target assembly in each second lock operation assembly according to the locking failure information, wherein each second lock operation assembly is obtained by packaging locking failure operation logic of different types of distributed locks; and executing the locking failure operation corresponding to the locking failure information according to the second target component.
The modules in the distributed lock operation execution device may be implemented in whole or in part by software, hardware, or a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 5. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is for storing financial system data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program, when executed by a processor, implements a distributed lock operation execution method.
It will be appreciated by those skilled in the art that the structure shown in fig. 5 is merely a block diagram of some of the structures associated with the present application and is not limiting of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided comprising a memory and a processor, the memory having stored therein a computer program, the processor when executing the computer program performing the steps of:
receiving a lock operation request through a preset first abstract interface; determining a first target component in first lock operation components corresponding to different types of distributed locks according to lock operation attribute information corresponding to the lock operation request, wherein each first lock operation component is obtained by packaging lock operation logic of the different types of distributed locks; and executing the distributed lock operation corresponding to the lock operation request according to the first target component.
In one embodiment, the lock operation attribute information includes distributed lock type information and lock operation type information; the processor when executing the computer program also implements the steps of:
acquiring annotation information of the lock operation request, and determining distributed lock type information and lock operation type information corresponding to the lock operation request according to the annotation information; and determining a first target component in the first lock operation components corresponding to the distributed locks of different types according to the distributed lock type information and the lock operation type information.
In one embodiment, the processor when executing the computer program further performs the steps of:
determining each component to be selected in first lock operation components corresponding to different types of distributed locks according to the distributed lock type information and the lock operation type information; and acquiring the execution priority information of each first lock operation component, and selecting a first target component from the components to be selected according to the execution priority information.
In one embodiment, the processor when executing the computer program further performs the steps of:
acquiring the total execution times and the execution success times of each first lock operation assembly in a preset time period; determining the current execution success rate of each first lock operation assembly according to the execution success times and the execution total times; and generating the execution priority information of each first lock operation assembly according to each current execution success rate.
In one embodiment, the processor when executing the computer program further performs the steps of:
obtaining downtime times of each first lock operation assembly in the preset time period; according to the current execution success rate and the downtime times, priority grading is carried out on each first lock operation assembly to obtain grading values; and generating the execution priority information of each first lock operation assembly according to each grading value.
In one embodiment, the processor when executing the computer program further performs the steps of:
receiving locking failure information fed back by a preset middleware through a preset second abstract interface; determining a second target assembly in each second lock operation assembly according to the locking failure information, wherein each second lock operation assembly is obtained by packaging locking failure operation logic of different types of distributed locks; and executing the locking failure operation corresponding to the locking failure information according to the second target component.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of:
receiving a lock operation request through a preset first abstract interface; determining a first target component in first lock operation components corresponding to different types of distributed locks according to lock operation attribute information corresponding to the lock operation request, wherein each first lock operation component is obtained by packaging lock operation logic of the different types of distributed locks; and executing the distributed lock operation corresponding to the lock operation request according to the first target component.
In one embodiment, the lock operation attribute information includes distributed lock type information and lock operation type information; the computer program when executed by the processor also performs the steps of:
Acquiring annotation information of the lock operation request, and determining distributed lock type information and lock operation type information corresponding to the lock operation request according to the annotation information; and determining a first target component in the first lock operation components corresponding to the distributed locks of different types according to the distributed lock type information and the lock operation type information.
In one embodiment, the computer program when executed by the processor further performs the steps of:
determining each component to be selected in first lock operation components corresponding to different types of distributed locks according to the distributed lock type information and the lock operation type information; and acquiring the execution priority information of each first lock operation component, and selecting a first target component from the components to be selected according to the execution priority information.
In one embodiment, the computer program when executed by the processor further performs the steps of:
acquiring the total execution times and the execution success times of each first lock operation assembly in a preset time period; determining the current execution success rate of each first lock operation assembly according to the execution success times and the execution total times; and generating the execution priority information of each first lock operation assembly according to each current execution success rate.
In one embodiment, the computer program when executed by the processor further performs the steps of:
obtaining downtime times of each first lock operation assembly in the preset time period; according to the current execution success rate and the downtime times, priority grading is carried out on each first lock operation assembly to obtain grading values; and generating the execution priority information of each first lock operation assembly according to each grading value.
In one embodiment, the computer program when executed by the processor further performs the steps of:
receiving locking failure information fed back by a preset middleware through a preset second abstract interface; determining a second target assembly in each second lock operation assembly according to the locking failure information, wherein each second lock operation assembly is obtained by packaging locking failure operation logic of different types of distributed locks; and executing the locking failure operation corresponding to the locking failure information according to the second target component.
In one embodiment, a computer program product is provided comprising a computer program which, when executed by a processor, performs the steps of:
receiving a lock operation request through a preset first abstract interface; determining a first target component in first lock operation components corresponding to different types of distributed locks according to lock operation attribute information corresponding to the lock operation request, wherein each first lock operation component is obtained by packaging lock operation logic of the different types of distributed locks; and executing the distributed lock operation corresponding to the lock operation request according to the first target component.
In one embodiment, the lock operation attribute information includes distributed lock type information and lock operation type information; the computer program when executed by the processor also performs the steps of:
acquiring annotation information of the lock operation request, and determining distributed lock type information and lock operation type information corresponding to the lock operation request according to the annotation information; and determining a first target component in the first lock operation components corresponding to the distributed locks of different types according to the distributed lock type information and the lock operation type information.
In one embodiment, the computer program when executed by the processor further performs the steps of:
determining each component to be selected in first lock operation components corresponding to different types of distributed locks according to the distributed lock type information and the lock operation type information; and acquiring the execution priority information of each first lock operation component, and selecting a first target component from the components to be selected according to the execution priority information.
In one embodiment, the computer program when executed by the processor further performs the steps of:
acquiring the total execution times and the execution success times of each first lock operation assembly in a preset time period; determining the current execution success rate of each first lock operation assembly according to the execution success times and the execution total times; and generating the execution priority information of each first lock operation assembly according to each current execution success rate.
In one embodiment, the computer program when executed by the processor further performs the steps of:
obtaining downtime times of each first lock operation assembly in the preset time period; according to the current execution success rate and the downtime times, priority grading is carried out on each first lock operation assembly to obtain grading values; and generating the execution priority information of each first lock operation assembly according to each grading value.
In one embodiment, the computer program when executed by the processor further performs the steps of:
receiving locking failure information fed back by a preset middleware through a preset second abstract interface; determining a second target assembly in each second lock operation assembly according to the locking failure information, wherein each second lock operation assembly is obtained by packaging locking failure operation logic of different types of distributed locks; and executing the locking failure operation corresponding to the locking failure information according to the second target component.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the various embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the various embodiments provided herein may include at least one of relational databases and non-relational databases. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic units, quantum computing-based data processing logic units, etc., without being limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples only represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the present application. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application shall be subject to the appended claims.

Claims (10)

1. A method of performing a distributed lock operation, the method comprising:
receiving a lock operation request through a preset first abstract interface;
determining a first target component in first lock operation components corresponding to different types of distributed locks according to lock operation attribute information corresponding to the lock operation request, wherein each first lock operation component is obtained by packaging lock operation logic of the different types of distributed locks;
And executing the distributed lock operation corresponding to the lock operation request according to the first target component.
2. The method of claim 1, wherein the lock operation attribute information includes distributed lock type information and lock operation type information; the determining, according to the lock operation attribute information corresponding to the lock operation request, a first target component in first lock operation components corresponding to different types of distributed locks includes:
acquiring annotation information of the lock operation request, and determining distributed lock type information and lock operation type information corresponding to the lock operation request according to the annotation information;
and determining a first target component in the first lock operation components corresponding to the distributed locks of different types according to the distributed lock type information and the lock operation type information.
3. The method according to claim 2, wherein determining a first target component in a first lock operation component corresponding to a different type of distributed lock according to the distributed lock type information and lock operation type information comprises:
determining each component to be selected in first lock operation components corresponding to different types of distributed locks according to the distributed lock type information and the lock operation type information;
And acquiring the execution priority information of each first lock operation component, and selecting a first target component from the components to be selected according to the execution priority information.
4. The method of claim 3, wherein said obtaining execution priority information for each of said first lock operation components comprises:
acquiring the total execution times and the execution success times of each first lock operation assembly in a preset time period;
determining the current execution success rate of each first lock operation assembly according to the execution success times and the execution total times;
and generating the execution priority information of each first lock operation assembly according to each current execution success rate.
5. The method of claim 4, wherein generating execution priority information for each of the first lock operation components based on each of the current execution success rates comprises:
obtaining downtime times of each first lock operation assembly in the preset time period;
according to the current execution success rate and the downtime times, priority grading is carried out on each first lock operation assembly to obtain grading values;
And generating the execution priority information of each first lock operation assembly according to each grading value.
6. The method according to claim 1, wherein the method further comprises:
receiving locking failure information fed back by a preset middleware through a preset second abstract interface;
determining a second target assembly in each second lock operation assembly according to the locking failure information, wherein each second lock operation assembly is obtained by packaging locking failure operation logic of different types of distributed locks;
and executing the locking failure operation corresponding to the locking failure information according to the second target component.
7. A distributed lock operation execution device, the device comprising:
the request receiving module is used for receiving a lock operation request through a preset first abstract interface;
the component determining module is used for determining a first target component in first lock operation components corresponding to different types of distributed locks according to lock operation attribute information corresponding to the lock operation request, wherein each first lock operation component is obtained by packaging lock operation logic of the different types of distributed locks;
and the lock operation execution module is used for executing the distributed lock operation corresponding to the lock operation request according to the first target component.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 6 when the computer program is executed.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
CN202311193656.5A 2023-09-15 2023-09-15 Distributed lock operation execution method, device, computer equipment and storage medium Pending CN117331949A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311193656.5A CN117331949A (en) 2023-09-15 2023-09-15 Distributed lock operation execution method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311193656.5A CN117331949A (en) 2023-09-15 2023-09-15 Distributed lock operation execution method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117331949A true CN117331949A (en) 2024-01-02

Family

ID=89276379

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311193656.5A Pending CN117331949A (en) 2023-09-15 2023-09-15 Distributed lock operation execution method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117331949A (en)

Similar Documents

Publication Publication Date Title
CN111782668A (en) Data structure reading and updating method and device, and electronic equipment
US20220164170A1 (en) Usage-based software library decomposition
US20060236308A1 (en) Configurable functionality chaining
CN115686881A (en) Data processing method and device and computer equipment
CN114625723A (en) Data migration method and device, computer equipment and storage medium
CN110928941A (en) Data fragment extraction method and device
CN117331949A (en) Distributed lock operation execution method, device, computer equipment and storage medium
CN116361153A (en) Method and device for testing firmware codes, electronic equipment and storage medium
CN114116256A (en) Variable calling method and device, computer equipment and storage medium
CN114756293A (en) Service processing method, device, computer equipment and storage medium
CN111538491A (en) Data event processing method, device, equipment and storage medium
CN118193032B (en) Method, apparatus, device, medium and program product for eliminating invalid dependency library
CN116880927A (en) Rule management method, device, computer equipment and storage medium
CN113032407B (en) Processing method and device for mutual exclusion function, storage medium and computer equipment
US11823011B2 (en) Analyzing execution of quantum services using quantum computing devices and quantum simulators
CN116842029B (en) Asset management method, device, computer equipment and storage medium
CN113867975B (en) Quick response method and device for command line and computer equipment
CN116975072A (en) Data processing method, device, computer equipment and storage medium
CN117076292A (en) Webpage testing method and device, computer equipment and storage medium
CN116301733A (en) Service transaction logic arrangement method, device, computer equipment and storage medium
CN117407193A (en) Cross-system business interaction method and device, computer equipment and storage medium
CN117455501A (en) Request processing method, apparatus, computer device and storage medium
CN116483532A (en) Scheduling processing method, device, computer equipment and storage medium
CN116450341A (en) Asynchronous callback method, device, equipment, storage medium and program product
CN118034885A (en) Task processing method, device, computer equipment and storage medium

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