Backtracking database table recovery management method and device, equipment and medium
By dynamically configuring the life cycle and recycling strategy of the backtracking database table, and performing life cycle management based on the data update status, the problem of backtracking data management in the Hadoop cluster is solved, automatic recycling and dynamic recycling are realized, and mistaken recycling and resource waste are avoided.
Patent Information
- Application Number
- CN202411195020.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2044-08-29
AI Technical Summary
The existing technology is difficult to effectively manage the traceback data stored in the Hadoop cluster while ensuring the smooth progress of the traceback task, leading to problems of incorrect recycling and resource waste.
By dynamically configuring the life cycle and recycling strategy of the backdated database table, the life cycle management of the backdated data is carried out according to the data update status. If there is no update, it will be recycled based on the storage duration. If there is an update, it will be recycled based on the latest update time to ensure automated management. and dynamic recycling.
It realizes the automatic recycling management of backtracking database tables, reduces the waste of invalid storage resources, avoids the failure of backtracking tasks caused by mistaken recycling, and ensures dynamic recycling under data update status.
Smart Images

Figure CN118708595A
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, equipment and medium for managing the recovery of a backtracking database table. Background Art
[0002] Task backtracking is a very important function of data processing and scheduling systems. For example, when the data processing and scheduling system needs to correct abnormal data, or needs to re-analyze and mine historical data, task backtracking is required. At present, the backtracking data in the task backtracking process is usually stored in the Hadoop Distributed File System (HDFS) in the form of Hive tables. With the continuous growth of the task backtracking business scale, the backtracking data stored in the Hadoop cluster is increasing. How to achieve the life cycle management of the backtracking data while ensuring the smooth progress of the backtracking task is a technical issue that needs to be considered in the backtracking data storage process. Summary of the invention
[0003] The present application provides a backtracking database table recovery management method, device, equipment and medium to solve the problem that the prior art is difficult to achieve life cycle management of backtracking data while ensuring the smooth progress of the backtracking task. The technical solution provided by the present application is as follows: On the one hand, the present application provides a backtracking database table recovery management method, comprising: Obtain the current life cycle and current recycling strategy dynamically configured for the backtracking database table corresponding to the target backtracking task; wherein the backtracking database table is a Hive table used to store the backtracking data of the target backtracking task; the current life cycle and current recycling strategy are dynamically configured based on the backtracking data update status of the backtracking database table; If it is determined that the current recycling policy of the backtracking database table is the default recycling policy, it is determined that there is no backtracking data update in the backtracking database table, and based on the current life cycle of the backtracking database table and according to the current storage duration of the backtracking database table, recycling management is performed on the backtracking database table; If it is determined that the current recycling strategy of the backtracking database table is a dynamic recycling strategy, it is determined that there is a backtracking data update in the backtracking database table, and based on the current life cycle of the backtracking database table and according to the duration of the most recent update of the backtracking database table, the backtracking database table is recycled.
[0004] In a possible implementation manner, before obtaining the current life cycle and the current recycling strategy dynamically configured for the backtracking database table corresponding to the target backtracking task, the method further includes: Obtain the initial duration and default recycling policy pre-configured for the backtracking database table corresponding to the target backtracking task, configure the initial duration as the current life cycle of the backtracking database table corresponding to the target backtracking task, and configure the default recycling policy as the current recycling policy of the backtracking database table corresponding to the target backtracking task; When it is monitored that the backtracking database table corresponding to the target backtracking task has a backtracking data update, the current recovery strategy of the backtracking database table is changed from the default recovery strategy to the dynamic recovery strategy, and the current life cycle of the backtracking database table is changed from the initial duration to the target duration; wherein the target duration is greater than the initial duration.
[0005] In a possible implementation, obtaining the current life cycle and the current recycling strategy dynamically configured for the backtracking database table corresponding to the target backtracking task includes: Parse the business metadata file corresponding to the target backtracking task to obtain the business configuration metadata of the backtracking database table corresponding to the target backtracking task; Based on the life cycle field value and the recycling policy field value in the business metadata of the retrospective database table, the current life cycle and the current recycling policy of the retrospective database table are determined; wherein the life cycle field value and the recycling policy field value are synchronously updated when the retrospective data in the retrospective database table is updated.
[0006] In a possible implementation, based on the current life cycle of the backtracking database table and according to the current storage duration of the backtracking database table, recycling management is performed on the backtracking database table, including: The time difference between the partition time of the backtracking database table and the current time is determined as the current storage duration of the backtracking database table; If it is determined that the current storage duration is not greater than the current life cycle, the backtracking database table will not be recycled; If it is determined that the current storage duration is longer than the current life cycle, the backtracking database table is recycled.
[0007] In a possible implementation, based on the current life cycle of the backtracking database table and according to the duration of the most recent update of the backtracking database table, the backtracking database table is recycled and managed, including: The time difference between the last update time of the backtracking database table and the current time is determined as the last update duration of the backtracking database table; If it is determined that the duration of the most recent update is not greater than the current life cycle, the backtracking database table will not be recycled; If it is determined that the duration of the most recent update is longer than the current life cycle, the backtracking database table is recycled.
[0008] In a possible implementation manner, before recycling the backtracking database table, the method further includes: Determine the creator information of the backtracking database table, and push a recycling warning message for the backtracking database table to the creator corresponding to the creator information; Based on the latest life cycle and latest recycling policy returned by the creator's terminal device in response to the life cycle update operation performed by the creator on the recycling warning message, the current life cycle and current recycling policy of the backtracking database table are updated.
[0009] In a possible implementation, recycling the backtracking database table includes: Synchronize the backtracking database table to the Mysql database; Use the scheduled task to start multiple threads to delete the backtracking data of the target backtracking task in the backtracking database table in parallel.
[0010] On the other hand, the present application provides a backtracking database table recovery management device, including: A recycling preparation unit is used to obtain the current life cycle and current recycling strategy dynamically configured for the backtracking database table corresponding to the target backtracking task; wherein the backtracking database table is a Hive table used to store the backtracking data of the target backtracking task; the current life cycle and the current recycling strategy are dynamically configured based on the backtracking data update state of the backtracking database table; The recycling execution unit is used to, if it is determined that the current recycling policy of the backtracking database table is the default recycling policy, determine that there is no backtracking data update in the backtracking database table, and based on the current life cycle of the backtracking database table, perform recycling management on the backtracking database table according to the current storage duration of the backtracking database table; if it is determined that the current recycling policy of the backtracking database table is the dynamic recycling policy, determine that there is a backtracking data update in the backtracking database table, and based on the current life cycle of the backtracking database table, perform recycling management on the backtracking database table according to the latest update duration of the backtracking database table.
[0011] On the other hand, the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned backtracking database table recycling management method when executing the computer program.
[0012] On the other hand, the present application provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed by a processor, the above-mentioned backtracking database table recycling management method is implemented.
[0013] The beneficial effects of this application are as follows: The present application dynamically configures a life cycle and a recycling strategy for a backtracking database table corresponding to a target backtracking task based on the backtracking data update status of the backtracking database table corresponding to the target backtracking task. When there is no backtracking data update in the backtracking database table, recycling management can be performed based on the current life cycle of the backtracking database table and according to the current storage duration of the backtracking database table. When there is a backtracking data update in the backtracking database table, recycling management can be performed based on the latest update duration of the backtracking database table. This not only realizes automatic recycling management of the backtracking database table and reduces the waste of storage resources of invalid backtracking database tables, but also realizes dynamic recycling based on the backtracking data update status and avoids the problem of backtracking task failure due to incorrect recycling of the backtracking database table.
[0014] Other features and advantages of the present application will be described in the subsequent description, and in part, will become apparent from the description, or will be understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The schematic diagram and description of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings: Figure 1 A schematic diagram of an overview of the backtracking database table recovery management method in an embodiment of the present application; Figure 2 A schematic diagram of the process framework of the backtracking database table recovery management method in the embodiment of the present application; Figure 3 This is a functional structure diagram of the backtracking database table recovery management device in the embodiment of the present application; Figure 4 Schematic diagram of the hardware structure of the electronic device in the embodiment of the present application. DETAILED DESCRIPTION
[0016] In order to make the purpose, technical solution and beneficial effects of this application clearer, the technical solution of this application will be clearly and completely described below in combination with the embodiments and drawings. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0017] Hive is a data warehouse tool based on Hadoop, which is used to extract, transform and load retrospective data. It is a mechanism that can store, query and analyze large-scale data stored in Hadoop. It can map the structured retrospective data stored in the Hadoop distributed file system into a Hive table, that is, the retrospective database table, and provide a query method based on the Structured Query Language (SQL) for users to query the retrospective data and analyze the retrospective data. At present, the retrospective database table usually uses Hive's own deletion function to achieve recycling management, that is, when the storage duration of the retrospective database table reaches the preset life cycle, the retrospective database table is deleted. This retrospective database table recycling method is prone to erroneous recycling, which leads to the failure of the retrospective task.
[0018] To this end, the present application proposes an improved backtracking database table recycling management method, that is, based on the backtracking data update status of the backtracking database table corresponding to the target backtracking task, a life cycle and recycling strategy are dynamically configured for the backtracking database table corresponding to the target backtracking task. When there is no backtracking data update in the backtracking database table, recycling management is performed according to the current storage duration of the backtracking database table based on the current life cycle of the backtracking database table. When there is a backtracking data update in the backtracking database table, recycling management is performed according to the latest update duration of the backtracking database table. In this way, automatic recycling management of the backtracking database table is realized, storage resource waste of invalid backtracking database tables is reduced, and dynamic recycling based on the backtracking data update status is realized, avoiding the problem of backtracking task failure due to incorrect recycling of the backtracking database table.
[0019] After introducing the application scenarios and design ideas of the present application, the technical solutions provided by the present application are described in detail below.
[0020] The embodiment of the present application provides a backtracking database table recovery management system, including a terminal device, a communication network and a server; the communication network is used to provide a communication link between the terminal device and the server, and the communication network may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.; the terminal device can be various electronic devices with a display screen, including but not limited to desktop computers, portable computers, smart phones and tablet computers, etc. It should be understood that any number of terminal devices, communication networks and servers can be provided according to implementation needs. For example, the server can be a server cluster composed of multiple servers, etc., and the multiple servers include at least one metadata server, at least one storage server and at least one management server, etc.
[0021] The backtracking database table recovery management method provided in the embodiment of the present application is generally executed by the management server, and accordingly, the backtracking database table recovery management device is generally arranged in the management server. In the embodiment of the present application, the user initiates the target backtracking task through the terminal device, and configures the initial life cycle and the default recovery policy for the backtracking database table corresponding to the target backtracking task, the terminal device transmits the initial life cycle and the default recovery policy of the backtracking database table corresponding to the target backtracking task to the management server, and transmits the backtracking data to the storage server during the execution of the target backtracking task; the storage server creates a backtracking database table for the target backtracking task, and stores the backtracking data corresponding to the target backtracking task in the backtracking database table corresponding to the target backtracking task; the management server obtains the initial life cycle and the default recovery policy of the backtracking database table corresponding to the target backtracking task, and based on the initial life cycle and the default recovery policy of the backtracking database table corresponding to the target backtracking task, through the backtracking database table recovery management method provided in the embodiment of the present application, the life cycle and the recovery policy of the backtracking database table are dynamically configured, and after logical recovery and physical recovery, the recovery result of whether the backtracking database table has been recovered is transmitted to the terminal device, and at the terminal device end, the backtracking database table that has been logically recovered is not visible to the user.
[0022] Based on the above embodiments, the present application provides a method for managing the recovery of a backtracking database table, which can be applied to a server in a backtracking database table recovery management system, and can be specifically applied to a management server in a backtracking database table recovery management system, see Figure 1 As shown, the overview process of the backtracking database table recovery management method provided in the embodiment of the present application is as follows: Step 101: Obtain the current life cycle and current recycling strategy dynamically configured for the backtracking database table corresponding to the target backtracking task; wherein the backtracking database table is a Hive table used to store the backtracking data of the target backtracking task; the current life cycle and current recycling strategy are dynamically configured based on the backtracking data update status of the backtracking database table.
[0023] In an embodiment of the present application, a user initiates a target backtracking task through a terminal device, and configures an initial life cycle and a default recycling policy for a backtracking database table corresponding to the target backtracking task. The terminal device generates a business metadata file based on business metadata such as the creator of the backtracking database table corresponding to the target backtracking task, the project area to which the table belongs, the initial life cycle, and the default recycling policy, and stores it in a business metadata database. At the same time, the initial life cycle and the default recycling policy of the backtracking database table corresponding to the target backtracking task are carried in a backtracking database table configuration request and transmitted to a management server. In the process of executing the target backtracking task, the backtracking data of the target backtracking task and the backtracking time of the backtracking data are carried in a backtracking data storage request and transmitted to a storage server.
[0024] After the storage server receives a backtracing data storage request initiated by the terminal device for the target backtracing task, which carries at least the backtracing data and the backtracing time, it obtains the backtracing data and the backtracing time of the target backtracing task from the backtracing data storage request, and stores the backtracing data corresponding to the target backtracing task in the backtracing database table corresponding to the target backtracing task, and uses the backtracing time corresponding to the backtracing data as the partition time of the backtracing database table.
[0025] The metadata server generates Hive metadata such as table name, library name storage path, etc. for the backtracking database table corresponding to the target backtracking task and stores them in the Hive metadata database. It also updates the file system image (FS-Image) file in the Hadoop distributed file system based on the directory structure, size, number of copies, file block size (blocksize), backtracking data update time, etc. of the backtracking database table corresponding to the target backtracking task.
[0026] After the management server receives the backtracking database table configuration request initiated by the terminal device for the target backtracking task, which carries at least the initial duration and the default recycling policy, it obtains the initial duration and the default recycling policy pre-configured for the backtracking database table corresponding to the target backtracking task from the backtracking database table configuration request, configures the initial duration as the current life cycle of the backtracking database table corresponding to the target backtracking task, and configures the default recycling policy as the current recycling policy of the backtracking database table corresponding to the target backtracking task; when it is detected that the backtracking database table corresponding to the target backtracking task has a backtracking data update, the current recycling policy of the backtracking database table is changed from the default recycling policy to the dynamic recycling policy, and the current life cycle of the backtracking database table is changed from the initial duration to the target duration; wherein the target duration is greater than the initial duration. Specifically, the management server can add a set duration on the basis of the initial duration, so that the current life cycle of the backtracking database table is changed from the initial duration to the target duration; the set duration can be a fixed value, or a dynamic value that increases with the number of backtracking data updates.
[0027] It is worth mentioning that in an embodiment of the present application, in order to further ensure the smooth progress of the backtracking task, the management server can also change the current recovery strategy of the backtracking database table from the default recovery strategy to the dynamic recovery strategy when it monitors that the backtracking database table corresponding to the target backtracking task has a data dependency change, and change the current life cycle of the backtracking database table from the initial duration to the target duration; wherein, the data dependency change includes the appearance of new data dependencies and / or changed data dependencies in the backtracking database table corresponding to the target backtracking task; the data dependencies are determined based on the job dependencies between the backtracking tasks. For example, assuming that the target backtracking task is backtracking task A, and backtracking task B depends on backtracking task A, then the data dependency is that the backtracking data output of backtracking task B depends on the backtracking data output of backtracking task A. When the data dependency is increased to have the backtracking data output of backtracking task C depend on the backtracking data output of backtracking task A, or the data dependency is changed to the backtracking data output of backtracking task C depend on the backtracking data output of backtracking task A, the current recovery strategy of the backtracking database table of backtracking task A is changed from the default recovery strategy to the dynamic recovery strategy, and the current life cycle of the backtracking database table of backtracking task A is changed from the initial duration to the target duration, so that the data relationship change based on the backtracking database table corresponding to backtracking task A can be realized, and the dynamic recovery management of the backtracking database table corresponding to backtracking task A can be implemented, thereby ensuring the smooth progress of backtracking task C.
[0028] In an embodiment of the present application, when the management server monitors that the backtracking database table corresponding to the target backtracking task has backtracking data updates and / or data dependency changes, the current recovery strategy of the backtracking database table is changed from the default recovery strategy to the dynamic recovery strategy, and the current life cycle of the backtracking database table is changed from the initial duration to the target duration. This can achieve dynamic recovery management of the backtracking database table corresponding to backtracking task A based on the backtracking data updates and / or data relationship changes of the backtracking database table corresponding to backtracking task A, thereby ensuring the smooth progress of the target backtracking task and other backtracking tasks that have job dependencies with the target backtracking task.
[0029] Furthermore, the management server may also periodically monitor the current recycling strategy and current life cycle of the backtracking database table corresponding to the target backtracking task to realize the timely recycling of the backtracking database table corresponding to the target backtracking task. In specific implementation, the management server may adopt, but is not limited to, the following methods when obtaining the current life cycle and current recycling strategy dynamically configured for the backtracking database table corresponding to the target backtracking task during the periodic monitoring process: First, the management server obtains the business metadata file corresponding to the target backtracking task from the business metadata database, and parses the business metadata file corresponding to the target backtracking task to obtain the business configuration metadata of the backtracking database table corresponding to the target backtracking task.
[0030] Then, the management server determines the current life cycle and current recycling policy of the traceback database table based on the life cycle field value and recycling policy field value in the business metadata of the traceback database table. The life cycle field value and recycling policy field value are synchronously updated when the traceback data in the traceback database table is updated.
[0031] Step 102: If it is determined that the current recycling policy of the backtracking database table is the default recycling policy, it is determined that there is no backtracking data update on the backtracking database table, and based on the current life cycle of the backtracking database table, the backtracking database table is recycled according to the current storage duration of the backtracking database table; if it is determined that the current recycling policy of the backtracking database table is the dynamic recycling policy, it is determined that there is a backtracking data update on the backtracking database table, and based on the current life cycle of the backtracking database table, the backtracking database table is recycled according to the duration of the most recent update of the backtracking database table.
[0032] In the embodiment of the present application, when the management server recycles the backtracking database table based on the current life cycle of the backtracking database table and the current storage duration of the backtracking database table, the time difference between the partition time of the backtracking database table and the current time can be determined as the current storage duration of the backtracking database table; if it is determined that the current storage duration is not greater than the current life cycle, the backtracking database table is not recycled; if it is determined that the current storage duration is greater than the current life cycle, the default target backtracking task ends and the backtracking database table is recycled. When the management server recycles the backtracking database table based on the current life cycle of the backtracking database table and the last update duration of the backtracking database table, the time difference between the last update time of the backtracking database table and the current time can be determined as the last update duration of the backtracking database table; if it is determined that the last update duration is not greater than the current life cycle, the backtracking database table is not recycled; if it is determined that the last update duration is greater than the current life cycle, the default target backtracking task ends and the backtracking database table is recycled.
[0033] It is worth mentioning that in the embodiment of the present application, when the management server recycles the backtracking database table, it can first generate a backtracking database table recycling task based on the Hive metadata of the backtracking database table and add it to the backtracking database table recycling task queue, and transfer the backtracking database table and the metadata of the backtracking database table waiting for the recycling table data to the database to be recycled, so as to perform logical recycling processing on the backtracking database table; and then, when it is determined that there is no data dependency change in the backtracking database table within the future set time range, execute the backtracking database table recycling task for the backtracking database table in the backtracking database table recycling task queue to perform physical recycling processing on the backtracking database table, so as to realize the buffer recycling of the backtracking database table, and further avoid the problem of erroneous recycling of the backtracking database table. Specifically, when the management server performs physical recycling processing on the backtracking database table, the backtracking database table can be synchronized to the Mysql database, and multiple threads can be started through the scheduled task to delete the backtracking data in the backtracking database table in parallel.
[0034] In the embodiment of the present application, before the management server recycles the backtracking database table, it can also obtain the business metadata file corresponding to the target backtracking task from the business metadata database, and after parsing the business metadata file to obtain the business metadata corresponding to the target backtracking task, obtain the creator information of the backtracking database table from the business metadata corresponding to the target backtracking task, and push the recycling warning message for the backtracking database table to the terminal device of the creator corresponding to the creator information, so that the creator determines whether to update the current life cycle and current recycling strategy of the backtracking database table according to the recycling warning information; and based on the latest life cycle and latest recycling strategy returned by the creator's terminal device in response to the life cycle update operation performed by the creator for the recycling warning message, the current life cycle and current recycling strategy of the backtracking database table are updated. At this time, the management server performs recycling management on the backtracking database table corresponding to the target backtracking task according to the updated latest life cycle and latest recycling strategy.
[0035] In summary, see Figure 2 As shown, the backtracking database table recovery management method provided in the embodiment of the present application includes: 1. Configure the lifecycle: When users create a Hive table on the platform, they need to specify the lifecycle (TimeToL) of the table (for example, 1 day, 3 days, one week, one month, one year, forever). If it is a time-partitioned table, they also need to specify the format of the partition field (the purpose is to parse the date in the partition field in strategy 2).
[0036] 2. Choose a recycling strategy: After a Hive table is created on the platform, the default recycling strategy is to recycle the table according to its natural partition time (that is, the default recycling strategy).
[0037] When the backtracking task traces back the backtracking data to the Hive table, in order to prevent the backtracking data from being recycled by mistake, it is set to be recycled according to the most recent update time of the partition (that is, the dynamic recycling strategy), which can ensure that the backtracking data is not deleted and ensure the smooth progress of the backtracking task.
[0038] 1. Strategy 1 (also known as dynamic recycling strategy): Recycling based on the most recent update time of the backtracking data. The specific steps include: Step 1: Parse the FS-Image file in HDFS to obtain the file metadata such as directory structure, size, number of copies, file block size (blocksize), modification time, etc. of all files, classify them according to the file path, and generate detailed data by category.
[0039] Step 2: Get the Hive metadata of the table from the Hive metadata repository, including the table name, library name, storage path, etc.
[0040] Step 3: Get the business metadata of the table from the business metadata database, including the creator, project area to which the table belongs, life cycle, recycling strategy, etc.
[0041] Step 4: After ETL association of various metadata in steps 1-3 above, a large wide table is formed. The table is marked with: the last update time of the table or partition, the TTL of the table or partition life cycle obtained from step 3, and the storage time of the table or partition calculated by subtracting the "last update time" from the current time, and then comparing it with the TTL. If it is greater than the TTL survival time, it means that the table or partition should be recycled, otherwise, it should not be recycled.
[0042] 2. Strategy 2 (also known as the default recycling strategy): Recycling according to the natural time of table partitions. The specific steps include: Step 1: Parse the FS-Image file in HDFS to obtain the file metadata such as directory structure, size, number of copies, file block size (blocksize), modification time, etc. of all files, classify them according to the file path, and generate detailed data by category.
[0043] Step 2: Get the Hive metadata of the table from the Hive metadata repository, including the table name, library name, storage path, etc.
[0044] Step 3: Get the business metadata of the table from the business metadata database, including the creator, project area to which the table belongs, life cycle, recycling strategy, etc.
[0045] Step 4: ETL the metadata of steps 1-3 above to form a large wide table. Use a custom UDF function to extract the standard date of the partition field in the partition table. For example: if the partition field p_date=2024-01-01, 2024-01-01 will be extracted; if pd=20240101, 2024-01-01 will be extracted. Since the user-defined time types are quite diverse, 4 types are currently supported: yyyy-MM-dd, yyyyMMdd, yyyyMMddHH, yyyy-MM. If it is a non-partitioned table, take the time when the table was created. Subtract the extracted time from the current time to get the time when the current partition has existed. Compare the life cycle TTL of the table or partition obtained from step 3 with the TTL. If it is greater than the TTL survival time, it means that the table or partition should be recycled. Otherwise, it should not be recycled.
[0046] 3. Delete warning: The large wide table formed in step 2 defines the number of days the table or partition has existed, and compares this time with the user-defined life cycle TTL. If the remaining set time (for example, 2 days) reaches the TTL number of days, a message that the backtracking database table is about to be recycled is sent to the table owner through the terminal device, and the table owner decides whether to extend the TTL.
[0047] 4. Multi-threaded deletion: Synchronize the large wide table formed in step 2 and the table or partition to be deleted to the MySQL database, and delete the data through a scheduled task. Sometimes a lot of data will be deleted in a day (some tables or partitions are centrally managed, shortening the life cycle). If you need to delete the partition or table to be deleted within a set time (for example, within 1 day), you need to start multiple threads for parallel processing.
[0048] 5. BI Report: Configure BI reports to monitor the progress and details of daily data deletion to facilitate troubleshooting. All fields in the large wide table formed in the second step can be configured in the BI report to facilitate detailed data, summary data and troubleshooting, and to facilitate observation of whether the data to be deleted meets expectations and the trend of the amount of data recovered each day.
[0049] Based on the above embodiments, the present application provides a backtracking database table recovery management device, see Figure 3 As shown, the backtracking database table recovery management device 300 provided in the embodiment of the present application at least includes: The recycling preparation unit 301 is used to obtain the current life cycle and current recycling strategy dynamically configured for the backtracking database table corresponding to the target backtracking task; wherein the backtracking database table is a Hive table for storing the backtracking data of the target backtracking task; the current life cycle and the current recycling strategy are dynamically configured based on the backtracking data update state of the backtracking database table; The recycling execution unit 302 is used to determine that there is no backtracking data update in the backtracking database table if it is determined that the current recycling strategy of the backtracking database table is the default recycling strategy, and based on the current life cycle of the backtracking database table, recycle the backtracking database table according to the current storage duration of the backtracking database table; if it is determined that the current recycling strategy of the backtracking database table is the dynamic recycling strategy, determine that there is a backtracking data update in the backtracking database table, and based on the current life cycle of the backtracking database table, recycle the backtracking database table according to the latest update duration of the backtracking database table.
[0050] In a possible implementation manner, the backtracking database table recovery management device 300 provided by the present application further includes: An initial configuration unit 303 is used to obtain an initial duration and a default recycling policy pre-configured for the backtracking database table corresponding to the target backtracking task, configure the initial duration as the current life cycle of the backtracking database table corresponding to the target backtracking task, and configure the default recycling policy as the current recycling policy of the backtracking database table corresponding to the target backtracking task; The dynamic configuration unit 304 is used to monitor that when the backtracking database table corresponding to the target backtracking task has a backtracking data update, change the current recovery strategy of the backtracking database table from the default recovery strategy to the dynamic recovery strategy, and change the current life cycle of the backtracking database table from the initial duration to the target duration; wherein the target duration is greater than the initial duration.
[0051] In one possible implementation, the recycling preparation unit 301 is used to parse the business metadata file corresponding to the target backtracking task to obtain the business configuration metadata of the backtracking database table corresponding to the target backtracking task; based on the life cycle field value and the recycling policy field value in the business metadata of the backtracking database table, determine the current life cycle and the current recycling policy of the backtracking database table; wherein the life cycle field value and the recycling policy field value are synchronously updated when the backtracking data is updated in the backtracking database table.
[0052] In a possible implementation, the recycling execution unit 302 is used to determine the time difference between the partition time of the backtracking database table and the current time as the current storage duration of the backtracking database table; if it is determined that the current storage duration is not greater than the current life cycle, the backtracking database table is not recycled; if it is determined that the current storage duration is greater than the current life cycle, the backtracking database table is recycled.
[0053] In a possible implementation, the recycling execution unit 302 is used to determine the time difference between the last update time of the backtracking database table and the current time as the duration of the last update of the backtracking database table; if it is determined that the duration of the last update is not greater than the current life cycle, the backtracking database table is not recycled; if it is determined that the duration of the last update is greater than the current life cycle, the backtracking database table is recycled.
[0054] In a possible implementation manner, the backtracking database table recovery management device 300 provided by the present application further includes: The update configuration unit 305 is used to determine the creator information of the backtracking database table, and push a recycling warning message for the backtracking database table to the creator corresponding to the creator information; based on the latest life cycle and latest recycling policy returned by the creator's terminal device in response to the life cycle update operation performed by the creator for the recycling warning message, the current life cycle and current recycling policy of the backtracking database table are updated.
[0055] In a possible implementation, the recycling execution unit 302 is used to synchronize the backtracking database table to the Mysql database; and to start multiple threads through a scheduled task to delete the backtracking data of the target backtracking task in the backtracking database table in parallel.
[0056] It should be noted that the principle of solving the technical problem by the backtracking database table recovery management device 300 provided in the embodiment of the present application is similar to the backtracking database table recovery management method provided in the embodiment of the present application. Therefore, the implementation of the backtracking database table recovery management device 300 provided in the embodiment of the present application can refer to the implementation of the backtracking database table recovery management method provided in the embodiment of the present application, and the repeated parts will not be repeated.
[0057] After introducing the backtracking database table recovery management method and device provided in the embodiment of the present application, next, the electronic device provided in the embodiment of the present application is briefly introduced.
[0058] See also Figure 4As shown, the electronic device 400 provided in the embodiment of the present application includes at least a processor 401, a memory 402, and a computer program stored in the memory 402 and executable on the processor 401. When the processor 401 executes the computer program, the backtracking database table recovery management method provided in the embodiment of the present application is implemented.
[0059] The electronic device 400 provided in the embodiment of the present application may further include a bus 403 connecting different components (including the processor 401 and the memory 402). The bus 403 represents one or more of several types of bus structures, including a memory bus, a peripheral bus, a local bus, and the like.
[0060] The memory 402 may include a readable medium in the form of a volatile memory, such as a random access memory (RAM) 4021 and / or a cache memory 4022, and may further include a read-only memory (ROM) 4023. The memory 402 may also include a program tool 4025 having a group (at least one) of program modules 4024, and the program modules 4024 include but are not limited to: an operating subsystem, one or more application programs, other program modules, and program data, each of which or some combination may include the implementation of a network environment.
[0061] Processor 401 may be a processing element or a collective term for multiple processing elements. For example, processor 401 may be a central processing unit (CPU) or one or more integrated circuits configured to implement the backtracking database table recycling management method provided in the embodiment of the present application. Specifically, processor 401 may be a general-purpose processor, including but not limited to a CPU, an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc.
[0062] The electronic device 400 may also communicate with one or more external devices 404 (e.g., keyboards, remote controls, etc.), and may also communicate with one or more devices that enable a user to interact with the electronic device 400 (e.g., mobile phones, computers, etc.), and / or communicate with any device that enables the electronic device 400 to communicate with one or more other electronic devices 400 (e.g., routers, modems, etc.). Such communication may be performed through an input / output (I / O) interface 405. Furthermore, the electronic device 400 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 406. Figure 4 As shown, the network adapter 406 communicates with other modules of the electronic device 400 via the bus 403. It should be understood that although Figure 4 Not shown, other hardware and / or software modules may be used in conjunction with the electronic device 400, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, disk arrays (Redundant Arrays of Independent Disks, RAID) subsystems, tape drives, and data backup storage subsystems.
[0063] It should be noted that Figure 4 The electronic device 400 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0064] The computer-readable storage medium provided by the embodiment of the present application is introduced below. The computer-readable storage medium provided by the embodiment of the present application stores computer instructions, and when the computer instructions are executed by the processor, the backtracking database table recovery management method provided by the embodiment of the present application is implemented. Specifically, the computer instructions can be built-in or installed in the processor, so that the processor can implement the backtracking database table recovery management method provided by the embodiment of the present application by executing the built-in or installed computer instructions.
[0065] In addition, the backtracking database table recycling management method provided in the embodiment of the present application can also be implemented as a computer program product, which includes a program code. When the program code is executed on a processor, it implements the backtracking database table recycling management method provided in the embodiment of the present application.
[0066] The computer program product provided in the embodiments of the present application may adopt one or more computer-readable storage media, and the computer-readable storage medium may be, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any suitable combination of the above. Specifically, more specific examples of computer-readable storage media (a non-exhaustive list) include an electrical connection with one or more wires, a portable disk, a hard disk, RAM, ROM, Erasable Programmable Read Only Memory (EPROM), optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
[0067] The computer program product provided in the embodiment of the present application may adopt a CD-ROM and include program code, and may also be run on electronic devices such as computers and servers. However, the computer program product provided in the embodiment of the present application is not limited thereto. In the embodiment of the present application, the computer-readable storage medium may be any tangible medium containing or storing program code, and the program code may be used by or in combination with an instruction execution system, apparatus, or device.
[0068] It should be noted that, although several units or subunits of the device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more units described above can be embodied in one unit. Conversely, the features and functions of one unit described above can be further divided into multiple units to be embodied.
[0069] In addition, although the operations of the method of the present application are described in a specific order in the drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.
[0070] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they are aware of the basic creative concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0071] Obviously, those skilled in the art can make various changes and modifications to the embodiments of the present application without departing from the spirit and scope of the embodiments of the present application. Thus, if these modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A backtracking database table recovery management method, characterized in that: include: Obtaining the current life cycle and current recycling strategy dynamically configured for the backtracking database table corresponding to the target backtracking task; wherein the backtracking database table is a Hive table for storing the backtracking data of the target backtracking task; the current life cycle and the current recycling strategy are dynamically configured based on the backtracking data update state of the backtracking database table; If it is determined that the current recycling strategy of the backtracking database table is a default recycling strategy, it is determined that there is no backtracking data update in the backtracking database table, and based on the current life cycle of the backtracking database table and according to the current storage duration of the backtracking database table, recycling management is performed on the backtracking database table; If it is determined that the current recycling strategy of the backtracking database table is a dynamic recycling strategy, it is determined that there is a backtracking data update in the backtracking database table, and based on the current life cycle of the backtracking database table and according to the duration of the most recent update of the backtracking database table, the backtracking database table is recycled.
2. The backtracking database table recovery management method according to claim 1, characterized in that: Before obtaining the current life cycle and current recycling strategy dynamically configured for the backtracking database table corresponding to the target backtracking task, the following is also included: Obtaining the initial duration and default recycling policy pre-configured for the backtracking database table corresponding to the target backtracking task, configuring the initial duration as the current life cycle of the backtracking database table corresponding to the target backtracking task, and configuring the default recycling policy as the current recycling policy of the backtracking database table corresponding to the target backtracking task; When it is monitored that the backtracking database table corresponding to the target backtracking task has a backtracking data update, the current recovery strategy of the backtracking database table is changed from the default recovery strategy to the dynamic recovery strategy, and the current life cycle of the backtracking database table is changed from the initial duration to the target duration; wherein the target duration is greater than the initial duration.
3. The backtracking database table recovery management method according to claim 1, characterized in that: Get the current life cycle and current recycling strategy dynamically configured for the backtracking database table corresponding to the target backtracking task, including: Parsing the business metadata file corresponding to the target backtracking task to obtain the business configuration metadata of the backtracking database table corresponding to the target backtracking task; Based on the life cycle field value and the recycling policy field value in the business metadata of the retrospective database table, determine the current life cycle and the current recycling policy of the retrospective database table; wherein the life cycle field value and the recycling policy field value are synchronously updated when retrospective data is updated in the retrospective database table.
4. The backtracking database table recovery management method according to claim 1, characterized in that: Based on the current life cycle of the backtracking database table and according to the current storage duration of the backtracking database table, recycling management is performed on the backtracking database table, including: Determine the time difference between the partition time of the backtracking database table and the current time as the current storage duration of the backtracking database table; If it is determined that the current storage duration is not greater than the current life cycle, then the backtracking database table is not recycled; If it is determined that the current storage duration is longer than the current life cycle, the backtracking database table is recycled.
5. The backtracking database table recovery management method according to claim 1, characterized in that: Based on the current life cycle of the backtracking database table, and according to the duration of the most recent update of the backtracking database table, the backtracking database table is recycled and managed, including: Determine the time difference between the last update time of the backtracking database table and the current time as the last update duration of the backtracking database table; If it is determined that the duration of the most recent update is not greater than the current life cycle, then the backtracking database table is not recycled; If it is determined that the duration of the most recent update is longer than the current life cycle, the backtracking database table is recycled.
6. The backtracking database table recovery management method according to claim 4 or 5, characterized in that: Before recycling the backtracking database table, the method further includes: Determine the creator information of the backtracking database table, and push a recycling warning message for the backtracking database table to a terminal device of the creator corresponding to the creator information; The current life cycle and the current recycling policy of the traceability database table are updated based on the latest life cycle and the latest recycling policy returned by the creator's terminal device in response to the life cycle update operation performed by the creator on the recycling warning message.
7. The backtracking database table recovery management method according to claim 4 or 5, characterized in that: The backtracking database table is recycled, including: Synchronize the traceback database table to the Mysql database; Multiple threads are started through a scheduled task to delete the backtracking data of the target backtracking task in the backtracking database table in parallel.
8. A backtracking database table recovery management device, characterized in that: include: A recycling preparation unit, used to obtain the current life cycle and current recycling strategy dynamically configured for the backtracking database table corresponding to the target backtracking task; wherein the backtracking database table is a Hive table for storing the backtracking data of the target backtracking task; the current life cycle and the current recycling strategy are dynamically configured based on the backtracking data update state of the backtracking database table; A recycling execution unit is used to, if it is determined that the current recycling strategy of the backtracking database table is a default recycling strategy, determine that there is no backtracking data update to the backtracking database table, and based on the current life cycle of the backtracking database table, perform recycling management on the backtracking database table according to the current storage duration of the backtracking database table; if it is determined that the current recycling strategy of the backtracking database table is a dynamic recycling strategy, determine that there is a backtracking data update to the backtracking database table, and based on the current life cycle of the backtracking database table, perform recycling management on the backtracking database table according to the latest update duration of the backtracking database table.
9. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the backtracking database table recycling management method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the backtracking database table recycling management method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Method and device for judging whether to perform offline recycling on database or not
CN105574195A
Data storage management method and device, and computer readable storage medium
CN111694505A
Table data backup cleaning method and device based on life cycle
CN112905386A
Data cleaning method and device
CN113297193A
Data warehouse storage space recovery method and electronic equipment
CN117149738A
