A data deletion method, device, equipment and readable storage medium
Patent Information
- Application Number
- CN202310454045.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-24
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2043-04-24
AI Technical Summary
但存在以下问题:被删除的文件索引信息数据量大、删除的数据零散无序,导致删除操作时间长、效率低,无法对用户的删除操作进行快速的响应,用户体验差;其次,由于数据库中被删除的数据量大,导致删除操作时间长,因此在删除过程中会影响数据库的当前读写性能,使数据库读写性能下降
[0034]以上数据删除方法、装置、设备和可读存储介质,响应于数据删除请求,执行磁盘中对应的磁盘文件以及数据库中所述磁盘文件对应的第一索引信息的同步删除操作,在所述数据库没有执行读写操作的情况下,执行所述数据库中所述磁盘文件对应的第二索引信息的异步删除操作。本申请通过对磁盘文件以及数据库中所述磁盘文件对应的第一索引信息进行同步删除操作,实现了对用户数据删除请求的快速响应,达到快速删除磁盘文件的效果,提高用户体验。同时在所述数据库没有执行读写操作的情况下,执行所述数据库中所述磁盘文件对应的第二索引信息的异步删除操作,通过降低数据库删除操作执行的优先级,为数据库实时读写操作让行,保证数据库实时读写业务性能最优。
Smart Images

Figure CN116627323B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of database data processing, and more particularly to a data deletion method, apparatus, device, and readable storage medium. Background Technology
[0002] Security data mainly includes video recordings and images, characterized by its large volume. Security storage devices typically store this large amount of data as files on a disk, while simultaneously storing index information for the corresponding files in a database to facilitate quick and accurate data retrieval.
[0003] In existing technologies, when deleting a disk file, the corresponding file index information in the database needs to be deleted. However, this presents the following problems: the deleted file index information is large in volume and the deleted data is scattered and disordered, resulting in long deletion operation time, low efficiency, and an inability to quickly respond to user deletion operations, leading to a poor user experience; secondly, because the amount of data to be deleted in the database is large, the deletion operation takes a long time, which affects the current read and write performance of the database during the deletion process, causing a decrease in database read and write performance. Summary of the Invention
[0004] Therefore, it is necessary to provide a data deletion method, apparatus, device, and readable storage medium to address the aforementioned technical problems.
[0005] In a first aspect, embodiments of this application provide a data deletion method, the method comprising:
[0006] In response to a data deletion request, perform a synchronous deletion operation on the corresponding disk file in the disk and the first index information corresponding to the disk file in the database;
[0007] If no read or write operation is performed on the database, an asynchronous deletion operation is performed on the second index information corresponding to the disk file in the database.
[0008] In one embodiment, the step of synchronously deleting the corresponding disk file in the disk and the first index information corresponding to the disk file in the database in response to the data deletion request includes:
[0009] In response to a data deletion request, the filename corresponding to the disk file in the database is obtained, and the filename is stored in the first cache queue;
[0010] Based on the filename, determine the first index information corresponding to the disk file;
[0011] Perform a synchronous deletion operation on the corresponding disk file in the disk and the first index information corresponding to the disk file in the database.
[0012] In one embodiment, the asynchronous deletion operation of the second index information corresponding to the disk file in the database when no read or write operation is performed in the database includes:
[0013] Based on the filename, determine the second index information corresponding to the disk file in the database;
[0014] If no read or write operation is performed on the database, an asynchronous deletion operation is performed on the second index information corresponding to the disk file in the database.
[0015] In one embodiment, the asynchronous deletion operation of the second index information corresponding to the disk file in the database when no read or write operation is performed in the database includes:
[0016] The unique identifier of the second index information corresponding to the disk file in the database is stored in the second cache queue, and the unique identifier is sorted; the unique identifier is the database writing order of the second index information corresponding to the disk file in the database.
[0017] Based on the sorted unique identifier, the deletion order of the second index information corresponding to the disk file in the database is determined;
[0018] If no read or write operations are performed on the database, an asynchronous deletion operation is performed on the second index information corresponding to the disk file in the database based on the deletion order.
[0019] In one embodiment, sorting the unique identifier includes:
[0020] Determine whether the second cache queue has any newly added unique identifiers within a preset time period;
[0021] If not, then sort the unique identifiers;
[0022] If so, then sort the newly added unique identifiers.
[0023] In one embodiment, the asynchronous deletion operation of the second index information corresponding to the disk file in the database based on the deletion order includes:
[0024] Determine the single deletion amount of the second index information corresponding to the disk file in the database;
[0025] Based on the single deletion amount of the second index information corresponding to the disk file in the database, at least one asynchronous deletion operation is performed on the second index information corresponding to the disk file in the database.
[0026] In one embodiment, the asynchronous deletion operation of executing at least one instance of the second index information corresponding to the disk file in the database includes:
[0027] If the database is performing read / write operations, then at least one asynchronous deletion operation of the second index information corresponding to the disk file in the database is paused;
[0028] After the database completes its read and write operations, at least one asynchronous deletion operation is performed on the second index information corresponding to the disk file in the database.
[0029] Secondly, embodiments of this application also provide a data deletion device, the device comprising:
[0030] The synchronous deletion module is used to respond to a data deletion request by performing a synchronous deletion operation on the corresponding disk file in the disk and the first index information corresponding to the disk file in the database.
[0031] The asynchronous deletion module is used to perform an asynchronous deletion operation on the second index information corresponding to the disk file in the database when no read or write operations are performed on the database.
[0032] Thirdly, embodiments of this application also provide a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the software number information storage method as described in the first aspect above.
[0033] Fourthly, embodiments of this application also provide a readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the software number information storage method described in the first aspect above.
[0034] The above-described data deletion method, apparatus, device, and readable storage medium, in response to a data deletion request, perform synchronous deletion operations on the corresponding disk file in the disk and the first index information corresponding to the disk file in the database. If no read / write operation is being performed on the database, an asynchronous deletion operation is performed on the second index information corresponding to the disk file in the database. This application achieves a rapid response to user data deletion requests by synchronously deleting the disk file and the first index information corresponding to the disk file in the database, thus improving the user experience. Simultaneously, by performing an asynchronous deletion operation on the second index information corresponding to the disk file in the database when no read / write operation is being performed on the database, the priority of the database deletion operation is reduced, allowing real-time database read / write operations to take precedence and ensuring optimal performance for real-time database read / write services.
[0035] Details of one or more embodiments of this application are set forth in the following drawings and description to make other features, objects and advantages of this application more readily apparent. Attached Figure Description
[0036] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0037] Figure 1 This is a schematic diagram of the application environment of the data deletion method according to the embodiments of this application;
[0038] Figure 2 This is a flowchart of a data deletion method according to an embodiment of this application;
[0039] Figure 3 This is a schematic diagram illustrating the relationship between disk files and corresponding index information in the database according to an embodiment of this application;
[0040] Figure 4 This is a flowchart illustrating the synchronous deletion operation of the corresponding disk file in the disk and the first index information corresponding to the disk file in the database, according to an embodiment of this application.
[0041] Figure 5 This is a flowchart illustrating the asynchronous deletion operation of the second index information corresponding to the disk file in the database according to an embodiment of this application;
[0042] Figure 6 This is a flowchart illustrating an asynchronous deletion operation of the second index information corresponding to the disk file in the database, according to another embodiment of this application.
[0043] Figure 7 This is a preferred flowchart of a data deletion method according to an embodiment of this application;
[0044] Figure 8 This is a schematic flowchart of a data deletion apparatus according to an embodiment of this application;
[0045] Figure 9 This is a schematic diagram of a computer device structure according to an embodiment of this application. Detailed Implementation
[0046] To make the objectives, technical solutions, and advantages of this application clearer, the application is described and illustrated below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application. All other embodiments obtained by those skilled in the art based on the embodiments provided in this application without inventive effort are within the scope of protection of this application.
[0047] Obviously, the accompanying drawings described below are merely some examples or embodiments of this application. Those skilled in the art can apply this application to other similar scenarios based on these drawings without any inventive effort. Furthermore, it is understood that although the efforts made in this development process may be complex and lengthy, for those skilled in the art related to the content disclosed in this application, any changes to design, manufacturing, or production based on the technical content disclosed in this application are merely conventional technical means and should not be construed as insufficient disclosure of the content of this application.
[0048] In this application, the reference to "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment that is mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments without conflict.
[0049] Unless otherwise defined, the technical or scientific terms used in this application shall have the ordinary meaning understood by one of ordinary skill in the art to which this application pertains. The terms “a,” “an,” “an,” “the,” and similar words used in this application do not indicate quantity limitation and may indicate singular or plural. The terms “comprising,” “including,” “having,” and any variations thereof used in this application are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units not listed, or may include other steps or units inherent to these processes, methods, products, or devices. The terms “connected,” “linked,” “coupled,” and similar words used in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. “Multiple” used in this application refers to two or more. “And / or” describes the relationship between related objects, indicating that three relationships may exist; for example, “A and / or B” can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following objects are in an "or" relationship. The terms "first," "second," and "third" used in this application are merely to distinguish similar objects and do not represent a specific ordering of the objects.
[0050] The data deletion method provided in this application embodiment can be applied to, for example, Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104, or it can be located in the cloud or on other network servers. Terminal 102 can be, but is not limited to, various personal computers, laptops, tablets, etc. Server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.
[0051] This embodiment provides a data deletion method, such as Figure 2 As shown, the method includes the following steps:
[0052] Step S201: In response to the data deletion request, perform a synchronous deletion operation on the corresponding disk file in the disk and the first index information corresponding to the disk file in the database.
[0053] It is important to know that, such as Figure 3As shown, the disk files stored on the disks (Disk 1, Disk 2...Disk N) include security data-related files such as images and videos (File1.dav, File2.jpg...File100.dav). When users store images, videos, and other security data on the disks, corresponding image indexes, video indexes, and other security data indexes are simultaneously stored in the security storage device database (Database1, Database2...DatabaseN) to facilitate convenient, fast, and accurate retrieval of security data such as images and videos. The index information includes first index information corresponding to the disk files stored in the database, indicating the correspondence between disk files and disks, and second index information corresponding to the disk files stored in the database, indicating the location information of the data in the disk files on the disk, such as the location information of each event in the video file and the location information of each image in the image file. The first index information corresponding to the disk files has a smaller data volume, while the second index information corresponding to the disk files has a larger data volume. For example, if there is a 4GB image file on the disk, there is a first index record for the image file in the database. The first index record contains information related to the disk file and has a small data volume. Suppose that the image file corresponds to 10,000 images, then there are 10,000 second index records for the 10,000 images in the database. The second index records contain information related to the 10,000 images and has a large data volume. In other words, for this image file on the disk, there is one record of the first index record and 10,000 records of the second index record in the database.
[0054] Specifically, data deletion requests include disk formatting, disk full overwrite, and user-initiated deletion of disk files. When a user performs disk formatting, disk full overwrite, or actively deletes disk files, in response to the data deletion request, the corresponding disk files on the disk and the first index information corresponding to the disk files in the database are deleted synchronously.
[0055] Step S202: If no read or write operation is performed on the database, perform an asynchronous deletion operation on the second index information corresponding to the disk file in the database.
[0056] Monitor the current read and write operations in the database. If the second index information table corresponding to the disk file in the database has not performed any database read or write operations such as reading data, writing data, updating or modifying data in the current state, then the second index information corresponding to the disk file in the database will be deleted asynchronously.
[0057] Steps S201 to S202 above involve synchronously deleting the corresponding disk file in the disk and the corresponding first index information in the database in response to a data deletion request. Since the amount of data in the first index information of the disk file in the database is small, upon receiving a data deletion request, the corresponding disk file in the disk and the corresponding first index information in the database are deleted synchronously to respond promptly. This achieves fast deletion of the disk file, making it invisible to the user and thus providing a rapid response to the user's deletion operation, improving the user experience. In contrast, related technologies typically require deleting both the first and second-level index information of the disk file in the database before the disk file becomes invisible to the user. Because the amount of data in the second index information is large, the deletion speed is slow, resulting in a poor user experience and an inability to respond quickly to the user's deletion operation. When no read or write operations are performed on the database, an asynchronous deletion operation is performed on the second index information corresponding to the disk file in the database. By monitoring the current read and write status of the database before performing the database deletion operation, and performing the deletion operation when no read or write operations are performed on the database, the priority of the database deletion operation is reduced to give way to real-time database read and write operations, thus ensuring optimal performance of real-time database read and write services.
[0058] In one embodiment, such as Figure 4 The step of synchronously deleting the corresponding disk file in the disk and the first index information corresponding to the disk file in the database in response to the data deletion request includes the following steps:
[0059] Step S301: In response to the data deletion request, obtain the filename corresponding to the disk file and store the filename in the first cache queue;
[0060] Each disk file has a corresponding filename. When a disk file is deleted, the filename of the disk file is obtained and stored in the first cache queue. The filename is used to retrieve the first index information corresponding to the disk file.
[0061] Step S302: Based on the filename, determine the first index information corresponding to the disk file in the database;
[0062] Based on the filename in the first cache queue, retrieve the first index information corresponding to the disk file, and determine the first index information corresponding to the disk file.
[0063] Step S303: Perform a synchronous deletion operation on the corresponding disk file in the disk and the first index information corresponding to the disk file in the database.
[0064] In this embodiment, by performing a synchronous deletion operation on the corresponding disk file in the disk and the first index information corresponding to the disk file in the database, a fast response to the user's deletion operation is achieved, thereby improving the user experience.
[0065] In one embodiment, such as Figure 5 As shown, the asynchronous deletion operation of the second index information corresponding to the disk file in the database when no read or write operation is performed includes:
[0066] Step S401: Based on the filename, determine the second index information corresponding to the disk file in the database;
[0067] Based on the filename in the first cache queue, retrieve the second index information corresponding to the disk file, and determine the second index information corresponding to the disk file.
[0068] Step S402: If no read or write operation is performed on the database, perform an asynchronous deletion operation on the second index information corresponding to the disk file in the database.
[0069] In this embodiment, by performing an asynchronous deletion operation on the second index information corresponding to the disk file in the database when no read or write operations are being performed in the database, the priority of the database deletion operation is reduced to give way to real-time database read and write operations, thus ensuring optimal performance of real-time database read and write services.
[0070] In one embodiment, such as Figure 6 As shown, the asynchronous deletion operation of the second index information corresponding to the disk file in the database when no read or write operation is performed includes the following steps:
[0071] Step S501: Store the unique identifier of the second index information corresponding to the disk file in the database into the second cache queue, and sort the unique identifier; the unique identifier is the database writing order of the second index information corresponding to the disk file in the database;
[0072] The unique identifier of the second index information is the rowid field in the second index information table. The rowid field is equivalent to the database write order of the second index information corresponding to the disk file. The rowid field can be used to quickly locate the position of a specific row of data.
[0073] Step S502: Based on the sorted unique identifier, determine the deletion order of the second index information corresponding to the disk file in the database;
[0074] By sorting the unique identifier rowid field in the second index information corresponding to the disk file, the order in which the second index information corresponding to the rowid field was written to the database can be obtained, and this order can be used as the deletion order of the second index information corresponding to the disk file in the database.
[0075] Step S503: If no read or write operation is performed on the database, perform an asynchronous deletion operation on the second index information corresponding to the disk file in the database based on the deletion order.
[0076] In this embodiment, the deletion order of the second index information corresponding to the disk file in the database is determined by sorting the unique identifier rowid field in the second index information corresponding to the disk file. The deletion order is based on the order in which the second index information corresponding to the disk file is written to the database, thereby achieving continuous data deletion as much as possible and greatly improving the deletion efficiency compared to scattered deletion.
[0077] In one embodiment, sorting the unique identifier includes:
[0078] Determine whether the second cache queue has any newly added unique identifiers within a preset time period;
[0079] In this embodiment, the preset time period can be 2 seconds, 3 seconds, 5 seconds or other values. Before performing the asynchronous deletion operation of the second index information corresponding to the disk file in the database, it is determined whether the second cache queue has added the unique identifier within the preset time period.
[0080] If not, then sort the unique identifiers;
[0081] If so, then sort the newly added unique identifiers.
[0082] In this embodiment, when the second cache queue has newly added unique identifiers within a preset time, sorting the newly added unique identifiers can achieve continuous data deletion in the database, which greatly improves the deletion efficiency compared to scattered deletion.
[0083] In one embodiment, the asynchronous deletion operation of executing at least one instance of the second index information corresponding to the disk file in the database includes:
[0084] If the database is performing read / write operations, then at least one asynchronous deletion operation of the second index information corresponding to the disk file in the database is paused;
[0085] After the database completes its read and write operations, at least one asynchronous deletion operation is performed on the second index information corresponding to the disk file in the database.
[0086] This embodiment manages the database data deletion process in a unified manner, refines the control over the amount of data deleted each time, avoids long deletion operations, avoids the problem of long deletion operations affecting the real-time read and write performance of the database, and ensures optimal performance of real-time database read and write services by giving way to real-time database read and write operations by reducing the execution priority of database deletion operations.
[0087] The present embodiment will now be described and illustrated through preferred embodiments.
[0088] Figure 7 This is a preferred flowchart of the data deletion method in this embodiment, such as... Figure 7 As shown, the data deletion includes the following steps:
[0089] Step S601: In response to the data deletion request, obtain the filename corresponding to the disk file and store the filename in the first cache queue;
[0090] Step S602: Based on the filename, determine the first index information corresponding to the disk file in the database;
[0091] Step S603: Perform a synchronous deletion operation on the corresponding disk file in the disk and the first index information corresponding to the disk file in the database;
[0092] Step S604: Based on the filename, determine the second index information corresponding to the disk file in the database;
[0093] Step S605: Store the rowid field in the second index information table corresponding to the disk file to the second cache queue;
[0094] Step S606: Determine whether the second cache queue has a newly added rowid field within a preset time period;
[0095] For example, if the preset time is 10 seconds, then check whether there is a newly added rowid field in the second cache queue within 10 seconds.
[0096] If no new rowid field is added to the second cache queue within 10 seconds, then proceed to step S607.
[0097] If a new rowid field is added to the second cache queue within 10 seconds, then proceed to step S608.
[0098] Step S607: Sort the rowid field.
[0099] Step S608: Continue waiting for the second cache queue to add a rowid field until the second cache queue has no new rowid field added within 10 seconds, and then sort the newly added rowid field.
[0100] Step S609: Determine the single deletion amount of the second index information corresponding to the disk file in the database;
[0101] For example, the number of deletions per batch can be set to 1000, 2000, or other values.
[0102] Step S610: Determine whether the database is currently performing read / write operations;
[0103] The read / write status of a database can be checked using database commands, such as the `show processlist` command in MySQL. MySQL is a relational database management system, characterized by its open-source and lightweight nature, and is currently the relational database with the most running instances. For a MySQL connection, or a thread, there is always a state indicating what MySQL is currently doing. The `show processlist` command in MySQL can display currently running threads. Other methods can also be used to check the current read / write status of the database.
[0104] If so, proceed to step S611.
[0105] Step S611: Continue to wait until the database read / write operation is completed, and then execute step S612;
[0106] Step S612: Perform at least one asynchronous deletion operation on the second index information corresponding to the disk file in the database.
[0107] If not, proceed to step S612.
[0108] During the execution of at least one asynchronous deletion operation of the second index information corresponding to the disk file in the database, before each deletion operation, it is necessary to determine whether the database is currently performing read / write operations. If not, an asynchronous deletion operation of the second index information corresponding to the disk file in the database is executed. If so, the process continues to wait until the database read / write operation ends, and then the next asynchronous deletion operation of the second index information corresponding to the disk file in the database is executed.
[0109] This embodiment responds to data deletion requests by synchronously deleting the corresponding disk file on the disk and the first index information corresponding to the disk file in the database. This enables rapid response to user operations such as disk formatting, disk overwriting, and active deletion of disk files, improving user experience. Data deletion is aggregated and optimized by sorting by the rowid field and using the order in which the second index information was written to the database as the deletion order. This achieves continuous data deletion as much as possible, significantly improving deletion efficiency compared to piecemeal deletion. The amount of data deleted each time is carefully controlled to ensure rapid response during deletion operations, preventing blockage or impact on database read / write performance due to batch deletion of large amounts of data at the application layer. Before each refined deletion operation, the current read / write status of the database is monitored. If the database is currently reading or writing, the priority of the deletion operation is reduced to allow other read / write operations to proceed, prioritizing optimal performance for real-time read / write services.
[0110] This embodiment provides a data deletion device, such as... Figure 8 As shown, the device includes:
[0111] The synchronous deletion module 710 is used to respond to a data deletion request by performing a synchronous deletion operation on the corresponding disk file in the disk and the first index information corresponding to the disk file in the database.
[0112] The asynchronous deletion module 720 is used to perform an asynchronous deletion operation on the second index information corresponding to the disk file in the database when no read or write operation is performed in the database.
[0113] The apparatus provided in this embodiment, in response to a data deletion request, performs a synchronous deletion operation on the corresponding disk file in the disk and the first index information corresponding to the disk file in the database. When no read / write operation is being performed on the database, an asynchronous deletion operation is performed on the second index information corresponding to the disk file in the database. This application achieves a rapid response to user data deletion requests by synchronously deleting the disk file and the first index information corresponding to the disk file in the database, thus improving the user experience. Simultaneously, by performing an asynchronous deletion operation on the second index information corresponding to the disk file in the database when no read / write operation is being performed, the priority of the database deletion operation is lowered, allowing real-time database read / write operations to take precedence and ensuring optimal performance for real-time database read / write services.
[0114] The synchronous deletion module 710 is further configured to, in response to a data deletion request, obtain the filename corresponding to the disk file and store the filename in a first cache queue;
[0115] Based on the filename, determine the first index information corresponding to the disk file in the data;
[0116] Perform a synchronous deletion operation on the corresponding disk file in the disk and the first index information corresponding to the disk file in the database.
[0117] The asynchronous deletion module 720 is further configured to determine the second index information corresponding to the disk file in the database based on the file name;
[0118] If no read or write operation is performed on the database, an asynchronous deletion operation is performed on the second index information corresponding to the disk file in the database.
[0119] The asynchronous deletion module 720 is further configured to store the unique identifier of the second index information corresponding to the disk file in the database into the second cache queue, and sort the unique identifier; the unique identifier is the database writing order of the second index information corresponding to the disk file in the database;
[0120] Based on the sorted unique identifier, the deletion order of the second index information corresponding to the disk file in the database is determined;
[0121] If no read or write operations are performed on the database, an asynchronous deletion operation is performed on the second index information corresponding to the disk file in the database based on the deletion order.
[0122] The asynchronous deletion module 720 is also used to determine whether the second cache queue has a newly added unique identifier within a preset time.
[0123] If not, then sort the unique identifiers;
[0124] If so, then sort the newly added unique identifiers.
[0125] The asynchronous deletion module 720 is also used to determine the amount of deletion in a single operation of the second index information corresponding to the disk file in the database;
[0126] Based on the single deletion amount of the second index information corresponding to the disk file in the database, at least one asynchronous deletion operation is performed on the second index information corresponding to the disk file in the database.
[0127] The asynchronous deletion module 720 is further configured to pause at least one asynchronous deletion operation of the second index information corresponding to the disk file in the database if the database is performing a read / write operation.
[0128] After the database completes its read and write operations, at least one asynchronous deletion operation is performed on the second index information corresponding to the disk file in the database.
[0129] It should be noted that the specific examples in this embodiment can be referred to the above embodiments, and will not be repeated here. All of the above modules can be implemented, in whole or in part, through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each of the above modules.
[0130] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 9 As shown. The computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database stores first and second index information corresponding to the disk files. The network interface communicates with external terminals via a network connection. When executed by the processor, the computer program implements a data deletion method.
[0131] Those skilled in the art will understand that Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0132] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps in any of the above data deletion method embodiments.
[0133] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0134] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0135] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A data deletion method applied to a database, characterized in that, include: In response to a data deletion request, perform a synchronous deletion operation on the corresponding disk file in the disk and the first index information corresponding to the disk file in the database; When no read / write operations are performed on the database, an asynchronous deletion operation is performed on the second index information corresponding to the disk file in the database, including: storing the unique identifier of the second index information corresponding to the disk file in the database into a second cache queue, and sorting the unique identifier; the unique identifier is the database write order of the second index information corresponding to the disk file in the database; determining the deletion order of the second index information corresponding to the disk file in the database based on the sorted unique identifier; and performing the asynchronous deletion operation on the second index information corresponding to the disk file in the database based on the deletion order when no read / write operations are performed on the database.
2. The data deletion method according to claim 1, characterized in that, The step of synchronously deleting the corresponding disk file in the disk and the first index information corresponding to the disk file in the database in response to the data deletion request includes: In response to a data deletion request, the filename corresponding to the disk file is obtained, and the filename is stored in the first cache queue; Based on the filename, determine the first index information corresponding to the disk file in the database; Perform a synchronous deletion operation on the corresponding disk file in the disk and the first index information corresponding to the disk file in the database.
3. The data deletion method according to claim 2, characterized in that, The asynchronous deletion operation of the second index information corresponding to the disk file in the database when no read or write operation is performed includes: Based on the filename, determine the second index information corresponding to the disk file in the database; If no read or write operation is performed on the database, an asynchronous deletion operation is performed on the second index information corresponding to the disk file in the database.
4. The data deletion method according to claim 1, characterized in that, The sorting of the unique identifier includes: Determine whether the second cache queue has any newly added unique identifiers within a preset time period; If not, then sort the unique identifiers; If so, then sort the newly added unique identifiers.
5. The data deletion method according to claim 1, characterized in that, The asynchronous deletion operation of the second index information corresponding to the disk file in the database based on the deletion order includes: Determine the single deletion amount of the second index information corresponding to the disk file in the database; Based on the single deletion amount of the second index information corresponding to the disk file in the database, at least one asynchronous deletion operation is performed on the second index information corresponding to the disk file in the database.
6. The data deletion method according to claim 5, characterized in that, The asynchronous deletion operation of executing at least one instance of the second index information corresponding to the disk file in the database includes: If the database is performing read / write operations, then at least one asynchronous deletion operation of the second index information corresponding to the disk file in the database is paused; After the database completes its read and write operations, at least one asynchronous deletion operation is performed on the second index information corresponding to the disk file in the database.
7. A data deletion device, characterized in that, The device includes: The synchronous deletion module is used to respond to a data deletion request by performing a synchronous deletion operation on the corresponding disk file in the disk and the first index information corresponding to the disk file in the database. An asynchronous deletion module is used to perform an asynchronous deletion operation on the second index information corresponding to the disk file in the database when no read or write operations are performed on the database. This includes: storing a unique identifier of the second index information corresponding to the disk file in the database into a second cache queue, and sorting the unique identifiers; the unique identifiers represent the database write order of the second index information corresponding to the disk file in the database; determining the deletion order of the second index information corresponding to the disk file in the database based on the sorted unique identifiers; and performing the asynchronous deletion operation on the second index information corresponding to the disk file in the database based on the deletion order when no read or write operations are performed on the database.
8. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method as described in any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Method and device for deleting file
CN102332014A
Distributed data deletion flow control method and apparatus, electronic device, and storage medium
WO2019232927A1