Tenant data deletion method and device, equipment, storage medium and program product

By setting the target critical time and block timestamp in the timing database, the storage time of tenant data is determined, and the problem of untimely deletion of tenant data is solved, and efficient utilization of disk space and optimized resource management is achieved.

CN120447834APending Publication Date: 2025-08-08CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510532008.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-25
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

In the existing timing database, the deletion of tenant data is not timely, resulting in waste of disk space, and the existing methods cannot effectively manage tenant data to improve resource utilization.

Method used

By setting the target critical time, combining the maximum and minimum timestamps of the preset block, we can judge the storage time of tenant data, determine which data needs to be deleted or retained, and realize the timely cleaning of tenant data.

Benefits of technology

Effectively clean up expired tenant data, release disk resources, improve the tenant data carrying capacity of the timing database, and optimize resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120447834A_ABST
    Figure CN120447834A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of cloud computing, and discloses a tenant data deletion method and device, equipment, a storage medium and a program product, and the tenant data deletion method comprises the following steps: determining target critical time according to current time and a preset deadline; obtaining a maximum timestamp and a minimum timestamp corresponding to each preset block in a preset time sequence database; judging whether the maximum timestamp corresponding to each preset block is greater than or equal to target critical time or not; if yes, whether the minimum timestamp corresponding to the preset block is smaller than or equal to the target critical time or not is judged; if yes, the storage time of each piece of tenant data in the preset block is compared with the target critical time, and the target tenant data with the storage time smaller than or equal to the target critical time is deleted. According to the method, the tenant data stored in each preset block is judged by setting the target critical time, and the useless tenant data is deleted, so that the disk space is saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of cloud computing technology, and in particular to a method, apparatus, device, storage medium, and program product for deleting tenant data. Background Art

[0002] With the development of cloud computing, more and more industries use cloud computing to process large amounts of data. In cloud computing and related fields, tenants refer to organizations or individuals that use cloud services. One or more users can belong to a tenant, and the tenant provides users with access to computing and management resources.

[0003] In cloud computing scenarios, there are many tenants, and tenant management is becoming increasingly important. How to effectively manage tenants and allocate resources to improve resource utilization is an urgent problem to be solved in the current cloud computing field.

[0004] In related technologies, tenants are usually stored and managed through time series databases. The commonly used time series database is the VictoriaMetrics database. The characteristic of VictoriaMetrics is that it uses the logical concept of namespace to distinguish and isolate the data of different tenants, ensuring the independence and security of tenant data.

[0005] However, all tenants in VictoriaMetrics share the same data expiration time, so useless tenant data will be retained until the longest expiration time before being deleted, resulting in a large amount of disk space waste. Summary of the Invention

[0006] In view of this, the present invention provides a method, apparatus, device, storage medium and program product for deleting tenant data to solve the problem of untimely deletion of tenant data in a time series database in the related art.

[0007] In the first aspect, the present invention provides a method for deleting tenant data, including: determining a target critical time based on the current time and a preset deadline; the target critical time is the dividing time indicating whether the tenant data has reached the deletion state; obtaining the maximum timestamp and minimum timestamp corresponding to each preset block in the preset time series database; each preset block in the preset time series database is used to store multiple tenant data of different types; judging whether the corresponding maximum timestamp of each preset block is greater than or equal to the target critical time; if the maximum timestamp corresponding to the preset block is greater than or equal to the target critical time, judging whether the minimum timestamp corresponding to the preset block is less than or equal to the target critical time; if the minimum timestamp corresponding to the preset block is less than or equal to the target critical time, comparing the storage time of each tenant data in the preset block with the target critical time, and deleting the target tenant data whose storage time is less than or equal to the target critical time.

[0008] The present invention determines the target critical time based on the current time and the preset deadline. The target critical time serves as the dividing point for whether the tenant data reaches the deletion state. When the storage time of the tenant data is less than or equal to the target critical time, it means that the storage time of the tenant data is long enough and the tenant data can be deleted. When the storage time of the tenant data is greater than the target critical time, it means that the storage time of the tenant data is not long enough and may still be useful, so the tenant data can be retained. The present invention combines the acquisition of the maximum and minimum timestamps of the preset block. Multiple tenant data are stored in a preset block. The maximum timestamp of the preset block represents the timestamp corresponding to the tenant data with the shortest storage time among the multiple tenant data in the preset block. The minimum timestamp of the preset block represents the timestamp corresponding to the tenant data with the longest storage time among the multiple tenant data in the preset block. Therefore, when the maximum timestamp corresponding to the preset block is greater than or equal to the target critical time, it means that the tenant data with the shortest storage time has not reached the preset deadline and needs to be retained. Then determine whether the minimum timestamp corresponding to the preset block is less than or equal to the target critical time. If the minimum timestamp corresponding to the preset block is less than or equal to the target critical time, it means that the tenant data with the longest storage time has been stored long enough and can be deleted. At this time, some of the multiple tenant data in the preset block need to be deleted and some need to be retained. Therefore, the storage time of each tenant data in the preset block is compared with the target critical time, and the target tenant data with a storage time less than or equal to the target critical time is deleted. By setting the target critical time and judging each tenant data, the present invention can clean up expired tenant data in time, release disk resources, and enable the time series database to carry more tenant data.

[0009] In an optional embodiment, the method for deleting tenant data also includes: obtaining the creation date of the index corresponding to each tenant data in each preset block; determining whether the creation date is less than or equal to the target critical time, and if the creation date is less than or equal to the target critical time, deleting the index.

[0010] A corresponding index will be created for each tenant data in each preset block in the preset time series database of the present invention when it is stored. Therefore, it is necessary to determine whether the creation date is less than or equal to the target critical time. If the creation date is less than or equal to the target critical time, it means that the index creation time is long enough, so the index will be deleted.

[0011] In an optional implementation, the tenant data deletion method further includes: if the maximum timestamp corresponding to the preset block is less than the target critical time, removing the preset block.

[0012] In the present invention, if the maximum timestamp corresponding to the preset block is less than the target critical time, it means that the storage time of the tenant data with the shortest storage time among the multiple tenant data in the entire preset block has exceeded the preset period. Therefore, the storage time of multiple tenant data in the entire preset block has exceeded the maximum storage time. The entire preset block is removed to delete all expired tenant data.

[0013] In an optional implementation, the tenant data deletion method further includes: if the minimum timestamp corresponding to the preset block is greater than the target critical time, retaining the preset block.

[0014] In the present invention, if the minimum timestamp corresponding to the preset block is greater than the target critical time, it means that among the multiple tenant data in the entire preset block, the storage time of the tenant data with the longest storage time is less than the maximum storage time. Therefore, the storage time of the multiple tenant data in the entire preset block is less than the maximum storage time, and the entire preset block is retained.

[0015] In an optional implementation, determining the target critical time according to the current time and the preset deadline includes: determining the target critical time according to the difference between the current time and the preset deadline.

[0016] In an optional embodiment, obtaining the maximum timestamp and minimum timestamp corresponding to each preset block in the preset time series database includes: obtaining monitoring indicator information of each preset block in the preset time series database, and querying and obtaining the maximum timestamp and minimum timestamp in the monitoring indicator information.

[0017] In the second aspect, the present invention provides a tenant data deletion device, including: a target critical time determination module, used to determine the target critical time based on the current time and a preset deadline; the target critical time is the dividing time indicating whether the tenant data reaches the deletion state; a timestamp acquisition module, used to obtain the maximum timestamp and minimum timestamp corresponding to each preset block in the preset time series database; each preset block in the preset time series database is used to store multiple tenant data of different types; a first judgment module, used to judge whether the corresponding maximum timestamp of each preset block is greater than or equal to the target critical time; a second judgment module, used to judge whether the minimum timestamp corresponding to the preset block is less than or equal to the target critical time based on the maximum timestamp corresponding to the preset block being greater than or equal to the target critical time; a data deletion module, used to compare the storage time of each tenant data in the preset block with the target critical time based on the minimum timestamp corresponding to the preset block being less than or equal to the target critical time, and delete the target tenant data whose storage time is less than or equal to the target critical time.

[0018] In a third aspect, the present invention provides a computer device comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the tenant data deletion method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0019] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the tenant data deletion method of the above-mentioned first aspect or any corresponding embodiment thereof.

[0020] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions, which are used to enable a computer to execute the tenant data deletion method of the above-mentioned first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in related technologies, the following briefly introduces the drawings required for use in the specific embodiments or related technical descriptions. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0022] Figure 1 4 is a flowchart of a method for deleting tenant data according to an embodiment of the present invention.

[0023] Figure 2 2 is a schematic diagram of the data storage structure of the Victoriametrics database according to an embodiment of the present invention.

[0024] Figure 3 4 is a flowchart of another method for deleting tenant data according to an embodiment of the present invention.

[0025] Figure 4 2 is a schematic diagram of a day-level index storage structure according to an embodiment of the present invention.

[0026] Figure 5 is a flowchart of an index deletion method according to an embodiment of the present invention.

[0027] Figure 6 4 is a flowchart of another method for deleting tenant data according to an embodiment of the present invention.

[0028] Figure 7 4 is a structural block diagram of a device for deleting tenant data according to an embodiment of the present invention.

[0029] Figure 8Schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0030] To make the purpose, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative efforts shall fall within the scope of protection of the present invention.

[0031] Currently, in the field of cloud computing observability, representative time series databases include the Victoriametrics database and the Thanos database.

[0032] Victoriametrics logically isolates tenant data through namespaces, and all tenants share the same data expiration time. This can lead to data being deleted only after the maximum expiration time allowed by the system, even if most tenants have configured short expiration times. This wastes a significant amount of disk space.

[0033] Thanos is characterized by isolating tenant data through directories. While this approach allows tenants to have independent data expiration times and timely data deletion, freeing up disk resources, the one-directory-per-tenant approach prevents the system from supporting too many tenants. Furthermore, the presence of a large number of independent directories can lead to a high volume of random disk input and output, degrading system performance.

[0034] An embodiment of the present invention provides a method for deleting tenant data, which judges the tenant data stored in each preset block by setting a target critical time and deletes useless tenant data to save disk space.

[0035] According to an embodiment of the present invention, an embodiment of a method for deleting tenant data is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0036] In this embodiment, a method for deleting tenant data is provided, which can be used on a computer device, specifically, on a computer device where a time series database for cloud computing is located. Figure 1 is a flowchart of a method for deleting tenant data according to an embodiment of the present invention. Figure 1As shown, the process includes the following steps:

[0037] Step S101: Determine a target critical time based on the current time and a preset deadline; the target critical time is a demarcation time indicating whether the tenant data has reached a deletion state.

[0038] In some optional implementations, determining the target critical time based on the current time and the preset deadline includes: determining the target critical time based on the difference between the current time and the preset deadline.

[0039] Among them, the current time is the current date, and the preset period is the maximum time period that tenant data can be stored. For example, the current time is May 6, the preset period is one month (31 days), and the target critical time is April 6.

[0040] In some optional implementations, when the storage time of the tenant data is less than or equal to the target critical time, it means that the storage time of the tenant data has exceeded the preset period, so the tenant data can be deleted. When the storage time of the tenant data is greater than the target critical time, it means that the storage time of the tenant data has not exceeded the preset period, so the tenant data can be retained.

[0041] Step S102 : obtaining a maximum timestamp and a minimum timestamp corresponding to each preset block in a preset time series database; each preset block in the preset time series database is used to store multiple tenant data of different types.

[0042] The preset time series database can be Victorametric, such as Figure 2 The figure shows a schematic diagram of the data storage structure of the Victoriametrics database. The Victoriametrics database stores tenant data in segments according to Blocks (preset blocks). A Victoriametrics database includes multiple Blocks. Different preset blocks store different types of tenant data, that is, the type of tenant data stored in each preset block is the same. For example, a Block is used to store the tenant's identity data. The tenant data stored in each Block of the Victoriametrics database presents a Key-Value (key-value pair) structure. The Key corresponds to a two-layer sparse index structure, where the first layer is BlockHeader (block header), which represents the monitoring indicator information of the tenant data. Each Block corresponds to a BlockHeader, and the second layer is Value, which represents the specific tenant data. The tenant data is time series data, and the tenant data is sorted from small to large in time to form a time-value list.

[0043] like Figure 2As shown, physically, the Value of each Block is divided into two files, namely Value.bin (value binary file) and Timestamp.bin (timestamp binary file). Value.bin is used to store specific tenant data, and Timestamp.bin is used to store timestamps.

[0044] like Figure 2 As shown, the BlockHeader includes monitoring indicator information such as the time stream identifier (TSID) of the corresponding block, the minimum timestamp (MinTimestamp) of the corresponding block, the maximum timestamp (MaxTimestamp) of the corresponding block, the first indicator value (FirstValue) of the corresponding block, the timestamp data block offset (TimestampsBlockOffset) of the corresponding block, and the indicator value data block offset (ValuesBlockOffset) of the corresponding block. Among them, TSID is composed of the tenant's AccountID (account ID) and ProjectID (project ID). Multiple BlockHeaders form an IndexBlock (IndexBlock), and multiple IndexBlocks form the index data binary (Index.bin) file.

[0045] like Figure 2 As shown, the Victoriametrics database also includes a meta-index block binary file (MetaIndex.bin) for storing block monitoring indicator information of multiple BlockHeaders in the index data binary file (Index.bin). MetaIndex.bin includes timeline identifiers (Time StreamIDentity, TSID) of multiple BlockHeaders, minimum timestamps (MinTimestamp) of multiple BlockHeaders, maximum timestamps (MaxTimestamp) of multiple BlockHeaders, index block offsets (IndexBlockOffset) of multiple BlockHeaders, and index block counts (IndexBlockCount) of multiple BlockHeaders.

[0046] In some optional embodiments, obtaining the maximum timestamp and minimum timestamp corresponding to each preset block in the preset time series database includes: obtaining monitoring indicator information of each preset block in the preset time series database, and querying and obtaining the maximum timestamp and minimum timestamp in the monitoring indicator information.

[0047] The monitoring indicator information in the BlockHeader corresponding to the Block is obtained, and the MinTimestamp and MaxTimestamp are queried and obtained in the monitoring indicator information.

[0048] In some optional embodiments, the maximum timestamp is the timestamp corresponding to the tenant data whose storage time is closest to the current time among multiple tenant data in the preset block; the minimum timestamp is the timestamp corresponding to the tenant data whose storage time is earliest (farthest from the current time) among multiple tenant data in the preset block.

[0049] Step S103 , determining whether the corresponding maximum timestamp of each preset block is greater than or equal to the target critical time.

[0050] In step S104 , if the maximum timestamp corresponding to the preset block is greater than or equal to the target critical time, it is determined whether the minimum timestamp corresponding to the preset block is less than or equal to the target critical time.

[0051] Among them, if the maximum timestamp corresponding to the preset block is greater than or equal to the target critical time, it means that the storage time of the tenant data with the shortest storage time has not reached the preset period and needs to be retained. Then, it is determined whether the minimum timestamp corresponding to the preset block is less than or equal to the target critical time.

[0052] In some optional implementations, the tenant data deletion method further includes: if the maximum timestamp corresponding to the preset block is less than the target critical time, removing the preset block.

[0053] Among them, if the maximum timestamp corresponding to the preset block is less than the target critical time, it means that among the multiple tenant data in the entire preset block, the storage time of the tenant data with the shortest storage time is long enough. Therefore, the storage time of multiple tenant data in the entire preset block exceeds the maximum storage time. The entire preset block is removed to delete all expired tenant data.

[0054] In step S105 , if the minimum timestamp corresponding to the preset block is less than or equal to the target critical time, the storage time of each tenant data in the preset block is compared with the target critical time, and the target tenant data with a storage time less than or equal to the target critical time is deleted.

[0055] If the minimum timestamp corresponding to a preset block is less than or equal to the target critical time, it means that the tenant data with the longest storage time has been stored long enough and can be deleted. In this case, some of the tenant data in the preset block needs to be deleted while others need to be retained. Therefore, the storage time of each tenant data in the preset block is compared with the target critical time, and the target tenant data with a storage time less than or equal to the target critical time is deleted.

[0056] In some optional embodiments, the storage time of each tenant data in a preset block is obtained, the storage time of each tenant data is compared with the target critical time, the target tenant data whose storage time is less than or equal to the target critical time is deleted, and the tenant data whose storage time is greater than the target critical time is retained.

[0057] In some optional implementations, the tenant data deletion method further includes: if the minimum timestamp corresponding to the preset block is greater than the target critical time, retaining the preset block.

[0058] Among them, if the minimum timestamp corresponding to the preset block is greater than the target critical time, it means that among the multiple tenant data in the entire preset block, the storage time of the tenant data with the longest storage time is less than the maximum storage time. Therefore, the storage time of multiple tenant data in the entire preset block is less than the maximum storage time, and the entire preset block is retained.

[0059] The tenant data deletion method provided in this embodiment determines a target critical time based on the current time and a preset deadline. The target critical time serves as the demarcation point for whether the tenant data has reached the deletion state. When the storage time of the tenant data is less than or equal to the target critical time, it indicates that the tenant data has been stored for a long enough time and the tenant data can be deleted. When the storage time of the tenant data is greater than the target critical time, it indicates that the tenant data has not been stored for a long enough time and may still be useful, so the tenant data can be retained. The embodiment of the present invention combines obtaining the maximum and minimum timestamps of a preset block. A preset block stores multiple tenant data. The maximum timestamp of the preset block represents the timestamp corresponding to the tenant data with the shortest storage time among the multiple tenant data in the preset block. The minimum timestamp of the preset block represents the timestamp corresponding to the tenant data with the longest storage time among the multiple tenant data in the preset block. Therefore, when the maximum timestamp corresponding to the preset block is greater than or equal to the target critical time, it indicates that the tenant data with the shortest storage time has not yet reached the preset deadline and needs to be retained. The embodiment of the present invention then determines whether the minimum timestamp corresponding to the preset block is less than or equal to the target critical time. If the minimum timestamp corresponding to the preset block is less than or equal to the target critical time, it means that the tenant data with the longest storage time has been stored long enough and can be deleted. At this time, some of the multiple tenant data in the preset block need to be deleted and some need to be retained. Therefore, the storage time of each tenant data in the preset block is compared with the target critical time, and the target tenant data with a storage time less than or equal to the target critical time is deleted. By setting the target critical time and judging each tenant data, the embodiment of the present invention can clean up expired tenant data in a timely manner, release disk resources, and enable the time series database to carry more tenant data.

[0060] In this embodiment, a method for deleting tenant data is provided, which can be used on a computer device, specifically, on a computer device where a time series database for cloud computing is located. Figure 3 is a flowchart of another method for deleting tenant data according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:

[0061] Step S301: Determine the target critical time based on the current time and the preset deadline; the target critical time is the demarcation time indicating whether the tenant data has reached the deletion state. Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.

[0062] Step S302: Obtain the maximum timestamp and minimum timestamp corresponding to each preset block in the preset time series database; each preset block in the preset time series database is used to store multiple tenant data of different types. Figure 1 Step S102 of the illustrated embodiment will not be described in detail here.

[0063] Step S303: Determine whether the maximum timestamp corresponding to each preset block is greater than or equal to the target critical time. Figure 1 Step S103 of the illustrated embodiment will not be described in detail here.

[0064] Step S304: If the maximum timestamp corresponding to the preset block is greater than or equal to the target critical time, determine whether the minimum timestamp corresponding to the preset block is less than or equal to the target critical time. Figure 1 Step S104 of the illustrated embodiment will not be described in detail here.

[0065] Step S305: If the minimum timestamp corresponding to the preset block is less than or equal to the target critical time, the storage time of each tenant data in the preset block is compared with the target critical time, and the target tenant data whose storage time is less than or equal to the target critical time is deleted. Figure 1 Step S105 of the illustrated embodiment will not be described in detail here.

[0066] Step S306: Obtain the creation date of the index corresponding to each tenant data in each preset block.

[0067] In some optional implementations, Victoriametrics' indexes are divided into two types: a global index and a daily index. Since the global index does not contain time information, expiration judgment is not performed on the global index for the time being. The daily index is a method of organizing and managing data indexes according to time granularity. The daily index information contains date information and tenant data information. Therefore, embodiments of the present invention perform expiration judgment on the daily index.

[0068] The day-level index includes multiple indexing methods, such as: indexing from date to TSID, indexing from date + monitoring name to TSID, and indexing from date + tag to indicator identifier. The data structure of multiple indexing methods is the same, such as Figure 4 The following is a diagram of the index storage structure at the day level. Each row in the figure represents an index record. Each index record includes: type (Type), account ID (Account ID), project ID (ProjectID), creation date (Date), and tenant data value (Value).

[0069] Therefore, the creation date (Date) corresponding to the value (Value) of each tenant data is obtained in the index information.

[0070] Step S307: determine whether the creation date is less than or equal to the target critical time. If the creation date is less than or equal to the target critical time, delete the index.

[0071] In some optional implementations, if the creation date is greater than the target critical time, the index is retained.

[0072] For example, Figure 5 As shown, it is a flowchart of the index deletion method, which traverses multiple indexes, obtains the creation date corresponding to the tenant data according to the tenant data in the index information, and determines whether the creation date is less than or equal to the target critical time. If the creation date is less than or equal to the target critical time, the index is deleted, and the step of traversing multiple indexes is returned to make a judgment on each index; if the creation date is greater than the target critical time, the index is retained, and the step of traversing multiple indexes is returned to make a judgment on each index.

[0073] In an embodiment of the present invention, a corresponding index will be created for each tenant data in each preset block in the preset time series database when it is stored. Therefore, it is necessary to determine whether the creation date is less than or equal to the target critical time. If the creation date is less than or equal to the target critical time, it means that the index creation time is long enough, so the index will be deleted.

[0074] In this embodiment, a method for deleting tenant data is provided, which can be used on a computer device, specifically, on a computer device where a time series database for cloud computing is located. Figure 6 FIG. 1 is a flowchart of another method for deleting tenant data according to an embodiment of the present invention. Figure 6 As shown, the process includes the following steps:

[0075] Get a preset block, obtain the maximum and minimum timestamps based on the monitoring indicator information in the block header corresponding to the preset block, and determine whether the entire preset block has expired based on the corresponding maximum timestamp and target critical time of each preset block. If the maximum timestamp corresponding to the preset block is less than the target critical time, the entire preset block is determined to be expired and the preset block is removed. If the maximum timestamp corresponding to the preset block is greater than or equal to the target critical time, determine whether the entire preset block has not expired based on the corresponding minimum timestamp and target critical time. If the minimum timestamp corresponding to the preset block is greater than the target critical time, the entire preset block has not expired and the preset block is retained. If the minimum timestamp corresponding to the preset block is less than or equal to the target critical time, traverse the time series pairs corresponding to each tenant data in the preset block and determine whether each time series pair has expired based on its storage time and target critical time. If the storage time is less than or equal to the target critical time, it indicates that it has expired and the time series pair is deleted. If the storage time is greater than the target critical time, it indicates that it has not expired and the time series pair is retained.

[0076] In this embodiment of the present invention, the above actions are performed using a pre-defined deletion algorithm. The Victoriametrics database is configured with a background task that continuously merges small logical units (parts) into larger parts to optimize read performance. Therefore, a pre-defined deletion algorithm can be inserted into the merging process.

[0077] However, the Victoriametrics database stops merging large parts. If the default deletion algorithm is only executed during the merging process, expired tenant data in these large parts will not be deleted in a timely manner. Therefore, an additional data cleanup background task is required to regularly check all parts and execute the default deletion algorithm. To reduce disk read and write operations, the time of the last default deletion algorithm execution for each part is recorded. This information, combined with information such as the minimum timestamp of the data in the part, allows the default deletion algorithm to be executed as needed.

[0078] This embodiment also provides a device for deleting tenant data, which is used to implement the above-mentioned embodiments and preferred implementations. Details that have already been described will not be repeated. As used below, the term "module" may refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.

[0079] This embodiment provides a device for deleting tenant data, such as Figure 7 Shown, including:

[0080] The target critical time determination module 701 is used to determine the target critical time according to the current time and the preset deadline; the target critical time is the boundary time indicating whether the tenant data reaches the deletion state.

[0081] The timestamp acquisition module 702 is used to obtain the maximum timestamp and the minimum timestamp corresponding to each preset block in the preset time series database; each preset block in the preset time series database is used to store multiple tenant data of different types.

[0082] The first determination module 703 is configured to determine whether the maximum timestamp corresponding to each preset block is greater than or equal to a target critical time.

[0083] The second judgment module 704 is configured to judge whether the minimum timestamp corresponding to the preset block is less than or equal to the target critical time according to whether the maximum timestamp corresponding to the preset block is greater than or equal to the target critical time.

[0084] The data deletion module 705 is used to compare the storage time of each tenant data in the preset block with the target critical time based on the minimum timestamp corresponding to the preset block being less than or equal to the target critical time, and delete the target tenant data whose storage time is less than or equal to the target critical time.

[0085] In some optional implementations, the tenant data deletion device further includes:

[0086] The index deletion module is used to obtain the creation date of the index corresponding to each tenant data in each preset block; determine whether the creation date is less than or equal to the target critical time, and if the creation date is less than or equal to the target critical time, delete the index.

[0087] In some optional implementations, the tenant data deletion device further includes:

[0088] The preset block removing module is used to remove the preset block if the maximum timestamp corresponding to the preset block is less than the target critical time.

[0089] The preset block retaining module is used to retain the preset block if the minimum timestamp corresponding to the preset block is greater than the target critical time.

[0090] In some optional implementations, the target critical time determination module 701 includes:

[0091] The target critical time determination unit is used to determine the target critical time according to the difference between the current time and the preset deadline.

[0092] In some optional implementations, the timestamp acquisition module 702 includes:

[0093] The timestamp acquisition unit is used to obtain monitoring indicator information of each preset block in the preset time series database, and query and obtain the maximum timestamp and the minimum timestamp in the monitoring indicator information.

[0094] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0095] The tenant data deletion device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0096] The embodiment of the present invention also provides a computer device having the above Figure 7 Deletion means of the tenant data shown.

[0097] See also Figure 8 , Figure 8 is a structural diagram of a computer device provided by an optional embodiment of the present invention, such as Figure 8 As shown, the computer device includes: one or more processors 10, memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components utilize different buses to communicate with each other and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in the memory or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Equally, multiple computer devices can be connected, and each device provides part of the necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 8 A processor 10 is taken as an example.

[0098] The processor 10 may be a central processing unit, a network processor, or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit, a programmable logic device, or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic, or any combination thereof.

[0099] The memory 20 stores instructions that can be executed by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.

[0100] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and application programs required for at least one function; the data storage area may store data created based on the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely located relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0101] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid-state drive; the memory 20 may also include a combination of the above types of memory.

[0102] The computer device further includes a communication interface 30 for the computer device to communicate with other devices or a communication network.

[0103] The embodiment of the present invention also provides a computer-readable storage medium. The above-mentioned method according to the embodiment of the present invention can be implemented in hardware, firmware, or implemented as a computer code that can be recorded in a storage medium, or implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and downloaded through a network and will be stored in a local storage medium, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor or hardware, the method shown in the above embodiment is implemented.

[0104] A portion of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the form in which the computer program instruction exists in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc. Accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium that can be accessed by the computer.

[0105] Although the embodiments of the present invention have been described with reference to the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention. Such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A method for deleting tenant data, characterized in that: The method comprises: Determine a target critical time based on the current time and a preset deadline; the target critical time is the demarcation time indicating whether the tenant data has reached a deletion state; Obtaining a maximum timestamp and a minimum timestamp corresponding to each preset block in a preset time series database; each of the preset blocks in the preset time series database is used to store multiple tenant data of different types; Determining whether the maximum timestamp corresponding to each of the preset blocks is greater than or equal to the target critical time; If the maximum timestamp corresponding to the preset block is greater than or equal to the target critical time, determining whether the minimum timestamp corresponding to the preset block is less than or equal to the target critical time; If the minimum timestamp corresponding to the preset block is less than or equal to the target critical time, the storage time of each tenant data in the preset block is compared with the target critical time, and the target tenant data whose storage time is less than or equal to the target critical time is deleted.

2. The method according to claim 1, characterized in that The method further comprises: Obtaining a creation date of an index corresponding to each of the tenant data in each of the preset blocks; It is determined whether the creation date is less than or equal to the target critical time; if the creation date is less than or equal to the target critical time, the index is deleted.

3. The method according to claim 1 or 2, characterized in that The method further comprises: If the maximum timestamp corresponding to the preset block is less than the target critical time, the preset block is removed.

4. The method according to claim 1 or 2, characterized in that The method further comprises: If the minimum timestamp corresponding to the preset block is greater than the target critical time, the preset block is retained.

5. The method according to claim 1 or 2, characterized in that Determining the target critical time based on the current time and the preset deadline includes: The target critical time is determined according to the difference between the current time and the preset time limit.

6. The method according to claim 1 or 2, characterized in that The obtaining of the maximum timestamp and the minimum timestamp corresponding to each preset block in the preset time series database includes: The monitoring indicator information of each preset block in the preset time series database is obtained, and the maximum timestamp and the minimum timestamp are searched and obtained in the monitoring indicator information.

7. A device for deleting tenant data, characterized in that: The device comprises: A target critical time determination module is used to determine a target critical time based on the current time and a preset deadline; the target critical time is a demarcation time indicating whether the tenant data has reached a deletion state; A timestamp acquisition module, configured to acquire a maximum timestamp and a minimum timestamp corresponding to each preset block in a preset time series database; each preset block in the preset time series database is used to store multiple tenant data of different types; A first determination module is configured to determine whether the maximum timestamp corresponding to each of the preset blocks is greater than or equal to the target critical time; a second determining module, configured to determine whether the minimum timestamp corresponding to the preset block is less than or equal to the target critical time according to whether the maximum timestamp corresponding to the preset block is greater than or equal to the target critical time; A data deletion module is used to compare the storage time of each tenant data in the preset block with the target critical time based on the minimum timestamp corresponding to the preset block being less than or equal to the target critical time, and delete the target tenant data whose storage time is less than or equal to the target critical time.

8. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the tenant data deletion method according to any one of claims 1 to 6 by executing the computer instructions.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the tenant data deletion method according to any one of claims 1 to 6.

10. A computer program product, characterized in that The method comprises computer instructions for causing a computer to execute the tenant data deletion method according to any one of claims 1 to 6.