A data processing method and device, electronic equipment and storage medium
By introducing database planning language attributes and planning service units into the database and using timers to automatically trigger operations, the system complexity and performance issues caused by the introduction of external systems are resolved, achieving efficient data management and improved reliability.
Patent Information
- Application Number
- CN202210633726.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-06
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2042-06-06
AI Technical Summary
Existing technologies that introduce external systems into the database for data recording operations increase system complexity, reduce interface performance and service reliability, and increase database load.
By introducing database planning language attributes into the database and using the planning service unit to set timers, operations on the data record table are automatically triggered based on time information, reducing dependence on external systems and enabling the management of planned tasks.
It reduces system complexity, improves interface performance and service reliability, reduces the access load of external systems on the database, maintains the ACID properties of the database, and reduces development and operating costs.
Smart Images

Figure CN115221224B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of information technology, and in particular to a data processing method, apparatus, electronic device, and storage medium. Background Technology
[0002] In databases, data records often have a requirement to modify their status based on time. This can typically be achieved using external database systems. These external systems operate on the database according to the time requirements of the task, and they also need to establish an interface with the database. Adding an external database system increases system complexity and, moreover, reduces interface performance and service reliability due to the need to call external systems. Summary of the Invention
[0003] This invention provides a data processing method, apparatus, electronic device, and storage medium.
[0004] According to a first aspect of the present invention, a data processing method is provided, applied to a planning service unit of a database, the method comprising:
[0005] Obtain the database planning language attribute of the data record table in the database, wherein the database planning language attribute is used at least to indicate the time information associated with the planned task and the execution status of the planned task;
[0006] Based on the time information, a timer is set to trigger an operation on the database planning language attribute.
[0007] In one embodiment, the method further includes:
[0008] In response to the timer expiring, a trigger message is sent to trigger the database management unit to operate on the database planning language attribute.
[0009] In one embodiment, the step of sending a trigger message to trigger the database management unit to operate on the database planning language attribute in response to the timer expiration includes:
[0010] In response to the timer expiring, a trigger message is sent, prompting the management unit to operate on the database planning language attribute based on the execution information associated with the planned task.
[0011] In one embodiment, operating on the database plan language attribute includes at least one of the following:
[0012] Update the execution status of the scheduled task in the database's scheduled language attributes;
[0013] Delete the database plan language attribute.
[0014] In one embodiment, the database planning language attribute includes: an index indicating the database planning language attribute;
[0015] The process of obtaining the database planning language attribute of the data record table in the database includes:
[0016] Retrieve the database plan language attribute of the data record table in the database indicated by the index.
[0017] In one embodiment, the database planning language attribute is created by the database management unit based at least on the time information associated with the planned tasks in the data record table.
[0018] In one embodiment, the time information includes at least one of the following:
[0019] Timed information;
[0020] Delayed information.
[0021] According to a second aspect of the present invention, a data processing method is provided, applied to a database management unit, the method comprising:
[0022] The database planning language attributes of the data record table are operated based at least on the time information associated with the planned task; wherein the database planning language attributes are used at least to indicate the time information associated with the planned task and the execution status of the planned task.
[0023] In one embodiment, the operation on the database planning language attributes of the data record table, based at least on the time information associated with the planned tasks in the data record table, includes:
[0024] The database planning language attributes of the data record table are created based at least on the time information associated with the planned tasks in the data record table.
[0025] In one embodiment, the operation on the database planning language attributes of the data record table, based at least on the time information associated with the planned tasks in the data record table, includes:
[0026] Based on the triggering information of the planning service unit of the database, the database planning language attribute of the data record table is operated. The triggering information is triggered by the timer of the planning service unit, and the timer is set by the planning service unit based on the time information.
[0027] In one embodiment, the operation on the database planning language attributes based on the triggering information of the planning service unit of the database includes:
[0028] Based on the triggering information of the planning service unit in the database and the execution information associated with the planned task, the planning language attributes of the database are manipulated.
[0029] In one embodiment, operating on the database plan language attribute includes at least one of the following:
[0030] In response to the execution information of the planned task, update the execution status of the planned task in the database planning language attribute;
[0031] In response to the completion of the scheduled task, the database scheduled language attribute is deleted.
[0032] In one embodiment, the database planning language attribute includes: an index indicating the database planning language attribute, wherein the index is used by the database planning service unit to determine the database planning language attribute.
[0033] In one embodiment, the time information includes at least one of the following:
[0034] Timed information;
[0035] Delayed information.
[0036] According to a third aspect of the present invention, a data processing apparatus is provided for a planning service unit applied to a database, the apparatus comprising:
[0037] The first processing module is used to obtain the database planning language attribute of the data record table in the database, wherein the database planning language attribute is used to indicate at least the time information associated with the planned task and the execution status of the planned task;
[0038] The first processing module is further configured to set a timer to trigger an operation on the database planning language attribute based on the time information.
[0039] In one embodiment, the apparatus further includes:
[0040] The first transceiver module is used to send a trigger message in response to the timer expiration, triggering the database management unit to operate on the database planning language attribute.
[0041] In one embodiment, the first transceiver module is configured to:
[0042] In response to the timer expiring, a trigger message is sent, prompting the management unit to operate on the database planning language attribute based on the execution information associated with the planned task.
[0043] In one embodiment, the first transceiver module is specifically configured to trigger the management unit to perform at least one of the following actions based on the execution information associated with the scheduled task:
[0044] Update the execution status of the scheduled task in the database's scheduled language attributes;
[0045] Delete the database plan language attribute.
[0046] In one embodiment, the database planning language attribute includes: an index indicating the database planning language attribute;
[0047] The first processing module is specifically used for:
[0048] Retrieve the database plan language attribute of the data record table in the database indicated by the index.
[0049] In one embodiment, the database planning language attribute is created by the database management unit based at least on the time information associated with the planned tasks in the data record table.
[0050] In one embodiment, the time information includes at least one of the following:
[0051] Timed information;
[0052] Delayed information.
[0053] According to a fourth aspect of the present invention, a data processing apparatus is provided for a database management unit, the apparatus comprising:
[0054] The second processing module is used to perform operations on the database planning language attributes of the data record table based at least on the time information associated with the planned task; wherein the database planning language attributes are used at least to indicate the time information associated with the planned task and the execution status of the planned task.
[0055] In one embodiment, the second processing module is specifically used for:
[0056] The database planning language attributes of the data record table are created based at least on the time information associated with the planned tasks in the data record table.
[0057] In one embodiment, the second processing module is specifically used for:
[0058] Based on the triggering information of the planning service unit of the database, the database planning language attribute of the data record table is operated. The triggering information is triggered by the timer of the planning service unit, and the timer is set by the planning service unit based on the time information.
[0059] In one embodiment, the second processing module is specifically used for:
[0060] Based on the triggering information of the planning service unit in the database and the execution information associated with the planned task, the planning language attributes of the database are manipulated.
[0061] In one embodiment, the second processing module is specifically used for at least one of the following:
[0062] In response to the execution information of the planned task, update the execution status of the planned task in the database planning language attribute;
[0063] In response to the completion of the scheduled task, the database scheduled language attribute is deleted.
[0064] In one embodiment, the database planning language attribute includes: an index indicating the database planning language attribute, wherein the index is used by the database planning service unit to determine the database planning language attribute.
[0065] In one embodiment, the time information includes at least one of the following:
[0066] Timed information;
[0067] Delayed information.
[0068] According to a fifth aspect of the present invention, an electronic device is provided, comprising: a processor, a transceiver, a memory, and an executable program stored in the memory and capable of being executed by the processor, wherein the processor executes the steps of the data processing method as described in the first or second aspect when executing the executable program.
[0069] According to a sixth aspect of the present invention, a storage medium is provided that stores an executable program thereon, which, when executed by a processor, implements the steps of the data processing method as described in the first or second aspect.
[0070] The data processing method, apparatus, and storage medium provided in the embodiments of the present invention.
[0071] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description
[0072] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0073] Figure 1This is a flowchart illustrating an order processing method based on relevant technologies;
[0074] Figure 2 This is a flowchart illustrating a check-in method based on relevant technologies;
[0075] Figure 3 This is a flowchart illustrating a data processing method according to an exemplary embodiment;
[0076] Figure 4 This is a schematic diagram of a database architecture according to an exemplary embodiment;
[0077] Figure 5 This is a flowchart illustrating a data processing method according to an exemplary embodiment;
[0078] Figure 6 This is a flowchart illustrating a data processing method according to an exemplary embodiment;
[0079] Figure 7 This is a schematic diagram illustrating the composition structure of a data processing apparatus according to an exemplary embodiment;
[0080] Figure 8 This is a schematic diagram illustrating the composition structure of a data processing apparatus according to an exemplary embodiment;
[0081] Figure 9 This is a block diagram illustrating an apparatus for data processing according to an exemplary embodiment. Detailed Implementation
[0082] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with those of the present invention. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the embodiments of the present invention as detailed in the appended claims.
[0083] The terminology used in this embodiment of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the embodiments of the invention. The singular forms “a,” “the,” and “the” as used in the embodiments of the invention and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more of the associated listed items.
[0084] It should be understood that although the terms first, second, third, etc., may be used to describe various information in embodiments of the present invention, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of embodiments of the present invention, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."
[0085] The execution entities involved in the embodiments of the present invention include, but are not limited to, terminals such as mobile phones, computers, tablet computers, and human-computer interaction devices with touch functions.
[0086] One application scenario of this disclosure is:
[0087] In many database application scenarios, a small amount of data needs to be modified within a certain period of time under certain conditions.
[0088] For example, orders placed on an online store need to be paid within half an hour, and the order status needs to be changed to "payment timeout" after half an hour. Figure 1 As shown, a common solution is: the order system 11 sends the order information to the task triggering platform 12, which is implemented through a time wheel or a delayed queue. The task triggering platform 12 triggers the task execution system 13 to execute the task after half an hour, checks the order status, and if the order is still unpaid, changes the order status to "payment timeout".
[0089] The addition of task triggering platform 12 and task execution system 13 increases system complexity. Furthermore, the order process makes an extra call to task triggering platform 12, reducing interface performance and service reliability. When the time expires, task execution system 13 needs to query the record an additional time, increasing database pressure, since most orders do not normally require record checks after successful payment. An optimized solution would be to cancel the task on task triggering platform 12 after successful payment, but this would further reduce service reliability.
[0090] For example, if an app offers a daily check-in activity where you receive a reward for checking in for 7 consecutive days, you need to determine the number of consecutive check-in days. Figure 2 As shown, common solutions include: 1) Check-in service 21 checks the user's check-in records for the past 7 days and calculates consecutive check-in days. 2) Add a counting service 22 to count the number of consecutive check-in days for users and a periodic reset service 23 to reset the consecutive check-in days of users who did not check in that day to 0 at the end of each day.
[0091] After the sign-in service 21 signs in, it is necessary to update the counting service 22 again to get the consecutive sign-in days. This also reduces the interface performance and reliability. Given that the number of users participating in the event is very low, there is no need to reset the consecutive sign-in days count for the vast majority of users who have not signed in before.
[0092] Therefore, how to achieve data update and scheduled task functions at low cost through database systems, reduce the introduction of complex systems to lower system reliability, and thus improve interface performance and service reliability is an urgent problem to be solved.
[0093] Figure 3 This is a flowchart illustrating a data processing method according to an exemplary embodiment, applied to a database planning service unit, such as... Figure 3 As shown, it includes the following steps:
[0094] Step 301: Obtain the database planning language attribute of the data record table in the database, wherein the database planning language attribute is used at least to indicate the time information associated with the planned task and the execution status of the planned task;
[0095] Step 302: Based on the time information, set a timer to trigger the operation on the database planning language attribute.
[0096] Here, the database can be either a centralized database or a distributed database.
[0097] For example, the database could be a mongos database, etc. A data record table could be a single data record within the database.
[0098] Data log tables can have planned tasks associated with time information. The data log table needs to execute the planned task at the time indicated by the time information. The planned task can be an operation on the data log table associated with the time information, such as an update operation or a check operation. The execution status can be the result of executing the planned task on the data log.
[0099] Time information may include, but is not limited to, indicating at least one of the following: start time, end time, period, interval duration, etc.
[0100] In one embodiment, the time information includes at least one of the following:
[0101] Timed information;
[0102] Delayed information.
[0103] Here, the timing information can indicate when to execute the planned task.
[0104] Delay information indicates the duration between the reference time and the execution of the planned task. The reference time may include, but is not limited to, the creation time of the data record table, the completion time of operations performed using database planning language attributes, etc.
[0105] For example, the database could be an online store's order database. Each data record table in the database could record information such as the items traded, fees, and payment status for an order. The data record table needs to be updated with the payment status half an hour after creation. If payment is not received within half an hour, the payment status in the data record table needs to be changed to "payment timeout" after half an hour. Here, the scheduled task could be a confirmation of the payment status, the time information could be a delay indicating half an hour after order creation, and the execution status could be "paid" or "unpaid."
[0106] For example, the database could be the same as the check-in record database used in an online store. Each data record table in the database could record a user's information, check-in information, etc. The data record tables need to be updated daily with check-in information. If a user does not check in for the day, the consecutive check-in days in the check-in information can be reset to 0. Here, the scheduled task could be the confirmation of check-in information, the time information could be the scheduled confirmation time each day, such as 24:00, and the execution status could be whether a user has checked in for the day.
[0107] Here, a Database Planning Language (DBL) attribute can be added to each data table to indicate the time information associated with the scheduled task and the execution status of the task. The DBL attribute can be hidden, accessible only to database administrators or readable by database devices.
[0108] In one embodiment, the database planning language attribute is created by the database management unit based at least on the time information associated with the planned tasks in the data record table.
[0109] The management unit of a database can be a management cluster within the database. For example, the management unit of a database can be a mongos cluster within the mongos database.
[0110] The database management unit can create database planning language attributes for a data record table based on the time information associated with its scheduled tasks. For example, if the database management unit determines that a data record table's scheduled tasks are associated with time information (e.g., the scheduled tasks are executed with a delay and / or at a set time), it creates database planning language attributes for the data record table.
[0111] In one possible implementation, the database planning language attributes may include the contents shown in Table (1).
[0112] Table (1)
[0113]
[0114] A planning service unit can be a cluster within a distributed database. Planning service units can be implemented in software or hardware.
[0115] Taking the mongos database as an example, such as Figure 4 As shown, a planned service unit cluster can be added to the mongos database cluster.
[0116] The planning service unit can be used to monitor the time information associated with planned tasks, as well as to execute or assign tasks that operate on database planning language attributes.
[0117] In one possible implementation, the planning service unit can set a timer based on the time information associated with the planned task, and the timer will trigger operations on the database planning language attributes. The planning service unit can assign the operations on the database planning language attributes to other service units, or it can perform the operations on the database planning language attributes itself.
[0118] Operations on database plan language attributes can include: creating, deleting, updating, and querying database plan language attributes.
[0119] For example, taking pending payment orders as an example, each data record table in the database can record information such as the transaction items, fees, and payment status for one order. Database planning language attributes can be set for the data record tables. These attributes can include: the time information associated with the planned task (payment task) (with a half-hour delay) and the execution status of the planned task (i.e., payment status: paid or unpaid). The planning service unit can set a half-hour timer. After the timer expires, it triggers an operation on the database planning language attributes, such as updating the payment status or deleting the database planning language attributes. This achieves the management of planned tasks.
[0120] Thus, the planning service unit manages planned tasks by setting timers that trigger operations on the database planning language attributes, based on the time information and execution status of the planned tasks indicated by the database planning language attributes. On the one hand, since the planning service unit is internal to the database, it eliminates the need for external platforms and / or systems to operate on the database, reducing system complexity and consequently reducing the database workload caused by external systems accessing the database through interfaces, thereby improving interface performance and service reliability. On the other hand, because no external platforms and / or systems are introduced, the ACID (Indivisibility, Consistency, Independence, Durability) characteristics of database transactions can be maintained, reducing development cycles and operating costs.
[0121] Figure 5 This is a flowchart illustrating a data processing method according to an exemplary embodiment, applied to a database planning service unit, such as... Figure 5 As shown, it includes the following steps:
[0122] Step 501: In response to the timer expiration, a trigger message is sent to trigger the database management unit to operate on the database planning language attribute.
[0123] Step 501 can be performed alone or in conjunction with step 301.
[0124] The management unit of a database can be a management cluster within the database. For example, the management unit of a database can be a mongos cluster within the mongos database.
[0125] The database management unit can perform operations such as updating, querying, and deleting database planning language attributes. For example, the database management unit can update the execution status of planned tasks in the database planning language attributes.
[0126] In one embodiment, the database planning language attribute includes: an index indicating the database planning language attribute;
[0127] The process of obtaining the database planning language attribute of the data record table in the database includes:
[0128] Retrieve the database plan language attribute of the data record table in the database indicated by the index.
[0129] Here, different database planning language attributes can each have a different index. The planning service unit can load database planning language attribute tasks based on the index, add timers to the data record table containing the database planning language attributes, periodically find the trigger task, and request the management unit (e.g., the mongos cluster in the mongos database) to perform database planning language attribute operations on the current record.
[0130] In one possible implementation, the planning service unit can operate in a multi-threaded manner.
[0131] For example, the planning service unit can be divided into three thread pools:
[0132] Monitoring thread: Determines if there are any expired tasks in the index.
[0133] Synchronization thread: Synchronizes indexes to the service
[0134] Scheduling thread: Sends the database plan language attributes of tasks that are about to expire to mongos for execution.
[0135] In one possible implementation, the size of different thread pools can be adjusted according to the scale of the task.
[0136] In one embodiment, the step of sending a trigger message to trigger the database management unit to operate on the database planning language attribute in response to the timer expiration includes:
[0137] In response to the timer expiring, a trigger message is sent, prompting the management unit to operate on the database planning language attribute based on the execution information associated with the planned task.
[0138] Execution information may include, but is not limited to, the results of planned task execution. For example, execution information may include the payment status of the aforementioned payment orders and consecutive check-in records. Execution information may be sent to the management unit by the system executing the planned task. For example, the system executing the planned task could be an order system, a check-in service, etc.
[0139] In one possible implementation, the system executing the planned task can store the execution information in a data log table or other storage location, which can then be read by the management unit.
[0140] The management unit can manipulate database planning language attributes based on execution information.
[0141] Database scheduling language attributes can be used, at least based on the time information of scheduled tasks, to trigger operations on these attributes. Specifically, by using the time information within the database scheduling language attributes, timers can be set to confirm the execution status of the scheduled task, and then operations can be performed on the data record tables. This allows for operations on data record tables linked to time information without requiring external platforms and / or systems to access the database, reducing system complexity and consequently reducing the database workload imposed by external systems accessing the database through interfaces, thus improving interface performance and service reliability.
[0142] In one embodiment, operating on the database plan language attribute includes at least one of the following:
[0143] Update the execution status of the scheduled task in the database's scheduled language attributes;
[0144] Delete the database plan language attribute.
[0145] Scheduled tasks can be tasks that need to be executed continuously over multiple times. The scheduling service unit can set multiple timers based on time information, triggering the management unit to operate on the database scheduling language attributes. Multiple timers can be set sequentially. For example, for consecutive check-ins over multiple days, a new timer can be set after the previous one expires. Multiple timers can also be set simultaneously.
[0146] After a scheduled task completes, the management unit can also delete the database scheduling language attribute, stopping operations on the database scheduling language attribute triggered based on time information. The completion of a scheduled task can include one of the following: the scheduled task has been successfully executed; the scheduled task failed to execute, etc.
[0147] There are currently four commonly used database languages:
[0148] Database Query Language (DQL); Data Manipulation Language (DML); Database Definition Language (DDL); Database Control Language (DCL).
[0149] Here, a new database schedule language (DSL) can be introduced to add scheduled task functionality to the data, including timed tasks and delayed tasks, which can perform certain operations on database schedule language attributes on a scheduled or delayed basis.
[0150] Database planning language can take the form of { <query> <update> <dsl>The format of} is not limited here.
[0151] The operations that can be performed on database planning language attributes include, but are not limited to, at least one of the following:
[0152] 1. Insert records with database planning language attributes:
[0153]
[0154] 2. Query the database plan language attribute of the records;
[0155]
[0156]
[0157] 3. Query the database plan language attribute index of the collection;
[0158]
[0159] 4. Database plan language attribute for deleting records;
[0160] >db.getcollection("order").find({"id":"202001010001"}).delDsl();
[0161] 5. Update the database plan language attribute of the record.
[0162]
[0163]
[0164] Here, we provide two use cases for database plan language attributes.
[0165] 1. Delayed task scenario, such as order payment scenario, the result of the data record table, i.e. the order record table, can be shown in Table (2).
[0166] Table (2)
[0167]
[0168] 1. When a user places an order, the order system creates an order record containing a database planning language attribute with time information (execution time is half an hour later).
[0169]
[0170] 2. When the user completes the payment within half an hour, update the order status and delete the database plan language attribute.
[0171]
[0172] If the user does not pay for the order within half an hour, execute the "$set":{"status":-1} update statement on the database plan language attribute of the current record after half an hour, and delete the database plan language attribute of the record.
[0173] 2. Scheduled task scenarios, such as scenarios where users' consecutive check-ins are reset.
[0174] The structure of a data record table (e.g., an attendance sheet) is shown in Table (2):
[0175]
[0176] 1. User check-in statement: Accumulate consecutive check-in days and add a scheduled task at midnight on the third day. If no check-in is performed on the second day, the scheduled task will reset the consecutive check-in count to 0 and delete the record. Database plan language attribute:
[0177]
[0178]
[0179] 2. If a user does not check in on the second day, the "$set":{"consecutive_checkin_days":0} statement of the database plan language attribute of the current record will be executed at midnight on the third day. This will update the user's consecutive check-in days to 0 and delete the database plan language attribute. If the user does not check in again after this, the scheduled cleanup task will not be triggered because the record no longer has the database plan language attribute.
[0180] 3. If a user signs in on the second day, the user's system record will be updated, the consecutive sign-in days will be incremented by 1, and the database plan language attribute will be reset at midnight on the fourth day.
[0181] Figure 6 This is a flowchart illustrating a data processing method according to an exemplary embodiment, applied to a database management unit, such as... Figure 6 As shown, it includes the following steps:
[0182] Step 601: Based at least on the time information associated with the planned task in the data record table, perform operations on the database planning language attributes of the data record table; wherein, the database planning language attributes are at least used to indicate the time information associated with the planned task and the execution status of the planned task.
[0183] Here, the database can be either a centralized database or a distributed database.
[0184] For example, the database could be a mongos database, etc. A data record table could be a single data record within the database.
[0185] Data log tables can have planned tasks associated with time information. The data log table needs to execute the planned task at the time indicated by the time information. The planned task can be an operation on the data log table associated with the time information, such as an update operation or a check operation. The execution status can be the result of executing the planned task on the data log.
[0186] Time information may include, but is not limited to, indicating at least one of the following: start time, end time, period, interval duration, etc.
[0187] In one embodiment, the time information includes at least one of the following:
[0188] Timed information;
[0189] Delayed information.
[0190] Here, the timing information can indicate when to execute the planned task.
[0191] Delay information indicates the duration between the reference time and the execution of the planned task. The reference time may include, but is not limited to, the creation time of the data record table, the completion time of operations performed using database planning language attributes, etc.
[0192] For example, the database could be an online store's order database. Each data record table in the database could record information such as the items traded, fees, and payment status for an order. The data record table needs to be updated with the payment status half an hour after creation. If payment is not received within half an hour, the payment status in the data record table needs to be changed to "payment timeout" after half an hour. Here, the scheduled task could be a confirmation of the payment status, the time information could be a delay indicating half an hour after order creation, and the execution status could be "paid" or "unpaid."
[0193] For example, the database could be the same as the check-in record database used in an online store. Each data record table in the database could record a user's information, check-in information, etc. The data record tables need to be updated daily with check-in information. If a user does not check in for the day, the consecutive check-in days in the check-in information can be reset to 0. Here, the scheduled task could be the confirmation of check-in information, the time information could be the scheduled confirmation time each day, such as 24:00, and the execution status could be whether a user has checked in for the day.
[0194] Here, a Database Planning Language (DBL) attribute can be added to each data table to indicate the time information associated with the scheduled task and the execution status of the task. The DBL attribute can be hidden, accessible only to database administrators or readable by database devices.
[0195] The management unit of a database can be a management cluster within the database. For example, the management unit of a database can be a mongos cluster within the mongos database.
[0196] In one embodiment, the operation on the database planning language attributes of the data record table, based at least on the time information associated with the planned tasks in the data record table, includes:
[0197] The database planning language attributes of the data record table are created based at least on the time information associated with the planned tasks in the data record table.
[0198] The database management unit can create database planning language attributes for a data record table based on the time information associated with its scheduled tasks. For example, if the database management unit determines that a data record table's scheduled tasks are associated with time information (e.g., the scheduled tasks are executed with a delay and / or at a set time), it creates database planning language attributes for the data record table.
[0199] In one possible implementation, the database planning language attributes may include the contents shown in Table (1).
[0200] The database management unit can perform operations such as updating, querying, and deleting database planning language attributes. For example, the database management unit can update the execution status of planned tasks in the database planning language attributes.
[0201] Database scheduling language attributes can be used, at least based on the time information of scheduled tasks, to trigger operations on these attributes. Specifically, by using the time information within the database scheduling language attributes, timers can be set to confirm the execution status of the scheduled task, and then operations can be performed on the data record tables. This allows for operations on data record tables linked to time information without requiring external platforms and / or systems to access the database, reducing system complexity and consequently reducing the database workload imposed by external systems accessing the database through interfaces, thus improving interface performance and service reliability.
[0202] In one embodiment, the operation on the database planning language attributes of the data record table, based at least on the time information associated with the planned tasks in the data record table, includes:
[0203] Based on the triggering information of the planning service unit of the database, the database planning language attribute of the data record table is operated. The triggering information is triggered by the timer of the planning service unit, and the timer is set by the planning service unit based on the time information.
[0204] The planning service unit can be used to monitor the time information associated with planned tasks, as well as to execute or assign tasks that operate on database planning language attributes.
[0205] In one possible implementation, the planning service unit can set a timer based on the time information associated with the planned task, and the timer will trigger operations on the database planning language attributes. The planning service unit can assign the operations on the database planning language attributes to other service units, or it can perform the operations on the database planning language attributes itself.
[0206] Operations on database plan language attributes can include: creating, deleting, updating, and querying database plan language attributes.
[0207] For example, taking pending payment orders as an example, each data record table in the database can record information such as the transaction items, fees, and payment status for one order. Database planning language attributes can be set for the data record tables. These attributes can include: the time information associated with the planned task (payment task) (with a half-hour delay) and the execution status of the planned task (i.e., payment status: paid or unpaid). The planning service unit can set a half-hour timer. After the timer expires, it triggers an operation on the database planning language attributes, such as updating the payment status or deleting the database planning language attributes. This achieves the management of planned tasks.
[0208] Thus, the planning service unit manages planned tasks by setting timers that trigger operations on the database planning language attributes, based on the time information and execution status of the planned tasks indicated by the database planning language attributes. On the one hand, since the planning service unit is internal to the database, it eliminates the need for external platforms and / or systems to operate on the database, reducing system complexity and consequently reducing the database workload caused by external systems accessing the database through interfaces, thereby improving interface performance and service reliability. On the other hand, because no external platforms and / or systems are introduced, the ACID (Indivisibility, Consistency, Independence, Durability) characteristics of database transactions can be maintained, reducing development cycles and operating costs.
[0209] In one embodiment, the database planning language attribute includes: an index indicating the database planning language attribute, wherein the index is used by the database planning service unit to determine the database planning language attribute.
[0210] Here, different database planning language attributes can each have a different index. The planning service unit can load database planning language attribute tasks based on the index, add timers to the data record table containing the database planning language attributes, periodically find the trigger task, and request the management unit (e.g., the mongos cluster in the mongos database) to perform database planning language attribute operations on the current record.
[0211] In one possible implementation, the planning service unit can operate in a multi-threaded manner.
[0212] For example, the planning service unit can be divided into three thread pools:
[0213] Monitoring thread: Determines if there are any expired tasks in the index.
[0214] Synchronization thread: Synchronizes indexes to the service
[0215] Scheduling thread: Sends the database plan language attributes of tasks that are about to expire to mongos for execution.
[0216] In one possible implementation, the size of different thread pools can be adjusted according to the scale of the task.
[0217] In one embodiment, the operation on the database planning language attributes based on the triggering information of the planning service unit of the database includes:
[0218] Based on the triggering information of the planning service unit in the database and the execution information associated with the planned task, the planning language attributes of the database are manipulated.
[0219] Execution information may include, but is not limited to, the results of planned task execution. For example, execution information may include the payment status of the aforementioned payment orders and consecutive check-in records. Execution information may be sent to the management unit by the system executing the planned task. For example, the system executing the planned task could be an order system, a check-in service, etc.
[0220] In one possible implementation, the system executing the planned task can store the execution information in a data log table or other storage location, which can then be read by the management unit.
[0221] The management unit can manipulate database planning language attributes based on execution information.
[0222] Database scheduling language attributes can be used, at least based on the time information of scheduled tasks, to trigger operations on these attributes. Specifically, by using the time information within the database scheduling language attributes, timers can be set to confirm the execution status of the scheduled task, and then operations can be performed on the data record tables. This allows for operations on data record tables linked to time information without requiring external platforms and / or systems to access the database, reducing system complexity and consequently reducing the database workload imposed by external systems accessing the database through interfaces, thus improving interface performance and service reliability.
[0223] In one embodiment, operating on the database plan language attribute includes at least one of the following:
[0224] In response to the execution information of the planned task, update the execution status of the planned task in the database planning language attribute;
[0225] In response to the completion of the scheduled task, the database scheduled language attribute is deleted.
[0226] Scheduled tasks can be tasks that need to be executed continuously over multiple times. The scheduling service unit can set multiple timers based on time information, triggering the management unit to operate on the database scheduling language attributes. Multiple timers can be set sequentially. For example, for consecutive check-ins over multiple days, a new timer can be set after the previous one expires. Multiple timers can also be set simultaneously.
[0227] After a scheduled task completes, the management unit can also delete the database scheduling language attribute, stopping operations on the database scheduling language attribute triggered based on time information. The completion of a scheduled task can include one of the following: the scheduled task has been successfully executed; the scheduled task failed to execute, etc.
[0228] There are currently four commonly used database languages:
[0229] Database Query Language (DQL); Data Manipulation Language (DML); Database Definition Language (DDL); Database Control Language (DCL).
[0230] Here, a new database schedule language (DSL) can be introduced to add scheduled task functionality to the data, including timed tasks and delayed tasks, which can perform certain operations on database schedule language attributes on a scheduled or delayed basis.
[0231] Database planning language can take the form of { <query> <update> <dsl>The format of} is not limited here.
[0232] The operations that can be performed on database planning language attributes include, but are not limited to, at least one of the following:
[0233] 1. Insert records with database planning language attributes:
[0234]
[0235]
[0236] 2. Query the database plan language attribute of the records;
[0237]
[0238] 3. Query the database plan language attribute index of the collection;
[0239]
[0240]
[0241] 4. Database plan language attribute for deleting records;
[0242] >db.getcollection("order").find({"id":"202001010001"}).delDsl();
[0243] 5. Update the database plan language attribute of the record.
[0244]
[0245] Here, we provide two use cases for database plan language attributes.
[0246] 1. Delayed task scenario, such as order payment scenario, the result of the data record table, i.e. the order record table, can be shown in Table (2).
[0247] 1. When a user places an order, the order system creates an order record containing a database planning language attribute with time information (execution time is half an hour later).
[0248]
[0249]
[0250] 2. When the user completes the payment within half an hour, update the order status and delete the database plan language attribute.
[0251]
[0252] If the user does not pay for the order within half an hour, execute the "$set":{"status":-1} update statement on the database plan language attribute of the current record after half an hour, and delete the database plan language attribute of the record.
[0253] 2. Scheduled task scenarios, such as scenarios where users' consecutive check-ins are reset.
[0254] The structure of the data record table (e.g., the sign-in table) is shown in Table (2).
[0255] 1. User check-in statement: Accumulate consecutive check-in days and add a scheduled task at midnight on the third day. If no check-in is performed on the second day, the scheduled task will reset the consecutive check-in count to 0 and delete the record. Database plan language attribute:
[0256]
[0257]
[0258] 2. If a user does not check in on the second day, the "$set":{"consecutive_checkin_days":0} statement of the database plan language attribute of the current record will be executed at midnight on the third day. This will update the user's consecutive check-in days to 0 and delete the database plan language attribute. If the user does not check in again after this, the scheduled cleanup task will not be triggered because the record no longer has the database plan language attribute.
[0259] 3. If a user signs in on the second day, the user's system record will be updated, the consecutive sign-in days will be incremented by 1, and the database plan language attribute will be reset at midnight on the fourth day.
[0260] Figure 7 This is a data processing apparatus 100 illustrated according to an exemplary embodiment, applied to a database planning service unit, the apparatus 100 comprising:
[0261] The first processing module 110 is used to obtain the database planning language attribute of the data record table in the database, wherein the database planning language attribute is used to indicate at least the time information associated with the planned task and the execution status of the planned task;
[0262] The first processing module 110 is also configured to set a timer to trigger an operation on the database planning language attribute based on the time information.
[0263] In one embodiment, the device 100 further includes:
[0264] The first transceiver module 120 is used to send a trigger message in response to the timer expiration, triggering the database management unit to operate on the database planning language attribute.
[0265] In one embodiment, the first transceiver module 120 is configured to:
[0266] In response to the timer expiring, a trigger message is sent, prompting the management unit to operate on the database planning language attribute based on the execution information associated with the planned task.
[0267] In one embodiment, the first transceiver module 120 is specifically configured to trigger the management unit to perform at least one of the following actions based on the execution information associated with the scheduled task:
[0268] Update the execution status of the scheduled task in the database's scheduled language attributes;
[0269] Delete the database plan language attribute.
[0270] In one embodiment, the database planning language attribute includes: an index indicating the database planning language attribute;
[0271] The first processing module 110 is specifically used for:
[0272] Retrieve the database plan language attribute of the data record table in the database indicated by the index.
[0273] In one embodiment, the database planning language attribute is created by the database management unit based at least on the time information associated with the planned tasks in the data record table.
[0274] In one embodiment, the time information includes at least one of the following:
[0275] Timed information;
[0276] Delayed information.
[0277] Figure 8 This is a data processing apparatus 200 illustrated according to an exemplary embodiment, applied to a database management unit, the apparatus 200 comprising:
[0278] The second processing module 210 is used to perform operations on the database planning language attributes of the data record table based at least on the time information associated with the planned task; wherein the database planning language attributes are used at least to indicate the time information associated with the planned task and the execution status of the planned task.
[0279] In one embodiment, the second processing module 210 is specifically used for:
[0280] The database planning language attributes of the data record table are created based at least on the time information associated with the planned tasks in the data record table.
[0281] In one embodiment, the second processing module 210 is specifically used for:
[0282] Based on the triggering information of the planning service unit of the database, the database planning language attribute of the data record table is operated. The triggering information is triggered by the timer of the planning service unit, and the timer is set by the planning service unit based on the time information.
[0283] In one embodiment, the second processing module 210 is specifically used for:
[0284] Based on the triggering information of the planning service unit in the database and the execution information associated with the planned task, the planning language attributes of the database are manipulated.
[0285] In one embodiment, the second processing module 210 is specifically used for at least one of the following:
[0286] In response to the execution information of the planned task, update the execution status of the planned task in the database planning language attribute;
[0287] In response to the completion of the scheduled task, the database scheduled language attribute is deleted.
[0288] In one embodiment, the database planning language attribute includes: an index indicating the database planning language attribute, wherein the index is used by the database planning service unit to determine the database planning language attribute.
[0289] In one embodiment, the time information includes at least one of the following:
[0290] Timed information;
[0291] Delayed information.
[0292] Figure 9 A block diagram of a data processing apparatus 800 is shown according to an exemplary embodiment. For example, apparatus 800 may be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness equipment, personal digital assistant, etc.
[0293] Reference Figure 9 The device 800 may include one or more of the following components: a processing component 802, a memory 804, a power supply component 806, a multimedia component 808, an audio component 810, an input / output (I / O) interface 812, a sensor component 814, and a communication component 816.
[0294] Processing component 802 typically controls the overall operation of device 800, such as operations associated with display, telephone calls, data communication, camera operation, and recording. Processing component 802 may include one or more processors 820 to execute instructions to perform all or part of the steps of the methods described above. Furthermore, processing component 802 may include one or more modules to facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.
[0295] Memory 804 is configured to store various types of data to support the operation of device 800. Examples of this data include instructions for any application or method operating on device 800, contact data, phonebook data, messages, pictures, videos, etc. Memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0296] Power supply component 806 provides power to various components of device 800. Power supply component 806 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power to device 800.
[0297] Multimedia component 808 includes a screen that provides an output interface between the device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 808 includes a front-facing camera and / or a rear-facing camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0298] Audio component 810 is configured to output and / or input audio signals. For example, audio component 810 includes a microphone (MIC) configured to receive external audio signals when device 800 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 804 or transmitted via communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
[0299] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.
[0300] Sensor assembly 814 includes one or more sensors for providing status assessments of various aspects of device 800. For example, sensor assembly 814 may detect the on / off state of device 800, the relative positioning of components such as the display and keypad of device 800, changes in the position of device 800 or a component of device 800, the presence or absence of user contact with device 800, the orientation or acceleration / deceleration of device 800, and temperature changes of device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 814 may also include an accelerometer, a gyroscope, a magnetometer, a pressure sensor, or a temperature sensor.
[0301] Communication component 816 is configured to facilitate wired or wireless communication between device 800 and other devices. Device 800 can access wireless networks based on communication standards, such as Wi-Fi, 2G, or 3G, or combinations thereof. In one exemplary embodiment, communication component 816 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 816 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0302] In an exemplary embodiment, the apparatus 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the methods described above.
[0303] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, which can be executed by a processor 820 of the device 800 to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0304] A non-transitory computer-readable storage medium, wherein when instructions in the storage medium are executed by a terminal's processor, the terminal is able to perform the steps of the aforementioned data processing method.
[0305] Other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the following claims.
[0306] It should be understood that the present invention is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.< / dsl> < / update> < / query> < / dsl> < / update> < / query>
Claims
1. A data processing method, characterized by, A method applied to a database, the method comprising: obtaining a database plan language attribute of a data record table in a database, wherein the database plan language attribute is used at least to indicate time information associated with a plan task and an execution state of the plan task, and the data record table is a single data record in the database; setting a timer that triggers an operation on the database plan language attribute according to the time information.
2. The method of claim 1, wherein, The method further comprises: sending trigger information to trigger an operation on the database plan language attribute by a management unit of the database in response to the timer expiring.
3. The method of claim 2, wherein, The sending of the trigger information to trigger the operation on the database plan language attribute by the management unit of the database in response to the timer expiring comprises: sending trigger information to trigger the operation on the database plan language attribute by the management unit based on the execution information associated with the plan task in response to the timer expiring.
4. The method of claim 3, wherein, The operation on the database plan language attribute comprises at least one of: updating the execution state of the plan task in the database plan language attribute; and deleting the database plan language attribute.
5. The method of claim 1, wherein, The database plan language attribute comprises an index indicating the database plan language attribute. The obtaining of the database plan language attribute of the data record table in the database comprises: obtaining the database plan language attribute of the data record table in the database indicated by the index.
6. The method of claim 1, wherein, The database plan language attribute is created by a management unit of the database based at least on the time information associated with the plan task of the data record table.
7. The method according to any one of claims 1 to 6, characterized in that, The time information comprises at least one of: timing information; and delay information.
8. A data processing method, characterized by, A method applied to a management unit of a database, the method comprising: performing an operation on a database plan language attribute of a data record table based at least on time information associated with a plan task of the data record table, wherein the database plan language attribute is used at least to indicate the time information associated with the plan task and an execution state of the plan task, and the data record table is a single data record in the database.
9. The method of claim 8, wherein, The performing of the operation on the database plan language attribute of the data record table based at least on the time information associated with the plan task of the data record table comprises:
10. The method of claim 8, wherein, creating the database plan language attribute of the data record table based at least on the time information associated with the plan task of the data record table. The performing of the operation on the database plan language attribute of the data record table based at least on the time information associated with the plan task of the data record table comprises:
11. The method of claim 10, wherein, performing the operation on the database plan language attribute of the data record table based on trigger information of a plan service unit of the database, wherein the trigger information is triggered by a timer of the plan service unit, and the timer is set by the plan service unit based on the time information. The performing of the operation on the database plan language attribute based on the trigger information of the plan service unit of the database comprises: The database plan language attribute is operated based on trigger information of a plan service unit of the database and execution information associated with the plan task.
12. The method of claim 11, wherein, The operation on the database plan language attribute comprises at least one of the following: updating an execution state of the plan task in the database plan language attribute in response to the execution information of the plan task; deleting the database plan language attribute in response to the end of the plan task.
13. The method of claim 8, wherein, The database plan language attribute comprises an index indicating the database plan language attribute, wherein the index is used for a plan service unit of a database to determine the database plan language attribute.
14. The method according to any one of claims 8 to 13, characterized in that, The time information comprises at least one of the following: timing information; delay information.
15. A data processing apparatus, characterized by The apparatus applied to a plan service unit of a database comprises: a first processing module configured to acquire a database plan language attribute of a data record table in a database, wherein the database plan language attribute is used at least to indicate time information associated with a plan task and an execution state of the plan task, and the data record table is a single data record in the database; the first processing module is further configured to set a timer triggering an operation on the database plan language attribute according to the time information.
16. The apparatus of claim 15, wherein, The apparatus further comprises: a first transceiving module configured to send trigger information to trigger a management unit of the database to operate on the database plan language attribute in response to expiration of the timer.
17. The apparatus of claim 16, wherein, The first transceiving module is configured to: send trigger information to trigger the management unit to operate on the database plan language attribute based on execution information associated with the plan task in response to expiration of the timer.
18. The apparatus of claim 17, wherein, The first transceiving module is specifically configured to trigger the management unit to perform at least one of the following based on the execution information associated with the plan task: update the execution state of the plan task in the database plan language attribute; and delete the database plan language attribute.
19. The apparatus of claim 15, wherein, The database plan language attribute comprises an index indicating the database plan language attribute. The first processing module is specifically configured to: acquire the database plan language attribute of the data record table in the database indicated by the index.
20. The apparatus of claim 15, wherein, The database plan language attribute is created by a management unit of a database based at least on time information associated with a plan task of a data record table.
21. The apparatus of any one of claims 15 to 20, wherein, The time information comprises at least one of the following: timing information; delay information.
22. A data processing apparatus, characterized in that, The apparatus applied to a management unit of a database comprises: a second processing module configured to operate on a database plan language attribute of a data record table based at least on time information associated with a plan task of the data record table; wherein the database plan language attribute is used at least to indicate the time information associated with the plan task and an execution state of the plan task, and the data record table is a single data record in the database.
23. The apparatus of claim 22, wherein, The second processing module is specifically configured to: create the database plan language attribute of the data record table based at least on the time information associated with the plan task of the data record table.
24. The apparatus of claim 22, wherein, The second processing module is specifically configured to: Performing operation on the database plan language attribute of the data record table based on trigger information of a plan service unit of the database, wherein the trigger information is triggered by a timer of the plan service unit, and wherein the timer is set by the plan service unit based on the time information.
25. The apparatus of claim 24, wherein, The second processing module is specifically configured to: Perform operation on the database plan language attribute based on trigger information of a plan service unit of the database and execution information associated with the plan task.
26. The apparatus of claim 25, wherein, The second processing module is specifically configured to at least one of: updating execution status of the plan task in the database plan language attribute in response to the execution information of the plan task; and deleting the database plan language attribute in response to the plan task ending.
27. The apparatus of claim 22, wherein, The database plan language attribute comprises an index indicating the database plan language attribute, wherein the index is used for a plan service unit of a database to determine the database plan language attribute.
28. The apparatus of any one of claims 22-27, wherein, The time information comprises at least one of: timing information; and delay information.
29. An electronic device, comprising: A processor, a transceiver, a memory, and an executable program stored on the memory and capable of being executed by the processor, wherein the processor executes the executable program to perform the steps of the data processing method according to any one of claims 1 to 7 or 8 to 14.
30. A storage medium having stored thereon an executable program, characterized in that The executable program is executed by the processor to implement the steps of the data processing method according to any one of claims 1 to 7 or 8 to 14.
Citation Information
Patent Citations
Travel plan producing system
CN101493921A
Time-based method and time-based system for triggering execution of database task
CN102708171A