CN108228813B - Method and device for deleting duplicate database in distributed system - Google Patents

Method and device for deleting duplicate database in distributed system Download PDF

Info

Publication number
CN108228813B
CN108228813B CN201711486360.7A CN201711486360A CN108228813B CN 108228813 B CN108228813 B CN 108228813B CN 201711486360 A CN201711486360 A CN 201711486360A CN 108228813 B CN108228813 B CN 108228813B
Authority
CN
China
Prior art keywords
directory
database
hard link
deleting
duplicate
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201711486360.7A
Other languages
Chinese (zh)
Other versions
CN108228813A (en
Inventor
王康
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Qihoo Technology Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Qihoo Technology Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201711486360.7A priority Critical patent/CN108228813B/en
Publication of CN108228813A publication Critical patent/CN108228813A/en
Application granted granted Critical
Publication of CN108228813B publication Critical patent/CN108228813B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/162Delete operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Abstract

The invention discloses a method and a device for deleting a duplicate database in a distributed system. Wherein the method comprises the following steps: a recovery folder is configured in a file system in advance; when a deleting operation of a duplicate database is received, acquiring a first directory which is in hard link with the duplicate database, and establishing a second directory under the recovery folder according to the first directory; establishing a hard link between the replica database and the second directory; deleting the hard link of the replica database to the first directory. By adopting the scheme, the duplicate database is easy to recover after being deleted, so that the risk of mistakenly deleting the duplicate database is reduced, and the loss caused by incapability of recovering after the mistakenly deleting the duplicate database in the prior art is avoided.

Description

Method and device for deleting duplicate database in distributed system
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for deleting a duplicate database in a distributed system.
Background
The distributed system is favored by the technicians in the field due to the characteristics of high parallelism, high fault tolerance, high flexibility and the like. Each replica data in the distributed system has its corresponding replica database. Deletion of the replica database may result when migration or deletion of the replica database, table deletion, etc.
However, at present, after the duplicate database is deleted, the duplicate database cannot be recovered any more, so that the risk of mistaken deletion of the duplicate database is increased, and the loss caused by the mistaken deletion of the duplicate database is increased.
Disclosure of Invention
In view of the above, the present invention is proposed to provide a method and apparatus for deleting a replica database in a distributed system that overcomes or at least partially solves the above problems.
According to one aspect of the invention, a method for deleting a duplicate database in a distributed system is provided, which comprises the following steps:
a recovery folder is configured in a file system in advance;
when a deleting operation of a duplicate database is received, acquiring a first directory which is in hard link with the duplicate database, and establishing a second directory under the recovery folder according to the first directory;
establishing a hard link between the replica database and the second directory;
deleting the hard link of the replica database to the first directory.
According to another aspect of the present invention, there is provided a device for deleting a duplicate database in a distributed system, including:
the preset module is suitable for pre-configuring a recovery folder in a file system;
the first directory establishing module is suitable for acquiring a first directory which is in hard link with a duplicate database when a deleting operation of the duplicate database is received, and establishing a second directory under the recovery folder according to the first directory;
a first hard link establishing module, adapted to establish a hard link between the replica database and the second directory;
a first hard link deletion module adapted to delete hard links of the replica database with the first directory.
According to yet another aspect of the present invention, there is provided a computing device comprising: the system comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete mutual communication through the communication bus;
the memory is used for storing at least one executable instruction, and the executable instruction enables the processor to execute the operation corresponding to the deleting method of the replica database in the distributed system.
According to still another aspect of the present invention, a computer storage medium is provided, where at least one executable instruction is stored in the storage medium, and the executable instruction causes a processor to perform an operation corresponding to the deletion method of the replica database in the distributed system.
According to the method and the device for deleting the duplicate database in the distributed system, provided by the invention, the duplicate database is deleted. Firstly, a recovery folder is configured in a file system in advance; when a deleting operation of the duplicate database is received, acquiring a first directory which is in hard link with the duplicate database, and establishing a second directory under a recovery folder according to the first directory; establishing a hard link between the replica database and the second directory; the hard link of the replica database to the first directory is deleted. By adopting the scheme, the duplicate database is easy to recover after being deleted, so that the risk of mistakenly deleting the duplicate database is reduced, and the loss caused by incapability of recovering after the mistakenly deleting the duplicate database in the prior art is avoided.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 is a flow chart illustrating a method for deleting a replica database in a distributed system according to an embodiment of the present invention;
FIG. 2 is a flow chart illustrating a method for deleting a replica database in a distributed system according to another embodiment of the present invention;
fig. 3 is a block diagram illustrating a structure of a device for deleting a replica database in a distributed system according to an embodiment of the present invention;
fig. 4 is a block diagram illustrating a structure of a device for deleting a replica database in a distributed system according to another embodiment of the present invention;
FIG. 5 illustrates a schematic structural diagram of a computing device provided in accordance with an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Fig. 1 is a flowchart illustrating a method for deleting a duplicate database in a distributed system according to an embodiment of the present invention. As shown in fig. 1, the method includes:
in step S110, a recycle folder is configured in the file system in advance.
Among them, the file system is a mechanism in the operating system responsible for managing and storing file information. The specific type of the file system is not limited in the present invention, for example, the file system may be a RAMFS file system (memory file system), a VFAT file system (file system adopted by Windows 95/98 operating system), an HPFS file system (file system adopted by OS/2 operating system), or the like.
The operation of the copy database by the user is realized through a file system. For example, in the prior art, when a duplicate database is deleted, the deletion of the duplicate database is achieved by deleting a file directory or a file corresponding to the duplicate database in the file system.
Specifically, before deleting the replica database, a recycle folder is configured in the file system in advance. The invention does not limit the format of the recycle folder. Optionally, the recycle folder may be displayed in a hidden folder manner after being set up, and displayed in an explicit folder manner when the recycle folder contains the directory.
Step S120, when the deleting operation of the copy database is received, acquiring a first directory which is hard-linked with the copy database, and establishing a second directory under the recovery folder according to the first directory.
In particular, a first directory is located in the file system, the first directory having a hard link established with a replica database stored in a storage node or partition. When a delete operation for the duplicate database is received, a first directory which is in hard link with the duplicate database can be obtained, and a second directory which is the same as the first directory is automatically established in the recovery folder.
When the deleting operation of the plurality of duplicate databases is received, the first directories which are hard-linked with the duplicate databases are respectively obtained, and the second directories corresponding to the first directories are established under the recovery folder according to the first directories.
Step S130, a hard link between the duplicate database and the second directory is established.
After the second directory is created under the recycle folder in step S120, a hard link of the replica database with the second directory is further created.
In step S140, the hard link between the duplicate database and the first directory is deleted.
After establishing the hard link between the replica database and the second directory in step S130, the hard link between the replica database and the first directory is deleted. After deleting the hard link of the replica database to the first directory, the first directory in the file system is also deleted without any change to the location or content of the replica database in the storage node or partition, thereby facilitating recovery of the replica database.
According to the method for deleting the duplicate database in the distributed system provided by the embodiment, firstly, a recovery folder is configured in a file system in advance; when a deleting operation of the duplicate database is received, acquiring a first directory which is in hard link with the duplicate database, and establishing a second directory under a recovery folder according to the first directory; establishing a hard link between the replica database and the second directory; the hard link of the replica database to the first directory is deleted. By adopting the scheme, after the duplicate database is deleted, the position or the content of the duplicate database in the storage node or the partition is not changed, so that the duplicate database is convenient to restore, the risk of mistakenly deleting the duplicate database is reduced, and the loss caused by the fact that the duplicate database cannot be restored after being mistakenly deleted in the prior art is avoided.
Fig. 2 is a flowchart illustrating a method for deleting a duplicate database in a distributed system according to another embodiment of the present invention. As shown in fig. 2, the method includes:
step S210, a recycle folder is configured in the file system in advance.
Among them, the file system is a mechanism in the operating system responsible for managing and storing file information. The specific type of the file system is not limited in the present invention, for example, the file system may be a RAMFS file system (memory file system), a VFAT file system (file system adopted by Windows 95/98 operating system), an HPFS file system (file system adopted by OS/2 operating system), or the like.
The operation of the copy database by the user is realized through a file system. For example, in the prior art, when a duplicate database is deleted, the deletion of the duplicate database is achieved by deleting a file directory or a file corresponding to the duplicate database in the file system.
Specifically, before deleting the replica database, a recycle folder is configured in the file system in advance. The invention does not limit the format of the recycle folder. Optionally, the recycle folder may be displayed in a hidden folder mode after being set up.
Step S220, when a delete operation for the duplicate database is received, acquiring a first directory that has established a hard link with the duplicate database, establishing a second directory under the recycle folder according to the first directory, acquiring a log file corresponding to the duplicate database, acquiring a third directory that has established a hard link with the log file, and establishing a fourth directory under the recycle folder according to the third directory.
Specifically, the replica database has a first directory corresponding to the replica database in the file system, and the replica database is connected with the first directory in a hard link manner. The user can realize the addition, deletion, modification and check of the copy database through the operation on the first directory. In addition, the duplicate database also has a log file corresponding to the duplicate database, and the log file records operation information or data change information and the like in the duplicate database. The type of the log file is not limited in the present invention, and the log file may be, for example, a binlog log (binary log), a redo log (redo log), an error log, or the like. The number of log files may be one or more. And a third directory corresponding to the log file also exists in the file system, and the third directory is connected with the log file in a hard link mode.
Specifically, when a deleting operation of a duplicate database is received, a first directory which is in hard link with the duplicate database, a log file corresponding to the duplicate database and a third directory which is in hard link with the log file are obtained; and a second directory and a fourth directory identical to the first directory and the third directory are respectively established under the recycle folder.
When the deleting operation of the plurality of duplicate databases is received, the first directories which are hard-linked with each duplicate database and the third directories of the log files corresponding to each duplicate database are respectively obtained, and the second directories and the fourth directories corresponding to the first directories and the third directories are established in batches under the recovery files.
Step S230, a hard link between the duplicate database and the second directory is established, and a hard link between the log file corresponding to the duplicate database and the fourth directory is established.
After the second directory and the fourth directory are established in step S220, a hard link between the duplicate database and the second directory is established, and a hard link between a log file corresponding to the duplicate database and the fourth directory is established.
In step S240, the hard link between the duplicate database and the first directory is deleted, and the hard link between the log file corresponding to the duplicate database and the third directory is deleted.
After establishing the hard link between the duplicate database and the second directory and the hard link between the log file corresponding to the duplicate database and the fourth directory in step S230, the hard link between the duplicate database and the first directory is deleted, and the hard link between the log file corresponding to the duplicate database and the third directory is deleted.
After deleting the hard link of the replica database to the first directory, the first directory in the file system is also deleted without any change to the location or content of the replica database in the storage node or partition, thereby facilitating recovery of the replica database.
Similarly, after deleting the hard link between the log file corresponding to the replica database and the third directory, the third directory in the file system is also deleted, and the location or content of the log file corresponding to the replica database in the storage node or the partition is not changed, so that the recovery of the log file corresponding to the replica database is facilitated.
Step S250, deleting the hard link between the duplicate database and the second directory according to a complete deletion command aiming at the duplicate database executed under the recovery folder; and deleting the hard link between the log file corresponding to the duplicate database and the fourth directory.
When a user triggers a complete deletion command for the duplicate database under the recovery folder, deleting the hard link between the duplicate database and the second directory; and deleting the hard link between the log file corresponding to the duplicate database and the fourth directory. Because the second directory in the recovery folder and the duplicate database in the storage node or the partition are in the unique link relation, when the hard link between the duplicate database and the second directory is deleted, the second directory under the recovery file is also deleted, and the duplicate database in the storage node or the partition is also deleted from the storage node or the partition, so that the duplicate database is completely deleted. Similarly, the fourth directory in the recycle folder and the log file corresponding to the replica database in the storage node or the partition are in a unique link relationship, when the hard link between the log file corresponding to the replica database and the fourth directory is deleted, the fourth directory under the recycle file is also deleted, and the log file corresponding to the replica database in the storage node or the partition is also deleted from the storage node or the partition, so that the log file corresponding to the replica database is completely deleted.
Optionally, when the user triggers a complete deletion command for the duplicate database, prompt information about the duplicate database to be completely deleted and the log file corresponding to the duplicate database may be sent in the form of a popup window or the like, and after the user performs a complete deletion determination operation for the prompt information, the hard link between the duplicate database and the second directory is deleted, and the hard link between the log file corresponding to the duplicate database and the fourth directory is deleted; and after the user executes the return operation aiming at the prompt message, the hard link between the duplicate database and the second directory and the hard link between the log file corresponding to the duplicate database and the fourth directory are not deleted at this time.
Step S260, according to the recovery command aiming at the copy database, according to the hard link between the copy database and the second directory, the hard link between the copy database and the first directory is rebuilt; and reconstructing the hard link between the log file corresponding to the duplicate database and the third directory according to the hard link between the log file corresponding to the duplicate database and the fourth directory.
Optionally, after the hard link between the duplicate database and the first directory is rebuilt and the hard link between the log file corresponding to the duplicate database and the third directory is rebuilt, the hard link between the duplicate database and the second directory and the hard link between the log file corresponding to the duplicate database and the fourth directory may be deleted, and further, the second directory and the fourth directory in the recycle folder may also be deleted.
Step S270, according to the recycle folder empty command, empty all the second directories and all the fourth directories under the recycle folder.
After the steps S220 to S240 are continuously executed in a loop, the recycle folder may include a plurality of second directories and a plurality of fourth directories. And when an emptying command of the recovery folder is received, emptying all the second directories and all the fourth directories under the recovery folder, thereby realizing batch deletion of the copy databases corresponding to the second directories and the log files corresponding to the copy databases.
In an alternative embodiment, after the recycle folder is pre-configured in the file system in step S210, steps S220 to S240 may be: and establishing second directories corresponding to the copy databases in the recycle folder, wherein the second directories are established according to the first directories which are in hard links with the copy databases. When a deletion operation of the designated copy database is received, establishing a hard link between the second directories corresponding to the designated copy database, and deleting the hard link of the first directory corresponding to the designated copy database and the designated copy data.
According to the method for deleting the duplicate database in the distributed system provided by the embodiment, firstly, a recovery folder is configured in a file system in advance; when a deleting operation of the duplicate database is received, acquiring a first directory which is in hard link with the duplicate database, establishing a second directory under a recovery folder according to the first directory, acquiring a log file corresponding to the duplicate database and a third directory which is in hard link with the log file, and establishing a fourth directory under the recovery folder according to the third directory; establishing a hard link between the duplicate database and the second directory, and establishing a hard link between a log file corresponding to the duplicate database and the fourth directory; and then deleting the hard link between the duplicate database and the first directory, and deleting the hard link between the log file corresponding to the duplicate database and the third directory. After the duplicate database is deleted, the position or the content of the duplicate database in the storage node or the partition is not changed, so that the duplicate database is convenient to recover, the risk of mistakenly deleting the duplicate database is reduced, and the loss caused by the fact that the duplicate database cannot be recovered after being mistakenly deleted in the prior art is avoided; further, the hard link of the duplicate database with the second directory may be deleted for a complete delete command against the duplicate database executed under the recycle folder; deleting the hard link between the log file corresponding to the duplicate database and the fourth directory, so as to realize the complete deletion of the duplicate database and the log file; according to a recovery command aiming at the copy database, and according to the hard link between the copy database and the second directory, the hard link between the copy database and the first directory is rebuilt; according to the hard link between the log file corresponding to the duplicate database and the fourth directory, the hard link between the log file corresponding to the duplicate database and the third directory is rebuilt, and the deleted duplicate database and the log file can be automatically recovered; and in addition, all second directories and all fourth directories under the recovery folder can be emptied according to the recovery folder emptying command, so that batch deletion of the duplicate database and the log files is realized.
Fig. 3 is a block diagram illustrating a structure of a device for deleting a duplicate database in a distributed system according to an embodiment of the present invention. As shown in fig. 3, the apparatus includes: a preset module 31, a first directory establishing module 32, a first hard link establishing module 33, and a first hard link deleting module 34.
The preset module 31 is suitable for configuring the recycle folder in the file system in advance.
The first directory establishing module 32 is adapted to, when a delete operation for the duplicate database is received, obtain a first directory in which a hard link is already established with the duplicate database, and establish a second directory under the recycle folder according to the first directory.
A first hard link establishing module 33 adapted to establish a hard link between the replica database and the second directory.
A first hard link deletion module 34 is adapted to delete the hard link of the replica database to the first directory.
For a specific implementation of each module in the device for deleting a replica database in a distributed system in this embodiment, reference may be made to the description in the embodiment of the method for deleting a replica database in a distributed system shown in fig. 1 or fig. 2, which is not described herein again.
According to the deleting device of the duplicate database in the distributed system provided by the embodiment, firstly, a recovery folder is configured in a file system in advance; when a deleting operation of the duplicate database is received, acquiring a first directory which is in hard link with the duplicate database, and establishing a second directory under a recovery folder according to the first directory; establishing a hard link between the replica database and the second directory; the hard link of the replica database to the first directory is deleted. By adopting the scheme, after the duplicate database is deleted, the position or the content of the duplicate database in the storage node or the partition is not changed, so that the duplicate database is convenient to restore, the risk of mistakenly deleting the duplicate database is reduced, and the loss caused by the fact that the duplicate database cannot be restored after being mistakenly deleted in the prior art is avoided.
Fig. 4 is a block diagram illustrating a structure of a device for deleting a replica database in a distributed system according to another embodiment of the present invention. As shown in fig. 4, the apparatus further includes, in addition to the apparatus shown in fig. 3: a second directory establishing module 41, a second hard link establishing module 42, a second hard link deleting module 43, a complete deleting module 44, a restoring module 45, and a clearing module 46.
The second directory establishing module 41 is adapted to, when a delete operation on the duplicate database is received, acquire a log file corresponding to the duplicate database and a third directory in which a hard link has been established with the log file, and establish a fourth directory under the recycle folder according to the third directory.
A second hard link establishing module 42 adapted to establish a hard link between the log file corresponding to the replica database and the fourth directory;
and a second hard link deletion module 43 adapted to delete the hard link between the log file corresponding to the replica database and the third directory.
A complete delete module 44 adapted to delete the hard link of the duplicate database with the second directory according to a complete delete command for the duplicate database executed under the recycle folder; and deleting the hard link between the log file corresponding to the duplicate database and the fourth directory.
A recovery module 45 adapted to reconstruct the hard link between the replica database and the first directory according to the hard link between the replica database and the second directory, according to a recovery command for the replica database; and reconstructing the hard link between the log file corresponding to the duplicate database and the third directory according to the hard link between the log file corresponding to the duplicate database and the fourth directory.
And the clearing module 46 is adapted to clear all the second directories and all the fourth log directories under the recycle folder according to the recycle folder clear command.
For a specific implementation of each module in the device for deleting a replica database in a distributed system in this embodiment, reference may be made to the description in the embodiment of the method for deleting a replica database in a distributed system shown in fig. 1 or fig. 2, which is not described herein again.
According to the deleting device of the duplicate database in the distributed system provided by the embodiment, firstly, a recovery folder is configured in a file system in advance; when a deleting operation of the duplicate database is received, acquiring a first directory which is in hard link with the duplicate database, establishing a second directory under a recovery folder according to the first directory, acquiring a log file corresponding to the duplicate database and a third directory which is in hard link with the log file, and establishing a fourth directory under the recovery folder according to the third directory; establishing a hard link between the duplicate database and the second directory, and establishing a hard link between a log file corresponding to the duplicate database and the fourth directory; and then deleting the hard link between the duplicate database and the first directory, and deleting the hard link between the log file corresponding to the duplicate database and the third directory. Therefore, after the duplicate database is deleted, the position or the content of the duplicate database in the storage node or the partition is not changed, so that the duplicate database is convenient to recover, the risk of mistakenly deleting the duplicate database is reduced, and the loss caused by the fact that the duplicate database cannot be recovered after being mistakenly deleted in the prior art is avoided; further, the hard link of the duplicate database with the second directory may be deleted for a complete delete command against the duplicate database executed under the recycle folder; deleting the hard link between the log file corresponding to the duplicate database and the fourth directory, so as to realize the complete deletion of the duplicate database and the log file; according to a recovery command aiming at the copy database, and according to the hard link between the copy database and the second directory, the hard link between the copy database and the first directory is rebuilt; according to the hard link between the log file corresponding to the duplicate database and the fourth directory, the hard link between the log file corresponding to the duplicate database and the fourth directory is rebuilt, and the deleted duplicate database and the log file can be automatically recovered; and in addition, all second directories and all fourth directories under the recovery folder can be emptied according to the recovery folder emptying command, so that batch deletion of the duplicate database and the log files is realized.
According to an embodiment of the present invention, a non-volatile computer storage medium is provided, where the computer storage medium stores at least one executable instruction, and the computer executable instruction can execute the method for deleting the replica database in the distributed system in any method embodiment.
According to an embodiment of the present invention, a schematic structural diagram of a computing device is provided, and the specific embodiment of the present invention does not limit the specific implementation of the computing device.
As shown in fig. 5, the computing device may include: a processor (processor)502, a Communications Interface 504, a memory 506, and a communication bus 508.
Wherein:
the processor 502, communication interface 504, and memory 506 communicate with one another via a communication bus 508.
A communication interface 504 for communicating with network elements of other devices, such as clients or other servers.
The processor 502 is configured to execute the program 510, and may specifically perform relevant steps in the foregoing deletion method embodiment of the duplicate database in the distributed system.
In particular, program 510 may include program code that includes computer operating instructions.
The processor 502 may be a central processing unit CPU, or an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits configured to implement an embodiment of the present invention. The computing device includes one or more processors, which may be the same type of processor, such as one or more CPUs; or may be different types of processors such as one or more CPUs and one or more ASICs.
And a memory 506 for storing a program 510. The memory 506 may comprise high-speed RAM memory, and may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
The program 510 may specifically be used to cause the processor 502 to perform the following operations:
a recovery folder is configured in a file system in advance;
when a deleting operation of a duplicate database is received, acquiring a first directory which is in hard link with the duplicate database, and establishing a second directory under the recovery folder according to the first directory;
establishing a hard link between the replica database and the second directory;
deleting the hard link of the replica database to the first directory.
In an alternative embodiment, the program 510 may be specifically configured to cause the processor 502 to perform the following operations:
when a deleting operation of a duplicate database is received, acquiring a log file corresponding to the duplicate database and a third directory which is in hard link with the log file, and establishing a fourth directory under the recovery folder according to the third directory;
establishing a hard link between a log file corresponding to the replica database and the fourth directory;
and deleting the hard link between the log file corresponding to the duplicate database and the third directory.
In an alternative embodiment, the program 510 may be specifically configured to cause the processor 502 to perform the following operations:
deleting the hard link of the duplicate database and the second directory according to a complete deletion command aiming at the duplicate database executed under a recovery folder; and deleting the hard link between the log file corresponding to the duplicate database and the fourth directory.
In an alternative embodiment, the program 510 may be specifically configured to cause the processor 502 to perform the following operations:
according to a recovery command aiming at the replica database, according to a hard link between the replica database and a second directory, rebuilding the hard link between the replica database and the first directory; and rebuilding the hard link between the log file corresponding to the replica database and the third directory according to the hard link between the log file corresponding to the replica database and the fourth directory.
In an alternative embodiment, the program 510 may be specifically configured to cause the processor 502 to perform the following operations:
and clearing all second directories and all fourth directories under the recovery folder according to the recovery folder clearing command.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the claims, any of the claimed embodiments may be used in any combination.
The various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It will be appreciated by those skilled in the art that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components of the means for deleting duplicate databases in a distributed system according to embodiments of the present invention. The present invention may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.

Claims (12)

1. A method for deleting a duplicate database in a distributed system comprises the following steps:
a recovery folder is configured in a file system in advance; the recovery folder is subjected to implicit display after configuration, and is subjected to explicit display when a directory is contained in the recovery folder;
when a deleting operation of a duplicate database is received, acquiring a first directory which is in hard link with the duplicate database, and establishing a second directory under the recovery folder according to the first directory;
establishing a hard link between the replica database and the second directory;
deleting the hard link of the replica database and the first directory;
wherein the location or content of the replica database remains unchanged;
wherein, after the deleting the hard link of the replica database to the first directory, the method further comprises:
when a user triggers a complete deletion command for the duplicate database, sending prompt information about the duplicate database to be completely deleted in a popup mode;
after a user executes a complete deletion determination operation for the prompt information, deleting the hard link between the duplicate database and the second directory;
and after the user executes a return operation aiming at the prompt message, the hard link between the copy database and the second directory is not deleted.
2. The method of claim 1, wherein the method further comprises:
when a deleting operation of a duplicate database is received, acquiring a log file corresponding to the duplicate database and a third directory which is in hard link with the log file, and establishing a fourth directory under the recovery folder according to the third directory;
establishing a hard link between a log file corresponding to the replica database and the fourth directory;
and deleting the hard link between the log file corresponding to the duplicate database and the third directory.
3. The method of claim 2, wherein after said deleting the hard link of the replica database to the first directory, the method further comprises:
and deleting the hard link between the log file corresponding to the duplicate database and the fourth directory.
4. The method of claim 2, wherein after said deleting the hard link of the replica database to the first directory, the method further comprises:
according to a recovery command aiming at the replica database, according to a hard link between the replica database and a second directory, rebuilding the hard link between the replica database and the first directory; and rebuilding the hard link between the log file corresponding to the replica database and the third directory according to the hard link between the log file corresponding to the replica database and the fourth directory.
5. The method of any of claims 2-4, wherein after the deleting the hard link of the replica database to the first directory, the method further comprises:
and clearing all second directories and all fourth directories under the recovery folder according to the recovery folder clearing command.
6. A device for deleting duplicate databases in a distributed system, comprising:
the preset module is suitable for pre-configuring a recovery folder in a file system; the recovery folder is subjected to implicit display after configuration, and is subjected to explicit display when a directory is contained in the recovery folder;
the first directory establishing module is suitable for acquiring a first directory which is in hard link with a duplicate database when a deleting operation of the duplicate database is received, and establishing a second directory under the recovery folder according to the first directory;
a first hard link establishing module, adapted to establish a hard link between the replica database and the second directory;
a first hard link deletion module adapted to delete a hard link of the replica database with the first directory; wherein the location or content of the replica database remains unchanged;
the complete deletion module is suitable for sending prompt information about complete deletion of the duplicate database in a popup window mode when a user triggers a complete deletion command for the duplicate database; after a user executes a complete deletion determination operation for the prompt information, deleting the hard link between the duplicate database and the second directory; and after the user executes a return operation aiming at the prompt message, the hard link between the copy database and the second directory is not deleted.
7. The apparatus of claim 6, wherein the apparatus further comprises:
the second directory establishing module is suitable for acquiring a log file corresponding to the duplicate database and a third directory which is in hard link with the log file when a deleting operation of the duplicate database is received, and establishing a fourth directory under the recovery folder according to the third directory;
the second hard link establishing module is suitable for establishing a hard link between the log file corresponding to the replica database and the fourth directory;
and the second hard link deleting module is suitable for deleting the hard link between the log file corresponding to the duplicate database and the third directory.
8. The apparatus of claim 7, wherein the apparatus further comprises:
and the complete deletion module is suitable for deleting the hard link between the log file corresponding to the duplicate database and the fourth directory according to a complete deletion command aiming at the duplicate database executed under the recovery folder.
9. The apparatus of claim 7, wherein the apparatus further comprises:
a recovery module adapted to reconstruct a hard link between the replica database and the first directory according to a recovery command for the replica database and according to a hard link between the replica database and the second directory; and rebuilding the hard link between the log file corresponding to the replica database and the third directory according to the hard link between the log file corresponding to the replica database and the fourth directory.
10. The apparatus of any of claims 7-9, wherein the apparatus further comprises:
and the emptying module is suitable for emptying all the second directories and all the fourth directories under the recovery folders according to the recovery folder emptying command.
11. A computing device, comprising: the system comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete mutual communication through the communication bus;
the memory is used for storing at least one executable instruction, and the executable instruction causes the processor to execute the operation corresponding to the deleting method of the duplicate database in the distributed system according to any one of claims 1-5.
12. A computer storage medium having stored therein at least one executable instruction for causing a processor to perform operations corresponding to a method for deleting a replica database in a distributed system as recited in any one of claims 1 to 5.
CN201711486360.7A 2017-12-29 2017-12-29 Method and device for deleting duplicate database in distributed system Active CN108228813B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711486360.7A CN108228813B (en) 2017-12-29 2017-12-29 Method and device for deleting duplicate database in distributed system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711486360.7A CN108228813B (en) 2017-12-29 2017-12-29 Method and device for deleting duplicate database in distributed system

Publications (2)

Publication Number Publication Date
CN108228813A CN108228813A (en) 2018-06-29
CN108228813B true CN108228813B (en) 2021-08-24

Family

ID=62647394

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711486360.7A Active CN108228813B (en) 2017-12-29 2017-12-29 Method and device for deleting duplicate database in distributed system

Country Status (1)

Country Link
CN (1) CN108228813B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111258954B (en) * 2020-01-10 2023-12-05 北京百度网讯科技有限公司 Data migration method, device, equipment and storage medium
CN114564456B (en) * 2022-03-03 2022-09-23 北京天融信网络安全技术有限公司 Distributed storage file recovery method and device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101937377A (en) * 2009-06-29 2011-01-05 百度在线网络技术(北京)有限公司 Data recovery method and device
CN103473296A (en) * 2013-09-04 2013-12-25 国云科技股份有限公司 Recycle bin mechanism and recycle bin system applicable to cloud computing
CN103973731A (en) * 2013-01-29 2014-08-06 中兴通讯股份有限公司 Method and device for managing cloud storage recycle bin
US9098520B2 (en) * 2012-04-03 2015-08-04 Baloota Applications Ltd. Apparatus and methods for restoring data objects
CN104991834A (en) * 2015-05-27 2015-10-21 努比亚技术有限公司 Data recycle method and mobile terminal
CN107239521A (en) * 2017-05-26 2017-10-10 郑州云海信息技术有限公司 Recycle bin application process and system on a kind of distributed type assemblies

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102662981B (en) * 2012-03-13 2014-04-16 中国人民大学 Windows recycle bin delete record forensics method based on feature scan
CN107066349A (en) * 2017-01-20 2017-08-18 郑州云海信息技术有限公司 A kind of method and system of cluster file system data protection

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101937377A (en) * 2009-06-29 2011-01-05 百度在线网络技术(北京)有限公司 Data recovery method and device
US9098520B2 (en) * 2012-04-03 2015-08-04 Baloota Applications Ltd. Apparatus and methods for restoring data objects
CN103973731A (en) * 2013-01-29 2014-08-06 中兴通讯股份有限公司 Method and device for managing cloud storage recycle bin
CN103473296A (en) * 2013-09-04 2013-12-25 国云科技股份有限公司 Recycle bin mechanism and recycle bin system applicable to cloud computing
CN104991834A (en) * 2015-05-27 2015-10-21 努比亚技术有限公司 Data recycle method and mobile terminal
CN107239521A (en) * 2017-05-26 2017-10-10 郑州云海信息技术有限公司 Recycle bin application process and system on a kind of distributed type assemblies

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Recycled文件夹的技术实质探索;邓波;《四川经济管理学院学报》;20030215;全文 *

Also Published As

Publication number Publication date
CN108228813A (en) 2018-06-29

Similar Documents

Publication Publication Date Title
CN107391628B (en) Data synchronization method and device
US11003437B2 (en) Automated transparent distribution of updates to server computer systems in a fleet
US20170124103A1 (en) Method and Apparatus for Creating System Disk Snapshot of Virtual Machine
US20120158662A1 (en) Backup and restore of data from any cluster node
CN109818934B (en) Method and device for automatically processing logs and computing equipment
CN105630632A (en) Virtual machine recovery method and virtual machine management device
CN109445861A (en) System start method, device, computer installation and storage medium
CN110968478B (en) Log acquisition method, server and computer storage medium
US20140222761A1 (en) Terminal Backup and Recovery Method
CN107783770B (en) Page configuration updating method, device, server and medium
CN110753084A (en) Uplink data reading method, cache server and computer readable storage medium
CN108228813B (en) Method and device for deleting duplicate database in distributed system
CN111200634A (en) Cache resource linkage updating method, system and server
CN108121774B (en) Data table backup method and terminal equipment
CN104486448B (en) A kind of data processing method and device
US20150220517A1 (en) Efficient conflict resolution among stateless processes
CN109361553B (en) Configuration rollback method and device
US9483485B1 (en) Restore database from backup system where full and incremental backups are performed simultaneously
CN108121514B (en) Meta information updating method and device, computing equipment and computer storage medium
CN111708835A (en) Block chain data storage method and device
CN109669815A (en) A kind of method and system restored by the long-range Mapping implementation Backup Data of LUN
CN108090128B (en) Recovery method and device for merged storage space and electronic equipment
CN110765144B (en) Distributed heterogeneous database data processing method and device
US10242025B2 (en) Efficient differential techniques for metafiles
WO2020060627A1 (en) Applying a log to storage segments

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant