Response method, device and equipment of database system event and storage medium

By creating a new target thread to receive and process event trigger signals, and by using built-in functions to traverse and store the system trigger list, the system achieves automated and standardized responses to database system events, solving the problem of delayed response to database system events and improving the timeliness and accuracy of responses.

CN121579176BActive Publication Date: 2026-06-23TIANJIN NANKAI UNIV GENERAL DATA TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TIANJIN NANKAI UNIV GENERAL DATA TECH
Filing Date
2026-01-23
Publication Date
2026-06-23

AI Technical Summary

Technical Problem

In existing technologies, database systems often fail to respond promptly to system events, exhibiting high response delays and an inability to accurately invoke built-in functions of system triggers, thus compromising data integrity.

Method used

By creating a new target thread to receive event trigger signals from system threads, determining the system event type based on the event flag, traversing the system trigger list, storing the corresponding built-in functions in the function queue, and executing them sequentially, an automated and standardized database system event response is achieved.

Benefits of technology

Ensure the timeliness and accuracy of database system event responses, avoid response omissions or call errors, adapt to complex scenarios with multiple databases and multiple event types, reduce the probability of abnormal system thread load, and improve traversal efficiency and overall response efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121579176B_ABST
    Figure CN121579176B_ABST
Patent Text Reader

Abstract

The application provides a database system event response method, device and equipment and a storage medium, which can be applied to the technical field of databases. The method comprises the following steps: in response to a target thread receiving an event trigger signal sent by a system thread, determining a system event type corresponding to the event trigger signal based on an event mark carried by the event trigger signal; for each target database in a database system, obtaining a system trigger list of the target database, the system trigger list storing at least one system trigger configured on the target database; based on the system event type, traversing the at least one system trigger stored in the system trigger list, and storing built-in functions in a target system trigger corresponding to the system event type into a function queue; in response to completing the traversal of the system trigger list, executing the built-in functions in the function queue in sequence, so that the target database responds to the system event.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of database technology, and more specifically to a method, apparatus, device, and storage medium for responding to database system events. Background Technology

[0002] During the operation and maintenance of a database system, system events that may affect the data integrity of the database, such as database startup and shutdown, database backup and recovery, and database login and logout, occur frequently. Therefore, after a system event is triggered, the database can be controlled to perform operations according to the type of system event in order to maintain data integrity.

[0003] In related technologies, triggers for system events are typically created within the database, and these triggers are polled at a preset frequency to periodically determine whether each trigger needs to be fired. However, since polling usually introduces latency, it is difficult to trigger triggers promptly after a system event occurs, resulting in a high response delay. Summary of the Invention

[0004] In view of the above problems, the present invention provides a method, apparatus, device and storage medium for responding to database system events.

[0005] According to a first aspect of the present invention, a method for responding to database system events is provided, comprising: in response to a target thread receiving an event trigger signal sent by a system thread, determining a system event type corresponding to the event trigger signal based on an event marker carried by the event trigger signal, wherein the system thread is a thread in the database system used to execute system events, and the target thread is a thread in the database system used to monitor various system threads; for each target database in the database system, obtaining a list of system triggers for the target database, the list of system triggers storing at least one system trigger configured on the target database; based on the system event type, traversing the at least one system trigger stored in the list of system triggers, and storing the built-in functions in the target system triggers corresponding to the system event type into a function queue; in response to the completion of traversing the list of system triggers, sequentially executing the built-in functions in the function queue to cause the target database to respond to the system event.

[0006] According to an embodiment of the present invention, based on the system event type, traversing at least one system trigger stored in the system trigger list and storing the built-in function in the target system trigger corresponding to the system event type into a function queue includes: traversing at least one system trigger stored in the system trigger list to determine the triggering condition corresponding to each of the at least one system trigger; determining the target system trigger from the at least one system trigger based on the system event type, wherein the system event type satisfies the triggering condition of the target system trigger; parsing the function body of the target system trigger to determine the built-in function of the target system trigger; and storing the built-in function into the function queue.

[0007] According to an embodiment of the present invention, the function body of the system trigger includes a trigger event type and a trigger timing; traversing at least one system trigger stored in the system trigger list to determine the trigger conditions corresponding to each of the at least one system trigger includes: for each system trigger stored in the system trigger list, determining the trigger event type and trigger timing included in the function body of the system trigger; and determining the trigger conditions corresponding to the system trigger based on the trigger event type and trigger timing.

[0008] According to an embodiment of the present invention, an event trigger signal is generated in the following manner: in response to a system event triggered in the database system, an event flag corresponding to the system event type is determined based on the system event type of the system event; and an event trigger signal is generated based on the event flag and the thread flag of the target thread using a system thread used to execute the system event.

[0009] According to an embodiment of the present invention, determining the system event type corresponding to the event trigger signal based on the event marker carried by the event trigger signal includes: parsing the event trigger signal to obtain the event marker carried by the event trigger signal; and determining the system event type corresponding to the event marker based on a preset mapping relationship between multiple event markers and multiple system event types, which is then used as the system event type corresponding to the event trigger signal.

[0010] According to an embodiment of the present invention, a database system includes multiple target databases; for each target database in the database system, obtaining a system trigger list for the target database includes: obtaining a system file from the default database of the database system for storing the multiple target databases in the database system; determining the multiple target databases existing in the database system and their respective authentication information based on the system file; and accessing each target database based on its respective authentication information to obtain a system trigger list for each target database.

[0011] According to an embodiment of the present invention, a system trigger is configured to a target database in the following manner: triggering conditions are set based on the system event type and triggering timing targeted by the system trigger; a built-in function is set based on the expected response after the system event type is triggered; a target name for the system trigger is determined based on the trigger names of other configured system triggers in the system trigger list of the target database, wherein the target name is different from the trigger names of other system triggers; a target trigger is determined based on the triggering conditions, built-in function, and trigger name; the target trigger is configured to the target database, and the trigger name and triggering conditions of the target trigger are saved to the system trigger list.

[0012] A second aspect of the present invention provides a database system event response apparatus, comprising: a type determination module, configured to, in response to a target thread receiving an event trigger signal sent by a system thread, determine a system event type corresponding to the event trigger signal based on an event marker carried by the event trigger signal, wherein the system thread is a thread in the database system used to execute system events, and the target thread is a thread in the database system used to monitor various system threads; a list acquisition module, configured to, for each target database in the database system, acquire a list of system triggers for the target database, wherein the system trigger list stores at least one system trigger configured on the target database; a list traversal module, configured to, based on the system event type, traverse at least one system trigger stored in the system trigger list, and store the built-in functions in the target system triggers corresponding to the system event type into a function queue; and a function execution module, configured to, in response to the completion of traversing the system trigger list, sequentially execute the built-in functions in the function queue, so that the target database responds to the system event.

[0013] A third aspect of the present invention provides an electronic device comprising: one or more processors; and a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the method described above.

[0014] A fourth aspect of the present invention also provides a computer-readable storage medium having a computer program or instructions stored thereon, wherein the computer program or instructions, when executed by a processor, implement the steps of the above-described method.

[0015] A fifth aspect of the present invention also provides a computer program product, including a computer program or instructions that, when executed by a processor, implement the steps of the above-described method.

[0016] According to an embodiment of the present invention, by receiving event trigger signals from system threads through a newly created target thread, matching the system event type, traversing the system trigger list, enqueuing the corresponding built-in functions, and executing them sequentially, automated and standardized responses to database system events are achieved. This ensures that after a system event is triggered in the database system, the built-in function of the system trigger corresponding to the system event type is accurately called, avoiding response omissions or call errors, improving the timeliness and accuracy of database system event responses, adapting to complex scenarios with multiple databases and multiple event types, and without increasing the load on system threads, reducing the probability of system threads encountering anomalies due to excessive load. After obtaining the target system trigger during the traversal process, its built-in function is not executed directly, but is first stored in the function queue. This avoids delays in traversal due to waiting for the execution of built-in functions, preventing late release of the system trigger list, and improving traversal efficiency and overall response efficiency. Attached Figure Description

[0017] The above-mentioned contents, as well as other objects, features and advantages of the present invention, will become clearer from the following description of embodiments of the present invention with reference to the accompanying drawings.

[0018] Figure 1 The diagram illustrates an application scenario of a database system event response method, apparatus, device, and storage medium according to embodiments of the present invention.

[0019] Figure 2 A flowchart illustrating a database system event response method according to an embodiment of the present invention is shown.

[0020] Figure 3 A timing diagram of a target thread triggering a system trigger is shown according to an embodiment of the present invention.

[0021] Figure 4 A structural block diagram of a database system event response device according to an embodiment of the present invention is shown.

[0022] Figure 5 A block diagram of an electronic device suitable for implementing a database system event response method according to an embodiment of the present invention is shown. Detailed Implementation

[0023] Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the invention. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of the invention for ease of explanation. However, it will be apparent that one or more embodiments may be practiced without these specific details. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concept of the invention.

[0024] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the invention. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.

[0025] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.

[0026] When using expressions such as "at least one of A, B and C", they should generally be interpreted in accordance with the meaning that is commonly understood by those skilled in the art (e.g., "a system having at least one of A, B and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B and C, etc.).

[0027] In the technical solution of this invention, the user information (including but not limited to user personal information, user image information, user device information, such as location information) and data (including but not limited to data used for analysis, stored data, and displayed data) involved are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, storage, use, processing, transmission, provision, invention, and application of related data all comply with relevant laws, regulations, and standards, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entry points for users to choose to authorize or refuse.

[0028] In scenarios involving automated decision-making using personal information, the methods, devices, and systems provided in this invention offer users corresponding entry points for choosing to agree to or reject the automated decision-making results. If the user chooses to reject, the process proceeds to the expert decision-making stage. Here, "automated decision-making" refers to the activity of automatically analyzing and evaluating an individual's behavioral habits, interests, or economic, health, and credit status through computer programs, and then making a decision. Here, "expert decision-making" refers to the activity of making decisions by personnel who specialize in a particular field, possess specialized experience, knowledge, and skills, and have reached a certain level of professional expertise.

[0029] An embodiment of the present invention provides a database system event response method, comprising: in response to a target thread receiving an event trigger signal sent by a system thread, determining a system event type corresponding to the event trigger signal based on an event marker carried by the event trigger signal, wherein the system thread is a thread in the database system used to execute system events, and the target thread is a thread in the database system used to monitor various system threads; for each target database in the database system, obtaining a system trigger list for the target database, the system trigger list storing at least one system trigger configured on the target database; based on the system event type, traversing the at least one system trigger stored in the system trigger list, and storing the built-in functions in the target system triggers corresponding to the system event type into a function queue; in response to the completion of traversing the system trigger list, sequentially executing the built-in functions in the function queue to enable the target database to respond to the system event.

[0030] Figure 1 The diagram illustrates an application scenario of a database system event response method, apparatus, device, and storage medium according to embodiments of the present invention.

[0031] like Figure 1 As shown, application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 serves as a medium for providing a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.

[0032] Users can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 via the network 104 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).

[0033] The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.

[0034] Server 105 can be a server that provides various services, such as a backend management server that supports websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (this is just an example). The backend management server can analyze and process data such as received user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal devices.

[0035] It should be noted that the database system event response method provided in this embodiment of the invention can generally be executed by server 105. Correspondingly, the database system event response device provided in this embodiment of the invention can generally be located in server 105. The database system event response method provided in this embodiment of the invention can also be executed by a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105. Correspondingly, the database system event response device provided in this embodiment of the invention can also be located in a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105.

[0036] It should be understood that Figure 1 The number of first terminal devices, second terminal devices, third terminal devices, networks, and servers shown in the diagram is merely illustrative. Depending on implementation needs, any number of first terminal devices, second terminal devices, third terminal devices, networks, and servers can be included.

[0037] Figure 2 A flowchart illustrating a database system event response method according to an embodiment of the present invention is shown.

[0038] like Figure 2 As shown, the database system event response method of this embodiment includes operations S210 to S240.

[0039] In operation S210, in response to the target thread receiving an event trigger signal sent by the system thread, the system event type corresponding to the event trigger signal is determined based on the event flag carried by the event trigger signal.

[0040] In operation S220, for each target database in the database system, obtain the list of system triggers for the target database.

[0041] In operation S230, based on the system event type, at least one system trigger stored in the system trigger list is traversed, and the built-in function in the target system trigger corresponding to the system event type is stored in the function queue.

[0042] In operation S240, in response to the completion of traversing the system trigger list, the built-in functions in the function queue are executed sequentially to enable the target database to respond to system events.

[0043] System threads are threads in a database system used to execute system events. Target threads can be newly created threads within the database system to monitor various system threads in response to database system events. For example, a new thread, sysevent_trig, can be created in the database system kernel as the target thread.

[0044] Event trigger signals are generated after a system event is triggered in the database system. Event trigger signals carry event markers. The database system pre-maintains a correspondence between multiple event markers and multiple system event types. Therefore, based on the event markers carried by the event trigger signal, the system event type corresponding to the event trigger signal can be determined according to the correspondence.

[0045] In the examples of this invention, system event types may include database start / stop, database backup / restore, database login, database logout, database internal execution checkpoints, etc.

[0046] A database system can contain multiple target databases. These target databases are created by users based on their business needs and are used to store business data. For each target database in the database system, a list of system triggers can be obtained. This list contains at least one system trigger configured on the target database, and each system trigger is matched with a system event of a specific system event type.

[0047] Based on the system trigger list, all system triggers configured on the target database can be identified. By traversing these system triggers, the system event type matching each trigger can be determined. From at least one system trigger, the system trigger matching the system event type corresponding to the event trigger signal can be identified and used as the target system trigger.

[0048] Since the target system trigger corresponds to the system event type, the target system trigger will be triggered accordingly after the current system event is triggered. The target system trigger includes built-in functions, which represent the operations to be performed when the target system trigger is triggered.

[0049] Since there can be multiple system triggers corresponding to the same system event type in the system trigger list, after determining the target system trigger, the built-in function of the target system trigger can be stored in the function queue used to store built-in functions, and the system trigger list can continue to be traversed.

[0050] After traversing the system trigger list, the built-in functions stored in the function queue are the operations that the target database needs to perform in response to system events. By executing the built-in functions in the function queue in sequence, the target database can respond to system events.

[0051] According to an embodiment of the present invention, by receiving event trigger signals from system threads through a newly created target thread, matching the system event type, traversing the system trigger list, enqueuing the corresponding built-in functions, and executing them sequentially, automated and standardized responses to database system events are achieved. This ensures that after a system event is triggered in the database system, the built-in function of the system trigger corresponding to the system event type is accurately called, avoiding response omissions or call errors, improving the timeliness and accuracy of database system event responses, adapting to complex scenarios with multiple databases and multiple event types, and without increasing the load on system threads, reducing the probability of system threads encountering anomalies due to excessive load. After obtaining the target system trigger during the traversal process, its built-in function is not executed directly, but is first stored in the function queue. This avoids delays in traversal due to waiting for the execution of built-in functions, preventing late release of the system trigger list, and improving traversal efficiency and overall response efficiency.

[0052] According to an embodiment of the present invention, based on the system event type, traversing at least one system trigger stored in the system trigger list and storing the built-in function in the target system trigger corresponding to the system event type into a function queue includes: traversing at least one system trigger stored in the system trigger list to determine the triggering condition corresponding to each of the at least one system trigger; determining the target system trigger from the at least one system trigger based on the system event type, wherein the system event type satisfies the triggering condition of the target system trigger; parsing the function body of the target system trigger to determine the built-in function of the target system trigger; and storing the built-in function into the function queue.

[0053] The system trigger list can store at least one system trigger and the trigger conditions for each system trigger. By using the system trigger list, you can obtain the trigger conditions corresponding to each of the at least one system trigger.

[0054] Based on the system event type and the triggering conditions corresponding to at least one system trigger, the target system trigger triggered by the event of the system event type can be determined from at least one system trigger. After determining the target system trigger, the built-in function can be determined from the function body of the target system trigger and stored in the function queue.

[0055] According to embodiments of the present invention, by traversing triggers and verifying trigger conditions, the target trigger is accurately located, and the built-in function is parsed and enqueued, thus achieving refined trigger selection. This avoids resource waste or erroneous responses caused by indiscriminately executing all trigger functions, and only executes trigger functions that match the current system event, improving the accuracy and efficiency of event response and reducing the additional performance overhead of the database.

[0056] According to an embodiment of the present invention, the function body of the system trigger includes the trigger event type and the trigger timing.

[0057] The triggering event type of a system trigger is the type of system event that can trigger the system trigger. The triggering timing of a system trigger can be used to indicate the order in which the system trigger is triggered and the system event occurs.

[0058] For example, if the triggering event type of a system trigger can be a backup and recovery type, and the triggering time can be after the event is executed, then the system trigger will be triggered after the backup and recovery type system event occurs.

[0059] The system iterates through at least one system trigger stored in the system trigger list to determine the triggering conditions corresponding to each system trigger. This includes: for each system trigger stored in the system trigger list, determining the triggering event type and triggering timing included in the function body of the system trigger; and determining the triggering conditions corresponding to the system trigger based on the triggering event type and triggering timing.

[0060] According to an embodiment of the present invention, the trigger event type and trigger timing are extracted from the trigger function body as trigger conditions, thus achieving a standardized definition of trigger conditions. By defining the event type and trigger timing, trigger conditions can be limited from multiple dimensions, making the matching logic between triggers and system events clearer, avoiding matching errors caused by ambiguous trigger conditions, and further improving the accuracy of target trigger selection.

[0061] According to an embodiment of the present invention, an event trigger signal can be generated in the following manner: in response to a system event triggered in the database system, an event flag corresponding to the system event type is determined based on the system event type of the system event; and an event trigger signal is generated based on the event flag and the thread flag of the target thread using a system thread used to execute the system event.

[0062] The system thread used to execute system events can determine the event flag corresponding to the system event type based on the system event after the system event is triggered in the database system, and generate an event trigger signal based on the event flag and the thread flag of the target thread, so that the event trigger signal can be correctly forwarded to the target thread according to the thread flag.

[0063] According to an embodiment of the present invention, a corresponding event marker is generated based on the system event type, and a trigger signal is generated by a system thread carrying the marker, thereby achieving standardized generation of event trigger signals. The event marker serves as a unique identifier for the system event type, ensuring that the target thread can quickly identify the event type, avoiding information loss or ambiguity during signal transmission, and improving the efficiency and accuracy of event type identification.

[0064] According to an embodiment of the present invention, determining the system event type corresponding to the event trigger signal based on the event marker carried by the event trigger signal includes: parsing the event trigger signal to obtain the event marker carried by the event trigger signal; and determining the system event type corresponding to the event marker based on a preset mapping relationship between multiple event markers and multiple system event types, which is then used as the system event type corresponding to the event trigger signal.

[0065] In the example of this invention, after receiving the event trigger signal, the target thread can send an acknowledgment to the system thread that sent the event trigger signal. After receiving the acknowledgment, the system thread can determine that the event trigger signal has been successfully sent.

[0066] If no acknowledgment is received within a predetermined time period after the system thread sends an event trigger signal, the event trigger signal can be resent to ensure that the event trigger signal is successfully sent to the target thread. A maximum number of resentments can be set. If the maximum number of resentments is reached and no acknowledgment is still not received, an error message can be triggered, prompting the user to check if the target thread's thread flag is incorrect. Preferably, the maximum number of resentments can be set to 3.

[0067] The target thread can also parse the event trigger, determine the event flag it carries, and determine the system event type corresponding to the event flag based on the pre-saved mapping relationship between multiple event flags and multiple system event types, which is then used as the system event type corresponding to the event trigger signal.

[0068] According to embodiments of the present invention, by parsing trigger signals to extract event markers and combining them with preset mapping relationships to determine event types, rapid and accurate event type identification is achieved. The preset mapping relationships avoid re-parsing event details for each identification; type determination can be completed solely through marker matching, significantly improving the speed of event type identification and ensuring timely event response.

[0069] Figure 3 A timing diagram of a target thread triggering a system trigger is shown according to an embodiment of the present invention.

[0070] like Figure 3 As shown, the interaction process includes operations S301 to S309.

[0071] When operating S301, after the system thread determines that a system event has been triggered, it sends an event trigger signal to the target thread.

[0072] When operating S302, the target thread receives the event trigger signal and sends an acknowledgment to the system thread.

[0073] In operation S303, the target thread determines the system event type corresponding to the event trigger signal based on the event trigger signal.

[0074] In operation S304, the target thread requests a list of system triggers from the target database.

[0075] In operation S305, the target database returns a list of system triggers to the target thread.

[0076] In operation S306, the target thread traverses the system trigger list to determine the target system trigger based on the system event type.

[0077] When operating S307, the target thread informs the target database of the target system trigger.

[0078] During operation S308, the target database stores the built-in functions of the target system triggers into the function queue.

[0079] In operation S309, the target database executes built-in functions in the function queue.

[0080] According to an embodiment of the present invention, a database system includes multiple target databases; for each target database in the database system, obtaining a system trigger list for the target database includes: obtaining a system file from the default database of the database system for storing the multiple target databases in the database system; determining the multiple target databases existing in the database system and their respective authentication information based on the system file; and accessing each target database based on its respective authentication information to obtain a system trigger list for each target database.

[0081] The default database of a database system is automatically created after the database management system is installed. It is used to support the operation of the database system itself or to provide basic functions. The default database is not used to store business data written by users, but rather to store target databases created by users based on business needs. Information related to the target databases can be stored in the default database as system files.

[0082] The system files can store basic information such as the target database name and address of each of the multiple target databases, as well as the authentication information required to log in to that target database.

[0083] Based on the basic information of each target database, each target database can be located in the database system. Based on the authentication information of each target database, it is possible to connect to and access each target database.

[0084] Since the system triggers are configured separately in each target database, each target database maintains its own configured system trigger information through a system trigger list. After accessing the target database, the system trigger list of the target database can be obtained.

[0085] According to embodiments of the present invention, system files are retrieved from a default database, and after identity verification, multiple target databases are accessed to obtain a trigger list, thus achieving unified retrieval of triggers from multiple databases. This eliminates the need for manual configuration of database access paths for each database, and by uniformly managing information from multiple databases through system files, the efficiency of trigger list retrieval in multi-database scenarios is improved, while identity verification ensures the security of database access.

[0086] According to an embodiment of the present invention, a system trigger is configured to a target database in the following manner: triggering conditions are set based on the system event type and triggering timing targeted by the system trigger; a built-in function is set based on the expected response after the system event type is triggered; a target name for the system trigger is determined based on the trigger names of other configured system triggers in the system trigger list of the target database, wherein the target name is different from the trigger names of other system triggers; a target trigger is determined based on the triggering conditions, built-in function, and trigger name; the target trigger is configured to the target database, and the trigger name and triggering conditions of the target trigger are saved to the system trigger list.

[0087] The type of system event targeted by a system trigger and the timing of its trigger can be determined according to business needs. For example, if a system trigger needs to be set for a checkpoint event, and the system trigger needs to be triggered before the checkpoint operation, the system event type can be set to a checkpoint event, the trigger timing can be set to before the event is executed, and the triggering conditions of the system trigger can be set according to the system event type and the trigger timing.

[0088] The built-in functions of system triggers can also be determined according to business needs. For example, before a checkpoint operation, it is necessary to check the parameters of the database to determine whether the checkpoint operation can be performed. In this case, the built-in function can be set to obtain the parameters of the database and compare the parameters with the threshold for performing the checkpoint operation to determine whether the checkpoint operation can be performed at present.

[0089] In addition, the target name of the system trigger can be determined based on the trigger names of other currently configured system triggers. Since the database system executes system trigger calls and triggers based on trigger names, the target name can be controlled to be different from any existing trigger name, ensuring the uniqueness of the target name.

[0090] By writing the trigger condition, built-in function, and trigger name into the function body template of the system trigger, the target trigger that needs to be configured can be obtained. Configure the target trigger in the target database and save the trigger name and trigger condition of the target trigger to the system trigger list. In subsequent response to database system events, the currently configured target trigger can be called through the system trigger list.

[0091] According to embodiments of the present invention, the working logic of system triggers can be clearly defined based on triggering conditions and built-in functions. By uniquely specifying the names of system triggers, execution errors caused by trigger naming conflicts can be avoided. System triggers are configured according to the above logic and saved to the system trigger list, achieving standardized configuration and management of system triggers. This standardized configuration process ensures that system triggers can be accurately identified and invoked by target threads, while the system trigger list saving mechanism makes subsequent traversal and matching more efficient, improving the stability and maintainability of the entire event response system.

[0092] Based on the above-described database system event response method, this invention also provides a database system event response apparatus. The following will be combined with... Figure 4 The device is described in detail.

[0093] Figure 4 A structural block diagram of a database system event response device according to an embodiment of the present invention is shown.

[0094] like Figure 4 As shown, the database system event response device 400 of this embodiment includes a type determination module 410, a list acquisition module 420, a list traversal module 430, and a function execution module 440.

[0095] The type determination module 410 is used to determine the system event type corresponding to the event trigger signal based on the event flag carried by the event trigger signal in response to the target thread receiving an event trigger signal sent by the system thread. The system thread is the thread in the database system used to execute system events, and the target thread is the thread in the database system used to monitor various system threads. In one embodiment, the type determination module 410 can be used to perform the operation S210 described above, which will not be repeated here.

[0096] The list acquisition module 420 is used to acquire a list of system triggers for each target database in the database system. The system trigger list stores at least one system trigger configured on the target database. In one embodiment, the list acquisition module 420 can be used to perform the operation S220 described above, which will not be repeated here.

[0097] The list traversal module 430 is used to traverse at least one system trigger stored in the system trigger list based on the system event type, and store the built-in functions in the target system trigger corresponding to the system event type into the function queue. In one embodiment, the list traversal module 430 can be used to perform the operation S230 described above, which will not be repeated here.

[0098] The function execution module 440 is used to execute the built-in functions in the function queue sequentially in response to the completion of traversing the system trigger list, so that the target database responds to system events. In one embodiment, the function execution module 440 can be used to perform the operation S240 described above, which will not be repeated here.

[0099] According to an embodiment of the present invention, the list traversal module 430 includes a list traversal submodule, a trigger determination submodule, a function body parsing submodule, and a function storage submodule.

[0100] The list traversal submodule is used to traverse at least one system trigger stored in the system trigger list and determine the triggering conditions corresponding to each of the at least one system trigger.

[0101] The trigger determination submodule is used to determine a target system trigger from at least one system trigger based on the system event type, wherein the system event type satisfies the triggering condition of the target system trigger.

[0102] The function body parsing submodule is used to parse the function body of the target system trigger and determine the built-in functions of the target system trigger.

[0103] The function storage submodule is used to store built-in functions to the function queue.

[0104] According to an embodiment of the present invention, the list traversal submodule includes a content parsing unit and a condition determination unit.

[0105] The content parsing unit is used to determine the trigger event type and trigger timing included in the function body of each system trigger stored in the system trigger list.

[0106] The condition determination unit is used to determine the triggering conditions corresponding to the system trigger based on the triggering event type and triggering timing.

[0107] According to an embodiment of the present invention, the database system event response device 400 further includes a tag determination module and a signal generation module.

[0108] The tag determination module is used to respond to system events triggered in the database system and determine the event tag corresponding to the system event type based on the system event type.

[0109] The signal generation module is used to generate event trigger signals based on the event flag and the thread flag of the target thread, using the system thread used to execute system events.

[0110] According to an embodiment of the present invention, the type determination module 410 includes a signal parsing submodule and a type determination submodule.

[0111] The signal parsing submodule is used to parse the event trigger signal to obtain the event flag carried by the event trigger signal.

[0112] The type determination submodule is used to determine the system event type corresponding to the event marker based on the preset mapping relationship between multiple event markers and multiple system event types, and use it as the system event type corresponding to the event trigger signal.

[0113] According to an embodiment of the present invention, the list acquisition module 420 includes a file acquisition submodule, an information determination submodule, and a database connection submodule.

[0114] The file retrieval submodule is used to retrieve system files from the default database of the database system, which are used to store multiple target databases in the database system.

[0115] The information determination submodule is used to determine, based on system files, the existence of multiple target databases in the database system and the authentication information of each target database.

[0116] The database connection submodule is used to access each target database separately based on the authentication information of each target database, so as to obtain the system trigger list of each target database.

[0117] According to an embodiment of the present invention, the database system event response device 400 further includes a condition setting module, a function setting module, a name determination module, a trigger generation module, and a trigger configuration module.

[0118] The condition setting module is used to set the triggering conditions of the system trigger based on the type of system event targeted by the system trigger and the triggering time.

[0119] The function setting module is used to set the built-in functions of system triggers based on the expected response after a system event type is triggered.

[0120] The name determination module is used to determine the target name of a system trigger based on the trigger names of other configured system triggers in the system trigger list of the target database, wherein the target name is different from the trigger names of other system triggers.

[0121] The trigger generation module is used to determine the target trigger based on the trigger condition, built-in function, and trigger name.

[0122] The trigger configuration module is used to configure target triggers to the target database and save the trigger name and trigger conditions of the target triggers to the system trigger list.

[0123] According to embodiments of the present invention, any plurality of modules among the type determination module 410, list acquisition module 420, list traversal module 430, and function execution module 440 may be combined into one module, or any one of these modules may be split into multiple modules. Alternatively, at least a portion of the functionality of one or more of these modules may be combined with at least a portion of the functionality of other modules and implemented in one module. According to embodiments of the present invention, at least one of the type determination module 410, list acquisition module 420, list traversal module 430, and function execution module 440 may be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or any other reasonable means of integrating or packaging circuitry, or implemented in hardware or firmware, or in any one of software, hardware, and firmware implementations, or in a suitable combination of any of these. Alternatively, at least one of the type determination module 410, list acquisition module 420, list traversal module 430, and function execution module 440 may be implemented at least partially as a computer program module that can perform corresponding functions when the computer program module is run.

[0124] Figure 5 A block diagram of an electronic device suitable for implementing a database system event response method according to an embodiment of the present invention is shown.

[0125] like Figure 5 As shown, an electronic device 500 according to an embodiment of the present invention includes a processor 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage portion 508 into a random access memory (RAM) 503. The processor 501 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 501 may also include onboard memory for caching purposes. The processor 501 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present invention.

[0126] RAM 503 stores various programs and data required for the operation of electronic device 500. Processor 501, ROM 502, and RAM 503 are interconnected via bus 504. Processor 501 executes various operations of the method flow according to embodiments of the present invention by executing programs in ROM 502 and / or RAM 503. It should be noted that the programs may also be stored in one or more memories other than ROM 502 and RAM 503. Processor 501 may also execute various operations of the method flow according to embodiments of the present invention by executing programs stored in said one or more memories.

[0127] According to an embodiment of the present invention, the electronic device 500 may further include an input / output (I / O) interface 505, which is also connected to a bus 504. The electronic device 500 may also include one or more of the following components connected to the input / output (I / O) interface 505: an input section 506 including a keyboard, mouse, etc.; an output section 507 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the input / output (I / O) interface 505 as needed. A removable medium 511, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 510 as needed so that computer programs read from it can be installed into the storage section 508 as needed.

[0128] The present invention also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs, which, when executed, implement the method according to the embodiments of the present invention.

[0129] According to embodiments of the present invention, the computer-readable storage medium may be a non-volatile computer-readable storage medium, such as including, but not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In the present invention, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to embodiments of the present invention, the computer-readable storage medium may include ROM 502 and / or RAM 503 and / or one or more memories other than ROM 502 and RAM 503 described above.

[0130] Embodiments of the present invention also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowchart. When the computer program product is run on a computer system, the program code is used to cause the computer system to implement the methods provided in the embodiments of the present invention.

[0131] When the computer program is executed by the processor 501, it performs the functions defined in the system / apparatus of this invention. According to embodiments of the invention, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.

[0132] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and may be downloaded and installed via the communication section 509, and / or installed from a removable medium 511. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.

[0133] In such an embodiment, the computer program can be downloaded and installed from a network via communication section 509, and / or installed from removable medium 511. When the computer program is executed by processor 501, it performs the functions defined in the system of this embodiment of the invention. According to embodiments of the invention, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.

[0134] According to embodiments of the present invention, program code for executing the computer programs provided in the embodiments of the present invention can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages ​​include, but are not limited to, languages ​​such as Java, C++, Python, "C", or similar programming languages. The program code can be executed entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0135] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0136] Those skilled in the art will understand that the features described in the various embodiments of the present invention can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in the present invention. In particular, the features described in the various embodiments of the present invention can be combined and / or combined in various ways without departing from the spirit and teachings of the present invention. All such combinations and / or combinations fall within the scope of the present invention.

[0137] The embodiments of the present invention have been described above. However, these embodiments are merely illustrative and not intended to limit the scope of the invention. Although various embodiments have been described above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. Various substitutions and modifications can be made by those skilled in the art without departing from the scope of the invention, and all such substitutions and modifications should fall within the scope of the invention.

Claims

1. A method for responding to events in a database system, characterized in that, The method includes: In response to a target thread receiving an event trigger signal sent by a system thread, the system event type corresponding to the event trigger signal is determined based on the event flag carried by the event trigger signal. The system thread is a thread in the database system used to execute system events, and the target thread is a thread in the database system used to monitor various system threads. The event trigger signal is generated as follows: in response to a system event being triggered in the database system, an event flag corresponding to the system event type is determined based on the system event type; the event trigger signal is generated using the system thread used to execute the system event, based on the event flag and the thread flag of the target thread. For each target database in the database system, obtain a system trigger list for the target database, wherein the system trigger list stores at least one system trigger configured on the target database; Based on the system event type, at least one system trigger stored in the system trigger list is traversed, and the built-in function in the target system trigger corresponding to the system event type is stored in the function queue; In response to the completion of traversing the system trigger list, the built-in functions in the function queue are executed sequentially to enable the target database to respond to the system event.

2. The method according to claim 1, characterized in that, The step of iterating through at least one system trigger stored in the system trigger list based on the system event type, and storing the built-in function in the target system trigger corresponding to the system event type into the function queue includes: The system trigger list is traversed to determine the triggering conditions corresponding to each of the system triggers. Based on the system event type, the target system trigger is determined from at least one of the system triggers, wherein the system event type satisfies the triggering condition of the target system trigger; The function body of the target system trigger is parsed to determine the built-in functions of the target system trigger; The built-in functions are stored in the function queue.

3. The method according to claim 2, characterized in that, The function body of the system trigger includes the trigger event type and the trigger timing; The step of iterating through at least one system trigger stored in the system trigger list to determine the triggering condition corresponding to each of the at least one system trigger includes: For each system trigger stored in the system trigger list, determine the trigger event type and trigger timing included in the function body of the system trigger; Based on the trigger event type and the trigger timing, determine the trigger conditions corresponding to the system trigger.

4. The method according to claim 1, characterized in that, The step of determining the system event type corresponding to the event trigger signal based on the event marker carried by the event trigger signal includes: The event trigger signal is parsed to obtain the event marker carried by the event trigger signal; Based on the preset mapping relationship between multiple event markers and multiple system event types, the system event type corresponding to the event marker is determined as the system event type corresponding to the event trigger signal.

5. The method according to claim 1, characterized in that, The database system includes multiple target databases; For each target database in the database system, obtaining the system trigger list for that target database includes: Obtain the system file used to store multiple target databases in the database system from the default database of the database system; Based on the system file, determine the multiple target databases existing in the database system and the authentication information of each of the multiple target databases; Based on the authentication information of each of the multiple target databases, each target database is accessed to obtain a list of system triggers for each target database.

6. The method according to any one of claims 1 to 5, characterized in that, The system trigger is configured to the target database in the following manner: Based on the type of system event and the timing of the trigger, the triggering conditions of the system trigger are set; Based on the expected response after the system event type is triggered, set the built-in function of the system trigger; Based on the system trigger list of the target database, the trigger names of other configured system triggers are used to determine the target name of the system trigger, wherein the target name is different from the trigger names of the other system triggers; The target trigger is determined based on the triggering conditions, the built-in function, and the trigger name; Configure the target trigger to the target database, and save the trigger name and trigger condition of the target trigger to the system trigger list.

7. A response device for database system events, characterized in that, The device includes: A type determination module is used to, in response to a target thread receiving an event trigger signal sent by a system thread, determine the system event type corresponding to the event trigger signal based on the event flag carried by the event trigger signal. The system thread is a thread in the database system used to execute system events, and the target thread is a thread in the database system used to monitor various system threads. The event trigger signal is generated as follows: in response to a system event being triggered in the database system, an event flag corresponding to the system event type is determined based on the system event type; the event trigger signal is generated using the system thread used to execute the system event, based on the event flag and the thread flag of the target thread. The list retrieval module is used to retrieve a list of system triggers for each target database in the database system. The list of system triggers stores at least one system trigger that has been configured on the target database. The list traversal module is used to traverse at least one system trigger stored in the system trigger list based on the system event type, and store the built-in functions in the target system trigger corresponding to the system event type into the function queue; The function execution module is used to execute the built-in functions in the function queue in sequence after traversing the system trigger list, so that the target database responds to the system event.

8. An electronic device, comprising: One or more processors; Memory, used to store one or more computer programs. The characteristic feature is that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program or instructions stored thereon, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 6.