CN111737275A - Database update event processing method and device and computer readable storage medium - Google Patents

Database update event processing method and device and computer readable storage medium Download PDF

Info

Publication number
CN111737275A
CN111737275A CN202010597638.3A CN202010597638A CN111737275A CN 111737275 A CN111737275 A CN 111737275A CN 202010597638 A CN202010597638 A CN 202010597638A CN 111737275 A CN111737275 A CN 111737275A
Authority
CN
China
Prior art keywords
task
database
message
subcomponent
event
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.)
Withdrawn
Application number
CN202010597638.3A
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.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology 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 Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202010597638.3A priority Critical patent/CN111737275A/en
Publication of CN111737275A publication Critical patent/CN111737275A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/235Update request formulation
    • 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

Abstract

The application discloses a database updating event processing method and device and a computer readable storage medium. The method comprises the steps of constructing a dynamic agent component which carries out database updating operation and comprises an event agent subcomponent, a transaction agent subcomponent, an event processing subcomponent and a task processing subcomponent in advance; issuing a database operation execution task for a user operation request; calling an event agent subcomponent to monitor target events accessing a target data access interface in the process of executing the database operation execution task, and recording each target event and the corresponding database operation type in a message library; if a new message exists in the message library, the transaction agent subassembly is called to perform database operation according to the database operation type of the message, meanwhile, the message to be processed is issued to the task processing subassembly through the event processing subassembly, and the task processing subassembly executes the task information carried by the message to be processed, so that the flexible processing of the database updating event is realized, and the code reusability and the easy maintenance are improved.

Description

Database update event processing method and device and computer readable storage medium
Technical Field
The present application relates to the field of cloud technologies, and in particular, to a method and an apparatus for processing a database update event, and a computer-readable storage medium.
Background
With the rapid development of big data and cloud computing, new data explosions appear to grow explosively. In a cloud computing environment, newly generated data or existing data updating of various resources all need to insert or update a corresponding resource database. For example, some application scenarios require frequent updating of fields of a certain type of resources and different operations are performed according to different requirements of the field values, and all cloud computing environments also need to have database update event processing capability.
In the process of updating events, the database in the related art needs to perform a complete data processing process on the processed normal stream or abnormal stream every time of updating, which wastes unnecessary resources, and the processing efficiency of the updating events is not high, thus causing code redundancy, poor reusability and being not beneficial to maintenance.
In view of this, how to flexibly process the database update event and improve the reusability of the code and the easy maintainability of the code is a technical problem to be solved by those skilled in the art.
Disclosure of Invention
The application provides a database update event processing method, a database update event processing device and a computer readable storage medium, which can flexibly process database update events and effectively improve code reusability and easy maintenance of codes.
In order to solve the above technical problems, embodiments of the present invention provide the following technical solutions:
an embodiment of the present invention provides a method for processing a database update event, including:
the method comprises the steps that a dynamic proxy component used for executing database updating operation is constructed in advance, and the dynamic proxy component comprises an event proxy subcomponent, a transaction proxy subcomponent, an event processing subcomponent and a task processing subcomponent;
when receiving a user database operation request, issuing a database operation execution task;
calling the event agent subcomponent to monitor target events of an access target data access interface in the execution process of the database operation execution task, and recording each target event and the corresponding executed database operation type in a pre-constructed message library;
if the message library has the message to be processed, calling the transaction agent subassembly to perform database operation according to the database operation type of the message to be processed, and simultaneously issuing the message to be processed to the task processing subassembly through the event processing subassembly so that the task processing subassembly executes the task information carried by the message to be processed.
Optionally, when receiving the user database operation request, the issuing a database operation execution task includes:
when receiving a user database operation request, automatically creating a database operation execution task as a parent task;
dividing the database operation execution task into a plurality of subtasks based on the logic sequence of each step in the database operation execution task;
and calling a plurality of threads to sequentially and asynchronously issue each subtask according to the logic sequence of each subtask so as to call the dynamic proxy component to complete the database updating operation of each subtask.
Optionally, the task processing sub-component includes a parent task event processing unit, a parent task completion processing unit, and a child task completion processing unit;
the parent task event processing unit is used for recording required log records for the corresponding parent task according to the task execution state of each subtask so as to facilitate viewing and positioning; the parent task completion processing unit is used for updating the state of the corresponding parent task according to the task execution state of each subtask; and the subtask completion processing unit is used for performing corresponding rollback or task notification operation according to the task information of each subtask.
Optionally, the task processing sub-component includes a plurality of parent task event processing units, a plurality of parent task completion processing units, and a plurality of child task completion processing units, so as to execute a plurality of parent tasks and a plurality of child tasks simultaneously.
Optionally, after the recording of each target event and the corresponding executed database operation type in the pre-constructed message library, the method further includes:
updating corresponding label types for the messages to be processed in the message library in real time according to the current execution state of the messages to be processed; the label type is any one of the following items:
tags to be processed, tags not issued, tags issued, task-waiting execution tags, and tags completed.
Optionally, after the message to be processed is issued to the task processing subcomponent through the event processing subcomponent at the same time, the method further includes:
when the completion of the release of the message to be processed is detected, the transaction agent subcomponent is called to eliminate the record of the message to be processed;
and if the completion of the task execution of the message to be processed is detected, calling the event processing subassembly to remove the message to be processed from the message library.
Another aspect of the embodiments of the present invention provides a database update event processing apparatus, including:
the system comprises a component pre-construction module, a task processing module and a task processing module, wherein the component pre-construction module is used for pre-constructing a dynamic proxy component for executing database updating operation, and the dynamic proxy component comprises an event proxy subcomponent, a transaction proxy subcomponent, an event processing subcomponent and a task processing subcomponent;
the task issuing module is used for issuing database operation execution tasks when receiving user database operation requests;
the message generation module is used for calling the event agent subcomponent to monitor a target event for accessing a target data access interface in the execution process of the database operation execution task, and recording each target event and the corresponding executed database operation type in a pre-constructed message library;
and the database operation execution module is used for calling the transaction agent subcomponent to perform database operation according to the database operation type of the message to be processed if the message to be processed exists in the message library, and simultaneously issuing the message to be processed to the task processing subcomponent through the event processing subcomponent so that the task processing subcomponent executes the task information carried by the message to be processed.
Optionally, the task issuing module includes:
the parent task creating submodule is used for automatically creating a database operation execution task as a parent task when receiving a user database operation request;
the task splitting sub-module is used for splitting the database operation execution task into a plurality of sub-tasks based on the logic sequence of each step in the database operation execution task;
and the subtask asynchronous issuing sub-module is used for calling a plurality of threads to asynchronously issue each subtask in turn according to the logic sequence of each subtask so as to call the dynamic proxy component to complete the database updating operation of each subtask.
The embodiment of the present invention further provides a database update event processing apparatus, which includes a processor, where the processor is configured to implement the steps of the database update event processing method according to any one of the foregoing embodiments when executing the computer program stored in the memory.
Finally, an embodiment of the present invention provides a computer-readable storage medium, where a database update event handler is stored on the computer-readable storage medium, and when being executed by a processor, the database update event handler implements the steps of the database update event handling method according to any of the foregoing items.
The technical scheme provided by the application has the advantages that the dynamic proxy component is constructed in advance, monitoring of various database updating events such as insertion or message release after updating can be achieved by the dynamic proxy component, an event consumer can complete consumption of the events by achieving the interface, complex definition and processing of the events are avoided, a complete data processing process of normal streams or abnormal streams needing to be processed is not required to be executed during each updating, operations such as task completion or failure rollback or notification can be carried out according to task states carried in the events or other information, the database updating events can be flexibly processed, database updating operation efficiency is higher, and code reusability and code maintainability are effectively improved.
In addition, the embodiment of the invention also provides a corresponding implementation device and a computer readable storage medium for the database update event processing method, so that the method has higher practicability, and the device and the computer readable storage medium have corresponding advantages.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions of the related art, the drawings required to be used in the description of the embodiments or the related art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a schematic flowchart of a database update event processing method according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart illustrating another database update event processing method according to an embodiment of the present invention;
FIG. 3 is a block diagram of an embodiment of a database update event processing apparatus according to an embodiment of the present invention;
fig. 4 is a block diagram of another embodiment of a database update event processing apparatus according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the disclosure, the invention will be described in further detail with reference to the accompanying drawings and specific embodiments. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms "first," "second," "third," "fourth," and the like in the description and claims of this application and in the above-described drawings are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "comprising" and "having," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements but may include other steps or elements not expressly listed.
Having described the technical solutions of the embodiments of the present invention, various non-limiting embodiments of the present application are described in detail below.
Referring to fig. 1, fig. 1 is a schematic flow chart of a database update event processing method according to an embodiment of the present invention, where the embodiment of the present invention includes the following:
s101: dynamic proxy components for performing database update operations are pre-built.
The dynamic proxy component is used for monitoring various database updating events such as data insertion or data updating and issuing the updating events through the database interface, and event consumers can complete the consumption of the events by realizing the interface without finishing the whole process every time the events are updated according to the related technology. To implement update operations on the entire database, the dynamic proxy components may include an event proxy subcomponent, a transaction proxy subcomponent, an event processing subcomponent and a task processing subcomponent. The event agent subcomponent is used for monitoring a specified target data access interface or a target data access object, and the data access interface is an object-oriented database interface and is sandwiched between the business logic and the database resources. And further specifies an interface to monitor database updates, such as a monitor store operation or an update operation. In the updating process of the system, dynamic agent information is generated when the instance of the target data access interface stores or updates the method, the dynamic agent information is used for expressing the operation type of the concrete realization database, simultaneously the message is recorded, and the message is sent to the message library. The transaction agent subcomponent is used for designating a target during initialization, detecting an instance of the running target in a running stage, generating a corresponding dynamic agent class, acquiring a database operation type to be executed in the running transaction, calling a corresponding interface function to realize the operation on the database, and then issuing a database change message through the event processing subcomponent. The event processing subassembly is used for issuing information to the task processing subassembly, the task processing subassembly can comprise an interface and a plurality of implementations, the issuing event of the event processing subassembly immediately completes the calling of the interface, the receiving of the event is completed through the plurality of implementations, and corresponding specific tasks are executed according to task information carried by the specific event.
S102: and when receiving a user database operation request, issuing a database operation execution task.
It can be understood that, a user needs to send a database operation request to the system when wanting to perform a data update or data insertion operation on the database, and the system generates a database operation execution task based on the database operation request of the user and issues the database operation execution task after receiving the database operation request of the user. For the database operation requests of a plurality of users at the same time, the corresponding database operation execution tasks can be sequentially issued according to the sequence of the request time, can also be issued randomly, or can be issued according to the preset priority sequence, which does not affect the implementation of the application.
S103: and calling an event agent subcomponent to monitor target events of the access target data access interface in the execution process of the database operation execution task, and recording each target event and the corresponding executed database operation type in a pre-constructed message library.
The message library is used for storing a plurality of dynamic proxy messages, each dynamic proxy message is generated by an event proxy subcomponent record, the plurality of dynamic proxy messages can be messages which are already executed by using a transaction proxy subcomponent, and messages waiting for the execution of the transaction proxy subcomponent can be called to-be-processed messages. The database operation type is the type of operation that the target event wants to execute on the database through the target data access interface, such as a data insertion operation or a data update operation or a data delete operation.
S104: if the message library has the message to be processed, the transaction agent subassembly is called to perform database operation according to the database operation type of the message to be processed, and meanwhile, the message to be processed is issued to the task processing subassembly through the event processing subassembly, so that the task processing subassembly executes the task information carried by the message to be processed.
In the embodiment of the invention, only if the message to be processed exists in the message library, the transaction agent subcomponent is called to call the existing function in the interface to execute the corresponding data operation. It can be understood that, after the database update message is executed, tasks such as notification of successful completion of operations or rollback of operation failure are generally required to be performed on the to-be-processed message, and these tasks may be set in the to-be-processed message as task information through different field values or state information, and the task processing subcomponent reads these task information and calls corresponding function functions to execute these tasks.
In the technical scheme provided by the embodiment of the invention, the dynamic proxy component is constructed in advance, various database updating events can be monitored by utilizing the dynamic proxy component, such as inserting or releasing information after updating, an event consumer can complete the consumption of the events by realizing the interface, the complex definition and processing of the events are avoided, a complete data processing process of a normal stream or an abnormal stream which needs to be processed by the event consumer is not needed to be executed for each updating, operations such as task completion or failure rollback or notification can be carried out according to task states carried in the events or other information, the database updating events can be flexibly processed, the database updating operation efficiency is higher, and the code reusability and the code maintainability are effectively improved.
In order to improve system response and to implement database update operation more quickly, an embodiment of the present invention further provides an implementation manner of S102, that is, an implementation process for receiving a user database operation request and issuing a database operation execution task may include:
and when receiving a user database operation request, automatically creating a database operation execution task as a parent task.
And dividing the database operation execution task into a plurality of subtasks based on the logic sequence of each step in the database operation execution task. Each subtask may correspond to one step or a plurality of steps, which does not affect the implementation of the present application.
And calling a plurality of threads to sequentially and asynchronously issue each subtask according to the logic sequence of each subtask so that the database updating operation of each subtask is completed by calling the dynamic proxy component. In the embodiment of the invention, the total number of the threads can be the same as the total number of the subtasks or less than the total number of the subtasks, and the total number of the threads is determined on the basis of ensuring the normal operation of the system.
As an alternative embodiment, in order to ensure the efficiency of executing the database operation execution task without missing the execution of the database operation execution task, the event processing subcomponent may be further configured to remove the message function, and accordingly, after S104, may further include:
and when the completion of the release of the message to be processed is detected, calling the transaction agent subcomponent to eliminate the record of the message to be processed.
And if the completion of the task execution of the message to be processed is detected, calling the event processing sub-component to remove the message to be processed from the message library.
In the above embodiment, how to execute step S101 is not limited, in this embodiment, a construction manner of a dynamic proxy component is provided, the dynamic proxy component is processed by a dynamic proxy class in a running stage, and the dynamic proxy may perform corresponding operations before or after an executed proxy method, and may be implemented based on a JAVA language, and encapsulate a computer program implementing specific functions as corresponding subcomponents. The event agent subcomponent may be a transaction agent class for executing a service, the transaction agent subcomponent may be an event agent class for executing a Dao (Data Access Object) database operation class, and the event agent class monitors a save or update method of the Dao database operation class and records a database update message, where the transaction agent class monitors the service class to implement publishing of an event, and may specifically include the following steps, as shown in fig. 2:
the transaction agent class is a java class, the InvocationHandler is realized, the invoke method is realized, the target class is designated during initialization, the instance of the running target class is detected in the running stage, the corresponding agent class is generated, the method in the running transaction is acquired, the user agent class completes the calling of the method, manually submits the transaction, updates the database, then releases the database change message through the event processing sub-component, and clears the message record when the transaction is finished.
The event agent class is a java class, implements InvocationHandler, monitors a specified target Dao class, and further specifies an interface for updating a monitored database, such as a specified monitoring save or update method.
The event processing sub-component is an event monitor which can comprise two processing methods, namely event issuing and message removing, wherein the event issuing is to firstly judge whether a message to be processed exists in a message library, if so, a database updating event is issued, otherwise, the database updating event is not issued; removing a message is removing a message in the message library.
The task processing subassembly can comprise an interface and n implementations, the issuing event of the event processing subassembly immediately completes the calling of the interface, and the task processing subassembly completes the receiving of the event through the n implementations and takes specific operation according to specific event information.
As can be seen from the above, the dynamic proxy component in the embodiment of the present invention monitors the specific method of the database of the specific entity class, and issues an event to the task processing subcomponent to complete the corresponding task operation.
It can be understood that many application scenarios need to perform corresponding different operations according to the specific state value of the data after the database is updated, so that the code implementation is more flexible, the reusability and the easy maintenance of the code are improved, and the performance and the stability of the system for processing the database update event are obtained. Based on this, as shown in fig. 2, the task processing subcomponent in the embodiment of the present invention includes a parent task event processing unit, a parent task completion processing unit, and a child task completion processing unit;
the parent task event processing unit is used for recording required log records for the corresponding parent task according to the task execution state of each subtask so as to facilitate viewing and positioning; the parent task completion processing unit is used for updating the state of the corresponding parent task according to the task execution state of each subtask; and the subtask completion processing unit is used for performing corresponding rollback or task notification operation according to the task information of each subtask.
In order to improve the execution efficiency of the database update operation, the task processing sub-component may further include a plurality of parent task event processing units, a plurality of parent task completion processing units, and a plurality of child task completion processing units for executing a plurality of parent tasks and a plurality of child tasks at the same time.
As an optional implementation manner, in order to timely process a database update operation request of a user, a tag update operation may be performed on each message stored in a message library in real time, which may include the following:
updating the corresponding label type for each message to be processed in the message library in real time according to the current execution state of each message to be processed; the type of the label is any one of the following items:
tags to be processed, tags not issued, tags issued, task-waiting execution tags, and tags completed.
It should be noted that, in the present application, there is no strict sequential execution order among the steps, and as long as a logical order is met, the steps may be executed simultaneously or according to a certain preset order, and fig. 1 to fig. 2 are only schematic manners, and do not represent only such an execution order.
The embodiment of the invention also provides a corresponding device for the database updating event processing method, so that the method has higher practicability. Wherein the means can be described separately from the functional module point of view and the hardware point of view. In the following, the database update event processing apparatus provided in the embodiment of the present invention is introduced, and the database update event processing apparatus described below and the database update event processing method described above may be referred to in correspondence with each other.
Based on the angle of the function module, referring to fig. 3, fig. 3 is a structural diagram of a database update event processing apparatus according to an embodiment of the present invention, in a specific implementation manner, the apparatus may include:
the component pre-construction module 301 is used for pre-constructing dynamic proxy components for executing database updating operations, wherein the dynamic proxy components comprise an event proxy subcomponent, a transaction proxy subcomponent, an event processing subcomponent and a task processing subcomponent.
The task issuing module 302 is configured to issue a database operation execution task when receiving a user database operation request.
And the message generation module 303 is configured to invoke a target event of the target data access interface in the execution process of the event agent subcomponent monitoring database operation execution task, and record each target event and the corresponding executed database operation type in a pre-constructed message library.
And the database operation executing module 304 is configured to, if the message library has the to-be-processed message, invoke the transaction agent subcomponent to perform database operation according to the database operation type of the to-be-processed message, and simultaneously issue the to-be-processed message to the task processing subcomponent through the event processing subcomponent, so that the task processing subcomponent executes task information carried by the to-be-processed message.
Optionally, in some embodiments of this embodiment, the task issuing module 302 may include:
the parent task creating submodule is used for automatically creating a database operation execution task as a parent task when receiving a user database operation request;
the task splitting sub-module is used for splitting the database operation execution task into a plurality of sub-tasks based on the logic sequence of each step in the database operation execution task;
and the subtask asynchronous issuing sub-module is used for calling a plurality of threads to asynchronously issue each subtask in turn according to the logic sequence of each subtask so as to enable the database updating operation of each subtask to call the dynamic proxy component to complete.
Optionally, in another implementation manner of this embodiment, the task processing sub-component includes a parent task event processing unit, a parent task completion processing unit, and a child task completion processing unit;
the parent task event processing unit is used for recording required log records for the corresponding parent task according to the task execution state of each subtask so as to facilitate viewing and positioning; the parent task completion processing unit is used for updating the state of the corresponding parent task according to the task execution state of each subtask; and the subtask completion processing unit is used for performing corresponding rollback or task notification operation according to the task information of each subtask.
In some other embodiments of the present invention, the task processing sub-component includes a plurality of parent task event processing units, a plurality of parent task completion processing units and a plurality of child task completion processing units, so as to execute a plurality of parent tasks and a plurality of child tasks simultaneously.
As an optional implementation manner, the apparatus may further include, for example, a tag setting module, configured to update, in real time, a corresponding tag type for each to-be-processed message in the message library according to a current execution state of each to-be-processed message; the type of the label is any one of the following items:
tags to be processed, tags not issued, tags issued, task-waiting execution tags, and tags completed.
In another optional implementation, the apparatus may further include a data clearing module, where the data clearing module includes:
the information clearing sub-module is used for calling the transaction agent sub-module to eliminate the record of the message to be processed when the completion of the release of the message to be processed is detected;
and the removing submodule is used for calling the event processing subcomponent to remove the message to be processed from the message library if the completion of the execution of the message task to be processed is detected.
The functions of the functional modules of the database update event processing apparatus according to the embodiment of the present invention may be specifically implemented according to the method in the foregoing method embodiment, and the specific implementation process may refer to the related description of the foregoing method embodiment, which is not described herein again.
Therefore, the embodiment of the invention can flexibly process the database updating event and effectively improve the code reusability and the easy maintenance of the code.
The above mentioned database update event processing device is described from the perspective of a functional module, and further, the present application also provides a database update event processing device, which is described from the perspective of hardware. Fig. 4 is a block diagram of another database update event processing apparatus according to an embodiment of the present application. As shown in fig. 4, the apparatus comprises a memory 40 for storing a computer program;
a processor 41, configured to implement the steps of the database update event processing method according to any of the above embodiments when executing the computer program.
Processor 41 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and so forth. The processor 41 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 41 may also include a main processor and a coprocessor, the main processor is a processor for processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 41 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content required to be displayed on the display screen. In some embodiments, processor 41 may further include an AI (Artificial Intelligence) processor for processing computational operations related to machine learning.
Memory 40 may include one or more computer-readable storage media, which may be non-transitory. Memory 40 may also include high speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In this embodiment, the memory 40 is at least used for storing the computer program 401, wherein after being loaded and executed by the processor 41, the computer program can implement the relevant steps of the database update event processing method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 40 may also include an operating system 402, data 403, and the like, and the storage manner may be a transient storage or a permanent storage. Operating system 402 may include, among other things, Windows, Unix, Linux, and the like. Data 403 may include, but is not limited to, data corresponding to test results, and the like.
In some embodiments, the database update event processing device may further include a display 42, an input/output interface 43, a communication interface 44, a power supply 45, and a communication bus 46.
Those skilled in the art will appreciate that the configuration shown in FIG. 4 does not constitute a limitation of the database update event processing arrangement and may include more or fewer components than those shown, such as sensors 47.
The functions of the functional modules of the database update event processing apparatus according to the embodiment of the present invention may be specifically implemented according to the method in the foregoing method embodiment, and the specific implementation process may refer to the related description of the foregoing method embodiment, which is not described herein again.
Therefore, the embodiment of the invention can flexibly process the database updating event and effectively improve the code reusability and the easy maintenance of the code.
It is to be understood that, if the database update event processing method in the above embodiment is implemented in the form of a software functional unit and sold or used as a stand-alone product, it may be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application may be substantially or partially implemented in the form of a software product, which is stored in a storage medium and executes all or part of the steps of the methods of the embodiments of the present application, or all or part of the technical solutions. And the aforementioned storage medium includes: a U disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), an electrically erasable programmable ROM, a register, a hard disk, a removable magnetic disk, a CD-ROM, a magnetic or optical disk, and other various media capable of storing program codes.
Based on this, an embodiment of the present invention further provides a computer-readable storage medium, in which a database update event processing program is stored, and the database update event processing program is executed by a processor, and the steps of the database update event processing method according to any one of the above embodiments are provided.
The functions of the functional modules of the computer-readable storage medium according to the embodiment of the present invention may be specifically implemented according to the method in the foregoing method embodiment, and the specific implementation process may refer to the related description of the foregoing method embodiment, which is not described herein again.
Therefore, the embodiment of the invention can flexibly process the database updating event and effectively improve the code reusability and the easy maintenance of the code.
The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The foregoing provides a detailed description of a database update event processing method, apparatus, and computer-readable storage medium. The principles and embodiments of the present invention are explained herein using specific examples, which are presented only to assist in understanding the method and its core concepts. It should be noted that, for those skilled in the art, it is possible to make various improvements and modifications to the present invention without departing from the principle of the present invention, and those improvements and modifications also fall within the scope of the claims of the present application.

Claims (10)

1. A database update event processing method is characterized by comprising the following steps:
the method comprises the steps that a dynamic proxy component used for executing database updating operation is constructed in advance, and the dynamic proxy component comprises an event proxy subcomponent, a transaction proxy subcomponent, an event processing subcomponent and a task processing subcomponent;
when receiving a user database operation request, issuing a database operation execution task;
calling the event agent subcomponent to monitor target events of an access target data access interface in the execution process of the database operation execution task, and recording each target event and the corresponding executed database operation type in a pre-constructed message library;
if the message library has the message to be processed, calling the transaction agent subassembly to perform database operation according to the database operation type of the message to be processed, and simultaneously issuing the message to be processed to the task processing subassembly through the event processing subassembly so that the task processing subassembly executes the task information carried by the message to be processed.
2. The method for processing database update events according to claim 1, wherein the issuing a database operation execution task when receiving a user database operation request comprises:
when receiving a user database operation request, automatically creating a database operation execution task as a parent task;
dividing the database operation execution task into a plurality of subtasks based on the logic sequence of each step in the database operation execution task;
and calling a plurality of threads to sequentially and asynchronously issue each subtask according to the logic sequence of each subtask so as to call the dynamic proxy component to complete the database updating operation of each subtask.
3. The database update event processing method according to claim 2, wherein the task processing subcomponent includes a parent task event processing unit, a parent task completion processing unit, and a child task completion processing unit;
the parent task event processing unit is used for recording required log records for the corresponding parent task according to the task execution state of each subtask so as to facilitate viewing and positioning; the parent task completion processing unit is used for updating the state of the corresponding parent task according to the task execution state of each subtask; and the subtask completion processing unit is used for performing corresponding rollback or task notification operation according to the task information of each subtask.
4. The database update event processing method according to claim 3, wherein the task processing subcomponent includes a plurality of parent task event processing units, a plurality of parent task completion processing units, and a plurality of child task completion processing units, for executing a plurality of parent tasks and a plurality of child tasks at the same time.
5. The method according to any one of claims 1 to 4, wherein after recording each target event and the type of the corresponding executed database operation in a pre-constructed message library, the method further comprises:
updating corresponding label types for the messages to be processed in the message library in real time according to the current execution state of the messages to be processed; the label type is any one of the following items:
tags to be processed, tags not issued, tags issued, task-waiting execution tags, and tags completed.
6. The database update event processing method according to claim 5, wherein after the message to be processed is issued to the task processing subcomponent through the event processing subcomponent at the same time, the method further comprises:
when the completion of the release of the message to be processed is detected, the transaction agent subcomponent is called to eliminate the record of the message to be processed;
and if the completion of the task execution of the message to be processed is detected, calling the event processing subassembly to remove the message to be processed from the message library.
7. A database update event processing apparatus, comprising:
the system comprises a component pre-construction module, a task processing module and a task processing module, wherein the component pre-construction module is used for pre-constructing a dynamic proxy component for executing database updating operation, and the dynamic proxy component comprises an event proxy subcomponent, a transaction proxy subcomponent, an event processing subcomponent and a task processing subcomponent;
the task issuing module is used for issuing database operation execution tasks when receiving user database operation requests;
the message generation module is used for calling the event agent subcomponent to monitor a target event for accessing a target data access interface in the execution process of the database operation execution task, and recording each target event and the corresponding executed database operation type in a pre-constructed message library;
and the database operation execution module is used for calling the transaction agent subcomponent to perform database operation according to the database operation type of the message to be processed if the message to be processed exists in the message library, and simultaneously issuing the message to be processed to the task processing subcomponent through the event processing subcomponent so that the task processing subcomponent executes the task information carried by the message to be processed.
8. The database update event processing apparatus according to claim 7, wherein the task issuing module includes:
the parent task creating submodule is used for automatically creating a database operation execution task as a parent task when receiving a user database operation request;
the task splitting sub-module is used for splitting the database operation execution task into a plurality of sub-tasks based on the logic sequence of each step in the database operation execution task;
and the subtask asynchronous issuing sub-module is used for calling a plurality of threads to asynchronously issue each subtask in turn according to the logic sequence of each subtask so as to call the dynamic proxy component to complete the database updating operation of each subtask.
9. A database update event processing apparatus comprising a processor for implementing the steps of the database update event processing method according to any one of claims 1 to 6 when executing a computer program stored in a memory.
10. A computer-readable storage medium, having a database update event handler stored thereon, which when executed by a processor implements the steps of the database update event handling method according to any one of claims 1 to 6.
CN202010597638.3A 2020-06-28 2020-06-28 Database update event processing method and device and computer readable storage medium Withdrawn CN111737275A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010597638.3A CN111737275A (en) 2020-06-28 2020-06-28 Database update event processing method and device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010597638.3A CN111737275A (en) 2020-06-28 2020-06-28 Database update event processing method and device and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN111737275A true CN111737275A (en) 2020-10-02

Family

ID=72651319

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010597638.3A Withdrawn CN111737275A (en) 2020-06-28 2020-06-28 Database update event processing method and device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN111737275A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112363817A (en) * 2020-11-27 2021-02-12 Oppo广东移动通信有限公司 Big data task execution method and device, storage medium and server
CN112612804A (en) * 2020-12-22 2021-04-06 新华三大数据技术有限公司 Service management parameter updating method and device
CN114328549A (en) * 2021-12-16 2022-04-12 北京百度网讯科技有限公司 Data processing method and device, electronic equipment and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112363817A (en) * 2020-11-27 2021-02-12 Oppo广东移动通信有限公司 Big data task execution method and device, storage medium and server
CN112612804A (en) * 2020-12-22 2021-04-06 新华三大数据技术有限公司 Service management parameter updating method and device
CN112612804B (en) * 2020-12-22 2023-03-31 新华三大数据技术有限公司 Service management parameter updating method and device
CN114328549A (en) * 2021-12-16 2022-04-12 北京百度网讯科技有限公司 Data processing method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN111737275A (en) Database update event processing method and device and computer readable storage medium
CN105068865A (en) Task scheduling method and apparatus
CN112416415A (en) Front-end micro-service implementation method and related components
CN110162344B (en) Isolation current limiting method and device, computer equipment and readable storage medium
WO2020232951A1 (en) Task execution method and device
US20130304442A1 (en) Scheduling discrete event simulation
CN111143039A (en) Virtual machine scheduling method and device and computer storage medium
CN110569113A (en) Method and system for scheduling distributed tasks and computer readable storage medium
CN113127299A (en) Server operation and maintenance method, device and system and computer readable storage medium
CN112153126A (en) Deployment and node management method and system for K8S cluster
CN111158800A (en) Method and device for constructing task DAG based on mapping relation
CN113190427A (en) Caton monitoring method and device, electronic equipment and storage medium
CN110908644B (en) Configuration method and device of state node, computer equipment and storage medium
CN111158877A (en) Event management method and device for big data platform and computer readable storage medium
CN107958414B (en) Method and system for eliminating long transactions of CICS (common integrated circuit chip) system
CN115599401A (en) Publishing method, device, equipment and medium of user-defined model
CN113835835B (en) Method, device and computer readable storage medium for creating consistency group
CN108062224A (en) Data read-write method, device and computing device based on file handle
CN113760403A (en) State machine linkage method and device
CN111381976A (en) Message prompt data updating method and device, storage medium and computer equipment
CN115543543A (en) Application service processing method, device, equipment and medium
CN114721876A (en) Data backup method, device and medium
CN112202724B (en) Data aggregation method and device of all-in-one arrangement mode
CN114237775A (en) Parallel execution method and device, electronic equipment and storage medium
CN112488462A (en) Unified pushing method, device and medium for workflow data

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
WW01 Invention patent application withdrawn after publication
WW01 Invention patent application withdrawn after publication

Application publication date: 20201002