Data processing method and device

By locking and labeling the initial data directory of the database, asynchronous deletion and rapid rollback are achieved, which solves the problem of time-consuming and difficult data deletion in the database and improves the efficiency and security of data processing.

CN113761059BActive Publication Date: 2024-12-13ALIBABA CLOUD COMPUTING CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110886698.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-03
Publication Date
2024-12-13
Estimated Expiration
2041-08-03

AI Technical Summary

Technical Problem

The prior art takes a long time to delete data in the database, and data rollback caused by misoperation is difficult to be carried out quickly and effectively, causing losses to enterprises and users.

Method used

By receiving data deletion instructions, locking the target database, annotating the initial data directory, and asynchronously deleting data when preset conditions are met, rapid rollback is achieved.

Benefits of technology

It reduces the time-consuming of data deletion operations, improves the efficiency of deletion operations, and quickly and efficiently rolls back data when misoperating, reducing losses to enterprises and users.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113761059B_ABST
    Figure CN113761059B_ABST
Patent Text Reader

Abstract

This specification provides a data processing method and device, wherein the method includes: receiving a data deletion instruction for a target database, wherein the data deletion instruction carries a library identifier of the target database; determining the target database based on the library identifier, locking the target database, marking an initial data directory corresponding to the target database, and creating a target data directory corresponding to the target database; writing the execution data of the target database after unlocking to the target data directory, and asynchronously deleting the target data corresponding to the initial data directory when the initial data directory meets a preset deletion condition. The method reduces the time consumption of the data deletion operation by marking the initial data directory corresponding to the target database, and asynchronously deletes the target data when the initial data directory meets the preset deletion condition, so as to facilitate the rollback of the erroneously deleted data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a data processing method. The present invention also relates to a data processing device, a computing device, a computer-readable storage medium, and a computer program. Background Art

[0002] With the rapid development of the Internet, there is usually a need to delete data in the entire database in the field of Internet of Things and Industrial Internet. In the process of deleting data in the database, the existing technology directly deletes the data to be deleted in the database, but the data in the database is stored in the memory and disk. When deleting data, it is necessary to synchronously wait for tasks such as writing and compaction to be completed before deleting the data in the memory and disk. This process usually takes a long time, resulting in unpredictable time consumption of data deletion operations.

[0003] Moreover, when problems such as misoperation and accidental deletion of data occur, it is difficult to quickly and effectively roll back the erroneously deleted data, thus causing great losses to enterprises and users. Summary of the invention

[0004] In view of this, the embodiments of this specification provide a data processing method. This specification also relates to a data processing device, a computing device, a computer-readable storage medium, and a computer program to solve the technical defects existing in the prior art.

[0005] According to a first aspect of an embodiment of this specification, a data processing method is provided, including:

[0006] Receiving a data deletion instruction for a target database, wherein the data deletion instruction carries a database identifier of the target database;

[0007] Determine the target database based on the library identifier, lock the target database, mark an initial data directory corresponding to the target database, and create a target data directory corresponding to the target database;

[0008] The execution data of the unlocked target database is written into the target data directory, and when the initial data directory meets a preset deletion condition, the target data corresponding to the initial data directory is asynchronously deleted.

[0009] According to a second aspect of an embodiment of this specification, there is provided a data processing device, including:

[0010] A receiving module is configured to receive a data deletion instruction for a target database, wherein the data deletion instruction carries a database identifier of the target database;

[0011] a marking module configured to determine the target database based on the library identifier, lock the target database, mark an initial data directory corresponding to the target database, and create a target data directory corresponding to the target database;

[0012] The deletion module is configured to write the execution data of the unlocked target database into the target data directory, and asynchronously delete the target data corresponding to the initial data directory when the initial data directory meets a preset deletion condition.

[0013] According to a third aspect of an embodiment of this specification, a computing device is provided, including:

[0014] Memory and processor;

[0015] The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of any of the data processing methods are implemented.

[0016] According to a fourth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, the steps of any of the data processing methods are implemented.

[0017] According to a fifth aspect of the embodiments of this specification, a computer program is provided, wherein when the computer program is executed in a computer, the computer is caused to execute any step of the data processing method.

[0018] The data processing method provided in this specification receives a data deletion instruction for a target database, wherein the data deletion instruction carries a library identifier of the target database; determines the target database based on the library identifier, locks the target database, marks the initial data directory corresponding to the target database, and creates a target data directory corresponding to the target database; writes the execution data of the target database after unlocking into the target data directory, and asynchronously deletes the target data corresponding to the initial data directory when the initial data directory meets the preset deletion condition. Specifically, the data processing method determines the target database based on the received data deletion instruction, and by marking the initial data directory corresponding to the target database, the time consumption of the data deletion operation is greatly reduced, and the problem of unpredictable time consumption of the data deletion operation is avoided. Moreover, when the initial data directory meets the preset deletion condition, the target data is asynchronously delayed deleted, which facilitates the subsequent rapid and effective rollback of the erroneously deleted data, reducing the losses of enterprises and users. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 This is a specific flow chart of deleting time series data in a time series database provided by an embodiment of this specification;

[0020] Figure 2 is a flow chart of a data processing method provided by an embodiment of this specification;

[0021] Figure 3 This is a schematic diagram of a cluster data directory change before and after the initial data directory is marked, provided in an embodiment of this specification;

[0022] Figure 4 is a schematic diagram of time series data provided by an embodiment of this specification;

[0023] Figure 5 This is a schematic diagram of a cluster data directory change before and after deleting a target data directory, provided in an embodiment of this specification;

[0024] Figure 6 It is a processing flow chart of a data processing method applied to a time series database cluster scenario provided in an embodiment of this specification;

[0025] Figure 7 It is a processing flow chart of another data processing method applied to a time series database cluster scenario provided in an embodiment of this specification;

[0026] Figure 8 It is a structural schematic diagram of a data processing device provided in an embodiment of this specification;

[0027] Fig. 9 It is a structural block diagram of a computing device provided in an embodiment of this specification. DETAILED DESCRIPTION

[0028] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.

[0029] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.

[0030] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0031] First, the terms involved in one or more embodiments of this specification are explained.

[0032] Time series data: It is a series of indicator data that is continuously generated at a certain frequency. A time series data is described by elements such as Metric, Tags, Timestamp, and Fields.

[0033] Metric: Metric is similar to a table in a relational database, representing a collection of similar time series data. For example, a table is created for an air quality sensor to store the monitoring data of all air quality sensors.

[0034] Tag: It is used to describe the characteristics of a data source and usually does not change over time. For example, a sensor device contains tag information such as the device ID and the Region where the device is located. The database will automatically create an index for the tag and support multi-dimensional search queries based on the tag. A tag consists of a tag key and a tag value, both of which are String types.

[0035] Timestamp: Timestamp represents the time point when the data is generated. Timestamp can be specified when writing data or automatically generated by the system.

[0036] Measurement value (Field): Field is a measurement indicator that describes a data source and usually changes over time. For example, sensor devices contain fields such as temperature and humidity. The Field columns stored in Metric do not need to create a fixed schema in advance and can be dynamically increased or decreased during operation. Field consists of Field Key (measurement value keyword) and FieldValue (specific measurement data in the measurement value). Among them, Field Key is of String type, and FieldValue supports Boolean, Int, Double, String, Byte and other types.

[0037] Time series database: It is a database specially designed to solve the high-throughput and low-latency query of time series data. The time series database provides a series of unique data access operations, including aggregation, downsampling, interpolation, etc. It also provides a data life cycle (data timeliness) management mechanism.

[0038] Aggregation: refers to grouping, summing, counting, maximum value, minimum value, and other calculation operations on data points on the same timeline or different timelines.

[0039] Downsampling: When the query time interval spans a long period and the original data sampling frequency is high, downsampling can be used to reduce the query display accuracy of the data. For example, data collected by seconds can be sampled at the hourly level during query to reduce the number of data points in the result set.

[0040] Interpolation: When some data points are missing in the middle of the timeline, the data points can be automatically filled in through the interpolation algorithm.

[0041] Data timeliness (Time To Live): abbreviated as: TTL, refers to the validity period of data storage. Data that exceeds the validity period will be automatically cleaned up. The default data validity period is permanent storage.

[0042] Data Point: A measurement indicator value (Field Value) generated by a data source at a certain time is called a data point. The number of data points is used as a statistical indicator when querying and writing to the database.

[0043] Time Series: A certain indicator of the data source changes over time to form a time line. The combination of Metric+Tags+Field determines a time line. Calculations on time series data, including downsampling, aggregation, and interpolation, are all based on the time line dimension. When storing data, the database will cluster and store the data on the same time line as much as possible to improve the access efficiency of time line data and better support time series data compression.

[0044] Database cluster: refers to a virtual single database logical image composed of at least two databases, which can provide transparent data services to clients like a single database system.

[0045] Cluster center node: also known as the cluster master node, responsible for the management of the entire cluster and processing received operation requests.

[0046] Data node: refers to the database in the database cluster; in actual applications, a data node can be composed of multiple databases.

[0047] Data directory: also known as database directory or disk directory, it is used to represent all databases and data in the databases managed by the central node of the cluster. The databases and data in the databases are organized into a tree structure in the form of files. Each database has a corresponding subdirectory under the data directory. The data stored in the same database corresponds to the files in the subdirectory of the database. That is, the data stored in the database is represented by various forms of files in the subdirectories.

[0048] Rollback: refers to the act of restoring a program or data to its last correct state after a program or data processing error.

[0049] In typical time series scenarios such as the Internet of Things, application monitoring, and the Industrial Internet, the data source (Data Source, indicating who generates the data) usually generates time series data continuously at a certain period, and the generated time series data is stored in a time series database. In the fields of the Internet of Things and the Industrial Internet, there is usually a need to delete the entire time series database, that is, to delete all the time series data in a time series database.

[0050] See also Figure 1 , Figure 1 This is a specific flow chart of deleting time series data in a time series database provided by an embodiment of this specification, which specifically includes the following steps:

[0051] Step 102: Lock the database.

[0052] Specifically, the data node of the database cluster can receive the deletion request sent by the user, and lock the time series database based on the deletion request, and stop all read and write tasks for the time series database.

[0053] Step 104: Send a background task termination signal.

[0054] Specifically, the data node sends a background task termination signal to the time series database, thereby terminating all tasks in the task queue of the time series database.

[0055] Step 106: Wait for the background task to end.

[0056] Specifically, the data node waits for all tasks in the task queue of the time series database to be terminated.

[0057] Step 108: Clear memory data.

[0058] Specifically, the data node clears the time series data in the memory of the time series database.

[0059] Step 110: Delete the disk file.

[0060] Specifically, the data node deletes the time series data in the disk of the time series database.

[0061] Step 112: Unlock the database.

[0062] Specifically, after deleting the data in the time series database, the data node restarts all read and write tasks for the time series database and sends a response request for the deletion request to the user.

[0063] Figure 1 In the technical solution, the time series data of the time series database is distributed on the database memory and the database disk. When deleting the time series data stored in the time series database, it is necessary to synchronously wait for the completion of tasks such as "write" and "compaction" before deleting the time series data in the memory and on the disk.

[0064] However, since the status of background tasks in the time series database is relatively complex and difficult to predict, the synchronous waiting process usually takes a long time, resulting in uncontrollable time for synchronous waiting for the end of background asynchronous tasks, which in turn makes the time spent on deleting time series data unpredictable.

[0065] In step 108 and step 110, the deletion operation of the time series data in the memory and on the disk is executed immediately. However, if the deleted data needs to be rolled back due to some reasons, such as misoperation, if the time series data is deleted directly from the disk immediately when the time series data is deleted, the data cannot be rolled back quickly and effectively.

[0066] Based on this, in this specification, a data processing method is provided. This specification also involves a data processing device, a computing device, a computer-readable storage medium, and a computer program, which are described in detail one by one in the following embodiments.

[0067] See also Figure 2 , Figure 2 A flowchart of a data processing method provided according to an embodiment of the present specification is shown, which specifically includes the following steps:

[0068] Step 202: Receive a data deletion instruction for a target database, wherein the data deletion instruction carries a database identifier of the target database.

[0069] In practical applications, the data processing method provided in this specification can be applied to a database cluster, which includes a cluster center node and multiple data nodes, and the data nodes include multiple databases.

[0070] Among them, the target database can be understood as a database that needs to delete data. The target database can be a database contained in a data node of a database cluster. When the database cluster to which the data processing method is applied is different, the target database is also different. For example, when the data processing method is applied to a time series database cluster, the target database can be a time series database. When the data processing method is applied to a relational database cluster, the target database can be a relational database. For ease of understanding, this specification only takes the target database as a time series database as an example to introduce the data processing method in detail.

[0071] The target data may be understood as data stored in a target database. When the target database is a time series database, the target data may be time series data stored in the time series database.

[0072] The data deletion instruction may be understood as an instruction for instructing a data node to asynchronously delete target data in a target database.

[0073] The library identifier can be understood as an identifier that represents a database, and each library identifier can uniquely represent a database.

[0074] Specifically, the data node can receive a data deletion instruction for a target database, and the data deletion instruction carries a database identifier of the target database.

[0075] For example, in the scenario where the data processing method is applied to a time series database cluster, a detailed description is given of receiving a data deletion instruction for a target database, wherein the target database may be a target time series database located in a data node of the time series database cluster.

[0076] The data node receives a data deletion instruction for a target time series database under the data node, wherein the data deletion instruction carries a database identifier of the target time series database.

[0077] Step 204: Determine the target database based on the library identifier, lock the target database, mark the initial data directory corresponding to the target database, and create a target data directory corresponding to the target database.

[0078] Among them, the initial data directory can be understood as the data directory corresponding to the target database; when the data processing method is applied to a time series database cluster, the initial data directory can be an initial subdirectory corresponding to the target time series directory, and the subdirectory is recorded in the cluster root directory corresponding to the database cluster.

[0079] In the case where the initial data directory is an initial subdirectory, the target data directory may be understood as a newly added subdirectory corresponding to the target database that is created after the initial data directory is annotated.

[0080] Marking the initial data directory corresponding to the target database may be understood as adding an asynchronous deletion mark to the initial data directory.

[0081] Specifically, after the data node determines the target database based on the library flag carried in the data deletion instruction, it can stop all read and write tasks for the target database by locking the target database, and mark the initial data directory corresponding to the target database; after completing the marking of the initial data, create a target data directory corresponding to the target database.

[0082] Following the above example, in the scenario where the data processing method is applied to a time series database cluster, the labeling of the initial data directory corresponding to the target database is described in detail. The initial data directory can be the initial subdirectory in the root directory corresponding to the time series database cluster, and the target data directory can be a newly added subdirectory corresponding to the target database created after the initial data directory is labeled.

[0083] After receiving the data deletion instruction for the target time series database, the data node determines the target time series database on which the data asynchronous deletion operation needs to be performed based on the database identifier of the target time series database carried in the data deletion instruction.

[0084] After determining the target time series database, lock the target time series database and stop all read and write tasks for the target time series database; add an asynchronous deletion mark to the initial subdirectory corresponding to the target time series database; after completing the mark addition, create a new subdirectory corresponding to the target database.

[0085] See also Figure 3 , Figure 3 It is a schematic diagram of a cluster data directory change before and after the initial data directory is marked, provided by an embodiment of this specification; wherein the time series database cluster includes data nodes, and each data node supports multiple time series databases (database); each database corresponds to a subdirectory under the root directory of the time series database cluster, such as Figure 3 As shown in the figure, " / data" is the name of the disk directory of the time series database cluster, which is also the root directory of the time series database cluster. "buy" is the name of a disk subdirectory under the disk directory " / data" of the time series database cluster. This disk subdirectory is the disk subdirectory corresponding to the database named "buy" in the time series database cluster. "monitor" is the name of another disk subdirectory under the disk directory " / data" of the time series database cluster. This disk subdirectory is the disk subdirectory corresponding to the database named "monitor" in the time series database cluster.

[0086] In the embodiment of the present specification, the initial subdirectory may be a disk subdirectory monitor; and the newly added subdirectory may be a disk subdirectory "monitor#1".

[0087] When the disk subdirectory corresponding to the target time series database is monitor, before marking the disk subdirectory monitor as asynchronously deleted, that is, Figure 3 Before deletion, the disk subdirectory monitor is stored in the root directory " / data" in an unlabeled state.

[0088] After adding the asynchronous deletion mark to the disk subdirectory monitor, that is, Figure 3 After the deletion in , the disk subdirectory monitor framed by a dotted line indicates the directory that needs to be asynchronously deleted when the initial data directory meets the preset deletion conditions; "monitor#1" is a newly created subdirectory created after the disk subdirectory monitor is marked as asynchronously deleted, which is also the target data directory. "#1" is used to identify the version of the disk subdirectory monitor corresponding to the time series database, and is used to determine the actual valid data directory corresponding to the time series database. If the disk subdirectory monitor corresponding to the time series database is deleted again, according to this identification method, the name of the valid disk subdirectory corresponding to the time series database becomes "monitor#1".

[0089] After the target data directory is created, the data node unlocks the target time series database and resumes all read and write tasks for the target time series database.

[0090] In the embodiments of this specification, only the method of identifying the valid sub-directory of the time series database is "#1" to describe the data processing method in detail. The method of identifying the valid sub-directory of the time series database can be set according to the needs of the actual application, and this specification does not make any specific limitations on this.

[0091] In the process of marking the initial data directory, the initial data directory corresponding to the target database can only be marked after all tasks in the task queue of the target database are completed. This is because the tasks in the task queue will generate new data in the target database during execution; when the data in the task queue has not stopped, marking the initial data directory may result in some newly generated data being unable to be marked.

[0092] In the prior art, the method of ending all tasks in the task queue is to terminate all tasks in the database task queue by sending a background task termination signal, and wait until the task is completed before deleting the data in the database. However, since the status of the database background task is relatively complex, the time for waiting for the background task to end is uncontrollable, which makes the time consumption of the data deletion operation unpredictable. In this case, the above problem is solved by clearing the unexecuted tasks in the task queue and waiting for the current task to be completed. The specific implementation method is as follows:

[0093] The marking of the initial data directory corresponding to the target database includes:

[0094] The pending tasks of the target database are interrupted, and when the current tasks of the target database are completed, the initial data directory corresponding to the target database is marked.

[0095] Among them, pending tasks can be understood as unexecuted tasks in the task queue of the target database; current tasks can be understood as tasks being executed in the task queue of the target database. In actual applications, tasks in the task queue include but are not limited to write tasks and compaction tasks.

[0096] Specifically, when the data node is marking the initial target, it first interrupts the pending tasks of the target database and waits for the current task to be completed; then, when the current task of the target database is completed, it marks the initial data directory corresponding to the target database.

[0097] Continuing with the above example, in the scenario where the data processing method is applied to a time series database cluster, further details are given on how to label the initial data directory after the current task is processed.

[0098] After locking the target time series database, the data node of the time series database cluster clears the unexecuted tasks in the task queue of the target time series database, thereby interrupting the execution of the tasks to be executed; but does not interrupt the current task being executed in the task queue, but waits for the current task to be completed; when the current task is completed, the initial subdirectory corresponding to the target time series database is marked.

[0099] In the embodiment of this specification, by interrupting the task to be executed and marking the initial data directory corresponding to the target database when the current task is completed, no background task termination information is sent to terminate the ongoing task, thereby avoiding the problem that the time of the background task end is uncontrollable, resulting in the unpredictable time consumption of the data deletion operation, and effectively saving the computer's operating resources.

[0100] Furthermore, in the embodiments of this specification, the data in the target database memory is not cleared, nor is the initial data directory of the target database directly deleted or renamed, which will not cause abnormal termination of the running task, but wait for the running task to end naturally, which will not cause the loss of target data, the target data not being marked, and other problems, that is, the target data contained in the initial data directory is still complete. Because the target data is consistent before and after adding the asynchronous deletion mark, when the initial data directory does not meet the preset deletion conditions, the target data can be quickly rolled back based on the initial data directory without causing data loss.

[0101] Step 206: writing the execution data of the unlocked target database into the target data directory, and asynchronously deleting the target data corresponding to the initial data directory when the initial data directory meets a preset deletion condition.

[0102] The preset deletion condition can be set according to actual application, and the embodiments of this specification do not impose any limitation on this. For example, the preset deletion condition includes but is not limited to the time difference between the marking time of the initial data directory and the current time being greater than or equal to the preset time threshold, receiving a direct deletion instruction for the marked initial data directory, and the capacity of the target database being greater than or equal to the preset capacity threshold.

[0103] Specifically, the data node can write the execution data of the unlocked target database into the target data directory, and asynchronously delete the target data corresponding to the initial data directory when the initial data directory meets the preset deletion condition.

[0104] Using the above example, the execution data is written into the target data directory, and when the initial data directory meets the preset deletion condition, the target data corresponding to the initial data directory is asynchronously deleted. The preset deletion condition may be receiving a direct deletion instruction for the marked initial data directory.

[0105] After creating a new subdirectory corresponding to the target time series database, the data node unlocks the target time series database and records the data generated by the target time series database in the process of executing the task to be executed into the valid new subdirectory corresponding to the target time series database.

[0106] Furthermore, when a direct deletion instruction for the marked initial subdirectory is received, the time series data corresponding to the initial subdirectory can be directly deleted immediately based on the direct deletion instruction.

[0107] Furthermore, in the initial data directory with the asynchronous deletion mark, the new data generated by the target database during the task execution process can no longer be recorded, which will cause the target database to crash and fail to store new data. Based on this, by creating a target data directory corresponding to the target database, the target database is prevented from crashing and failing to store new data due to the absence of a valid data directory, which effectively improves the stability of the target database operation. In addition, by unlocking the target database, all read and write tasks for the target database are started; in the process of executing read and write tasks on the target database, the generated execution data can be recorded in the target data directory. The specific implementation steps are as follows:

[0108] Writing the execution data of the unlocked target database into the target data directory includes:

[0109] The target database is unlocked, and the tasks to be executed of the target database are executed, and the execution data generated by executing the tasks to be executed are recorded in the target data directory.

[0110] The execution data may be understood as the data generated during the execution of the task of the target database.

[0111] Specifically, after creating a target data directory corresponding to the target database, the data node unlocks the target database; executes the to-be-executed tasks of the target database, and records the execution data generated by executing the to-be-executed tasks into the target data directory.

[0112] Using the previous example, this article describes in detail how to create a target data directory and unlock the database in the scenario where the data processing method is applied to a time series database cluster.

[0113] After creating a new subdirectory corresponding to the target time series database, the data node unlocks the target time series database, re-executes the pending task that was interrupted during the process of adding asynchronous deletion annotations to the initial subdirectory corresponding to the target time series database, and records the data generated during the execution of the pending task into the valid new subdirectory corresponding to the target time series database. After recording the generated data into the new subdirectory, the data generated during the execution of the pending task is represented in the form of files in the new subdirectory.

[0114] In the embodiments of the present specification, by unlocking the target database, executing the pending tasks of the target database, and recording the execution data generated by executing the pending tasks into the target data directory, the stable operation of the target database is achieved, the occurrence of problems such as target database paralysis and inability to store new data is avoided, and the stability of the target database operation is effectively improved.

[0115] In another case, when the initial data directory meets the preset deletion condition, in the process of asynchronously deleting the target data corresponding to the initial data directory, it can be determined whether to asynchronously delete the target data corresponding to the initial data directory according to the time difference between the marking time of the initial data directory and the current time; the specific implementation method is as follows:

[0116] When the initial data directory satisfies a preset deletion condition, asynchronously deleting target data corresponding to the initial data directory includes:

[0117] The time difference between the marking time of the initial data directory and the current time is determined, and when the time difference is greater than or equal to a preset time threshold, the target data corresponding to the initial data directory is asynchronously deleted.

[0118] The marking time can be understood as the time when the initial data directory is marked; the time difference between the marking time and the current time can be understood as the difference generated by subtracting the current time from the marking time.

[0119] The preset time threshold can be understood as the retention time during the asynchronous deletion of the target data. In the embodiment of this specification, when the difference between the time when the initial data directory is marked and the current time exceeds the retention time, the target data is asynchronously deleted. The preset time threshold can be set according to the actual application, and the embodiment of this specification does not impose any restrictions on this. For example, 30 days, 60 days.

[0120] Specifically, the data node determines the time difference between the marking time of the initial data directory and the current time, and asynchronously deletes the target data corresponding to the initial data directory when the time difference is greater than or equal to a preset time threshold.

[0121] Using the above example, in the scenario where the data processing method is applied to a time series database cluster, further details are given on asynchronously deleting target data when the time difference between the marked time and the current time is greater than or equal to the preset time threshold. The target data can be understood as time series data.

[0122] See also Figure 4 , Figure 4 is a schematic diagram of a time series data provided in an embodiment of this specification. Figure 4 As shown, the Metric / Table is Figure 4 The measurement / table name of the time series data table in the table is used to indicate the storage location of the time series data. Tags are used to indicate the data generation object, where Tags include: DeviceId and Region; the DeviceId is the device ID of the data generation object, and the Region is the region where the data generation object is located; Timestamp is used to indicate the time when the time series data is generated, and Fields is used to indicate the specific content of the time series data, where Fields include: Temperature and Humidity, where Temperature is temperature data and Humidity is humidity data.

[0123] The data node determines the time difference between the marking time of the initial sub-directory and the current time according to the preset frequency, and compares the time difference with the preset time threshold. When the time difference is less than the preset time threshold, the time series data corresponding to the initial data directory will not be deleted; when the time difference is greater than or equal to the preset time threshold, the time series data corresponding to the initial data directory will be asynchronously deleted.

[0124] In practical applications, the preset frequency can be set according to the practical application, and the embodiments of this specification do not impose any limitation on this. For example, the time difference is determined at a frequency of once a minute or once a second.

[0125] Further, in the embodiments of the present specification, when deleting data in the database in the prior art, the data cannot be rolled back after deletion. In the embodiments of the present specification, in the process of asynchronously deleting the target data, when the initial data directory does not meet the preset deletion conditions, the target data corresponding to the initial data directory can be rolled back, thereby realizing fast and effective rollback of the deleted target data, avoiding the problem of being unable to recover the data after being deleted due to misoperation. The specific implementation steps are as follows:

[0126] Before deleting the target data corresponding to the initial data directory, the method further includes:

[0127] A data recovery instruction for the target database is received, and when the initial data directory does not satisfy a preset deletion condition, a label of the initial data directory corresponding to the target database is deleted based on the data recovery instruction.

[0128] The data recovery instruction may be understood as an instruction for instructing the data node to delete the annotation of the initial data directory corresponding to the target database.

[0129] Specifically, the data node can receive a data recovery instruction for the target database, and when the initial data directory does not meet the preset deletion condition, delete the label of the initial data directory corresponding to the target database based on the data recovery instruction to achieve recovery of the initial data directory.

[0130] Continuing with the above example, in the scenario where the data processing method is applied to a time series database cluster, the annotation of deleting the initial data directory corresponding to the target database based on the data recovery instruction is further explained in detail.

[0131] When the preset deletion condition is that the time difference between the marking time of the initial data directory and the current time is greater than or equal to the preset time threshold, the data node determines the time when the data recovery instruction is received at the same time as receiving the data recovery instruction; and subtracts the time when the initial data directory is marked from the time when the data recovery instruction is received, thereby obtaining the time difference between the marking time and the receiving time, and compares the time difference with the preset time threshold. When the time difference is greater than or equal to the preset time threshold, it indicates that the time series data corresponding to the initial data directory has been deleted, and the deleted time series data cannot be rolled back.

[0132] When the time difference is less than the preset time threshold, it indicates that the time series data corresponding to the initial data directory has not been deleted. Then, based on the data recovery instruction, the asynchronous deletion mark of the initial data directory corresponding to the target time series database is deleted, thereby restoring the validity of the initial data directory corresponding to the target time series database and the target time series data corresponding to the initial data directory, and realizing the rollback of the time series data under the initial data directory.

[0133] When the preset deletion condition is receiving a direct deletion instruction for the marked initial data directory, the data node determines whether it has received a direct deletion instruction for the marked initial data directory before receiving the data recovery instruction while receiving the data recovery instruction.

[0134] If yes, it means that the time series data corresponding to the initial data directory has been deleted, and the deleted time series data cannot be rolled back.

[0135] If not, it means that the time series data corresponding to the initial data directory has not been deleted. Then, based on the data recovery instruction, the asynchronous deletion mark of the initial data directory corresponding to the target time series database is deleted, thereby restoring the validity of the initial data directory corresponding to the target time series database and the target time series data corresponding to the initial data directory, and realizing the rollback of the time series data under the initial data directory.

[0136] In an embodiment of the present specification, by receiving a data recovery instruction for a target database and deleting the mark of the initial data directory corresponding to the target database when the initial data directory meets the preset deletion condition, it is possible to effectively and quickly roll back the target data when the initial data directory does not meet the preset deletion condition.

[0137] After deleting the mark of the initial data directory corresponding to the target database, the initial data directory corresponding to the target database and the target data directory are both valid data directories of the target database. This will cause the execution data generated by the target database during the task execution process to be unable to be correctly recorded in the data directory, thereby causing data disorder in the target database. Based on this, in the embodiment of this specification, the above technical problem is solved by deleting the target data directory, and the specific implementation method is as follows.

[0138] After deleting the mark of the initial data directory corresponding to the target database based on the data recovery instruction, the method further includes:

[0139] The execution data recorded in the target data directory is recorded in the initial data directory, and the target data directory is deleted.

[0140] Specifically, after deleting the annotation of the initial data directory, the data node records the execution data recorded in the target data directory into the initial data directory, and deletes the target data directory.

[0141] Continuing with the above example, in the scenario where the data processing method is applied to a time series database cluster, further detailed description is given on recording the execution data recorded in the target data directory to the initial data directory and deleting the target data directory.

[0142] After deleting the annotation of the initial subdirectory corresponding to the target time series database, the data node points the effective directory of the target time series database to the initial subdirectory, and re-records the execution data recorded in the newly added subdirectory into the initial subdirectory, so that in the process of deleting the newly added subdirectory, the execution data corresponding to the newly added subdirectory will not be deleted.

[0143] After recording the execution data recorded in the newly added subdirectory to the initial subdirectory, the newly added subdirectory is deleted, so that the initial subdirectory is the only valid directory of the target time series database. Figure 5 , Figure 5 This is a schematic diagram of a cluster data directory change before and after deleting a target data directory, provided in an embodiment of this specification; see Figure 5 , the before rollback can be understood as before deleting the target data directory; the after rollback can be understood as after deleting the target data directory.

[0144] Before deleting the newly added subdirectory "monitor#1", the root directory / data includes the initial subdirectory monitor marked as asynchronously deleted, the newly added subdirectory "monitor#1", and the disk subdirectory buy.

[0145] After deleting the newly added subdirectory "monitor#1", the root directory / data includes the initial subdirectory monitor and the disk subdirectory buy. At this time, the initial subdirectory monitor is the only valid data directory of the target time series database.

[0146] In the embodiments of the present specification, the execution data recorded in the target data directory is recorded in the initial data directory, thereby avoiding the problem of accidental deletion of execution data during the deletion of the target data directory; and by deleting the target data directory, the initial data directory is made the only valid directory of the target time series database, thereby avoiding the problem of data disorder in the target database caused by the inability to correctly record the generated execution data in the data directory.

[0147] Furthermore, in the process of deleting the target data directory, in order to prevent the current task of the target database from being unable to execute normally and to avoid errors in the data recorded in the target data directory, in an embodiment of the present specification, the target data directory is deleted by interrupting the task to be executed and waiting for the current task to be completed. The specific implementation steps are as follows.

[0148] The step of recording the execution data recorded in the target data directory to the initial data directory and deleting the target data directory includes:

[0149] The pending tasks of the target database are interrupted, and when the current tasks of the target database are completed, the execution data recorded in the target data directory is recorded in the initial data directory, and the target data directory is deleted.

[0150] Specifically, the data node interrupts the pending tasks of the target database, and when the current tasks of the target database are completed, the data node records the execution data recorded in the target data directory to the initial data directory, and deletes the target data directory.

[0151] Continuing with the above example, the data processing method is applied to the scenario of a time series database cluster to interrupt the task to be executed and delete the target data directory after the current task is processed. Further details are given.

[0152] After deleting the mark of the initial subdirectory corresponding to the target time series database, the data node clears the unexecuted tasks in the task queue of the target time series database, thereby interrupting the tasks to be executed; but does not interrupt the current task being executed in the task queue, but waits for the current task to be completed; when the current task is completed, the execution data recorded in the newly added subdirectory is re-recorded in the initial subdirectory, and the newly added subdirectory is deleted.

[0153] In the embodiment of this specification, by interrupting the task to be executed, and when the current task is completed, the execution data recorded in the target data directory is recorded in the initial data directory, and the target data directory is deleted. This avoids the current task of the target database from being unable to execute normally and prevents errors in the execution data recorded in the initial data directory.

[0154] Furthermore, in order to avoid excessive computing pressure on the target database due to the read and write tasks for the target database during the process of deleting the annotation of the initial data directory corresponding to the target database based on the data recovery instruction, after receiving the data recovery instruction for the target database, the method further includes:

[0155] Locking the target database;

[0156] Correspondingly, after deleting the mark of the initial data directory corresponding to the target database based on the data recovery instruction, the method further includes: unlocking the target database.

[0157] Specifically, after receiving a data recovery instruction for a target database, the data node determines the target database based on the library identifier carried in the data recovery instruction, and locks the target database, thereby stopping all read and write tasks for the target database; and after deleting the mark of the initial data directory corresponding to the target database based on the data recovery instruction, the target database is unlocked, thereby effectively alleviating the computing pressure of the target database and saving computer resources.

[0158] Furthermore, in the data processing method provided in the embodiments of this specification, the determining the time difference between the marking time of the initial data directory and the current time includes:

[0159] A data asynchronous deletion task is created based on the marking time of the marking time of the initial data directory, and a time difference between the marking time and the current time is determined based on the data asynchronous deletion task.

[0160] Among them, the data asynchronous deletion task can be understood as a task of asynchronously deleting the target data corresponding to the initial data directory corresponding to the target database. In the embodiment of this specification, the data asynchronous deletion task is implemented by determining the time difference between the marking time and the current time. When the time difference is greater than or equal to the preset time threshold, the target data corresponding to the initial data directory is asynchronously deleted.

[0161] Specifically, after recording the marking time, the data node creates a data asynchronous deletion task based on the marking time, and determines the time difference between the marking time and the current time based on the data asynchronous deletion task.

[0162] Continuing with the above example, in the scenario where the data processing method is applied to a time series database cluster, this article explains in detail how to determine the time difference between the marking time and the current time based on creating a data asynchronous deletion task.

[0163] After the data node marks the initial data directory and records the marking time, it generates a data asynchronous deletion task based on the marking time.

[0164] Based on the data asynchronous deletion task, the data node determines the time difference between the marking time and the current time at a preset frequency, and compares the time difference with the preset time threshold. When the time difference is less than the preset time threshold, the time series data corresponding to the initial data directory will not be asynchronously deleted; when the time difference is greater than or equal to the preset time threshold, the time series data corresponding to the initial data directory will be asynchronously deleted.

[0165] In the embodiments of this specification, by determining the time difference between the marking time and the current time based on creating a data asynchronous deletion task, effective asynchronous deletion of the time series data corresponding to the initial data directory is achieved.

[0166] The data processing method provided in the embodiment of this specification determines the target database based on the received data deletion instruction, and replaces the method of directly deleting the data in the database by marking the initial data directory corresponding to the target database, which greatly reduces the time consumption of data deletion operation and improves the efficiency of deletion operation. In addition, when the initial data directory meets the preset deletion conditions, the target data is asynchronously delayed deleted, which facilitates the rapid and effective rollback of the erroneously deleted data in the subsequent case that the initial data directory does not meet the preset deletion conditions, thereby reducing the losses of enterprises and users.

[0167] The following combination Figure 6 , taking the application of the data processing method provided in this specification in the time series database cluster scenario as an example, the data processing method is further explained. Figure 6 A processing flow chart of a data processing method applied to a time series database cluster scenario provided in an embodiment of the present specification is shown. Based on the processing flow chart, it can be seen that the data processing method applied to a time series database cluster scenario provided in the present specification includes two processes: a data deletion process A and a data rollback process B.

[0168] Among them, data deletion process A can be that after the data node receives the deletion request, it first determines the target time series database based on the deletion request and locks the target time series data; secondly, it clears the unexecuted tasks in the task queue of the target time series database, and after the current task is executed, adds a deletion mark to the old data directory corresponding to the target time series database, records the marking time, and creates a new data directory; then, according to the retention time and the marking time, an asynchronous deletion task is added to the old data directory, so that when the time difference between the marking time and the current time is greater than or equal to the retention time, the old data directory is asynchronously deleted. After adding the asynchronous deletion task to the old data directory, the target time series database is unlocked, and after unlocking, a response request is returned to the user, and the data deletion process A ends.

[0169] Among them, in another case, if the time difference between the marked time and the current time is less than the retention time, the data can be rolled back through the data deletion process B.

[0170] Specifically, after receiving the rollback request, the data node can first lock the target time series database; secondly, cancel the asynchronous deletion task for the old data directory and delete the newly created data directory; then, load the data files under the old data directory and unlock the target time series database. After unlocking, return the response request to the user, and the data rollback process B ends.

[0171] Based on the above introduction, the data processing method provided in this specification for use in a time series database cluster scenario specifically includes the following steps:

[0172] Step 602: Lock the database.

[0173] Specifically, after receiving the deletion request sent by the user, the data node determines the target time series database that needs to perform the data deletion operation in the time series database cluster based on the database identifier carried in the deletion request; and locks the target time series database, thereby stopping all read and write tasks for the target time series database.

[0174] The deletion request may be understood as the data deletion instruction in the above embodiment.

[0175] Step 604: Clear the unexecuted tasks in the task queue.

[0176] Specifically, the data node clears the unexecuted tasks in the task queue of the target time series database and waits for the current task to be completed.

[0177] After the current task is processed, an asynchronous deletion mark is added to the old data directory corresponding to the target time series database, and the time when the mark is made is recorded.

[0178] The old data directory may be understood as the initial data directory in the above embodiment.

[0179] Step 606: Create a new data directory.

[0180] Specifically, after marking the old data directory corresponding to the target time series database, the data node recreates a new data directory.

[0181] The new data directory may be understood as the target data directory in the above embodiment.

[0182] Step 608: Add an asynchronous deletion task for the old data directory according to the retention time.

[0183] Specifically, the data node adds an asynchronous deletion task for the old data directory based on the marking time and the retention time. The asynchronous deletion task is used to asynchronously delete the time series data corresponding to the old data directory when the time difference between the marking time and the current time is greater than or equal to the retention time.

[0184] Furthermore, after adding an asynchronous deletion task for the old data directory, the new data directory is determined as the only valid data directory of the target time series database.

[0185] The retention time may be understood as the preset time threshold in the above embodiment.

[0186] Step 610: Unlock the database.

[0187] Specifically, after adding an asynchronous deletion task for the old data directory, the data node unlocks the target time series database, thereby starting all read and write tasks for the target time series database.

[0188] And, a response request to the deletion request is returned to the user.

[0189] In actual applications, when the time difference between the marked time and the current time is less than the retention time, if you want to restore the time series data corresponding to the old data directory, you can roll back the time series data by canceling the asynchronous deletion task of the old data directory. The specific implementation steps are as follows:

[0190] Step 612: Lock the database.

[0191] Specifically, after receiving the rollback request sent by the user, the data node corresponding to the target time series database locks the target time series database based on the rollback request, thereby stopping all read and write tasks for the target time series database.

[0192] The rollback request may be understood as the data recovery instruction in the above embodiment.

[0193] Step 614: Cancel the asynchronous deletion task.

[0194] Specifically, the data node deletes the asynchronous deletion task of the old data directory, thereby rolling back the old data directory and restoring the validity of the old data directory.

[0195] Step 616: Delete the newly created data directory.

[0196] Specifically, after deleting the asynchronous deletion task, the data node needs to migrate the newly created data directory, that is, the data recorded in the new data directory, to the old data directory, and delete the newly created data directory after the migration is completed.

[0197] Step 618: Load the data files in the old data directory.

[0198] Specifically, after deleting the new data directory, the data node reloads the data files in the old data directory, so that the old data directory becomes the only valid data directory of the target time series database.

[0199] Step 620: Unlock the database.

[0200] Specifically, after the data node determines the old data directory as the only valid data directory of the target time series database, it unlocks the target time series database, thereby starting all read and write tasks for the target time series database.

[0201] And, a response request for the rollback request is returned to the user.

[0202] The data processing method provided in the embodiment of this specification ensures the integrity of data before and after deletion by discarding the old data directory and using the new data directory to store new data during the deletion operation on the target time series database, and achieves a millisecond-level response to the request to delete data. In addition, an asynchronous delayed deletion task of the old data directory is set according to the retention time, so that the deleted data can be quickly and effectively rolled back completely as long as it is within the retention time range.

[0203] At the same time, the newly created disk directory is used as the new data directory corresponding to the target time series database, and the old data directory is not modified. There is no need to terminate the ongoing background tasks, and there is no time-consuming waiting for the task to terminate and complete, which greatly reduces the time consumption of data deletion operations and improves the efficiency of deletion operations. Ensure millisecond-level response to deletion requests; asynchronously delay the cleaning of deleted data directories, which ensures that data can be rolled back within the retention time, and can also ensure that the data will eventually be deleted after the retention time exceeds, alleviating the storage pressure of the database.

[0204] The following combination Figure 7 , taking another application of the data processing method provided in this specification in a time series database cluster scenario as an example, the data processing method is further described. Figure 7 A processing flow chart of another data processing method applied to a time series database cluster scenario provided in an embodiment of this specification is shown. Based on the processing flow chart, it can be seen that the data processing method applied to a time series database cluster scenario provided in this specification includes two processes: a data deletion process C and a data rollback process D.

[0205] Among them, the data deletion process C can be that after the data node receives the deletion request, it first determines the target time series database based on the deletion request and locks the target time series data; secondly, it clears the unexecuted tasks in the task queue of the target time series database, and after the current task is executed, adds a deletion mark to the old data directory corresponding to the target time series database, and creates a new data directory corresponding to the target time series database; then, according to the preset capacity threshold of the time series database, an asynchronous deletion task is added to the old data directory, so that when the capacity occupied by the data in the time series database is greater than or equal to the preset capacity threshold, the old data directory is asynchronously deleted, wherein the capacity occupied by the data in the time series database can be the sum of the capacity occupied by the old data directory and the capacity occupied by the new data directory; after adding the asynchronous deletion task to the old data directory, the target time series database is unlocked, and after unlocking, a response request is returned to the user, and the data deletion process C ends.

[0206] In another case, if the current capacity of the time series database is less than the preset capacity threshold, data rollback can be performed through the data deletion process D.

[0207] Specifically, after receiving the rollback request, the data node can first lock the target time series database; secondly, cancel the asynchronous deletion task for the old data directory and delete the newly created data directory; then, load the data files under the old data directory and unlock the target time series database. After unlocking, return the response request to the user, and the data rollback process D ends.

[0208] Based on the above introduction, the data processing method provided in this specification for use in a time series database cluster scenario specifically includes the following steps:

[0209] Step 702: Lock the database.

[0210] Specifically, after receiving the deletion request sent by the user, the data node determines the target time series database that needs to perform the data deletion operation in the time series database cluster based on the database identifier carried in the deletion request; and locks the target time series database, thereby stopping all read and write tasks for the target time series database.

[0211] The deletion request may be understood as the data deletion instruction in the above embodiment.

[0212] Step 704: Clear the unexecuted tasks in the task queue.

[0213] Specifically, the data node clears the unexecuted tasks in the task queue of the target time series database and waits for the current task to be completed.

[0214] After the current task is processed, an asynchronous deletion mark is added to the old data directory corresponding to the target time series database.

[0215] The old data directory may be understood as the initial data directory in the above embodiment.

[0216] Step 706: Create a new data directory.

[0217] Specifically, after marking the old data directory corresponding to the target time series database, the data node recreates a new data directory.

[0218] The new data directory may be understood as the target data directory in the above embodiment.

[0219] Step 708: Add an asynchronous deletion task for the old data directory according to a preset capacity threshold.

[0220] The preset capacity threshold can be set according to actual application, and the embodiments of this specification do not impose any limitation on this. For example, the preset capacity threshold can be 70% or 90% of the total capacity of the target time series database.

[0221] Specifically, the data node adds an asynchronous deletion task for the old data directory based on a preset capacity threshold of the time series database. The asynchronous deletion task is used to asynchronously delete the time series data corresponding to the old data directory when the capacity occupied by the data in the time series database is greater than or equal to the preset capacity threshold.

[0222] Furthermore, after adding an asynchronous deletion task for the old data directory, the new data directory is determined as the only valid data directory of the target time series database.

[0223] Step 710: Unlock the database.

[0224] Specifically, after adding an asynchronous deletion task for the old data directory, the data node unlocks the target time series database, thereby starting all read and write tasks for the target time series database.

[0225] And, a response request to the deletion request is returned to the user.

[0226] In actual applications, when the capacity occupied by data in the time series database is less than the preset capacity threshold, if you want to restore the time series data corresponding to the old data directory, you can roll back the time series data by canceling the asynchronous deletion task of the old data directory. The specific implementation steps are as follows:

[0227] Step 712: Lock the database.

[0228] Specifically, after receiving the rollback request sent by the user, the data node corresponding to the target time series database locks the target time series database based on the rollback request, thereby stopping all read and write tasks for the target time series database.

[0229] The rollback request may be understood as the data recovery instruction in the above embodiment.

[0230] Step 714: Cancel the asynchronous deletion task.

[0231] Specifically, the data node deletes the asynchronous deletion task of the old data directory, thereby rolling back the old data directory and restoring the validity of the old data directory.

[0232] Step 716: Delete the newly created data directory.

[0233] Specifically, after deleting the asynchronous deletion task, the data node needs to migrate the newly created data directory, that is, the data recorded in the new data directory, to the old data directory, and delete the newly created data directory after the migration is completed.

[0234] Step 718: Load the data files in the old data directory.

[0235] Specifically, after deleting the new data directory, the data node reloads the data files in the old data directory, so that the old data directory becomes the only valid data directory of the target time series database.

[0236] Step 720: Unlock the database.

[0237] Specifically, after the data node determines the old data directory as the only valid data directory of the target time series database, it unlocks the target time series database, thereby starting all read and write tasks for the target time series database.

[0238] And, a response request for the rollback request is returned to the user.

[0239] The data processing method provided in the embodiments of this specification ensures the integrity of data before and after deletion by discarding the old data directory and using the new data directory to store new data during the deletion operation on the target time series database, and achieves a millisecond-level response to the request to delete data. In addition, an asynchronous delayed deletion task for the old data directory is set according to a preset capacity threshold, and as long as the current capacity of the time series database is less than the preset capacity threshold, the deleted data can be quickly and effectively rolled back completely.

[0240] At the same time, the newly created disk directory is used as the new data directory corresponding to the target time series database, and the old data directory is not modified. There is no need to terminate the ongoing background tasks, and there is no time-consuming waiting for the task to terminate and complete, which greatly reduces the time consumption of data deletion operations and improves the efficiency of deletion operations. It ensures millisecond-level response to deletion requests; asynchronous delay cleanup of deleted data directories relieves the storage pressure of the database.

[0241] Corresponding to the above method embodiment, this specification also provides a data processing device embodiment, Figure 8 FIG. 1 shows a schematic diagram of the structure of a data processing device provided by an embodiment of the present specification. Figure 8 As shown, the device comprises:

[0242] The receiving module 802 is configured to receive a data deletion instruction for a target database, wherein the data deletion instruction carries a database identifier of the target database;

[0243] A marking module 804 is configured to determine the target database based on the library identifier, lock the target database, mark the initial data directory corresponding to the target database, and create a target data directory corresponding to the target database;

[0244] The deletion module 806 is configured to write the execution data of the unlocked target database into the target data directory, and asynchronously delete the target data corresponding to the initial data directory when the initial data directory meets a preset deletion condition.

[0245] Optionally, the marking module 804 is further configured to interrupt the pending tasks of the target database, and mark the initial data directory corresponding to the target database when the current task processing of the target database is completed.

[0246] Optionally, the deleting module 806 is further configured to unlock the target database, execute the to-be-executed tasks of the target database, and record the execution data generated by executing the to-be-executed tasks into the target data directory.

[0247] Optionally, the deletion module 806 is further configured to determine the time difference between the marking time of the initial data directory and the current time, and asynchronously delete the target data corresponding to the initial data directory when the time difference is greater than or equal to a preset time threshold.

[0248] Optionally, the data processing device further includes a recovery module, which is configured to receive a data recovery instruction for the target database, and delete the mark of the initial data directory corresponding to the target database based on the data recovery instruction when the initial data directory does not meet a preset deletion condition.

[0249] Optionally, the data processing device further includes a recording module, wherein the recording module is configured to record the execution data recorded in the target data directory to the initial data directory and delete the target data directory.

[0250] Optionally, the recording module is also configured to interrupt the pending tasks of the target database, and when the current task processing of the target database is completed, record the execution data recorded in the target data directory to the initial data directory and delete the target data directory.

[0251] Optionally, the data processing device further comprises a locking module, wherein the locking module is configured to lock the target database;

[0252] Correspondingly, the data processing device further includes an unlocking module; the unlocking module is configured to unlock the target database.

[0253] Optionally, the data processing device further includes a task creation module, which is configured to create a data asynchronous deletion task based on the marking time of the initial data directory, and determine the time difference between the marking time and the current time based on the data asynchronous deletion task.

[0254] The data processing device provided in this specification, after receiving a data deletion instruction, marks the initial data directory and records the marking time; and when the initial data directory meets the preset deletion conditions, asynchronous delayed deletion of the target data is performed, so as to facilitate the subsequent rapid and effective rollback of erroneous data, thereby reducing the losses of enterprises and users.

[0255] The above is a schematic scheme of a data processing device of this embodiment. It should be noted that the technical scheme of the data processing device and the technical scheme of the above data processing method belong to the same concept, and the details of the technical scheme of the data processing device that are not described in detail can be referred to the description of the technical scheme of the above data processing method.

[0256] Fig. 9 The structure block diagram of a computing device 900 provided according to an embodiment of the present specification is shown. The components of the computing device 900 include but are not limited to a memory 910 and a processor 920. The processor 920 is connected to the memory 910 via a bus 930, and a database 950 is used to store data.

[0257] The computing device 900 also includes an access device 940 that enables the computing device 900 to communicate via one or more networks 960. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 940 may include one or more of any type of network interface (e.g., a network interface card (NIC)) that is wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a World Wide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.

[0258] In one embodiment of the present specification, the above components of the computing device 900 and Fig. 9 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Fig. 9 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.

[0259] The computing device 900 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or PC. The computing device 900 may also be a mobile or stationary server.

[0260] The processor 920 is used to execute computer executable instructions, which, when executed by the processor 902, implement the steps of any of the data processing methods.

[0261] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above data processing method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the above data processing method.

[0262] An embodiment of the present specification further provides a computer-readable storage medium storing computer-executable instructions, which can implement any step of the data processing method when executed by a processor.

[0263] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above data processing method belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the above data processing method.

[0264] An embodiment of the present specification further provides a computer program, wherein when the computer program is executed in a computer, the computer is caused to execute any step of the data processing method.

[0265] The above is a schematic scheme of a computer program of this embodiment. It should be noted that the schematic scheme of the computer program and the technical scheme of the above data processing method belong to the same concept, and the details not described in detail in the schematic scheme of the computer program can be referred to the description of the technical scheme of the above data processing method.

[0266] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0267] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0268] It should be noted that, for the convenience of description, the aforementioned method embodiments are all described as a series of action combinations, but those skilled in the art should be aware that this specification is not limited by the order of the actions described, because according to this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this specification.

[0269] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0270] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to only the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of this specification, so that technicians in the relevant technical field can well understand and use this specification. This specification is limited only by the claims and their full scope and equivalents.

Claims

1. A data processing method, include: Receiving a data deletion instruction for a target database, wherein the data deletion instruction carries a database identifier of the target database; Determine the target database based on the library identifier, and lock the target database; Interrupt the pending tasks of the target database, and when the pending tasks are cleared and the current tasks of the target database are processed, mark the initial data directory corresponding to the target database and create a target data directory corresponding to the target database; The execution data of the unlocked target database is written into the target data directory, and when the initial data directory meets a preset deletion condition, the target data corresponding to the initial data directory is asynchronously deleted.

2. The data processing method according to claim 1, wherein the execution data of the target database after unlocking is written into the target data directory, include: The target database is unlocked, and the tasks to be executed of the target database are executed, and the execution data generated by executing the tasks to be executed are recorded in the target data directory.

3. The data processing method according to claim 1, wherein when the initial data directory meets a preset deletion condition, the target data corresponding to the initial data directory is asynchronously deleted. include: The time difference between the marking time of the initial data directory and the current time is determined, and when the time difference is greater than or equal to a preset time threshold, the target data corresponding to the initial data directory is asynchronously deleted.

4. The data processing method according to claim 1, before asynchronously deleting the target data corresponding to the initial data directory, include: A data recovery instruction for the target database is received, and when the initial data directory does not satisfy a preset deletion condition, a label of the initial data directory corresponding to the target database is deleted based on the data recovery instruction.

5. The data processing method according to claim 4, after deleting the annotation of the initial data directory corresponding to the target database based on the data recovery instruction, further include: The execution data recorded in the target data directory is recorded in the initial data directory, and the target data directory is deleted.

6. The data processing method according to claim 5, wherein the execution data recorded in the target data directory is recorded in the initial data directory, and the target data directory is deleted. include: The pending tasks of the target database are interrupted, and when the current tasks of the target database are completed, the execution data recorded in the target data directory is recorded to the initial data directory, and the target data directory is deleted.

7. The data processing method according to claim 4, after receiving the data recovery instruction for the target database, further comprising: include: Locking the target database; Correspondingly, after deleting the mark of the initial data directory corresponding to the target database based on the data recovery instruction, the method further includes: unlocking the target database.

8. The data processing method according to claim 3, wherein the time difference between the marking time of the initial data directory and the current time is determined. include: A data asynchronous deletion task is created based on the marking time of the initial data directory, and a time difference between the marking time and the current time is determined based on the data asynchronous deletion task.

9. A data processing device, include: A receiving module is configured to receive a data deletion instruction for a target database, wherein the data deletion instruction carries a database identifier of the target database; a marking module, configured to determine the target database based on the library identifier and lock the target database, Interrupt the pending tasks of the target database, and when the pending tasks are cleared and the current tasks of the target database are processed, mark the initial data directory corresponding to the target database and create a target data directory corresponding to the target database; The deletion module is configured to write the execution data of the unlocked target database into the target data directory, and asynchronously delete the target data corresponding to the initial data directory when the initial data directory meets a preset deletion condition.

10. A computing device, include: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of the data processing method according to any one of claims 1 to 8 are implemented.

11. A computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions, when executed by a processor, implement the steps of the data processing method according to any one of claims 1 to 8.

12. A computer program, in, When the computer program is executed in a computer, the computer is caused to execute the steps of the data processing method according to any one of claims 1 to 8.