Recycling Bin Management Method, Data Space Flashback Method, Device, Equipment and Medium

By setting up the management mechanism of the database recycling bin and the shared cluster file system recycling bin in the shared cluster environment, the table space deletion and flashback recovery are coordinated, which solves the time-consuming and complex problems in traditional methods and achieves efficient online recovery.

CN119668515BActive Publication Date: 2025-07-25SHENZHEN INST OF COMPUTING SCI
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411812314.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2025-07-25
Estimated Expiration
2044-12-10

AI Technical Summary

Technical Problem

When traditional methods accidentally delete table space in the database, the recovery process takes a long time and is complex, relying on backup and log integrity, and it cannot be restored without any of them.

Method used

In a shared cluster environment, through the management mechanism of the database recycling bin and the shared cluster file system recycling bin, the table space is deleted and flashback recovery is achieved, and data files and objects are directly restored from the recycling bin, clearing marks, and avoiding stopping cluster services and playback logs.

Benefits of technology

Improves the table space recovery efficiency, simplifies operations, and realizes online recovery to the moment before deletion, without the need for backup and log dependencies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119668515B_ABST
    Figure CN119668515B_ABST
Patent Text Reader

Abstract

This application is applicable to the field of shared cluster technology, and particularly relates to a method for managing a recycle bin, a method for data space flashback, a device, equipment, and a medium. When performing a deletion operation on a tablespace, move the database objects belonging to the tablespace into the database recycle bin. When marking the metadata of the data files included in the tablespace for deletion, move the data files into the shared cluster file system recycle bin and mark the metadata of the tablespace for deletion. When performing a flashback on a tablespace, if the data files to be flashbacked corresponding to the tablespace to be flashbacked have not been cleared, recover the data files to be flashbacked from the shared cluster file system recycle bin, clear the deletion mark for the metadata of the data files to be flashbacked, recover the database objects to be flashbacked corresponding to the tablespace to be flashbacked from the database recycle bin, and clear the deletion mark for the metadata of the tablespace to be flashbacked. Through the database recycle bin management mechanism and the shared cluster file system recycle bin management mechanism, the recovery efficiency of the tablespace is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application is applicable to the field of shared cluster technology, and particularly relates to a method for managing a recycle bin, a method for flashback of data space, a device, a device and a medium. Background Art

[0002] In a database management system, if a tablespace is accidentally deleted, it may directly result in the permanent loss of critical data, thereby causing immeasurable losses to users and businesses. Traditional methods for recovering a deleted tablespace mainly rely on full database backups, archived logs, and online logs to restore the database or tablespace to a certain point in time before deletion. However, this method usually takes a long time, has a high complexity, and also depends on the integrity and availability of the backups and logs. If any one of them is missing, the recovery operation may not be possible. Therefore, how to set the management method of the recycle bin to meet the flashback operation of the deleted tablespace has become an urgent problem to be solved. Summary of the Invention

[0003] In view of this, the embodiments of the present application provide a method for managing a recycle bin, a method for flashback of data space, a device, a device and a medium to solve the problem of how to set the management method of the recycle bin to meet the flashback operation of the deleted tablespace.

[0004] In a first aspect, the embodiments of the present application provide a method for managing a recycle bin of a shared cluster, and the method for managing the recycle bin includes:

[0005] When performing a delete operation on a tablespace in a shared storage, determine the database objects belonging to the tablespace and move the database objects into the database recycle bin;

[0006] Determine the data files included in the tablespace, and when making a deletion mark on the metadata of the data files in the database control file, move the data files into the recycle bin of the shared cluster file system;

[0007] Make a deletion mark on the metadata of the tablespace in the database control file.

[0008] In a second aspect, the embodiments of the present application provide a method for flashback of data space in a shared cluster, and the method for flashback of data space includes:

[0009] Determine the cleaning status of the data files to be flashbacked corresponding to the tablespace to be flashbacked from the recycle bin of the shared cluster file system in the method for managing the recycle bin of the shared cluster in the first aspect above;

[0010] If the cleaning status is not cleaned, recover the data file to be flashbacked from the recycle bin of the shared cluster file system, and in the database control file, clear the deletion mark for the meta-information of the data file to be flashbacked;

[0011] Recover the database object to be flashbacked corresponding to the tablespace to be flashbacked from the database recycle bin;

[0012] In the database control file, clear the deletion mark for the meta-information of the tablespace to be flashbacked.

[0013] Thirdly, an embodiment of the present application provides a recycle bin management for a shared cluster. The recycle bin management device includes:

[0014] A first recycling module, configured to determine database objects belonging to the tablespace when a deletion operation is performed on the tablespace in the shared storage, and move the database objects into the database recycle bin;

[0015] A second recycling module, configured to determine the data files included in the tablespace, and move the data files into the recycle bin of the shared cluster file system when a deletion mark is made for the meta-information of the data files in the database control file;

[0016] A third recycling module, configured to make a deletion mark for the meta-information of the tablespace in the database control file.

[0017] Fourthly, an embodiment of the present application provides a data space flashback device for a shared cluster. The data space flashback device includes:

[0018] A first determination module, configured to determine the cleaning status of the data file to be flashbacked corresponding to the tablespace to be flashbacked in the recycle bin of the shared cluster file system in the recycle bin management method of the shared cluster in the first aspect above;

[0019] A first flashback module, configured to if the cleaning status is not cleaned, recover the data file to be flashbacked from the recycle bin of the shared cluster file system, and in the database control file, clear the deletion mark for the meta-information of the data file to be flashbacked;

[0020] A second flashback module, configured to recover the database object to be flashbacked corresponding to the tablespace to be flashbacked from the database recycle bin;

[0021] A third flashback module, configured to clear the deletion mark for the meta-information of the tablespace to be flashbacked in the database control file.

[0022] In a fifth aspect, an embodiment of the present application provides a computer device, which includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the recycle bin management method for a shared cluster as described in the first aspect, or the data space flashback method for a shared cluster as described in the second aspect.

[0023] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the recycle bin management method for a shared cluster as described in the first aspect, or the data space flashback method for a shared cluster as described in the second aspect.

[0024] The beneficial effects of the embodiments of the present application compared with the prior art are as follows: When performing a deletion operation on a tablespace in a shared storage, the database objects belonging to the tablespace are determined and moved into the database recycle bin. The data files included in the tablespace are determined. When deleting the metadata of the data files in the database control file, the data files are moved into the recycle bin of the shared cluster file system, and the metadata of the tablespace in the database control file is marked for deletion. Correspondingly, when flashing back the tablespace, the cleaning status of the data files to be flashed back corresponding to the tablespace to be flashed back is determined from the recycle bin of the shared cluster file system. If not cleaned, the data files to be flashed back are restored from the recycle bin of the shared cluster file system, and in the database control file, the deletion mark for the metadata of the data files to be flashed back is cleared. The database objects to be flashed back corresponding to the tablespace to be flashed back are restored from the database recycle bin, and in the database control file, the deletion mark for the metadata of the tablespace to be flashed back is cleared.

[0025] Among them, in a shared cluster environment, by setting corresponding database recycle bin management mechanisms and shared cluster file system recycle bin management mechanisms, the two are linked to achieve the deletion and flashback recovery of the tablespace. Compared with the traditional method of recovery based on backup and logs, when flashing back and recovering the tablespace undergoing a deletion operation, the present application does not require stopping the cluster service or replaying the logs. Only based on the database recycle bin management mechanism and the shared cluster file system recycle bin management mechanism, the content of the tablespace can be restored to the moment before deletion online, with simple operations and improved recovery efficiency of the tablespace. Brief Description of the Drawings

[0026] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the accompanying drawings required for use in the embodiments or the description of the prior art. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other accompanying drawings can be obtained based on these drawings without creative efforts.

[0027] Figure 1 It is a schematic structural diagram of a recycle bin of a shared cluster provided in Embodiment 1 of the present application;;

[0028] Figure 2 It is a schematic flowchart of a recycle bin management method of a shared cluster provided in Embodiment 2 of the present application;

[0029] Figure 3 It is a schematic flowchart of a recycle bin management method of a shared cluster provided in Embodiment 3 of the present application;

[0030] Figure 4 It is a schematic flowchart of a recycle bin management method of a shared cluster provided in Embodiment 4 of the present application;

[0031] Figure 5 It is a schematic flowchart of a data space flashback method of a shared cluster provided in Embodiment 5 of the present application;

[0032] Figure 6 It is a schematic structural diagram of a recycle bin management device of a shared cluster provided in Embodiment 6 of the present application;

[0033] Figure 7 It is a schematic structural diagram of a data space flashback device of a shared cluster provided in Embodiment 7 of the present application;

[0034] Figure 8 It is a schematic structural diagram of a computer device provided in Embodiment 8 of the present application. Detailed Description of the Invention

[0035] In the following description, specific details such as specific system structures and technologies are proposed for the purpose of illustration rather than limitation, so as to thoroughly understand the embodiments of the present application. However, those skilled in the art should clearly understand that the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid unnecessary details from interfering with the description of the present application.

[0036] It should be understood that, as used in the specification of this application and the appended claims, the term "comprising" indicates the presence of the described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or their groups.

[0037] It should also be understood that the term "and / or" as used in the specification of this application and the appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0038] As used in the specification of this application and the appended claims, the term "if" may be interpreted, depending on the context, as "when", "once", "in response to determining", or "in response to detecting". Similarly, the phrases "if determined" or "if [the described condition or event] is detected" may be interpreted, depending on the context, as meaning "once determined", "in response to determining", "once [the described condition or event] is detected", or "in response to detecting [the described condition or event]".

[0039] In addition, in the description of the specification of this application and the appended claims, the terms "first", "second", "third", etc. are used only for distinguishing descriptions and should not be construed as indicating or implying relative importance.

[0040] The reference to "one embodiment" or "some embodiments" etc. described in the specification of this application means that a specific feature, structure or characteristic described in connection with that embodiment is included in one or more embodiments of this application. Thus, statements such as "in one embodiment", "in some embodiments", "in other some embodiments", "in still other embodiments", etc. that appear in different places in this specification do not necessarily all refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "comprising", "including", "having" and their variants all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0041] It should be understood that the magnitudes of the sequence numbers of the steps in the following embodiments do not mean the order of execution is prior or subsequent, and the order of execution of each process should be determined according to its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of this application.

[0042] In order to illustrate the technical solutions of this application, the following specific embodiments are used for illustration.

[0043] See Figure 1, which is a schematic diagram of the recycle bin structure of a shared cluster provided in the first embodiment of this application. In a shared cluster environment, a database recycle bin for storing deleted database objects is set on the database side, and a shared cluster file system recycle bin for storing deleted data files and deleted tablespaces is set in the shared cluster file system.

[0044] The overall process of deleting a tablespace at the client and performing flashback recovery on the deleted tablespace can be as follows:

[0045] 1) When deleting a tablespace, determine the database objects belonging to the tablespace. If the tablespace contains database objects, move the database objects corresponding to the tablespace to the database recycle bin; 2) If a delete operation needs to be performed on the data files included in the tablespace, determine the data files included in the tablespace. When marking the deletion of the metadata of the data files in the database control file, deposit the data files included in the tablespace into the shared cluster file system recycle bin through the interface of the shared cluster file system; 3) Mark the deletion of the metadata of the tablespace in the database control file.

[0046] 4) When performing flashback recovery on the deleted tablespace, determine the cleanup status of the data files to be flashbacked corresponding to the tablespace to be flashbacked from the shared cluster file system recycle bin; 5) If it has not been cleaned up, recover the data files to be flashbacked from the shared cluster file system recycle bin through the interface of the shared cluster file system, and in the database control file, clear the deletion mark of the metadata of the data files to be flashbacked; 6) If the tablespace to be flashbacked contains database objects to be flashbacked, recover the database objects to be flashbacked corresponding to the tablespace to be flashbacked from the database recycle bin; 7) In the database control file, clear the deletion mark of the metadata of the tablespace to be flashbacked.

[0047] Optionally, the recycle bin management method is also provided with a general recovery mechanism. When it is detected that the residence time of the deleted data file in the shared cluster file system recycle bin exceeds the preset time threshold, the general recovery mechanism of the recycle bin is triggered.

[0048] Optionally, the recycle bin management method is also provided with a forced recovery mechanism. When it is detected that the used storage capacity of the shared storage exceeds the preset first storage threshold, or it is detected that the used memory capacity of the shared cluster exceeds the preset second storage threshold, the forced recovery mechanism of the recycle bin is triggered.

[0049] See Figure 2 , which is a schematic flowchart of a recycle bin management method for a shared cluster provided in the second embodiment of this application. As Figure 2 shown, it may include the following steps:

[0050] Step S201, when performing a deletion operation on a tablespace in the shared storage, determine the database objects belonging to the tablespace and move the database objects into the database recycle bin.

[0051] Step S202, determine the data files included in the tablespace. When making a deletion mark on the metadata of the data files in the database control file, move the data files into the shared cluster file system recycle bin.

[0052] Step S203, make a deletion mark on the metadata of the tablespace in the database control file.

[0053] In the embodiment of the present application, the shared cluster may refer to a database cluster system that allows multiple database nodes to access and operate on the same storage medium. The shared storage may refer to a physical storage device (such as a disk), which allows multiple database nodes in the shared cluster to access and operate on the data in the shared storage. In a shared cluster environment, the data is stored in the shared storage, and the database management system can start database instances on multiple database nodes respectively. The database instances access the data in the shared storage through the shared cluster file system.

[0054] A tablespace is a logical structure unit in a database for storing data. It uniformly manages the data files in the space and provides a logical storage location for database objects (such as tables, indexes, etc.). A database object is various named entities and structures (such as tables, indexes, etc.) in a database for storing and managing data. Among them, the database object can be empty. When the database object is empty, it means that only the tablespace is created, and no tables or indexes are created on this tablespace. A data file is the basis of the database storage structure and exists in the form of an actual file in the file system. Each tablespace includes at least one data file, and the data file contains the data of database objects such as tables and indexes.

[0055] Metadata is information about information, recording additional descriptions or attribute characteristics of data or objects. In the embodiment of the present application, the metadata may be data describing characteristics such as the size and path of data files and tablespaces. The database control file is a physical file of the database, recording the metadata of data such as tablespaces and data files. The deletion mark is used to mark the tablespace and data file as in an un-overwritable or unavailable state. The database recycle bin may refer to a data structure set on the database side for storing deleted database objects. The shared cluster file system recycle bin may refer to an area set in the shared cluster file system or the shared storage for storing deleted data files and deleted tablespaces.

[0056] Specifically, when performing a deletion operation on a tablespace in the shared storage, first, it is determined whether the tablespace contains database objects. If the tablespace contains database objects, then database objects such as tables and indexes belonging to the tablespace can be determined from the data dictionary corresponding to the tablespace, and the database objects are moved into the database recycle bin. Then, if a deletion operation needs to be performed on the data files contained in the tablespace, the data files contained in the tablespace are determined. In the database control file, a deletion mark is made for the meta-information of the data files contained in the tablespace, and the interface of the shared cluster file system is called to store the data files in the shared cluster file system recycle bin. Finally, a deletion mark is made for the meta-information of the tablespace in the database control file to mark the tablespace as in a non-overwriteable or unavailable state.

[0057] Correspondingly, when performing a deletion operation on a tablespace, if the tablespace does not contain database objects, that is, the tablespace is empty, then the data files contained in the tablespace are directly determined. If a deletion operation needs to be performed on the data files contained in the tablespace, the data files contained in the tablespace are determined. In the database control file, a deletion mark is made for the meta-information of the data files contained in the tablespace, and the interface of the shared cluster file system is called to store the data files in the shared cluster file system recycle bin. A deletion mark is made for the meta-information of the tablespace in the database control file to mark the tablespace as in a non-overwriteable or unavailable state.

[0058] Optionally, in a non-shared cluster environment, a tablespace recycle bin management mechanism can also be adopted. The difference is that in a non-shared cluster environment, the data files contained in the tablespace are stored on the local disk, and only the database recycle bin needs to be set. When performing a deletion operation, first, the database objects belonging to the tablespace are moved into the database recycle bin. Then, in the database control file, a deletion mark is made for the meta-information of the data files contained in the tablespace, and the data files are also moved into the database recycle bin. Finally, a deletion mark is made for the meta-information of the tablespace in the database control file. Correspondingly, when performing a flashback recovery on the tablespace being deleted, first, the cleanup status of the data files to be flashbacked corresponding to the tablespace to be flashbacked is determined from the database recycle bin. If they have not been cleaned up, the data files to be flashbacked are recovered from the database recycle bin, and in the database control file, the deletion mark for the meta-information of the data files to be flashbacked is cleared. Then, the database objects to be flashbacked corresponding to the tablespace to be flashbacked are recovered from the database recycle bin. Finally, in the database control file, the deletion mark for the meta-information of the tablespace to be flashbacked is cleared.

[0059] In the embodiment of the present application, in a shared cluster environment, by setting a corresponding database recycle bin management mechanism and a shared cluster file system recycle bin management mechanism, the two are linked to achieve the deletion and flashback recovery of the tablespace. Compared with the traditional method of recovery based on backup and log, when the present application performs flashback recovery on the tablespace where the deletion operation is performed, there is no need to stop the cluster service and no need to replay the log. Only based on the database recycle bin management mechanism and the shared cluster file system recycle bin management mechanism, the content of the tablespace can be restored to the moment before deletion online, with simple operation and improved recovery efficiency of the tablespace.

[0060] See Figure 3 , which is a schematic flowchart of a recycle bin management method for a shared cluster provided in Embodiment 3 of the present application. As Figure 3 shown, the recycle bin management method may further include the following steps:

[0061] Step S301, obtain the residence time of each deleted data file in the shared cluster file system recycle bin. For any deleted data file, detect whether the residence time of the deleted data file exceeds a preset time threshold.

[0062] Step S302, if it is detected that the residence time of the deleted data file exceeds the preset time threshold, determine the deleted tablespace to which the deleted data file belongs.

[0063] Step S303, clean up all the deleted data files included in the deleted tablespace from the shared cluster file system recycle bin, and in the database control file, clear the meta-information of all the deleted data files included in the deleted tablespace.

[0064] Step S304, determine all the deleted database objects belonging to the deleted tablespace from the database recycle bin, and clean up all the deleted database objects belonging to the tablespace from the database recycle bin.

[0065] Step S305, in the database control file, clear the meta-information of the deleted tablespace.

[0066] In the embodiments of the present application, a deleted tablespace may refer to a tablespace in which database objects or data files included are moved to the recycle bin through a deletion operation and marked for deletion. A deleted data file may refer to a data file moved to the recycle bin of the shared cluster file system through the deletion operation of the deleted tablespace. A deleted database object may refer to a database object moved to the database recycle bin through the deletion operation of the deleted tablespace. The residence time may refer to the time period elapsed from the moment when the data file is moved to the recycle bin of the shared cluster file system by the deletion operation to the current moment. The preset time threshold may refer to the time preset to trigger the shared cluster file system recycle bin to recycle the deleted data file.

[0067] Specifically, a timing thread can be used to regularly obtain the residence time of each deleted data file in the recycle bin of the shared cluster file system. For any deleted data file, it is detected whether the residence time of the deleted data file exceeds the preset time threshold. If it exceeds, the general recycle mechanism of the recycle bin is triggered to release the storage space, memory resources, and resources occupied by the marked self-lock of the shared cluster, etc. That is, first, determine the deleted tablespace to which the deleted data file belongs, call the shared cluster file system interface, clear all the deleted data files included in the deleted tablespace from the recycle bin of the shared cluster file system, and in the database control file, clear the meta-information of all the deleted data files included in the deleted tablespace. Then, determine all the deleted database objects belonging to the deleted tablespace from the database recycle bin, and clear all the deleted database objects belonging to the tablespace from the database recycle bin. Finally, in the database control file, clear the meta-information of the deleted tablespace.

[0068] In the embodiments of the present application, when it is detected that the residence time of the deleted data file in the recycle bin of the shared cluster file system exceeds the preset time threshold, the general recycle mechanism of the recycle bin is triggered to automatically clear the tablespaces that meet the general recycle mechanism, so as to release the storage space, memory resources, and resources occupied by the marked self-lock of the shared cluster, etc., for other data to use, reducing the resource consumption of the recycle bin for maintaining the deleted tablespace and improving the overall performance of the cluster system.

[0069] See Figure 4 , which is a schematic flowchart of a method for managing the recycle bin of a shared cluster provided in Embodiment 4 of the present application. As Figure 4 shown, the method for managing the recycle bin may further include the following steps:

[0070] Step S401, obtain the used storage amount of the shared storage and the used memory amount of the shared cluster.

[0071] Step S402, detect whether the used storage exceeds a preset first storage threshold, and detect whether the used memory exceeds a preset second storage threshold.

[0072] Step S403, if it is detected that the used storage exceeds the preset first storage threshold, or it is detected that the used memory exceeds the preset second storage threshold, then execute the step of obtaining the residence time of each deleted data file in the recycle bin of the shared cluster file system, to obtain the updated used storage of the shared storage and the updated used memory of the shared cluster.

[0073] Step S404, detect whether the updated used storage exceeds the preset first storage threshold, and detect whether the updated used memory exceeds the preset second storage threshold.

[0074] Step S405, if it is detected that the updated used storage exceeds the preset first storage threshold, or it is detected that the updated used memory exceeds the preset second storage threshold, then perform a cleanup operation on the deleted data files in the recycle bin of the shared cluster file system and the deleted database objects in the database recycle bin, until the updated used storage of the shared storage does not exceed the preset first storage threshold, and the updated used memory of the shared cluster does not exceed the preset second storage threshold.

[0075] In the embodiments of the present application, the used storage may refer to the storage capacity that has been used in the shared storage, the used memory may refer to the memory capacity that has been used by all database nodes in the shared cluster, the preset first storage threshold may refer to the used storage capacity of the shared storage that triggers the recycle bin of the shared cluster file system to recycle the deleted data files, and the preset second storage threshold may refer to the used storage capacity of the cluster memory that triggers the recycle bin of the shared cluster file system to recycle the deleted data files.

[0076] Specifically, a timing thread can be used to regularly obtain the used storage amount of the shared storage and the used memory amount of the shared cluster, detect whether the used storage amount exceeds a preset first storage threshold, and detect whether the used memory amount exceeds a preset second storage threshold. If it is detected that the used storage amount exceeds the preset first storage threshold, or it is detected that the used memory amount exceeds the preset second storage threshold, the forced recovery mechanism of the recycle bin is triggered to release the storage space, memory resources, and the resources occupied by the marked self-lock of the shared cluster. That is, first, according to the content in steps S301 to S305 above, the deleted tablespaces that trigger the general recovery mechanism in the recycle bin are recycled to release the storage space, memory resources, and the resources occupied by the marked self-lock of the shared cluster, obtaining the updated used storage amount of the shared storage and the updated used memory amount of the shared cluster. Then, it is detected whether the updated used storage amount exceeds the preset first storage threshold, and it is detected whether the updated used memory amount exceeds the preset second storage threshold. Finally, if it is detected that the updated used storage amount exceeds the preset first storage threshold, or it is detected that the updated used memory amount exceeds the preset second storage threshold, the deleted tablespaces in the recycle bin are recycled without discrimination to further release the storage and memory resources until the updated used storage amount of the shared storage does not exceed the preset first storage threshold and the updated used memory amount of the shared cluster does not exceed the preset second storage threshold.

[0077] In the embodiment of the present application, when it is detected that the used storage amount of the shared storage or the used memory amount of the shared cluster exceeds the preset storage threshold, the forced recovery mechanism of the recycle bin is triggered, so that when the used storage amount or the used memory amount exceeds the threshold, the system can quickly identify and trigger forced cleaning, ensuring that resources are released in a timely manner, avoiding performance degradation of the system due to insufficient resources, and improving the overall performance of the cluster system.

[0078] See Figure 5 , which is a schematic flowchart of a method for flashback of a data space of a shared cluster provided in Embodiment 5 of the present application. As Figure 5 shown, the following steps may be included:

[0079] Step S501: Determine the cleaning status of the data file to be flashbacked corresponding to the tablespace to be flashbacked from the recycle bin of the shared cluster file system in the recycle bin management method of the shared cluster.

[0080] Step S502: If the cleaning status is uncleaned, recover the data file to be flashbacked from the recycle bin of the shared cluster file system, and in the database control file, clear the deletion mark of the meta-information of the data file to be flashbacked.

[0081] Step S503: Recover the database object to be flashbacked corresponding to the tablespace to be flashbacked from the database recycle bin.

[0082] Step S504: In the database control file, clear the deletion flag for the metadata of the tablespace to be flashbacked.

[0083] In the embodiments of the present application, the tablespace to be flashbacked may refer to the tablespace to be flashbacked and restored from the recycle bin of the shared cluster file system. The data file to be flashbacked may refer to the data file corresponding to the tablespace to be flashbacked. The database object to be flashbacked may refer to the database object corresponding to the tablespace to be flashbacked. The cleanup status may refer to the status of the data file to be flashbacked in the recycle bin of the shared cluster file system, which may include an uncleaned status and a cleaned status. Among them, the uncleaned status indicates that the data file to be flashbacked has not been cleaned by the recycle bin, and the cleaned status indicates that the data file to be flashbacked has been cleaned by the recycle bin.

[0084] Specifically, when flashbacking and restoring a tablespace for which a delete operation has been performed, first, according to the name of the data file to be flashbacked corresponding to the tablespace to be flashbacked, query the recycle bin of the shared cluster file system to determine whether the data file to be flashbacked has been cleaned by the recycle bin of the shared cluster file system. If it has not been cleaned, call the interface of the shared cluster file system to restore the data file to be flashbacked from the recycle bin of the shared cluster file system, and in the database control file, clear the deletion flag for the metadata of the data file to be flashbacked. Then, if the tablespace to be flashbacked contains a database object to be flashbacked, restore the database object to be flashbacked corresponding to the tablespace to be flashbacked from the database recycle bin. Finally, in the database control file, clear the deletion flag for the metadata of the tablespace to be flashbacked.

[0085] In the embodiments of the present application, in a shared cluster environment, by setting corresponding database recycle bin management mechanisms and shared cluster file system recycle bin management mechanisms, the two are linked to achieve the deletion and flashback recovery of the tablespace. Compared with the traditional method of recovery based on backup and log, when flashbacking and restoring a tablespace for which a delete operation has been performed in the present application, there is no need to stop the cluster service or replay the log. It is only necessary to restore the tablespace content to the moment before deletion online based on the database recycle bin management mechanism and the shared cluster file system recycle bin management mechanism. The operation is simple and the recovery efficiency of the tablespace is improved.

[0086] Corresponding to the recycle bin management method of the shared cluster in the above embodiments, Figure 6 The block diagram of the recycle bin management device of the shared cluster provided in Embodiment VI of the present application is shown. For the sake of convenience of description, only the parts related to the embodiments of the present application are shown.

[0087] See Figure 6 , the recycle bin management device includes:

[0088] The first recycling module 61 is used to determine database objects belonging to the tablespace when performing a deletion operation on the tablespace in the shared storage, and move the database objects into the database recycle bin;

[0089] The second recycling module 62 is used to determine the data files included in the tablespace, and move the data files into the shared cluster file system recycle bin when making a deletion mark on the meta-information of the data files in the database control file;

[0090] The third recycling module 63 is used to make a deletion mark on the meta-information of the tablespace in the database control file.

[0091] Optionally, the recycle bin management device further includes:

[0092] The second determination module is used to directly determine the data files included in the tablespace when performing a deletion operation on the tablespace if the tablespace does not include database objects;

[0093] The fourth recycling module is used to move the data files into the shared cluster file system recycle bin when making a deletion mark on the meta-information of the data files in the database control file;

[0094] The fifth recycling module is used to make a deletion mark on the tablespace in the database control file.

[0095] Optionally, the recycle bin management device further includes:

[0096] The time detection module is used to obtain the residence time of each deleted data file in the shared cluster file system recycle bin, and for any deleted data file, detect whether the residence time of the deleted data file exceeds a preset time threshold;

[0097] The third determination module is used to determine the deleted tablespace to which the deleted data file belongs if it is detected that the residence time of the deleted data file exceeds the preset time threshold;

[0098] The first cleaning module is used to clean all the deleted data files included in the deleted tablespace from the shared cluster file system recycle bin, and in the database control file, clear the meta-information of all the deleted data files included in the deleted tablespace;

[0099] The second cleaning module is used to determine all the deleted database objects belonging to the deleted tablespace from the database recycle bin, and clean all the deleted database objects belonging to the tablespace from the database recycle bin;

[0100] A third cleaning module, configured to clear the meta-information of the deleted tablespace in the database control file.

[0101] Optionally, the recycle bin management device further includes:

[0102] An acquisition module, configured to acquire the used storage capacity of the shared storage and the used memory capacity of the shared cluster;

[0103] A first capacity detection module, configured to detect whether the used storage capacity exceeds a preset first storage threshold, and detect whether the used memory capacity exceeds a preset second storage threshold;

[0104] A fourth cleaning module, configured to, if it is detected that the used storage capacity exceeds the preset first storage threshold, or it is detected that the used memory capacity exceeds the preset second storage threshold, then execute the step of obtaining the residence time of each deleted data file in the recycle bin of the shared cluster file system, to obtain the updated used storage capacity of the shared storage and the updated used memory capacity of the shared cluster;

[0105] A second capacity detection module, configured to detect whether the updated used storage capacity exceeds the preset first storage threshold, and detect whether the updated used memory capacity exceeds the preset second storage threshold;

[0106] A fifth cleaning module, configured to, if it is detected that the updated used storage capacity exceeds the preset first storage threshold, or it is detected that the updated used memory capacity exceeds the preset second storage threshold, then perform a cleaning operation on the deleted data files in the recycle bin of the shared cluster file system and the deleted database objects in the database recycle bin, until the updated used storage capacity of the shared storage does not exceed the preset first storage threshold, and the updated used memory capacity of the shared cluster does not exceed the preset second storage threshold.

[0107] It should be noted that, for the information interaction, execution process, etc. between the above modules, since they are based on the same concept as the method embodiment of the present application, for their specific functions and the technical effects brought, reference can be specifically made to the method embodiment part, and details are not described herein again.

[0108] Corresponding to the data space flashback method of the shared cluster in the above embodiment, Figure 7 FIG. shows the structural block diagram of the data space flashback device for the shared cluster provided in Embodiment 7 of the present application. For the sake of convenience of description, only the parts related to the embodiment of the present application are shown.

[0109] See Figure 7 , the data space flashback device includes:

[0110] The first determination module 71 is configured to determine the cleaning status of the data files to be flashbacked corresponding to the tablespaces to be flashbacked from the shared cluster file system recycle bin of the shared cluster recycle bin management method;

[0111] The first flashback module 72 is configured to, if the cleaning status is not cleaned, recover the data files to be flashbacked from the shared cluster file system recycle bin, and in the database control file, clear the deletion mark of the meta-information of the data files to be flashbacked;

[0112] The second flashback module 73 is configured to recover the database objects to be flashbacked corresponding to the tablespaces to be flashbacked from the database recycle bin;

[0113] The third flashback module 74 is configured to, in the database control file, clear the deletion mark of the meta-information of the tablespaces to be flashbacked.

[0114] Optionally, the data space flashback device further includes:

[0115] The fourth flashback module is configured to, if the tablespaces to be flashbacked do not include database objects to be flashbacked, directly in the database control file, clear the deletion marks of the meta-information of the tablespaces to be flashbacked and the data files to be flashbacked corresponding to the tablespaces to be flashbacked.

[0116] It should be noted that for the information interaction, execution process, etc. between the above modules, since they are based on the same concept as the method embodiments of the present application, their specific functions and the technical effects brought about can be specifically referred to in the method embodiment part, and will not be elaborated here.

[0117] Figure 8 It is a schematic structural diagram of a computer device provided in Embodiment 8 of the present application. As Figure 8 shown, the computer device of this embodiment includes: at least one processor ( Figure 8 only one is shown in the figure), a memory, and a computer program stored in the memory and executable on at least one processor. When the processor executes the computer program, it implements the steps in any of the above method embodiments of the shared cluster recycle bin management method, or implements the steps in any of the above method embodiments of the data space flashback method of the shared cluster.

[0118] The computer device may include, but is not limited to, a processor and a memory. Those skilled in the art can understand that Figure 8 this is only an example of a computer device and does not constitute a limitation on the computer device. The computer device may include more or fewer components than shown in the figure, or combine certain components, or different components. For example, it may further include a network interface, a display screen, and an input device, etc.

[0119] The so-called processor may be a CPU, and the processor may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0120] The memory includes a readable storage medium, internal memory, etc. Among them, the internal memory may be the memory of a computer device, and the internal memory provides an environment for the operation of the operating system and computer-readable instructions in the readable storage medium. The readable storage medium may be the hard disk of a computer device, and in some other embodiments, it may also be an external storage device of a computer device. For example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device. Further, the memory may also include both the internal storage unit of the computer device and the external storage device. The memory is used to store an operating system, application programs, a boot loader, data, and other programs, such as the program code of a computer program. The memory may also be used to temporarily store data that has been output or will be output.

[0121] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above-mentioned division of each functional unit and module is used as an example. In actual applications, the above-mentioned functions can be allocated to different functional units and modules according to needs, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiments can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit. In addition, the specific names of each functional unit and module are only for the convenience of mutual distinction and do not limit the protection scope of this application. The specific working processes of the units and modules in the above-mentioned device can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated here. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, to implement all or part of the processes in the above-mentioned method embodiments of this application, a computer program can be used to instruct the relevant hardware to complete. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file or some intermediate form, etc. The computer-readable medium can at least include: any entity or device that can carry the computer program code, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disc, etc. In some jurisdictions, according to legislation and patent practice, the computer-readable medium cannot be an electrical carrier signal and a telecommunication signal.

[0122] All or part of the processes in the above-mentioned method embodiments of this application can also be completed by a computer program product. When the computer program product runs on a computer device, it enables the computer device to execute and implement the steps in the above-mentioned method embodiments.

[0123] In the above embodiments, the descriptions of each embodiment have their own emphases. For the parts not detailed or recorded in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0124] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

[0125] In the embodiments provided in this application, it should be understood that the disclosed device / computer equipment and method can be implemented in other ways. For example, the device / computer equipment embodiments described above are only illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection between each other can be through some interfaces, and the indirect coupling or communication connection of the device or unit can be in an electrical, mechanical or other form.

[0126] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they can be located in one place, or can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0127] The above embodiments are only used to illustrate the technical solutions of this application, rather than to limit it; although this application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of each embodiment of this application, and should all be included in the protection scope of this application.

Claims

1. A method for managing a recycle bin of a shared cluster, characterized in that, The described recycle bin management method includes: When performing a deletion operation on a tablespace in the shared storage, determining the database objects belonging to the tablespace and moving the database objects into the database recycle bin; Determining the data files included in the tablespace, and when marking the metadata of the data files in the database control file for deletion, moving the data files into the shared cluster file system recycle bin; Marking the metadata of the tablespace for deletion in the database control file.

2. The method for managing the recycle bin of a shared cluster according to claim 1, wherein, The described recycle bin management method further includes: When performing a deletion operation on the tablespace, if the tablespace does not contain database objects, directly determining the data files included in the tablespace; When marking the metadata of the data files in the database control file for deletion, moving the data files into the shared cluster file system recycle bin; Marking the tablespace for deletion in the database control file.

3. The recycle bin management method of the shared cluster according to claim 1, characterized in that The described recycle bin management method further includes: Obtaining the residence time of each deleted data file in the shared cluster file system recycle bin, and for any deleted data file, detecting whether the residence time of the deleted data file exceeds a preset time threshold; If it is detected that the residence time of the deleted data file exceeds the preset time threshold, determining the deleted tablespace to which the deleted data file belongs; Clearing all the deleted data files included in the deleted tablespace from the shared cluster file system recycle bin, and in the database control file, clearing the metadata of all the deleted data files included in the deleted tablespace; Determining all the deleted database objects belonging to the deleted tablespace from the database recycle bin and clearing all the deleted database objects belonging to the tablespace from the database recycle bin; In the database control file, clearing the metadata of the deleted tablespace.

4. The method for managing the recycle bin of a shared cluster according to claim 3, wherein, The described recycle bin management method further includes: Obtaining the used storage capacity of the shared storage and the used memory capacity of the shared cluster; Detecting whether the used storage capacity exceeds a preset first storage threshold and detecting whether the used memory capacity exceeds a preset second storage threshold; If it is detected that the used storage capacity exceeds the preset first storage threshold or it is detected that the used memory capacity exceeds the preset second storage threshold, then performing the step of obtaining the residence time of each deleted data file in the shared cluster file system recycle bin to obtain the updated used storage capacity of the shared storage and the updated used memory capacity of the shared cluster; Detecting whether the updated used storage capacity exceeds the preset first storage threshold and detecting whether the updated used memory capacity exceeds the preset second storage threshold; If it is detected that the storage amount used for the update exceeds the preset first storage threshold, or it is detected that the memory amount used for the update exceeds the preset second storage threshold, then perform a cleanup operation on the deleted data files in the recycle bin of the shared cluster file system and the deleted database objects in the recycle bin of the database until the storage amount used for the update of the shared storage does not exceed the preset first storage threshold and the memory amount used for the update of the shared cluster does not exceed the preset second storage threshold.

5. A data space flashback method for a shared cluster, characterized in that, The data space flashback method includes: Determine the cleanup status of the data files to be flashbacked corresponding to the tablespace to be flashbacked from the recycle bin of the shared cluster file system of the recycle bin management method of the shared cluster according to any one of claims 1 to 4; If the cleanup status is uncleaned, then recover the data files to be flashbacked from the recycle bin of the shared cluster file system, and in the database control file, clear the deletion mark of the meta-information of the data files to be flashbacked; Recover the database objects to be flashbacked corresponding to the tablespace to be flashbacked from the recycle bin of the database; In the database control file, clear the deletion mark of the meta-information of the tablespace to be flashbacked.

6. The method for flashback of the data space of the shared cluster according to claim 5, wherein After recovering the data files to be flashbacked from the recycle bin of the shared cluster file system, it further includes: If the tablespace to be flashbacked does not contain database objects to be flashbacked, then directly in the database control file, clear the deletion marks of the meta-information of the tablespace to be flashbacked and the data files to be flashbacked corresponding to the tablespace to be flashbacked.

7. A recycling bin management device for a shared cluster, characterized in that, The recycle bin management device includes: A first recycle module, configured to determine the database objects belonging to the tablespace when performing a deletion operation on the tablespace in the shared storage, and move the database objects into the recycle bin of the database; A second recycle module, configured to determine the data files included in the tablespace, and move the data files into the recycle bin of the shared cluster file system when making a deletion mark on the meta-information of the data files in the database control file; A third recycle module, configured to make a deletion mark on the meta-information of the tablespace in the database control file.

8. A data space flashback device for a shared cluster, characterized in that, The data space flashback device includes: A first determination module, configured to determine the cleanup status of the data files to be flashbacked corresponding to the tablespace to be flashbacked from the recycle bin of the shared cluster file system of the recycle bin management method of the shared cluster according to any one of claims 1 to 4; A first flashback module, configured to if the cleanup status is uncleaned, then recover the data files to be flashbacked from the recycle bin of the shared cluster file system, and in the database control file, clear the deletion mark of the meta-information of the data files to be flashbacked; A second flashback module, configured to recover the database objects to be flashbacked corresponding to the tablespace to be flashbacked from the recycle bin of the database; A third flashback module, configured to in the database control file, clear the deletion mark of the meta-information of the tablespace to be flashbacked.

9. A computer device, characterized in that, The computer device includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the recycle bin management method of the shared cluster according to any one of claims 1 to 4, or the data space flashback method of the shared cluster according to any one of claims 5 to 6.

10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the recycle bin management method of the shared cluster according to any one of claims 1 to 4, or the data space flashback method of the shared cluster according to any one of claims 5 to 6.

Citation Information

Patent Citations

  • Flashback drop method and system of database

    CN110597781A

  • Method, device and equipment for cleaning junk files of HDFS and readable medium

    CN113806308A