Method and device for disk space management, equipment and storage medium

By obtaining the database storage space usage information and utilizing demand prediction models, and performing disk optimization operations, the problems of low disk management efficiency and waste of resources in the existing technology are solved, and efficient disk space management and database performance improvement are achieved.

CN119396346APending Publication Date: 2025-02-07JD DIGITS HAIYI INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202411577865.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-06
Publication Date
2025-02-07

AI Technical Summary

Technical Problem

In the face of dynamic data growth and burst storage demands, the disk management efficiency is not high, resulting in insufficient disk space or waste of resources.

Method used

By obtaining the database storage space usage information, using the trained demand prediction model, determining the database storage space requirements, and performing disk optimization operations based on this information, including cleaning up log files and data table space fragments, and timely updating disk space.

Benefits of technology

Adaptive and automated dynamic disk space management is realized, reducing dependence on human resources, improving disk space utilization and database system performance and stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119396346A_ABST
    Figure CN119396346A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a disk space management method and device, equipment and a storage medium. The method comprises the steps of obtaining storage space use information corresponding to a database, wherein the storage space use information at least indicates a storage space occupancy rate of the database in a corresponding target disk; using a trained demand prediction model corresponding to the database to determine a demand prediction result corresponding to the database based on the storage space usage information, the demand prediction result indicating a storage space demand of the database for the target disk; based on the storage space usage information and / or the demand prediction result, disk optimization operation on the target disk is executed, and the disk optimization operation comprises clearing operation for log files and / or data table space fragments in the target disk and / or disk space updating operation for the database. Therefore, by monitoring and analyzing the use condition of the disk space, the disk optimization operation is adjusted, and the efficiency of database disk space management is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Example embodiments of the present disclosure generally relate to the field of information technology, and more particularly, to a method, an apparatus, a device, and a computer-readable storage medium for disk space management. Background Art

[0002] As the amount of data continues to grow, the storage requirements and performance pressure of the database are also increasing rapidly, especially in high-concurrency and high-data-volume application scenarios such as cloud computing and large-scale distributed systems. Timely monitoring and management of database disk space resources is crucial to ensure the stable operation of the system.

[0003] In the related art, disk space management usually relies on manual monitoring and static configuration, such as preset cleanup rules and regular maintenance plans. These methods not only usually require manual operation and monitoring, but also have difficulty in responding to dynamic changes in database load in a timely manner, and are prone to insufficient disk space or waste of resources.

[0004] Therefore, a more flexible and efficient method for disk space management is needed. Summary of the invention

[0005] In a first aspect of the present disclosure, a method for disk space management is provided. The method includes: obtaining storage space usage information corresponding to a database, the storage space usage information at least indicating the storage space occupancy rate of the database in the corresponding target disk; using a trained demand prediction model corresponding to the database, based on the storage space usage information, determining a demand prediction result corresponding to the database, the demand prediction result indicating the storage space demand of the database for the target disk; and performing a disk optimization operation on the target disk based on the storage space usage information and / or the demand prediction result, the disk optimization operation including a cleanup operation for log files and / or data table space fragments in the target disk, and / or a disk space update operation for the database.

[0006] In a second aspect of the present disclosure, a device for disk space management is provided. The device includes: an acquisition module configured to acquire storage space usage information corresponding to a database, the storage space usage information at least indicating the storage space occupancy rate of the database in the corresponding target disk; a demand prediction module configured to use a trained demand prediction model corresponding to the database, based on the storage space usage information, to determine the demand prediction result corresponding to the database, the demand prediction result indicating the storage space demand of the database for the target disk; and a disk optimization module configured to perform disk optimization operations on the target disk based on the storage space usage information and / or the demand prediction result, the disk optimization operations including cleanup operations for log files and / or data table space fragments in the target disk, and / or disk space update operations for the database.

[0007] In a third aspect of the present disclosure, an electronic device is provided. The device includes at least one processing unit; and at least one memory, the at least one memory is coupled to the at least one processing unit and stores instructions for execution by the at least one processing unit. When the instructions are executed by the at least one processing unit, the device executes the method of the first aspect.

[0008] In a fourth aspect of the present disclosure, a computer-readable storage medium is provided, wherein a computer program is stored on the computer-readable storage medium, and the computer program can be executed by a processor to implement the method of the first aspect.

[0009] In a fifth aspect of the present disclosure, a computer program product is provided, which is tangibly stored in a computer storage medium and includes computer executable instructions, which when executed by a device cause the device to perform the method according to the first aspect of the present disclosure.

[0010] It should be understood that the content described in this content section is not intended to limit the key features or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, wherein:

[0012] Figure 1 A schematic diagram showing an example environment in which embodiments of the present disclosure can be implemented;

[0013] Figure 2 A flowchart showing a process of disk space management according to some embodiments of the present disclosure;

[0014] Figure 3A A schematic diagram showing a process of determining disk space usage according to some embodiments of the present disclosure;

[0015] Figure 3B A schematic diagram showing a process of training a demand prediction model according to some embodiments of the present disclosure;

[0016] Figure 3C A schematic diagram showing a process of performing a disk optimization operation according to some embodiments of the present disclosure;

[0017] Figure 3D A schematic diagram showing a process of performing a cleanup operation on a log file in some embodiments of the present disclosure;

[0018] Figure 3E A schematic diagram showing a process of performing a cleanup operation for table space fragments according to some embodiments of the present disclosure;

[0019] Figure 3F A schematic diagram showing a process of performing a disk space update operation on a database according to some embodiments of the present disclosure;

[0020] Figure 3G A schematic diagram showing a process of executing database performance monitoring in some embodiments of the present disclosure;

[0021] Figure 4 A block diagram showing an apparatus for disk space management according to some embodiments of the present disclosure; and

[0022] Figure 5 A block diagram of an electronic device capable of implementing one or more embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0023] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.

[0024] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.

[0025] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0026] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.

[0027] It is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.

[0028] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0029] In the description of the embodiments of the present disclosure, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The term "some embodiments" should be understood as "at least some embodiments". Other explicit and implicit definitions may also be included below.

[0030] As briefly mentioned above, as the amount of database data grows, how to effectively manage the database disk space becomes an important issue for maintaining the stability of system operation.

[0031] In the related art, disk management methods usually rely on the following two methods: preset rules and regular cleanup plans, which regularly clean up the database through pre-set rules and plans, such as regularly deleting old data or archiving it; disk status monitoring and alarm system, which monitors the disk status and sends an alarm if the disk space is about to be insufficient, notifying the relevant administrator to take action.

[0032] These methods all have certain limitations. For example, managers need to constantly monitor disk usage and manually adjust rules and cleanup plans, which not only increases workload but also consumes a lot of energy. In addition, when it comes to high-risk operations such as cleaning disks and deleting data, manual operation errors are prone to occur. For example, accidentally deleting important data may have a serious impact on the system.

[0033] In addition, database systems usually need to frequently read and write data. These operations place high demands on the read and write speed of the disk, especially in business scenarios that process large amounts of data, perform real-time analysis, or require fast responses. To meet these requirements, servers often use high-performance hardware, such as solid-state drives (SSDs). If the database allocates a large amount of disk space, but in actual use, this space is not fully utilized, the disk utilization rate will be very low, resulting in a waste of system resources.

[0034] Therefore, in order to solve the above-mentioned problems of inefficient disk management and insufficient space utilization leading to resource waste when facing dynamic data growth and sudden storage needs, an adaptive and automated disk space dynamic management solution is needed to reduce dependence on human resources, improve management efficiency, and effectively avoid waste or shortage of disk resources to ensure the stability and performance of the database.

[0035] In an embodiment of the present disclosure, a solution for disk space management is provided. According to an embodiment of the present disclosure, storage space usage information corresponding to a database is obtained, and the storage space usage information at least indicates the storage space occupancy rate of the database in the corresponding target disk; a demand prediction result corresponding to the database is determined based on the storage space usage information using a trained demand prediction model corresponding to the database, and the demand prediction result indicates the storage space demand of the database for the target disk; and based on the storage space usage information and / or the demand prediction result, a disk optimization operation is performed on the target disk, and the disk optimization operation includes a cleanup operation for log files and / or data table space fragments in the target disk, and / or a disk space update operation for the database.

[0036] Therefore, through real-time performance monitoring, storage demand prediction based on machine learning models, automated database expansion / reduction mechanism, and dynamic disk space cleanup operations, the utilization of disk space and the performance and stability of the database system are effectively improved. Moreover, through structured monitoring and data processing processes, sudden changes in storage demand can be predicted and responded to in advance, achieving efficient disk resource management, making this solution suitable for handling the dynamic needs of large-scale and diversified database systems.

[0037] Figure 1 A schematic diagram of an example environment 100 in which embodiments of the present disclosure can be implemented is shown. In the environment 100, the electronic device 110 can obtain storage space usage corresponding to the database 120, and automatically trigger a disk space management operation for the database 120 according to the actual storage demand of the database 120.

[0038] In some embodiments, the database 120 is a target database storing data required by an application or user. The electronic device 110 can monitor the usage of its storage space by interacting with the database 120, and perform space management on the storage device or storage pool carrying the data of the database 120, that is, the target disk 130.

[0039] In the environment 100, the electronic device 110 can be any type of device with computing capabilities, including a terminal device or a server device. The terminal device can be any type of mobile terminal, fixed terminal or portable terminal, including a mobile phone, a desktop computer, a laptop computer, a notebook computer, a netbook computer, a tablet computer, a media computer, a multimedia tablet, a personal communication system (PCS) device, a personal navigation device, a personal digital assistant (PDA), an audio / video player, a digital camera / camcorder, a positioning device, a television receiver, a radio broadcast receiver, an e-book device, a gaming device, or any combination of the foregoing, including accessories and peripherals of these devices or any combination thereof. The server device can include, for example, a computing system / server, such as a mainframe, an edge computing node, a computing device in a cloud environment, and the like.

[0040] It should be understood that the structure and functionality of environment 100 are described for exemplary purposes only and does not imply any limitation on the scope of the present disclosure.

[0041] Figure 2 1 is a flowchart of a process 200 of disk space management according to some embodiments of the present disclosure. The process 200 may be implemented in the environment 100, for example, the process 200 may be implemented at the electronic device 110. In the following, for ease of discussion, reference will be made to Figure 1 The process 200 is described below.

[0042] In box 210 , the electronic device 110 obtains storage space usage information corresponding to the database 120 .

[0043] In some embodiments, the storage space usage information at least indicates the storage space occupancy rate of the database 120 in the corresponding target disk 130 .

[0044] In some embodiments, the electronic device 110 determines the usage of the storage space allocated to the database 120, such as the storage space occupancy rate. The storage space occupancy rate is the ratio of the storage space actually used by the database on the corresponding disk to the total available storage space allocated, which is an important indicator for measuring the usage of database storage resources.

[0045] In some embodiments, the storage space usage information may also indicate at least one of the following: the disk capacity corresponding to the database, the disk occupancy, and the rate of disk data transmission. The disk capacity corresponding to the database refers to the total storage space allocated for the database. The disk occupancy refers to the size of the storage space actually occupied by the database on the disk. The degree of disk usage can be determined based on the ratio of the disk occupancy to the disk capacity.

[0046] The disk data transfer rate refers to the speed at which the disk reads or writes data (Input / Output, I / O) (e.g., the number of bytes read / written per second), and is used to evaluate the load of disk read / write operations. In other embodiments, the storage space usage information may also indicate more, less, or different other information.

[0047] In some embodiments, the electronic device 110 may also obtain the processor and memory usage corresponding to the database 120, for example, the central processing unit (CPU) load of the database server and the memory usage of the database system. When the CPU usage rate or the memory usage rate is high, the database may be under a high processing pressure and needs to be optimized for performance or expand the corresponding storage resources.

[0048] As an example, Figure 3A FIG. 3 is a schematic diagram of a process 300A for determining disk space usage according to some embodiments of the present disclosure. The process 300A may be implemented at the electronic device 110 .

[0049] like Figure 3A As shown, the electronic device 110 can periodically (e.g., in seconds) obtain storage space usage information and other related data of the database 120 by utilizing the performance database collector components (collectively or individually referred to as performance database collectors 311) corresponding to each database (collectively or individually referred to as database 120).

[0050] The performance database collector 311 is a tool component deployed on each database instance for real-time monitoring and collection of database operation status, performance indicators and resource usage.

[0051] In box 312, the electronic device 110 can obtain collected data from multiple database instances and perform regular sampling to store the collected data in a metadata database (such as MySQL) for persistence processing.

[0052] In block 313, the electronic device 110 can read the acquired data from the metadata repository and monitor it according to a predetermined time period, which means that the electronic device 110 can detect changes in database resources, especially the usage status of disk space, in a very short time interval (e.g., every second).

[0053] As an example, the electronic device 110 can use the data monitoring system to read the collected data from the MySQL metadata repository and perform second-level monitoring. Through the second-level data monitoring mechanism and the timing sampling mechanism, the electronic device 110 can use the data monitoring system to quickly detect the usage of the disk space.

[0054] In block 314 , the electronic device 110 may predict the storage space requirement of the database 120 for the target disk 130 based on the data obtained by the data monitoring operation.

[0055] In some embodiments, the electronic device 110 may also predict the storage space requirement of the database 120 for the target disk 130 based on the acquired storage space usage information corresponding to the database 120 .

[0056] Return to reference Figure 2 In block 220 , the electronic device 110 uses the trained demand prediction model corresponding to the database 120 and determines the demand prediction result corresponding to the database based on the storage space usage information. The demand prediction result indicates the storage space demand of the database 120 for the target disk 130 .

[0057] In some embodiments, the electronic device 110 may train a corresponding demand prediction model for each database based on the acquired historical storage space usage information corresponding to the database 120 , and determine the demand prediction result corresponding to the database 120 based on the trained demand prediction model.

[0058] As an example, Figure 3B A schematic diagram of a process 300B for training a demand prediction model according to some embodiments of the present disclosure is shown. The process 300B may be implemented at the electronic device 110 .

[0059] In block 321 , the electronic device 110 obtains storage space usage information corresponding to the database 120 , and collects historical data within a predetermined time period that is persistently stored in the metadata database, taking each database as a unit.

[0060] In block 322, after the electronic device 110 obtains the historical storage space usage information corresponding to the database, it performs data preprocessing operations, such as data cleaning operations, which ensure that the data used by the model is high-quality and accurate data by removing outliers and noise points, thereby avoiding the interference of erroneous data on the model prediction results; normalization operations, which scale features of different dimensions to similar scales, so that the model can better process multi-dimensional features and improve training effects.

[0061] In block 323, the electronic device 110 performs a data feature extraction operation to extract features such as time features, lag features, etc., so as to help the model understand the periodic and trend changes in the time series. For example, the electronic device 110 performs window partitioning on the time series data, and uses a sliding window technology to divide the historical storage space usage information into multiple time periods, each of which is used as an input to the model, so as to help the model capture short-term changes and long-term trends in the time series.

[0062] In block 324 , the electronic device 110 constructs a demand prediction model for determining a demand prediction result corresponding to the database 120 .

[0063] As an example, the electronic device 110 can build a demand forecasting model based on a long short-term memory network (LSTM). LSTM is a recursive neural network that can be used to process and predict time series data or sequence data, and is therefore suitable for storing demand forecasts. The demand forecasting model may, for example, include an input layer, an LSTM layer, and a fully connected layer. The LSTM layer is used to process time series data and can capture long-term dependencies, while the fully connected layer converts the output into a final predicted value.

[0064] In block 325, the electronic device 110 may use the preprocessed data to train the demand prediction model corresponding to the database 120. By learning from historical data, the model can continuously learn the law of storage demand, thereby being able to more accurately predict future demand changes.

[0065] In some embodiments, the electronic device 110 may use a suitable loss function (such as mean square error) and an optimization algorithm (such as Adam or RMSprop) to adjust the parameters of the model during the training process of the model, thereby minimizing the prediction error and further improving the accuracy of the demand forecast.

[0066] In some embodiments, the electronic device 110 can use the trained demand prediction model to predict the storage demand of the database 120 in the future time period. The prediction value output by the model indicates the storage demand of the database 120 for the target disk 130 in a specific future time period.

[0067] Return to reference Figure 2 , in box 230, the electronic device 110 performs a disk optimization operation on the target disk based on the storage space usage information and / or the demand prediction result.

[0068] In some embodiments, the disk optimization operation includes a cleanup operation for log files and / or data table space fragments in the target disk, and / or a disk space update operation for the database.

[0069] Return to reference Figure 3A In block 315, in response to the storage space usage information indicating that the storage space occupancy rate has reached a set threshold (disk space watermark) and / or the demand prediction result indicating that the storage demand of the database 120 for the target disk 130 in a specific time period in the future exceeds a set threshold, the electronic device 110 may determine that there is an abnormality in the disk space of the target disk 130 corresponding to the database 120. In this case, the electronic device 110 may execute blocks 316 and / or 317.

[0070] In block 316, the electronic device 110 may trigger an alarm operation and issue an early warning message, which will notify the relevant responsible person to indicate that the disk resources are about to be exhausted or abnormal.

[0071] At block 317 , the electronic device 110 performs a disk optimization operation.

[0072] In some embodiments, in response to determining that the storage space occupancy indicated by the storage space usage information is greater than a first occupancy threshold and / or determining that the remaining storage space of the target disk is less than the storage space demand indicated by the demand prediction result, the electronic device 110 performs a cleanup operation for log files and / or data table space fragments and / or a first disk space update operation for the database. The first disk space update operation indicates expansion of the storage space allocated for the database.

[0073] As an example, when the electronic device 110 determines that the storage space occupancy rate of the database 120 exceeds the preset high watermark (first occupancy rate threshold) and / or the remaining storage space of the target disk is less than the predicted storage space requirement, it means that the disk space of the database 120 is close to being exhausted and the disk space needs to be optimized. At this time, the electronic device 110 can first perform a root cause analysis operation to determine the cause of the disk space abnormality and the objects that can be cleaned up. For example, analyze and clean up the fragmentation of log files or data table spaces to free up disk space. This operation can restore part of the storage space without affecting the normal operation of the database. If the cleanup operation is not enough to solve the problem, the electronic device 110 can also perform a first disk space update operation, that is, allocate more disk space to the database 120 to meet current or future storage needs by expanding the disk resources available to the database.

[0074] In some embodiments, in response to determining that the space occupancy rate of the target disk indicated by the space usage information is less than a second occupancy rate threshold, the electronic device 110 performs a second disk space update operation for the database, and the second disk space update operation indicates reducing the storage space allocated for the database.

[0075] As an example, when the electronic device 110 determines that the storage space occupancy rate of the database 120 is lower than the preset low watermark (second occupancy rate threshold), it means that the storage space currently allocated to the database 120 exceeds its actual demand. In this case, the electronic device 110 can automatically perform the second disk space update operation, that is, reduce the disk space currently allocated to the database 120 to optimize the use of resources and reduce unnecessary costs.

[0076] In the disclosed embodiment, by dynamically monitoring storage space usage information and intelligently executing corresponding cleanup and disk space update operations, the resource utilization, response speed and high availability of the database are significantly improved.

[0077] Figure 3C A schematic diagram of a process 300C for performing a disk optimization operation according to some embodiments of the present disclosure is shown. The process 300C may be implemented at the electronic device 110 .

[0078] In block 331, the electronic device 110 performs a log file analysis operation. The electronic device 110 first determines the proportion of the storage space of the target disk occupied by the log file. In response to determining that the proportion of the space occupied by the log file on the target disk is greater than the proportion threshold, the electronic device 110 performs block 336, a cleanup operation for the log file.

[0079] In some embodiments, when the electronic device 110 determines that the storage space occupancy rate of the database 120 exceeds a preset high watermark (first occupancy rate threshold) and / or the remaining storage space of the target disk is less than the predicted storage space requirement, the log files, for example, mainly including the disk space occupied by the binary log (Binlog) file, can be analyzed. If the Binlog file occupies a large amount of disk space and exceeds the set ratio threshold, the log file cleanup operation is triggered.

[0080] Figure 3D A schematic diagram of a process 300D for performing a cleanup operation on a log file according to some embodiments of the present disclosure is shown. The process 300D may be implemented at the electronic device 110 .

[0081] In block 341 , the electronic device 110 performs a log file cleaning operation in response to determining that the proportion of the space occupied by the log file is greater than a proportion threshold.

[0082] In block 342, the electronic device 110 performs a backup check operation. If the electronic device 110 determines that the log file is in a non-backed-up state, a backup operation is performed on the log file.

[0083] In some embodiments, before performing a cleanup operation on a log file, the electronic device 110 first checks whether the log file has been backed up. If not, a backup operation is performed to ensure that the historical data in the log file is preserved. In this way, data integrity and recoverability are guaranteed to prevent data loss or database failure due to log cleaning.

[0084] In block 343, the electronic device 110 performs a cleanup operation on the log file based on the file sequence of the log file in response to determining that the log file is in a backed up state. When cleaning the log files that need to be deleted, the electronic device 110 can clean them one by one according to the file sequence, rather than deleting a large number of files at one time. This method can avoid excessive system load or performance fluctuations caused by large-scale cleaning operations.

[0085] In some embodiments, the Binlog file records database query statements that change data or may change data, and is an important source of data recovery. Therefore, when performing a cleanup operation on the log file, the Binlog files whose creation time is within the threshold time can be retained, so that when data is lost or damaged, it can be restored to a specific time point through the events in the Binlog to ensure data integrity.

[0086] In the disclosed embodiment, efficient disk management and data protection are achieved by performing status analysis and cleanup operations on log files. Data security is ensured by backup checks, and the impact on system performance is reduced by cleaning up one by one, effectively optimizing the use of disk space. This method can not only release disk space in a timely manner, but also ensure the stability of the database when performing log cleanup, providing flexibility for dynamic management.

[0087] Return to reference Figure 3C In block 332, the electronic device 110 performs a data table space fragmentation analysis operation. By performing a data table space fragmentation analysis and cleanup operation, the problem of table space fragmentation, disk space waste, and database performance degradation caused by database addition, deletion, and modification operations is solved.

[0088] In some embodiments, the electronic device 110 obtains statistical information of a data table space of a database. The statistical information of the data table space indicates the disk storage space occupancy of a data table, a data page, and a corresponding data area in the database.

[0089] As an example, the electronic device 110 can query and collect statistical information about the table space through the built-in tools and / or Structured Query Language (SQL) of the database management system. This information may include: the size of the data table, which refers to the size of the disk space occupied by each table; the usage of data pages, where the database table is usually divided into multiple pages to store data, and unused space in the page will cause fragmentation; the usage of data areas, where multiple pages constitute a zone, and the usage of monitoring areas helps analyze the distribution and fragmentation rate of the table space. After obtaining this information, the electronic device 110 can identify which data tables have space waste, providing basic data for subsequent fragmentation analysis and recovery.

[0090] In some embodiments, the electronic device 110 determines the space fragmentation rate corresponding to each data table in the database based on the statistical information of the data table space. The space fragmentation rate indicates the ratio of the storage space occupied by the data table to the storage space allocated in the target disk.

[0091] As an example, based on the collected statistical information, the electronic device 110 can calculate the ratio between the space actually used and the total allocated space in the table space (i.e., the fragmentation rate). By calculating the fragmentation rate, the space utilization efficiency of each table can be quantified. If the fragmentation rate is high, it means that the space allocated by the table is wasted a lot, and defragmentation may be required. Based on the evaluation of the fragmentation rate, the electronic device 110 can decide which data tables need to perform fragmentation cleaning and recycling operations.

[0092] In some embodiments, in response to determining that there is at least one data table in the database corresponding to a space fragmentation rate greater than a fragmentation rate threshold, the electronic device 110 executes box 337 to perform a cleanup operation on table space fragments.

[0093] Figure 3E A schematic diagram of a process 300E for performing a cleanup operation for table space fragmentation according to some embodiments of the present disclosure is shown. The process 300E may be implemented at the electronic device 110 .

[0094] In block 351 , in response to determining that there is at least one data table in the database whose corresponding space fragmentation rate is greater than a fragmentation rate threshold, the electronic device 110 performs a cleanup operation for table space fragmentation.

[0095] In block 352 , the electronic device 110 may perform a pre-check operation on the data table to ensure that the debris recovery operation does not affect the normal operation of the database, especially when some data tables contain data corresponding to long transactions or unbacked up data.

[0096] In some embodiments, the electronic device 110 determines whether there is data corresponding to a transaction whose execution time is greater than a threshold time and / or data corresponding to an unexecuted backup operation in at least one data table.

[0097] As an example, the pre-check operation can include long transaction checking, which refers to transactions that have been executed in the database for a long time but have not yet been completed. These transactions may occupy a large amount of system resources, including lock resources, log space, etc., thus affecting the overall performance and stability of the database. If a data table contains data corresponding to running long transactions, cleanup and recycling operations may interfere with these transactions.

[0098] As another example, the precheck operation may also include a backup status check: if the data in the data table is not backed up, cleanup and recycling operations may bring data risks, so it is necessary to ensure that the data in the data table has been backed up.

[0099] In box 353, in response to determining that there is no data corresponding to transactions with an execution time greater than a threshold time and no data corresponding to unexecuted backup operations in at least one data table, a recovery operation is performed on at least one data table based on an order of space fragmentation rates corresponding to each data table in the at least one data table.

[0100] In some embodiments, if the result of the pre-check operation indicates that the debris cleaning operation will not have a negative impact on the database, the electronic device 110 will perform a table space debris cleaning / recycling operation. The electronic device 110 can perform recycling operations on tables with higher fragmentation rates in sequence. This orderly recycling strategy ensures that the system will not be affected by excessive load in a short period of time.

[0101] In some embodiments, some data tables may fail to pass the pre-check process due to long transactions or lack of backup. When performing cleanup operations on these data tables, these data tables can be marked as special tables. For these data tables that fail the pre-check, the debris cleanup operation cannot be automatically performed, and an alarm can be issued to the relevant staff, and the database administrator can manually intervene to analyze and recycle.

[0102] In the disclosed embodiment, by performing analysis and cleanup operations for data table space fragmentation, it is possible to automatically analyze the usage of the data table space and quantify the fragmentation rate, and perform the recovery operation without affecting performance. This method effectively improves disk space utilization and database performance. At the same time, by performing cleanup in order of fragmentation rate, it is ensured that the impact of the recovery operation on database operation is minimized, thereby achieving automated and efficient data table space management.

[0103] Return to reference Figure 3C In box 333, in response to determining that the space occupancy rate of the target disk indicated by the space usage information is less than the second occupancy rate threshold, the electronic device 110 executes box 338, a second disk space update operation for the database.

[0104] In boxes 334 and 335, in response to the cleanup operation for log files and / or data table space fragments having been performed, and determining that the storage space occupancy of the database in the target disk is still greater than the first occupancy threshold and / or the remaining disk space of the target disk is still less than the disk space requirement, the electronic device 110 executes box 339, a first disk space update operation for the database.

[0105] As an example, when the electronic device 110 determines that the storage space occupancy rate of the database 120 is lower than the preset low watermark (second occupancy rate threshold), it means that the storage space currently allocated to the database 120 exceeds its actual demand. In this case, the electronic device 110 can perform a second disk space update operation (database shrinking operation) to allocate less disk space to the database 120.

[0106] As another example, in the case of tight disk space, the electronic device 110 will first perform a cleanup operation, including deleting unnecessary log files and reclaiming fragmented space of the data table. This operation can free up disk space, but it is not always sufficient to cope with the increase in storage demand, especially in a high-load system. After the cleanup operation of log files and / or data table space fragments is performed, if the problem of high disk space occupancy rate still cannot be solved (for example, the storage space occupancy rate is still greater than the first occupancy rate threshold and / or the predicted disk space demand indicates that the available time of the remaining disk space of the target disk is less than the time threshold), the electronic device 110 can further perform a first disk space update operation (database expansion operation) to allocate more disk space to the database 120.

[0107] Figure 3F A schematic diagram of a process 300F for performing a disk space update operation on a database according to some embodiments of the present disclosure is shown. The process 300F may be implemented at the electronic device 110 .

[0108] In box 361, the electronic device 110 determines the storage space demand corresponding to the database based on the storage space usage information and demand prediction result corresponding to the database.

[0109] In some embodiments, based on the current database storage space usage, such as data including used disk space, remaining space, disk occupancy rate, and / or based on the predicted results of storage requirements, the electronic device 110 can accurately determine whether it is necessary to adjust the disk space allocated to the database 120 under the current circumstances, and how much storage space needs to be allocated.

[0110] As an example, determining the storage space requirements corresponding to the database 120 may also include determining the current topology of the database and obtaining the number of shards of the database topology architecture. The electronic device 110 may determine the topology of the current database 120, which refers to the structure and composition of the database system, including the configuration and organization of multiple database instances, such as the number and structure of existing database shards, so that consistency can be maintained when updating the corresponding storage space. Database sharding is a data distribution strategy that disperses data into multiple database instances to improve performance and availability. Each instance stores a subset of the data, called a shard.

[0111] As another example, the electronic device 110 may select a suitable database package (i.e., a predefined resource configuration combination, including computing, memory, and storage resources) according to the storage space requirements corresponding to the database. Database packages generally include different configurations to accommodate different load requirements. Selecting a suitable package according to actual conditions can optimize performance and cost.

[0112] At block 362 , the electronic device 110 obtains a pool of available resources.

[0113] The available resource pool refers to the collection of server resources that can currently be used for disk space update operations, including all physical or cloud platform resources that can provide computing, storage, and network resources. The servers in the available resource pool need to have the capabilities that meet the selected database package to ensure that they can support the new database instance.

[0114] In some embodiments, the electronic device 110 determines a server in an allocatable state from the resource pool corresponding to the target disk. A server in an allocatable state is determined from the resource pool corresponding to the target disk. A server in an allocatable state refers to a server that is not occupied or is in a waiting state, and is used to provide corresponding resources for the database when needed.

[0115] In block 363 , the electronic device 110 determines a target server to be allocated to the database from the servers in an allocatable state based on the storage space requirement corresponding to the database.

[0116] As an example, the electronic device 110 can randomly select a server in an allocatable state from the resource pool to ensure that resources are evenly distributed. The selected target server will be marked as a "resource to be used" so that it can be used for subsequent disk space update operations. By randomly allocating servers, the load can be evenly distributed, preventing some servers from being overloaded, and ensuring efficient use of overall system resources and load balancing.

[0117] In some embodiments, the electronic device 110 performs a disk space update operation using a target server.

[0118] In box 364, the electronic device 110 creates a database copy corresponding to the database 120 on the target server and deploys the database.

[0119] As an example, on the target server marked as to be used, the electronic device 110 can perform deployment and recovery operations of the database 120, configure it to the same topology as the database 120, and build a database topology replica set that is the same as the original database 120. This process ensures that the new server can be synchronized with the original database 120 to maintain data consistency.

[0120] In box 365, the electronic device 110 performs a database topology switching operation based on the created database replica, so that the created database replica takes over the data load corresponding to the database as a new topology node.

[0121] In some embodiments, when the new database instance is ready, the electronic device 110 may perform a database topology switching operation to promote the new database copy to a formally available node.

[0122] As an example, the electronic device 110 can promote the newly built replica to a formally available node based on the high-performance database (HDB), thereby completing the database switch. The switching process can be performed online with a response speed of seconds to ensure data integrity and service continuity. The old topology node can be marked as "to be offline" to prepare for subsequent offline and resource recovery operations.

[0123] HDB is a high-availability database solution that not only automatically transfers the failure to other replicas in the same topology when a database failure occurs, but also promotes a replica to the primary node during the regular database switching process, thus ensuring the continuous availability and flexibility of the system.

[0124] In some embodiments, the electronic device 110 performs a resource recovery operation on the topological node corresponding to the database before the database topology switching operation. After confirming that the new topological node is stable and running normally, the old database node will be offline and the server resources will be recovered to the resource pool. These recovered resources can be used for future disk space update operations to further optimize resource utilization efficiency.

[0125] In the disclosed embodiment, through the process of automated resource selection, server allocation, data synchronization and database switching, it is ensured that the system maintains high availability and business continuity while meeting storage requirements. In addition, resource recycling and efficient utilization further enhance the overall resource management capability of the database, enabling the database to flexibly respond to load changes, optimize performance and reduce operation and maintenance costs.

[0126] In some embodiments, when performing disk optimization operations (especially cleanup operations for log files and data table space fragments), the electronic device 110 can monitor the performance of the database 120 and control the execution of the cleanup operations according to changes in performance indicators.

[0127] Figure 3G A schematic diagram of a process 300G for performing database performance monitoring according to some embodiments of the present disclosure is shown. The process 300G may be implemented at the electronic device 110 .

[0128] In box 371, the electronic device 110 uses the first thread to determine the performance indicator data corresponding to the database during the process of performing the cleanup operation for the log file and / or data table space fragments.

[0129] Performance metric data indicates processor and / or memory utilization. Performance metric data provides important information about the current state of the database and helps the system assess the impact of cleanup operations on overall system performance.

[0130] In box 372, if it is determined that the performance indicator data exceeds a predetermined threshold, the electronic device 110 stops executing the cleanup operation for the log file and / or data table space fragments.

[0131] In some embodiments, if the monitored performance indicator data exceeds a preset threshold, the electronic device 110 may stop executing the cleanup operation for log files and data table space fragments to prevent the cleanup operation from further degrading system performance or causing system downtime when resources are tight.

[0132] In box 373, in response to the performance indicator data being lower than a predetermined threshold after the cleaning operation is stopped, the electronic device 110 continues to perform the cleaning operation for the log file and / or data table space fragments.

[0133] After stopping the cleaning operation, the electronic device 110 can continue to monitor the performance indicator data. Once the indicator returns to a normal range (below a preset threshold), the cleaning operation will continue to be performed to ensure that the disk space is freed as much as possible.

[0134] In the disclosed embodiment, by dynamically monitoring performance indicator data, when executing the log file and data table space debris cleaning operation, the operation can be flexibly adjusted according to the current resource utilization of the database. This intelligent decision-making mechanism can not only maintain the stability of database performance, but also optimize the use of resources, improve user experience, reduce the need for manual intervention, and improve the overall management efficiency of the system.

[0135] Figure 4 A block diagram of an apparatus 400 for disk space management according to some embodiments of the present disclosure is shown. The apparatus 400 may be implemented as or included in the electronic device 110.

[0136] The device 400 includes an acquisition module 410, which is configured to acquire storage space usage information corresponding to the database, the storage space usage information at least indicating the storage space occupancy rate of the database in the corresponding target disk; a demand prediction module 420, which is configured to use a trained demand prediction model corresponding to the database to determine the demand prediction result corresponding to the database based on the storage space usage information, the demand prediction result indicating the storage space demand of the database for the target disk; and a disk optimization module 430, which is configured to perform disk optimization operations on the target disk based on the storage space usage information and / or the demand prediction result, the disk optimization operations including cleanup operations for log files and / or data table space fragments in the target disk, and / or disk space update operations for the database.

[0137] In some embodiments, the storage space usage information further indicates at least one of the following: the disk capacity corresponding to the database, the disk occupancy, and the disk data transmission rate.

[0138] In some embodiments, the disk optimization module 430 is further configured to perform a cleanup operation on log files and / or data table space fragments and / or a first disk space update operation on the database in response to determining that the storage space occupancy indicated by the storage space usage information is greater than a first occupancy threshold and / or determining that the remaining storage space of the target disk is less than the storage space requirement indicated by the demand forecasting result, the first disk space update operation indicating the expansion of the storage space allocated for the database.

[0139] In some embodiments, the disk optimization module 430 is further configured to perform a second disk space update operation for the database in response to determining that the space occupancy rate of the target disk indicated by the space usage information is less than a second occupancy rate threshold, and the second disk space update operation indicates a reduction in the storage space allocated for the database.

[0140] In some embodiments, the disk optimization module 430 is further configured to perform cleanup operations on log files: determine the proportion of the storage space of the target disk occupied by log files; in response to determining that the proportion of the space of the target disk occupied by log files is greater than a proportion threshold, perform a cleanup operation on the log files, wherein the cleanup operation on the log files includes: if it is determined that the log file is in an unbacked up state, perform a backup operation on the log file; and in response to determining that the log file is in a backed up state, perform a cleanup operation on the log file based on the file order of the log file.

[0141] In some embodiments, the disk optimization module 430 is further configured to perform a cleanup operation for data table space fragmentation: obtain statistical information of the data table space of the database, the statistical information of the data table space indicates the disk storage space occupancy of the data tables, data pages and corresponding data areas in the database; based on the statistical information of the data table space, determine the space fragmentation rate corresponding to each data table in the database, the space fragmentation rate indicates the ratio of the storage space occupied by the data table to the storage space allocated in the target disk; in response to determining that there is at least one data table in the database with a space fragmentation rate greater than a fragmentation rate threshold, perform a cleanup operation for table space fragmentation, wherein the cleanup operation for table space fragmentation includes: determining whether there is data corresponding to transactions with an execution time greater than a threshold time and / or data corresponding to unexecuted backup operations in at least one data table; and in response to determining that there is no data corresponding to transactions with an execution time greater than a threshold time and data corresponding to unexecuted backup operations in at least one data table, perform a recovery operation on at least one data table based on the order of the space fragmentation rates corresponding to each data table in at least one data table.

[0142] In some embodiments, the disk optimization module 430 is further configured to perform a first disk space update operation in response to a cleanup operation on log files and / or data table space fragments having been performed and determining that the storage space occupancy of the database in the target disk is still greater than a first occupancy threshold and / or the remaining disk space of the target disk is still less than the disk space requirement.

[0143] In some embodiments, the disk optimization module 430 is further configured to perform disk space update operations for the database: determine the storage space demand corresponding to the database based on the storage space usage information and demand prediction results corresponding to the database; determine a server in an allocatable state from the resource pool corresponding to the target disk; determine the target server allocated to the database from the servers in an allocatable state based on the storage space demand corresponding to the database; and perform disk space update operations using the target server.

[0144] In some embodiments, the disk optimization module 430 is further configured to create a database copy corresponding to the database on the target server; based on the created database copy, perform a database topology switching operation so that the created database copy takes over the data load corresponding to the database as a new topology node; and perform a resource recovery operation on the topology node corresponding to the database before the database topology switching operation.

[0145] The modules included in the device 400 can be implemented in various ways, including software, hardware, firmware, or any combination thereof. In some embodiments, one or more units can be implemented using software and / or firmware, such as machine executable instructions stored on a storage medium. In addition to or as an alternative to machine executable instructions, some or all of the units in the device 400 can be implemented at least in part by one or more hardware logic components. As an example and not limitation, exemplary types of hardware logic components that can be used include field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0146] Figure 5 1 shows a block diagram of an electronic device 500 in which one or more embodiments of the present disclosure may be implemented. It should be understood that Figure 5 The electronic device 500 shown is merely exemplary and should not constitute any limitation on the functionality and scope of the embodiments described herein.

[0147] like Figure 5 As shown, the electronic device 500 is in the form of a general electronic device. The components of the electronic device 500 may include, but are not limited to, one or more processors or processing units 510, a memory 520, a storage device 530, one or more communication units 540, one or more input devices 550, and one or more output devices 560. The processing unit 510 may be an actual or virtual processor and is capable of performing various processes according to a program stored in the memory 520. In a multi-processor system, multiple processing units execute computer executable instructions in parallel to improve the parallel processing capability of the electronic device 500.

[0148] The electronic device 500 typically includes a plurality of computer storage media. Such media may be any available media accessible to the electronic device 500, including but not limited to volatile and non-volatile media, removable and non-removable media. The memory 520 may be a volatile memory (e.g., registers, caches, random access memory (RAM)), a non-volatile memory (e.g., a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof. The storage device 530 may be a removable or non-removable medium, and may include a machine-readable medium, such as a flash drive, a disk, or any other medium, which may be capable of being used to store information and / or data and may be accessed within the electronic device 500.

[0149] The electronic device 500 may further include additional removable / non-removable, volatile / non-volatile storage media. Figure 5As shown in , a disk drive for reading or writing from a removable, non-volatile disk (e.g., a "floppy disk") and an optical drive for reading or writing from a removable, non-volatile optical disk may be provided. In these cases, each drive may be connected to the bus (not shown) by one or more data media interfaces. The memory 520 may include a computer program product 525 having one or more program modules that are configured to perform various methods or actions of various embodiments of the present disclosure.

[0150] The communication unit 540 implements communication with other electronic devices through a communication medium. Additionally, the functions of the components of the electronic device 500 can be implemented in a single computing cluster or multiple computing machines that can communicate through a communication connection. Therefore, the electronic device 500 can operate in a networked environment using a logical connection with one or more other servers, a network personal computer (PC), or another network node.

[0151] The input device 550 may be one or more input devices, such as a mouse, a keyboard, a tracking ball, etc. The output device 560 may be one or more output devices, such as a display, a speaker, a printer, etc. The electronic device 500 may also communicate with one or more external devices (not shown) through the communication unit 540 as needed, such as a storage device, a display device, etc., communicate with one or more devices that allow a user to interact with the electronic device 500, or communicate with any device that allows the electronic device 500 to communicate with one or more other electronic devices (e.g., a network card, a modem, etc.). Such communication may be performed via an input / output (I / O) interface (not shown).

[0152] According to an exemplary implementation of the present disclosure, a computer-readable storage medium is provided, on which one or more computer instructions are stored, wherein the one or more computer instructions are executed by a processor to implement the method described above. According to an exemplary implementation of the present disclosure, a computer program product is also provided, which is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions, and the computer-executable instructions are executed by a processor to implement the method described above.

[0153] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products implemented according to the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.

[0154] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0155] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0156] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple implementations of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of a module, program segment or instruction includes one or more executable instructions for realizing the logical function of the specification. In some implementations as replacements, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be realized by a special hardware-based system that performs the function or action of the specification, or can be realized by a combination of special hardware and computer instructions.

[0157] The above descriptions of various implementations of the present disclosure are exemplary, non-exhaustive, and not limited to the disclosed implementations. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described implementations. The selection of terms used herein is intended to best explain the principles of the implementations, practical applications, or improvements to the technology in the marketplace, or to enable other persons of ordinary skill in the art to understand the implementations disclosed herein.

Claims

1. A method for disk space management, comprising: Acquire storage space usage information corresponding to the database, where the storage space usage information at least indicates a storage space occupancy rate of the database in the corresponding target disk; Determining a demand prediction result corresponding to the database based on the storage space usage information by using a trained demand prediction model corresponding to the database, wherein the demand prediction result indicates the storage space demand of the database for the target disk; as well as Based on the storage space usage information and / or the demand forecast result, a disk optimization operation is performed on the target disk, and the disk optimization operation includes a cleanup operation for log files and / or data table space fragments in the target disk, and / or a disk space update operation for the database.

2. The method according to claim 1, wherein the storage space usage information further indicates at least one of the following: the disk capacity, disk occupancy, and disk data transfer rate corresponding to the database.

3. The method according to claim 1, wherein performing a disk optimization operation on the target disk based on the space usage information and / or the demand prediction result comprises: In response to determining that the storage space occupancy indicated by the storage space usage information is greater than a first occupancy threshold and / or determining that the remaining storage space of the target disk is less than the storage space requirement indicated by the demand forecasting result, a cleanup operation for the log file and / or data table space fragments and / or a first disk space update operation for the database is performed, and the first disk space update operation indicates expansion of the storage space allocated for the database.

4. The method according to claim 3, further comprising: In response to determining that the space occupancy rate of the target disk indicated by the space usage information is less than a second occupancy rate threshold, a second disk space update operation for the database is performed, the second disk space update operation indicating reduction of storage space allocated for the database.

5. The method according to claim 1, wherein performing a cleanup operation on the log file comprises: Determine the proportion of the storage space of the target disk occupied by the log file; In response to determining that the proportion of the space occupied by the log file on the target disk is greater than a proportion threshold, performing a cleanup operation on the log file, wherein the cleanup operation on the log file includes: If it is determined that the log file is in a state of not being backed up, performing a backup operation on the log file; as well as In response to determining that the log file is in a backed-up state, a cleanup operation is performed on the log file based on a file sequence of the log file.

6. The method according to claim 1, wherein performing a cleanup operation on the data table space fragments comprises: Obtaining statistical information of a data table space of the database, wherein the statistical information of the data table space indicates disk storage space occupancy of data tables, data pages, and corresponding data areas in the database; Based on the statistical information of the data table space, determining the space fragmentation rate corresponding to each data table in the database, the space fragmentation rate indicating the ratio of the storage space occupied by the data table to the storage space allocated in the target disk; In response to determining that there is at least one data table in the database and that the space fragmentation rate corresponding to the table is greater than the fragmentation rate threshold, a cleanup operation for the table space fragments is performed, wherein the cleanup operation for the table space fragments includes: Determine whether there exists data corresponding to a transaction whose execution time is greater than a threshold time and / or data corresponding to an unexecuted backup operation in the at least one data table; as well as In response to determining that there is no data corresponding to transactions with an execution time greater than a threshold time and no data corresponding to unexecuted backup operations in at least one data table, a recovery operation is performed on the at least one data table based on an order of space fragmentation rates corresponding to the data tables in the at least one data table.

7. The method according to claim 3, wherein performing a first disk space update operation for the database comprises: In response to the cleanup operation for the log file and / or data table space fragments having been executed, it is determined that the storage space occupancy rate of the database in the target disk is still greater than the first occupancy rate threshold and / or the remaining disk space of the target disk is still less than the disk space requirement, and the first disk space update operation is executed.

8. The method according to claim 1, wherein performing the disk space update operation for the database comprises: Determining the storage space demand corresponding to the database based on the storage space usage information corresponding to the database and the demand prediction result; Determine a server in an allocatable state from the resource pool corresponding to the target disk; Based on the storage space requirement corresponding to the database, determining a target server to be allocated to the database from the servers in the allocatable state; as well as The disk space update operation is performed using the target server.

9. The method according to claim 8, wherein performing the disk space update operation based on the target server comprises: Creating a database copy corresponding to the database on the target server; Based on the created database replica, a database topology switching operation is performed so that the created database replica takes over the data load corresponding to the database as a new topology node; and A resource recovery operation is performed on the topology node corresponding to the database before the database topology switching operation.

10. The method according to claim 1, wherein performing corresponding disk optimization operations further comprises: Using the first thread, during the execution of the cleanup operation for the log file and / or data table space fragments, determining performance indicator data corresponding to the database, wherein the performance indicator data indicates utilization of a processor and / or memory; If it is determined that the performance indicator data exceeds a predetermined threshold, stopping the cleanup operation for the log file and / or data table space fragments; as well as In response to the performance indicator data being lower than the predetermined threshold after the cleaning operation is stopped, the cleaning operation for the log file and / or data table space fragments continues to be performed.

11. A device for disk space management, comprising: An acquisition module is configured to acquire storage space usage information corresponding to the database, wherein the storage space usage information at least indicates a storage space occupancy rate of the database in the corresponding target disk; a demand prediction module configured to use a trained demand prediction model corresponding to the database and determine a demand prediction result corresponding to the database based on the storage space usage information, wherein the demand prediction result indicates the storage space demand of the database for the target disk; as well as The disk optimization module is configured to perform disk optimization operations on the target disk based on the storage space usage information and / or the demand prediction results, and the disk optimization operations include cleanup operations for log files and / or data table space fragments in the target disk, and / or disk space update operations for the database.

12. An electronic device comprising: at least one processing unit; as well as At least one memory, the at least one memory being coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions causing the electronic device to perform the method according to any one of claims 1 to 10 when executed by the at least one processing unit.

13. A computer-readable storage medium having a computer program stored thereon, wherein the computer program can be executed by a processor to implement the method according to any one of claims 1 to 10.

14. A computer program product tangibly stored in a computer storage medium and comprising computer executable instructions which, when executed by a device, cause the device to perform the method according to any one of claims 1 to 10.

Citation Information

Cited By

  • Method, device, equipment and product for determining data storage condition in database

    CN120011195A

  • Self-adaptive storage capacity adjusting method and system for industrial-grade solid state disk

    CN120596037A

  • Storage space management method and device, electronic equipment and computer program product

    CN120994134A