Recycling station management method, data space flashback method, device, equipment and medium

By setting up a recycling bin management mechanism in a shared cluster environment, the time-consuming and complex problem of recovery after table space error deletion is solved, and fast and simple table space flashback recovery is achieved, which improves recovery efficiency and reduces dependence on backups and logs.

CN119668515AActive Publication Date: 2025-03-21SHENZHEN INST OF COMPUTING SCI

Patent Information

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

AI Technical Summary

Technical Problem

In a database management system, after the tablespace is accidentally deleted, the traditional recovery method takes a long time, is complex, and depends on the integrity and availability of backup and logs. If any of them are missing, the recovery operation may not be carried out.

Method used

By setting up the database recycling bin management mechanism and the shared cluster file system recycling bin management mechanism in the shared cluster environment, the table space is deleted and flashback recovery is achieved. The specific steps include moving the database object and data files into the corresponding recycling bin when deleting the tablespace, and making deletion marks in the database control file. During the flashback operation, recover data files and database objects from the Recycle Bin and clear the deletion mark.

Benefits of technology

It realizes fast and simple recovery of table space without stopping cluster services or playing back logs, improves table space recovery efficiency and reduces dependence on backups and logs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119668515A_ABST
    Figure CN119668515A_ABST
Patent Text Reader

Abstract

The invention is suitable for the technical field of shared clusters, and particularly relates to a recycle bin management method, a data space flashback method, a device, equipment and a medium. When deletion operation is carried out on the table space, the database objects belonging to the table space are moved into a database recycle bin, and when deletion marking is carried out on meta-information of data files contained in the table space, the data files are moved into a shared cluster file system recycle bin, and deletion marking is carried out on the meta-information of the table space. And when the table space is flashed back, if the to-be-flashed data file corresponding to the to-be-flashed table space is not cleared, recovering the to-be-flashed data file from the shared cluster file system recycle bin, clearing the deletion mark of the meta information of the to-be-flashed data file, and recovering the to-be-flashed database object corresponding to the to-be-flashed table space from the database recycle bin. And removing the deletion mark of the meta-information of the to-be-flashed-back table space. Through a database recycle bin management mechanism and a shared cluster file system recycle bin management mechanism, the table space recovery efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application is applicable to the field of shared cluster technology, and in particular relates to a recycle bin management method, a data space flashback method, a device, a equipment and a medium. Background Art

[0002] In a database management system, if a tablespace is deleted by mistake, it may directly lead to the permanent loss of key data, which in turn causes immeasurable losses to users and businesses. The traditional method of recovering a deleted tablespace mainly relies on full database backups, archived logs, and online logs to restore the database or tablespace to a certain point in time before it was deleted. However, this method is usually time-consuming and complex, and also depends on the integrity and availability of backups and logs. If any of them is missing, the recovery operation may not be possible. Therefore, how to set up 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, embodiments of the present application provide a recycle bin management method, a data space flashback method, an apparatus, a device and a medium to solve the problem of how to set the management method of the recycle bin to satisfy the flashback operation of the deleted tablespace.

[0004] In a first aspect, an embodiment of the present application provides a recycle bin management method for a shared cluster, the recycle bin management method comprising: When performing a deletion operation on a table space in a shared storage, determining a database object belonging to the table space, and moving the database object into a database recycle bin; Determine the data files included in the table space, and when marking the meta information of the data files in the database control file for deletion, move the data files to a shared cluster file system recycle bin; The metadata of the table space is marked for deletion in the database control file.

[0005] In a second aspect, an embodiment of the present application provides a data space flashback method for a shared cluster, the data space flashback method comprising: Determine the cleanup status of the to-be-flashback data file corresponding to the to-be-flashback tablespace from the shared cluster file system recycle bin of the shared cluster recycle bin management method of the first aspect; If the cleaning state is not cleaned, the data file to be flashed back is restored from the shared cluster file system recycle bin, and a deletion mark of the meta information of the data file to be flashed back is cleared in the database control file; Recovering the to-be-flashback database object corresponding to the to-be-flashback tablespace from the database recycle bin; In the database control file, a deletion mark of the meta information of the table space to be flashed back is cleared.

[0006] In a third aspect, an embodiment of the present application provides a recycle bin management of a shared cluster, and the recycle bin management device includes: A first recycling module is used to determine the database objects belonging to the table space when a deletion operation is performed on the table space in the shared storage, and move the database objects to a database recycling bin; A second recycling module is used to determine the data files contained in the table space, and when the meta information of the data files in the database control file is marked for deletion, move the data files into a shared cluster file system recycling bin; The third recycling module is used to mark the metadata of the table space for deletion in the database control file.

[0007] In a fourth aspect, an embodiment of the present application provides a data space flashback device for a shared cluster, the data space flashback device comprising: A first determination module is used to determine the cleaning status of the to-be-flashback data file corresponding to the to-be-flashback tablespace in the recycle bin management method of the shared cluster file system in the first aspect; A first flashback module is used for recovering the data file to be flashed back from the shared cluster file system recycle bin if the cleaning state is uncleaned, and clearing a deletion mark of the meta information of the data file to be flashed back in the database control file; A second flashback module, used for recovering the to-be-flashback database object corresponding to the to-be-flashback tablespace from the database recycle bin; The third flashback module is used to clear the deletion mark of the meta information of the table space to be flashed back in the database control file.

[0008] In a fifth aspect, an embodiment of the present application provides a computer device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the recycle bin management method for the shared cluster as described in the first aspect, or the data space flashback method for the shared cluster as described in the second aspect is implemented.

[0009] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, 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 is implemented.

[0010] Compared with the prior art, the embodiments of the present application have the following beneficial effects: when performing a deletion operation on a tablespace in a shared storage, the present application determines the database objects belonging to the tablespace, moves the database objects into the database recycle bin, determines the data files contained in the tablespace, and when making a deletion mark on the meta-information of the data files in the database control file, moves the data files into the shared cluster file system recycle bin, and makes a deletion mark on the meta-information of the tablespace in the database control file. Accordingly, when flashing back the tablespace, the cleanup status of the data files to be flashed back corresponding to the tablespace to be flashed back is determined from the shared cluster file system recycle bin, if not cleaned up, the data files to be flashed back are restored from the shared cluster file system recycle bin, and in the database control file, the deletion mark of the meta-information 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 of the meta-information of the tablespace to be flashed back is cleared.

[0011] Among them, in a shared cluster environment, by setting up the corresponding database recycle bin management mechanism and the shared cluster file system recycle bin management mechanism, the two are linked to realize the deletion and flashback recovery of the table space. Compared with the traditional method based on backup and log recovery, when the present application performs flashback recovery on the table space that has been deleted, there is no need to stop the cluster service or replay the log. It only needs to be based on the database recycle bin management mechanism and the shared cluster file system recycle bin management mechanism to restore the table space content to the moment before deletion online. The operation is simple and the recovery efficiency of the table space is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0013] Figure 1 This is a schematic diagram of a recycle bin structure of a shared cluster provided in Example 1 of the present application; Figure 2 It is a flow chart of a method for managing a recycle bin of a shared cluster provided in Embodiment 2 of the present application; Figure 3 It is a flowchart of a recycle bin management method for a shared cluster provided in Embodiment 3 of the present application; Figure 4 It is a flowchart of a recycle bin management method for a shared cluster provided in Embodiment 4 of the present application; Figure 5It is a flowchart of a data space flashback method of a shared cluster provided in Embodiment 5 of the present application; Figure 6 It is a structural diagram of a recycling bin management device for a shared cluster provided in Example 6 of the present application; Figure 7 This is a structural diagram of a data space flashback device for a shared cluster provided in Embodiment 7 of the present application; Figure 8 It is a structural diagram of a computer device provided in Example 8 of the present application. DETAILED DESCRIPTION

[0014] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may 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 prevent unnecessary details from obstructing the description of the present application.

[0015] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0016] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

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

[0018] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0019] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0020] It should be understood that the size of the serial numbers of the steps in the following embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0021] In order to illustrate the technical solution of the present application, a specific embodiment is provided below for illustration.

[0022] See also Figure 1 , is a schematic diagram of a shared cluster recycle bin structure provided in Example 1 of the present application. In a shared cluster environment, a database recycle bin for storing deleted database objects is provided on the database side, and a shared cluster file system recycle bin for storing deleted data files and deleted tablespaces is provided in the shared cluster file system.

[0023] The overall process of deleting a tablespace on the client and performing flash recovery on the deleted tablespace can be as follows: 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 you need to delete the data files contained in the tablespace, determine the data files contained in the tablespace. When marking the metadata of the data files in the database control file for deletion, store the data files contained in the tablespace in the shared cluster file system recycle bin through the interface of the shared cluster file system. 3) Mark the metadata of the tablespace for deletion in the database control file.

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

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

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

[0027] See also Figure 2 , is a flow chart of a recycle bin management method for a shared cluster provided in Embodiment 2 of the present application, such as Figure 2 As shown, the following steps may be included: Step S201, when performing a deletion operation on a table space in a shared storage, determining a database object belonging to the table space, and moving the database object into a database recycle bin.

[0028] Step S202, determining the data files included in the table space, and moving the data files into the shared cluster file system recycle bin when marking the meta information of the data files in the database control file for deletion.

[0029] Step S203: mark the metadata of the table space for deletion in the database control file.

[0030] In the embodiment of the present application, a shared cluster may refer to a database cluster system that allows multiple database nodes to access and operate the same storage medium, and a shared storage may refer to a physical storage device (such as a disk) that allows multiple database nodes in a shared cluster to access and operate data in the shared storage. In a shared cluster environment, data is stored in the shared storage, and a database management system may start database instances in multiple database nodes respectively, and the database instances access data in the shared storage through a shared cluster file system; Tablespace is a logical structural unit used to store data in a database. It manages data files in the space in a unified manner and provides a logical storage location for database objects (such as tables and indexes). Database objects are various named entities and structures (such as tables and indexes) used to store and manage data in a database. The database object can be empty. When the database object is empty, it means that only the tablespace is created, and no table or index is created on the tablespace. Data files are the basis of the database storage structure and exist in the form of actual files in the file system. Each tablespace includes at least one data file, which contains the data of database objects such as tables and indexes. Meta-information is information about information, which records additional descriptions or attribute characteristics of data or objects. In the embodiment of the present application, the meta-information may be data describing the size, path and other characteristics of data files and tablespaces; the database control file is a physical file of the database, which records the meta-information of data such as tablespaces and data files; the delete mark is used to mark tablespaces and data files as non-overwritable or unavailable; 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 a shared cluster file system or shared storage for storing deleted data files and deleted tablespaces.

[0031] Specifically, when performing a deletion operation on a table space in shared storage, first, determine whether the table space contains database objects. If the table space contains database objects, then determine the database objects such as tables and indexes belonging to the table space from the data dictionary corresponding to the table space, and move the database objects into the database recycle bin. Then, if it is necessary to perform a deletion operation on the data files contained in the table space, determine the data files contained in the table space, mark the metadata of the data files contained in the table space for deletion in the database control file, call the interface of the shared cluster file system, and store the data files into the shared cluster file system recycle bin. Finally, mark the metadata of the table space for deletion in the database control file to mark the table space as an overwriteable or unavailable state.

[0032] Accordingly, when performing a deletion operation on a tablespace, if the tablespace does not contain a database object, that is, the tablespace is empty, the data files contained in the tablespace are directly determined. If a deletion operation is required on the data files contained in the tablespace, the data files contained in the tablespace are determined, and the metadata of the data files contained in the tablespace is marked for deletion in the database control file. The interface of the shared cluster file system is called to store the data files in the shared cluster file system recycle bin, and the metadata of the tablespace is marked for deletion in the database control file to mark the tablespace as non-overlappable or unavailable.

[0033] Optionally, in a non-shared cluster environment, a tablespace recycle bin management mechanism may also be used. 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, the meta information of the data files contained in the tablespace is marked for deletion, and the data files are also moved into the database recycle bin, and finally, the meta information of the tablespace is marked for deletion in the database control file. Accordingly, when performing a flashback recovery on the tablespace to be deleted, first, the cleanup status of the data files to be flashed back corresponding to the tablespace to be flashed back is determined from the database recycle bin, if it is not cleaned up, the data files to be flashed back are restored from the database recycle bin, and the delete mark of the meta information of the data files to be flashed back is cleared in the database control file, then, the database objects to be flashed back corresponding to the tablespace to be flashed back are restored from the database recycle bin, and finally, the delete mark of the meta information of the tablespace to be flashed back is cleared in the database control file.

[0034] In an embodiment of the present application, in a shared cluster environment, by setting up a corresponding database recycle bin management mechanism and a shared cluster file system recycle bin management mechanism, the two are linked to realize the deletion and flashback recovery of the table space. Compared with the traditional method based on backup and log recovery, when the present application performs flashback recovery on the table space that has been deleted, there is no need to stop the cluster service or replay the log. It only needs to be based on the database recycle bin management mechanism and the shared cluster file system recycle bin management mechanism to restore the table space content to the moment before deletion online. The operation is simple and the recovery efficiency of the table space is improved.

[0035] See also Figure 3 , is a flow chart of a method for managing a recycle bin of a shared cluster provided in Example 3 of the present application. Figure 3 As shown, the recycle bin management method may further include the following steps: Step S301, 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.

[0036] Step S302: If it is detected that the residence time of the deleted data file exceeds a preset time threshold, the deleted tablespace to which the deleted data file belongs is determined.

[0037] Step S303: clear all deleted data files contained in the deleted tablespace from the shared cluster file system recycle bin, and clear the meta information of all deleted data files contained in the deleted tablespace from the database control file.

[0038] Step S304: determine all deleted database objects belonging to the deleted table space from the database recycle bin, and clear all deleted database objects belonging to the table space from the database recycle bin.

[0039] Step S305: clear the metadata of the deleted tablespace in the database control file.

[0040] In an embodiment of the present application, a deleted tablespace may refer to a tablespace in which a deletion operation is performed to move the contained database objects or data files into a recycle bin and mark the contained database objects or data files for deletion. A deleted data file may refer to a data file moved into a shared cluster file system recycle bin by a deletion operation of the deleted tablespace. A deleted database object may refer to a database object moved into a database recycle bin by a deletion operation of the deleted tablespace. The residence time may refer to the time period from the corresponding moment when the deletion operation moves the data file into the shared cluster file system recycle bin to the current moment. The preset time threshold may refer to the pre-set time for triggering the shared cluster file system recycle bin to recycle the deleted data file.

[0041] Specifically, the residence time of each deleted data file in the shared cluster file system recycle bin can be obtained periodically through a timing thread. For any deleted data file, it is detected whether the residence time of the deleted data file exceeds a preset time threshold. If it exceeds, the general recycling mechanism of the recycle bin is triggered to release the storage space, memory resources and resources occupied by the mark own lock of the shared cluster, that is, first, determine the deleted tablespace to which the deleted data file belongs, call the shared cluster file system interface, clean up all the deleted data files contained in the deleted tablespace from the shared cluster file system recycle bin, and clear the meta information of all the deleted data files contained in the deleted tablespace from the database control file, then determine all the deleted database objects belonging to the deleted tablespace from the database recycle bin, clean up all the deleted database objects belonging to the tablespace from the database recycle bin, and finally, clear the meta information of the deleted tablespace from the database control file.

[0042] In an embodiment of the present application, when it is detected that the residence time of a deleted data file in the shared cluster file system recycle bin exceeds a preset time threshold, the general recycling mechanism of the recycle bin is triggered, and the table space that meets the general recycling mechanism is automatically cleaned up to release the storage space, memory resources and resources occupied by the mark's own lock of the shared cluster for use by other data, thereby reducing the resource consumption of the recycle bin in maintaining the deleted table space and improving the overall performance of the cluster system.

[0043] See also Figure 4 , is a flow chart of a method for managing a recycle bin of a shared cluster provided in Embodiment 4 of the present application, such as Figure 4 As shown, the recycle bin management method may further include the following steps: Step S401, obtaining the used storage amount of the shared storage and the used memory amount of the shared cluster.

[0044] Step S402, detecting whether the used storage amount exceeds a preset first storage threshold, and detecting whether the used memory amount exceeds a preset second storage threshold.

[0045] 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 amount of the shared storage and the updated used memory amount of the shared cluster.

[0046] Step S404, detecting whether the amount of storage used for updating exceeds a preset first storage threshold, and detecting whether the amount of memory used for updating exceeds a preset second storage threshold.

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

[0048] In an embodiment of the present application, the used storage amount may refer to the storage capacity already used in the shared storage, the used memory amount may refer to the memory capacity already used by all database nodes in the shared cluster, the preset first storage threshold may refer to the pre-set shared storage storage capacity used to trigger the shared cluster file system recycle bin for reclaiming deleted data files, and the preset second storage threshold may refer to the used storage capacity of the cluster memory that triggers the shared cluster file system recycle bin for reclaiming deleted data files.

[0049] Specifically, the used storage amount of the shared storage and the used memory amount of the shared cluster can be obtained periodically through a timing thread to detect whether the used storage amount exceeds a preset first storage threshold and 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 if it is detected that the used memory amount exceeds the preset second storage threshold, the forced recycling mechanism of the recycle bin is triggered to release the storage space, memory resources and resources occupied by the mark's own lock of the shared cluster. That is, first, according to the contents of the above steps S301 to S305, the deleted table space in the recycle bin that triggers the general recycling mechanism is recycled to release the storage space of the shared cluster. , memory resources and the resources occupied by the mark's own lock, obtain the updated used storage amount of the shared storage and the updated used memory amount of the shared cluster, then detect whether the updated used storage amount exceeds the preset first storage threshold, and detect 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, then the deleted tablespace in the recycle bin is indiscriminately recycled to further release 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.

[0050] In an embodiment of the present application, by triggering the forced recycling mechanism of the recycle bin 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 system can quickly identify and trigger forced cleanup when the used storage amount or the used memory amount exceeds the threshold, ensuring that resources are released in a timely manner, avoiding system performance degradation due to insufficient resources, and improving the overall performance of the cluster system.

[0051] See also Figure 5 , is a flow chart of a data space flashback method for a shared cluster provided in Embodiment 5 of the present application, such as Figure 5 As shown, the following steps may be included: Step S501: determining the cleaning status of the to-be-flashback data file corresponding to the to-be-flashback tablespace from the shared cluster file system recycle bin in the shared cluster recycle bin management method.

[0052] Step S502: if the cleaning status is not cleaned, the data file to be flashed back is restored from the shared cluster file system recycle bin, and the deletion mark of the meta information of the data file to be flashed back is cleared in the database control file.

[0053] Step S503: recover the database object to be flashed back corresponding to the tablespace to be flashed back from the database recycle bin.

[0054] Step S504: clear the deletion mark of the meta information of the flashback tablespace in the database control file.

[0055] In an embodiment of the present application, the tablespace to be flashed back may refer to the tablespace to be flashed back from the shared cluster file system recycle bin, the data file to be flashed back may refer to the data file corresponding to the tablespace to be flashed back, the database object to be flashed back may refer to the database object corresponding to the tablespace to be flashed back, and the cleanup status may refer to the status of the data file to be flashed back in the shared cluster file system recycle bin, which may include an uncleaned status and a cleaned status, wherein the uncleaned status indicates that the data file to be flashed back has not been cleaned up by the recycle bin, and the cleaned status indicates that the data file to be flashed back has been cleaned up by the recycle bin.

[0056] Specifically, when performing flashback recovery on a tablespace that has been deleted, first, based on the name of the data file to be flashed back corresponding to the tablespace to be flashed back, the shared cluster file system recycle bin is queried to determine whether the data file to be flashed back has been cleaned up by the shared cluster file system recycle bin. If it has not been cleaned up, the interface of the shared cluster file system is called to restore the data file to be flashed back from the shared cluster file system recycle bin, and in the database control file, the deletion mark of the metadata of the data file to be flashed back is cleared. Then, if the tablespace to be flashed back contains the database object to be flashed back, the database object to be flashed back corresponding to the tablespace to be flashed back is restored from the database recycle bin. Finally, in the database control file, the deletion mark of the metadata of the tablespace to be flashed back is cleared.

[0057] In an embodiment of the present application, in a shared cluster environment, by setting up a corresponding database recycle bin management mechanism and a shared cluster file system recycle bin management mechanism, the two are linked to realize the deletion and flashback recovery of the table space. Compared with the traditional method based on backup and log recovery, when the present application performs flashback recovery on the table space that has been deleted, there is no need to stop the cluster service or replay the log. It only needs to be based on the database recycle bin management mechanism and the shared cluster file system recycle bin management mechanism to restore the table space content to the moment before deletion online. The operation is simple and the recovery efficiency of the table space is improved.

[0058] Corresponding to the recycle bin management method of the shared cluster in the above embodiment, Figure 6 The structural block diagram of the recycle bin management device of the shared cluster provided in the sixth embodiment of the present application is shown. For the convenience of description, only the part related to the embodiment of the present application is shown.

[0059] See also Figure 6 , the recycling bin management device comprises: A first recycling module 61 is used to determine the database objects belonging to the table space when a deletion operation is performed on the table space in the shared storage, and move the database objects to a database recycling bin; A second recycling module 62 is used to determine the data files included in the table space, and when the metadata of the data files in the database control file is marked for deletion, move the data files to a shared cluster file system recycle bin; The third recycling module 63 is used to mark the metadata of the table space for deletion in the database control file.

[0060] Optionally, the recycling bin management device further includes: A second determination module is used to directly determine the data files contained in the table space if the table space does not contain a database object when performing a deletion operation on the table space; A fourth recycling module, configured to move the data file into the shared cluster file system recycling bin when the metadata of the data file in the database control file is marked for deletion; The fifth recycling module is used to mark the table space for deletion in the database control file.

[0061] Optionally, the recycling bin management device further includes: A time detection module, 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; A third determination module, configured to determine a 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; A first cleaning module is used to clean up all deleted data files contained in the deleted tablespace from the shared cluster file system recycle bin, and to clear the meta information of all deleted data files contained in the deleted tablespace in the database control file; A second cleaning module, used to determine all deleted database objects belonging to the deleted table space from the database recycle bin, and clean up all deleted database objects belonging to the table space from the database recycle bin; The third cleaning module is used to clear the metadata of the deleted tablespace in the database control file.

[0062] Optionally, the recycling bin management device further includes: An acquisition module, used to acquire the used storage amount of the shared storage and the used memory amount of the shared cluster; A first capacity detection module, used to detect whether the used storage capacity exceeds a preset first storage threshold, and to detect whether the used memory capacity exceeds a preset second storage threshold; A fourth cleaning module is used to execute 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 amount of the shared storage and the updated used memory amount of the shared cluster if it is detected that the used storage amount exceeds the preset first storage threshold, or if it is detected that the used memory amount exceeds the preset second storage threshold; A second capacity detection module, used to detect whether the updated used storage exceeds the preset first storage threshold, and to detect whether the updated used memory exceeds the preset second storage threshold; A fifth cleaning module is used to clean up the deleted data files in the shared cluster file system recycle bin and the deleted database objects in the database recycle bin if it is detected that the updated storage used exceeds the preset first storage threshold, or if it is detected that the updated memory used exceeds the preset second storage threshold, until the updated storage used by the shared storage does not exceed the preset first storage threshold, and the updated memory used by the shared cluster does not exceed the preset second storage threshold.

[0063] It should be noted that the information interaction, execution process and other contents between the above-mentioned modules are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

[0064] Corresponding to the data space flashback method of the shared cluster in the above embodiment, Figure 7 The structure block diagram of the data space flashback device of the shared cluster provided by the seventh embodiment of the present application is shown. For the convenience of description, only the part related to the embodiment of the present application is shown.

[0065] See also Figure 7 , the data space flashback device comprises: A first determination module 71 is used to determine the cleaning status of the to-be-flashback data file corresponding to the to-be-flashback tablespace from the shared cluster file system recycle bin of the shared cluster recycle bin management method; A first flashback module 72 is used for recovering the data file to be flashed back from the shared cluster file system recycle bin if the cleaning state is not cleaned, and clearing the deletion mark of the meta information of the data file to be flashed back in the database control file; A second flashback module 73, used for recovering the to-be-flashback database object corresponding to the to-be-flashback tablespace from the database recycle bin; The third flashback module 74 is used to clear the deletion mark of the meta information of the table space to be flashed back in the database control file.

[0066] Optionally, the data space flashback device further includes: The fourth flashback module is used to directly clear the deletion mark of the metadata of the tablespace to be flashed back and the data file to be flashed back corresponding to the tablespace to be flashed back in the database control file if the tablespace to be flashed back does not contain the database object to be flashed back.

[0067] It should be noted that the information interaction, execution process and other contents between the above-mentioned modules are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

[0068] Figure 8 This is a schematic diagram of the structure of a computer device provided in Example 8 of the present application. Figure 8 As shown, the computer device of this embodiment includes: at least one processor ( Figure 8 Only one is shown), a memory, and a computer program stored in the memory and executable on at least one processor, wherein when the processor executes the computer program, the steps in any of the above-mentioned embodiments of the recycle bin management method for the shared cluster are implemented, or the steps in any of the above-mentioned embodiments of the data space flashback method for the shared cluster are implemented.

[0069] The computer device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that Figure 8 This is merely 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 those shown in the figure, or a combination of certain components, or different components. For example, it may also include a network interface, a display screen, and an input device.

[0070] The processor may be a CPU, or other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0071] The memory includes a readable storage medium, an internal memory, etc., wherein 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 a hard disk of a computer device, and in other embodiments, it may also be an external storage device of the computer device, for example, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device. Further, the memory may also include both an internal storage unit of the computer device and an external storage device. The memory is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of a computer program, etc. The memory may also be used to temporarily store data that has been output or is to be output.

[0072] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into a processing unit, or each unit can exist physically separately, 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 software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned device can refer to the corresponding process in the above-mentioned method embodiment, which will not be repeated 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 this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned method embodiment can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device capable of carrying computer program code, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.

[0073] The present application implements all or part of the processes in the above-mentioned embodiment method, and may also be completed through a computer program product. When the computer program product runs on a computer device, the computer device can implement the steps in the above-mentioned method embodiment when executing the computer program product.

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

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

[0076] In the embodiments provided in the present application, it should be understood that the disclosed devices / computer equipment and methods can be implemented in other ways. For example, the device / computer equipment embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as 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 mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

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

[0078] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A method for managing a recycle bin of a shared cluster, characterized in that: The recycling bin management method comprises: When performing a deletion operation on a table space in a shared storage, determining a database object belonging to the table space, and moving the database object into a database recycle bin; Determine the data files included in the table space, and when marking the metadata of the data files in the database control file for deletion, move the data files to a shared cluster file system recycle bin; The metadata of the table space is marked for deletion in the database control file.

2. The recycle bin management method of a shared cluster according to claim 1, characterized in that: The recycle bin management method further includes: When performing a deletion operation on the table space, if the table space does not contain a database object, directly determining the data files contained in the table space; When the meta information of the data file in the database control file is marked for deletion, the data file is moved to the shared cluster file system recycle bin; The table space is marked for deletion in the database control file.

3. The recycle bin management method of a shared cluster according to claim 1, characterized in that: The 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; Cleaning up all deleted data files contained in the deleted tablespace from the shared cluster file system recycle bin, and clearing out the meta information of all deleted data files contained in the deleted tablespace in the database control file; Determining all deleted database objects belonging to the deleted tablespace from the database recycle bin, and clearing all deleted database objects belonging to the tablespace from the database recycle bin; In the database control file, the meta information of the deleted table space is cleared.

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

5. A method for flashing back data space of a shared cluster, characterized in that: The data space flashback method comprises: Determine the cleanup status of the to-be-flashback data file corresponding to the to-be-flashback tablespace from the shared cluster file system recycle bin of the shared cluster recycle bin management method according to any one of claims 1 to 4; If the cleaning state is not cleaned, the data file to be flashed back is restored from the shared cluster file system recycle bin, and a deletion mark of the meta information of the data file to be flashed back is cleared in the database control file; Recovering the to-be-flashback database object corresponding to the to-be-flashback tablespace from the database recycle bin; In the database control file, a deletion mark of the meta information of the table space to be flashed back is cleared.

6. The data space flashback method of a shared cluster according to claim 5, characterized in that: After recovering the to-be-flashbacked data file from the shared cluster file system recycle bin, the method further includes: If the tablespace to be flashed back does not contain the database object to be flashed back, the deletion mark of the meta information of the tablespace to be flashed back and the data file to be flashed back corresponding to the tablespace to be flashed back is directly cleared in the database control file.

7. A recycle bin management device for a shared cluster, characterized in that: The recycling station management device comprises: A first recycling module is used to determine the database objects belonging to the table space when a deletion operation is performed on the table space in the shared storage, and move the database objects to a database recycling bin; A second recycling module is used to determine the data files contained in the table space, and when the meta information of the data files in the database control file is marked for deletion, move the data files into a shared cluster file system recycling bin; The third recycling module is used to mark the metadata of the table space for deletion in the database control file.

8. A data space flashback device for a shared cluster, characterized in that: The data space flashback device comprises: A first determining module, configured to determine a cleanup status of a to-be-flashback data file corresponding to a to-be-flashback tablespace from a shared cluster file system recycle bin in the shared cluster recycle bin management method according to any one of claims 1 to 4; A first flashback module is used for recovering the data file to be flashed back from the shared cluster file system recycle bin if the cleaning state is uncleaned, and clearing a deletion mark of the meta information of the data file to be flashed back in the database control file; A second flashback module, used for recovering the to-be-flashback database object corresponding to the to-be-flashback tablespace from the database recycle bin; The third flashback module is used to clear the deletion mark of the meta information of the table space to be flashed back in the database control file.

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, the recycle bin management method for a shared cluster as described in any one of claims 1 to 4 or the data space flashback method for a shared cluster as described in any one of claims 5 to 6 is implemented.

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

Citation Information

Patent Citations

  • Recycle bin file recovery method and apparatus

    CN107748780A

  • Flashback drop method and system of database

    CN110597781A

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

    CN113806308A

  • Flash-back processing method and device for database and electronic equipment

    CN114443365A

  • Distributed file management service center based on lightweight file system FastDFS

    CN114490536A

Cited By

  • Database object recovery method and device

    CN121051087A