Data processing method, device, electronic device and storage medium

By directly deleting the data fragments to be discarded by setting the associated status bitmap for the data fragments, the problem of the impact of deletion operations on query efficiency and data elimination operations in data processing is solved, and resource saving and data processing accuracy are achieved.

CN114443703BActive Publication Date: 2024-10-29BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111534833.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-15
Publication Date
2024-10-29
Estimated Expiration
2041-12-15

AI Technical Summary

Technical Problem

In the prior art, in data processing, deletion operations have a great impact on query efficiency, and it is difficult to effectively support data elimination operations. Especially when the amount of deleted data increases, bitmap space requirements are large and adaptability is poor.

Method used

By setting associated status bitmaps for different data shards, the data shards to be discarded and their read-only status bitmaps can be directly deleted to avoid deletion status marking of a large amount of unit data in the bitmap and support the elimination operation of data shards. And optimize storage space through merge processing.

Benefits of technology

Effectively supports the elimination operation of data shards to avoid excessive resource consumption, improve the accuracy and efficiency of data processing, and avoid accidental deletion of data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114443703B_ABST
    Figure CN114443703B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a data processing method, device, electronic device and storage medium. The method comprises: monitoring a preset discarding event, determining a data slice to be discarded from at least one read-only data slice; obtaining a read-only status bitmap associated with the data slice to be discarded; deleting the data slice to be discarded and the read-only status bitmap associated with the data slice to be discarded. According to the technical solution provided by the present disclosure, the elimination operation of data slices can be effectively supported and the accidental deletion of data can be avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a data processing method, device, electronic device and storage medium. Background Art

[0002] With the development of computer applications, data processing has become increasingly important. In order to maintain data (add data, delete data, query data, and eliminate data, etc.) to improve the accuracy of data processing, the relevant technology chooses to use the log structure merge tree strategy. In the data deletion process, the deletion operation is added as a special record (Doc) to the readable and writable data shard, and then the data is deleted in the merge stage. When querying, if this special Doc is queried, it is determined that the data has been deleted. Or add a global bitmap, and each bit in the bitmap marks whether a certain Doc has been deleted. The former will lead to an increasing number of Docs as more and more Docs are deleted, affecting the query efficiency. And this type of special Doc is invasive to the underlying index implementation and has poor general adaptability. The latter has higher query efficiency and does not affect the underlying index implementation. However, as the number of added Docs increases, the space required for the bitmap is also increasing, and it cannot support data elimination operations well. Summary of the invention

[0003] The present disclosure provides a data processing method, device, electronic device and storage medium to at least solve the problem of how to improve the accuracy of data processing in the related art. The technical solution of the present disclosure is as follows:

[0004] According to a first aspect of an embodiment of the present disclosure, there is provided a data processing method, including:

[0005] A preset discarding event is detected, and a data shard to be discarded is determined from at least one read-only data shard;

[0006] Obtaining a read-only status bitmap associated with the to-be-discarded data slice;

[0007] The to-be-discarded data slice and the read-only status bitmap associated with the to-be-discarded data slice are deleted.

[0008] In a possible implementation, the method further includes:

[0009] Acquire the to-be-discarded identification mapping information and the bitmap index record information associated with the to-be-discarded data slice; the to-be-discarded identification mapping information represents the correspondence between the data index information and the bitmap index information of each to-be-discarded data in the to-be-discarded data slice;

[0010] Deleting the to-be-discarded identification mapping information;

[0011] In the bitmap index record information, the bitmap index information in the to-be-discarded identification mapping information is modified to an unused state.

[0012] In a possible implementation, the method further includes:

[0013] In response to a data deletion request, the data deletion request includes first data index information of the unit data to be deleted;

[0014] In the readable and writable status bitmap, the status corresponding to the first data index information is marked as a deleted status.

[0015] In a possible implementation, the method further includes:

[0016] In response to a data query request, the data query request includes second data index information of the unit data to be queried;

[0017] Obtaining a read-only status bitmap associated with each of the at least one read-only data slices and a readable and writable status bitmap associated with the readable and writable data slices;

[0018] In the readable and writable status bitmap and the read-only status bitmap, query the target status information corresponding to the second data index information;

[0019] When the target state information is the initial state, obtaining query data matched by the second data index information;

[0020] The query data is sent to a terminal corresponding to the data query request.

[0021] In a possible implementation, the at least one read-only data shard is a plurality of read-only data shards; and the method further includes:

[0022] Monitoring a first quantity of unit data in the readable and writable status bitmap and the read-only status bitmap that are in a deleted state, and a second quantity of unit data in the readable and writable data slice and the at least one read-only data slice;

[0023] When the proportion of the first number in the second number is greater than a preset threshold, determining at least two read-only data shards from the multiple read-only data shards;

[0024] Merging the unit data in the at least two read-only data shards that are in a non-deleted state to obtain a merged data shard;

[0025] The at least two read-only data shards are replaced with the merged data shard.

[0026] In a possible implementation, the method further includes:

[0027] In response to a data adding request, dividing the data to be added in the data adding request into at least one unit data to be added;

[0028] respectively configure third data index information for the at least one unit data to be added;

[0029] Adding the at least one unit data to be added and the third data index information to the readable and writable data slice;

[0030] The third data index information is added to the readable and writable status bitmap associated with the readable and writable data slice, and the status corresponding to the third data index information is marked as an initial status in the readable and writable status bitmap.

[0031] In a possible implementation manner, after respectively configuring data index information for the at least one unit data to be added, the method further includes:

[0032] Configuring target bitmap index information for the unit data to be added;

[0033] The third data index information and the target bitmap index information are associated and stored in the readable and writable identification mapping information associated with the readable and writable data slice;

[0034] The adding the third data index information to the readable and writable status bitmap, and marking the status corresponding to the third data index information as the initial status in the readable and writable status bitmap, comprises:

[0035] The target bitmap index information is added to the readable and writable status bitmap, and the status corresponding to the target bitmap identification information is marked as an initial status in the readable and writable status bitmap.

[0036] According to a second aspect of an embodiment of the present disclosure, there is provided a data processing device, including:

[0037] A monitoring module is configured to monitor a preset discarding event and determine a data shard to be discarded from the read-only data shards;

[0038] A first acquisition module is configured to execute acquisition of a read-only status bitmap associated with the to-be-discarded data slice;

[0039] The data discarding module is configured to delete the to-be-discarded data slice and the read-only status bitmap associated with the to-be-discarded data slice.

[0040] In a possible implementation manner, the device further includes:

[0041] The second acquisition module is configured to execute acquisition of to-be-discarded identification mapping information and bitmap index record information associated with the to-be-discarded data slice; the to-be-discarded identification mapping information represents the correspondence between the data index information and the bitmap index information of each to-be-discarded data in the to-be-discarded data slice;

[0042] A deletion module, configured to delete the to-be-discarded identification mapping information;

[0043] The multiplexing module is configured to execute in the bitmap index record information to modify the bitmap index information in the to-be-discarded identification mapping information to an unused state.

[0044] In a possible implementation manner, the device further includes:

[0045] A deletion request response module, configured to execute a response to a data deletion request, wherein the data deletion request includes first data index information of the unit data to be deleted;

[0046] The data deletion module is configured to execute in the readable and writable status bitmap, marking the status corresponding to the first data index information as a deleted status.

[0047] In a possible implementation manner, the device further includes:

[0048] A query request response module, configured to execute a response to a data query request, wherein the data query request includes second data index information of the unit data to be queried;

[0049] A third acquisition module is configured to execute acquisition of the read-only status bitmap associated with each of the at least one read-only data slices and the readable and writable status bitmap associated with the readable and writable data slices;

[0050] A query module is configured to query the target state information corresponding to the second data index information in the readable and writable state bitmap and the read-only state bitmap;

[0051] a query data acquisition module, configured to acquire query data matching the second data index information when the target state information is the initial state;

[0052] The sending module is configured to send the query data to the terminal corresponding to the data query request.

[0053] In a possible implementation manner, the at least one read-only data shard is a plurality of read-only data shards; and the device further includes:

[0054] A monitoring module, configured to monitor a first quantity of unit data in a deleted state in the readable and writable state bitmap and the read-only state bitmap, and a second quantity of unit data in the readable and writable data slice and the at least one read-only data slice;

[0055] a merged shard determination module, configured to determine at least two read-only data shards from the plurality of read-only data shards when a proportion of the first number in the second number is greater than a preset threshold;

[0056] A merging processing module is configured to perform merging processing on the unit data in the at least two read-only data shards that are in a non-deleted state to obtain a merged data shard;

[0057] A replacement module is configured to replace the at least two read-only data shards using the merged data shards.

[0058] In a possible implementation manner, the device further includes:

[0059] an adding request response module, configured to execute, in response to a data adding request, dividing the data to be added in the data adding request into at least one unit data to be added;

[0060] A data index configuration module, configured to respectively configure third data index information for the at least one unit data to be added;

[0061] A first adding module is configured to execute adding the at least one unit data to be added and the third data index information to the readable and writable data slice;

[0062] The second adding module is configured to add the third data index information to the readable and writable status bitmap associated with the readable and writable data segment, and mark the status corresponding to the third data index information as an initial status in the readable and writable status bitmap.

[0063] In a possible implementation manner, the device further includes:

[0064] A bitmap index configuration module, configured to configure target bitmap index information for the unit data to be added;

[0065] A storage module configured to execute storage of the third data index information and the target bitmap index information in association with the readable and writable identification mapping information associated with the readable and writable data slice;

[0066] The second adding module comprises:

[0067] The adding unit is configured to add the target bitmap index information to the readable and writable status bitmap, and mark the state corresponding to the target bitmap identification information as an initial state in the readable and writable status bitmap.

[0068] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement a method as described in any one of the above-mentioned first aspects.

[0069] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute any method described in the first aspect of the embodiment of the present disclosure.

[0070] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, comprising computer instructions, which, when executed by a processor, enable a computer to execute any one of the methods described in the first aspect of an embodiment of the present disclosure.

[0071] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:

[0072] By setting associated status bitmaps for different data shards respectively, when performing the elimination operation of read-only data shards, the data shard to be discarded and the read-only status bitmap associated with the data shard to be discarded can be directly deleted. This operation of deleting the entire data shard to eliminate the data shard does not require marking the deletion status of a large number of unit data in the status bitmap, can effectively support the elimination operation of data shards, and has low resource consumption. In addition, since there is no need to change the status bitmap, accidental deletion of data can be avoided, thereby improving the accuracy of data processing.

[0073] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0074] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0075] Figure 1 It is a schematic diagram of an application environment according to an exemplary embodiment.

[0076] Figure 2 The figure is a flow chart of a method for adding data according to an exemplary embodiment.

[0077] Figure 3 The diagram is a schematic diagram showing data sharding and data sharding operations according to an exemplary embodiment.

[0078] Figure 4 The figure is a flow chart of a method for adding data according to an exemplary embodiment.

[0079] Figure 5 The figure is a flow chart of a method for discarding data according to an exemplary embodiment.

[0080] Figure 6 The figure is a flow chart of another method for discarding data according to an exemplary embodiment.

[0081] Figure 7 The figure is a flow chart of a method for deleting data according to an exemplary embodiment.

[0082] Figure 8 The figure is a flow chart of a method for data query according to an exemplary embodiment.

[0083] Fig. 9 The figure is a flow chart of a method for data merging according to an exemplary embodiment.

[0084] Fig.10 It is a block diagram of a data processing device according to an exemplary embodiment.

[0085] Fig.11 It is a block diagram of an electronic device for data processing according to an exemplary embodiment.

[0086] Fig.12 It is a block diagram of an electronic device for data processing according to an exemplary embodiment. DETAILED DESCRIPTION

[0087] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

[0088] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0089] See also Figure 1 , Figure 1 is a schematic diagram of an application environment according to an exemplary embodiment. Figure 1 As shown, the application environment may include a server 01 and a terminal 02 .

[0090] In an optional embodiment, server 01 can be used for data processing. Specifically, server 01 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.

[0091] In an optional embodiment, the terminal 02 can be used by the back-end administrator to read, write and delete data stored in the server. Specifically, the terminal 02 can include but is not limited to smart phones, desktop computers, tablet computers, laptops, smart speakers, digital assistants, augmented reality (AR) / virtual reality (VR) devices, smart wearable devices and other types of electronic devices. Optionally, the operating system running on the electronic device can include but is not limited to Android system, IOS system, Linux, Windows, etc.

[0092] In addition, it should be noted that Figure 1 What is shown is only one application environment of the data processing method provided by the present disclosure.

[0093] In the embodiments of this specification, the server 01 and the terminal 02 may be directly or indirectly connected via wired or wireless communication, and this application does not impose any limitation thereto.

[0094] It should be noted that the following figure shows a possible order of steps, which is not actually limited to this order. Some steps can be executed in parallel without relying on each other. The user information (including but not limited to user device information, user personal information, user behavior information, etc.) and data (including but not limited to data for display, training data, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.

[0095] Figure 2 FIG. 1 is a flow chart of a method for adding data according to an exemplary embodiment. Figure 2 As shown, the following steps may be included.

[0096] In step S201 , in response to a data adding request, the data to be added in the data adding request is divided into at least one unit data to be added.

[0097] In actual applications, backend administrators need to update and maintain the data stored in the database, such as adding, deleting, eliminating, and merging data, in order to improve read and write efficiency and reduce storage pressure.

[0098] In the embodiments of the present specification, the backend administrator can add data to the database to provide more abundant data for users to use. Based on this, a data adding request can be triggered to the server, and accordingly, a data adding request can be received, and the data adding request can include the data to be added. Further, the data to be added can be divided into at least one unit data to be added to facilitate the storage of the data to be added. The unit data can be a record in the database, and a docid can be used to represent a record.

[0099] In step S203, third data index information is respectively configured for at least one unit data to be added;

[0100] In the embodiment of this specification, data index information, such as docid1, can be configured for each unit data to be added. The data index information can be used to uniquely identify a unit data in the database, so that each unit data in the database can be identified and indexed. As an example, Figure 3 The identifier allocator in allocates data index information to each unit data to be added.

[0101] In step S205, at least one unit data to be added and the configured third data index information are added to the readable and writable data slice.

[0102] In step S207, the third data index information is added to the readable and writable status bitmap associated with the readable and writable data slice, and the state corresponding to the third data index information is marked as an initial state in the readable and writable status bitmap.

[0103] In the embodiment of this specification, based on the data organization strategy of the log merge tree, data can be stored in a data sharding manner in the database. The data sharding may include a readable and writable data shard and at least one read-only data shard, such as Figure 3 It should be noted that Figure 3 The time T0 shown may be the establishment time of the read-only data slice 1 . Before T1 , the data slices may include only one readable and writable data slice: the read-only data slice 1 .

[0104] like Figure 3As shown, there can be a readable and writable data shard at the current moment, that is, the readable and writable data shard can correspond to the current moment; at least one read-only data shard can correspond to at least one historical time period. In chronological order, it can include T0-T1 historical time period, T1-T2 historical time period, and T2-T3 historical time period. The data stored in each read-only data shard can be as follows:

[0105] During the historical period T0-T1, only data shard 1 is read. Data added during T0-T1: docidN0~docidN1;

[0106] T1-T2 historical time period, read-only data shard 2, data added during T1-T2: docidN2-docidN3;

[0107] T2-T3 historical time period, read-only data shard 3, data added during T2-T3: docidN4-docidN5;

[0108] T3-current time, readable and writable data slice 4, T3-data added in the current time: docidN6-docidN7. Among them, docidN0~docidN7 can refer to the range of data index information, and docidN7 can be the data index information of the latest unit data stored in the readable and writable data slice 4. In actual application, at least one unit data to be added and the configured third data index information can be added to the current readable and writable data slice. That is, the unit data to be added can be associated with the configured third data index information and stored. It should be noted that the third data index information refers to the index information of the unit data to be added.

[0109] Accordingly, each data shard may have an associated status bitmap, and the period of the status bitmap associated with each data shard is the same, that is, the corresponding time period is the same. The same period here may refer to the same period of writable operations. The status bitmap associated with a data shard may refer to a bitmap used to record the data status of the data shard in the corresponding time period. Figure 3 As shown, the status bitmap associated with read-only data slice 1 can be bitmap1, the status bitmap associated with read-only data slice 2 can be bitmap2, and the status bitmap associated with read-only data slice 3 can be bitmap3; the status bitmap associated with the readable and writable data slice from T3 to the current time can be a readable and writable status bitmap (which can be represented as bitmap4). It should be noted that bitmap1, bitmap2 and bitmap3 can refer to the read-only status bitmap introduced below. The status information recorded in each status bitmap can be as follows:

[0110] Read-only data shard 1, bitmap1 records the docids deleted in the range of docidN0 to docidN1 during T0-T1;

[0111] Read-only data shard 2, bitmap2 records the docids deleted in the range of docidN0-docidN3 during T1-T2;

[0112] Read-only data shard 3, bitmap3 records the docids deleted in the range of docidN0-docidN5 during T2-T3;

[0113] Data shard 4 can be read and written. Bitmap4 records the docids deleted within the range of all docids (docidN0 to docidN7) from T3 to the current time.

[0114] Taking the above-mentioned read-only data slices 1 to 3 and readable and writable data slice 4 as examples, at least one unit data to be added can be added to the current readable and writable data slice 4, and the third data index information of at least one unit data to be added can be added to the readable and writable status bitmap bitmap4, and the states corresponding to these third data index information are marked as initial states (default states, i.e., non-deleted states) in the readable and writable status bitmap. The initial state can be represented by "1", and the deleted state can be represented by "0", which is not limited in the present disclosure.

[0115] The accuracy of data addition operations can be ensured by processing data addition and maintaining the data status in the status bitmap associated with the readable and writable data shards.

[0116] Figure 4 is a flow chart of a method for adding data according to an exemplary embodiment. In a possible implementation, Figure 4 As shown, it may also include:

[0117] In step S401, target bitmap index information is configured for the unit data to be added;

[0118] In step S403, the third data index information and the target bitmap index information are associated and stored in the readable and writable identification mapping information associated with the readable and writable data slice;

[0119] Accordingly, the above step S207 may include:

[0120] In step S405, the target bitmap index information is added to the readable and writable state bitmap, and the state corresponding to the target bitmap identification information is marked as the initial state in the readable and writable state bitmap.

[0121] like Figure 3As shown, an identifier allocator can be set up, which can be used to configure unit identification information (docid) and bitmap identification information (localid) for the unit data to be added; and can maintain the identifier mapping information associated with each data slice, and can maintain a bitmap index record information. Among them, the identifier mapping information associated with each data slice can be in the form of a table, which is used to record the mapping relationship between docid and localid in each data slice. The bitmap index record information can record the currently configured bitmap index information. As an example, the bitmap index information can be configured in a continuous growth manner starting from 0, such as the bitmap index information of the first unit data added can be localid0, the bitmap index information of the second unit data added can be localid1, and so on, to achieve the configuration of the bitmap index information.

[0122] In the embodiments of this specification, in order to improve the independence of data index information and bitmap index information, and to improve the independence of data slicing operations and state bitmap operations, docid can be used in data slicing and localid can be used in state bitmap. Based on this, target bitmap index information can be configured for the unit data to be added, and the third data index information and target bitmap index information can be associated and stored in the readable and writable identification mapping information associated with the readable and writable data slicing, so as to achieve the mapping maintenance of the two index identifications. And the target bitmap index information can be added to the readable and writable state bitmap, and the state corresponding to the target bitmap identification information can be marked as the initial state in the readable and writable state bitmap.

[0123] Optionally, target bitmap index information may be added to the bitmap index record information to implement maintenance of used (configured) bitmap index information.

[0124] By using different index information in data sharding and status bitmap, state operations in the bitmap state will not affect the data index information, thus avoiding data misoperation and improving data processing accuracy.

[0125] Figure 5 FIG. 1 is a flow chart of a method for discarding data according to an exemplary embodiment. In a possible implementation, Figure 5 As shown, the following steps of discarding read-only data shards may also be included:

[0126] In step S501, a preset discarding event is detected, and a data shard to be discarded is determined from at least one read-only data shard;

[0127] In step S503, a read-only status bitmap associated with the data slice to be discarded is obtained;

[0128] In step S505, the to-be-discarded data slice and the read-only status bitmap associated with the to-be-discarded data slice are deleted.

[0129] In the prior art, the bitmap is global, that is, all data slices (read-only data slices and read-write data slices) use only one bitmap to maintain the status (deletion status or initial status) of all unit data, which cannot effectively support the discarding operation (elimination operation) of a certain read-only data slice. In order to solve this problem, each data slice in the embodiment of this specification is set with an independent status bitmap associated with each data slice, which can effectively support the discarding of slices.

[0130] Among them, the preset discarding event may include at least one of the following: the duration from the creation time of a read-only data slice to the current time is greater than the preset duration threshold; or, the total number of slices of read-only data slices and read-write data slices is greater than the quantity threshold. Accordingly, in the case where there is a read-only data slice whose creation time to the current time is greater than the preset duration threshold, the read-only data slice whose creation time to the current time is greater than the preset duration threshold can be determined as the data slice to be discarded. In the case where the total number of slices is greater than the quantity threshold, the read-only data slice that ranks first in time from the current time (sorted from high to low in time, that is, the one with the longest time) can be determined as the data slice to be discarded, for example Figure 3 As shown, the read-only data slice 1 can be determined as the data slice to be discarded. Further, the read-only status bitmap associated with the data slice to be discarded can be obtained. Thus, the data slice to be discarded and the read-only status bitmap associated with the data slice to be discarded can be deleted to achieve the elimination of the data slice to be discarded.

[0131] By setting associated status bitmaps for different data shards respectively, when performing the elimination operation of read-only data shards, the data shard to be discarded and the read-only status bitmap associated with the data shard to be discarded can be directly deleted. This operation of deleting the entire data shard to eliminate the data shard does not require marking the deletion status of a large number of unit data in the status bitmap, can effectively support the elimination operation of data shards, and has low resource consumption. In addition, since there is no need to change the status bitmap, accidental deletion of data can be avoided, thereby improving the accuracy of data processing.

[0132] The above may be the process of data elimination when the data shard and the status bitmap use the same index information (such as docid). When the data shard and the status bitmap use different index information, the following may be further performed: Figure 6The content in the bitmap index record information can be deleted by deleting the to-be-discarded identifier mapping information and modifying the bitmap index information in the to-be-discarded identifier mapping information to an unused state, thereby realizing the reuse of the bitmap index and avoiding the infinite growth of the bitmap index information in the state bitmap. For details, please refer to the following introduction.

[0133] Figure 6 FIG. 4 is a flow chart of another method for discarding data according to an exemplary embodiment. In a possible implementation, after step S505, as shown in FIG. Figure 6 As shown, it may also include:

[0134] In step S601, to-be-discarded identification mapping information and bitmap index record information associated with the to-be-discarded data slices are obtained; the to-be-discarded identification mapping information represents the correspondence between the data index information and the bitmap index information of each to-be-discarded data in the to-be-discarded data slices;

[0135] In step S603, the to-be-discarded identification mapping information is deleted;

[0136] In step S605, in the bitmap index record information, the bitmap index information in the to-be-discarded identification mapping information is modified to an unused state.

[0137] In the embodiment of the present specification, the to-be-discarded identifier mapping information and the bitmap index record information associated with the to-be-discarded data slice can be obtained from the identifier distributor. Thus, the to-be-discarded identifier mapping information can be deleted, and in the bitmap index record information, the bitmap index information in the to-be-discarded identifier mapping information can be modified to an unused state, so that the bitmap index information in the to-be-discarded identifier mapping information can be reused.

[0138] Figure 7 FIG. 1 is a flow chart of a method for deleting data according to an exemplary embodiment. In a possible implementation, Figure 7 As shown, it may include:

[0139] In step S701, a data deletion request is received, wherein the data deletion request includes first data index information of unit data to be deleted;

[0140] In step S703, in the readable and writable status bitmap, the status corresponding to the first data index information is marked as a deleted status.

[0141] In the embodiment of the present specification, the data corresponding to the first data index information may be data to be deleted. In response to a data deletion request, the state corresponding to the first data index information may be marked as a deleted state in the readable and writable state bitmap. In this way, when querying or merging data, it can be determined through this state that the data corresponding to the first data index information has been deleted.

[0142] Optionally, when the status bitmap uses bitmap index information, S703 can be replaced by: determining the first bitmap index information corresponding to the first data index information from the existing identification mapping information; thereby marking the status corresponding to the first bitmap index information as a deleted status in the readable and writable status bitmap.

[0143] When deleting data, by marking the state corresponding to the first data index information as a deleted state in the readable and writable state bitmap, compared with adding a special doc in the readable and writable shard to represent the deletion state in the prior art, the deletion operation will not increase the doc amount, thereby avoiding the impact on data query efficiency.

[0144] Figure 8 FIG. 1 is a flow chart of a method for data query according to an exemplary embodiment. In a possible implementation, Figure 8 As shown, it may include:

[0145] In step S801, in response to a data query request, the data query request includes second data index information of the unit data to be queried;

[0146] In step S803, a read-only status bitmap associated with at least one read-only data slice and a readable and writable status bitmap associated with a readable and writable data slice are obtained;

[0147] In step S805, the target state information corresponding to the second data index information is queried in the readable and writable state bitmap and the read-only state bitmap.

[0148] In practical applications, since the status bitmap associated with each data shard only records the deletion status of each data shard within the time period corresponding to the data shard, it is necessary to query the data status in all data shards. Based on this, in response to a data query request, at least one read-only data shard and the read-only status bitmap associated with the at least one read-only data shard can be obtained; and the target status information corresponding to the second data index information can be queried in the read-write status bitmap and the read-only status bitmap.

[0149] Optionally, when the status bitmap uses bitmap index information, S805 can be replaced by: determining the second bitmap index information corresponding to the second data index information from the existing identification mapping information; thereby querying the target status information corresponding to the second bitmap index information in the readable and writable status bitmap and the read-only status bitmap.

[0150] In step S807, when the target state information is in a non-deleted state, the query data matching the second data index information is obtained;

[0151] In step S809, the query data is sent to the terminal corresponding to the data query request.

[0152] In the embodiment of the present specification, when the target state information is in a non-deleted state, the data to be queried by the specification data query request is valid, and the query data matching the second data index information can be obtained.

[0153] Optionally, when the target status information is in a deleted state, data deleted information may be directly sent to the terminal to inform the terminal-side administrator that the data queried has been deleted.

[0154] In the case where a corresponding status bitmap is set for each data shard, in response to a data query request, the status of the queried data is determined in each status bitmap, so that the status accuracy of the queried data can be guaranteed, thereby ensuring the processing accuracy of the queried data.

[0155] Fig. 9 is a flow chart of a method for data merging according to an exemplary embodiment. In a possible implementation, Fig. 9 As shown, it may include:

[0156] In step S901, a first quantity of unit data in a deleted state in a readable and writable state bitmap and a read-only state bitmap, and a second quantity of unit data in a readable and writable data slice and at least one read-only data slice are monitored.

[0157] In the embodiments of this specification, in order to reduce storage pressure, the total amount of data can be monitored to achieve the merging of data slices. For example, the first number of unit data in the readable and writable state bitmap and the read-only state bitmap that are in the deleted state, and the second number of unit data in the readable and writable data slice and at least one read-only data slice (i.e., the total number of unit data in all data slices) can be monitored.

[0158] In step S903, when the proportion of the first quantity in the second quantity is greater than a preset threshold, at least two read-only data shards are determined from the plurality of read-only data shards.

[0159] In the embodiment of the present specification, when the proportion of the first quantity in the second quantity is greater than a preset threshold, at least two read-only data shards are determined from the multiple read-only data shards. For example, the time length from each of the multiple read-only data shards to the current time can be determined, and the time lengths can be sorted in descending order, so that the read-only data shards in the first and second positions in the sorting can be used as the at least two read-only data shards.

[0160] In step S905, the unit data in the non-deleted state in at least two read-only data shards are merged to obtain a merged data shard;

[0161] In step S907, at least two read-only data shards are replaced with the merged data shards.

[0162] In the embodiments of the present specification, the unit data in the non-deleted state in at least two read-only data slices can be merged to obtain a merged data slice; and the merged data slice can be used to replace the at least two read-only data slices. Optionally, an associated state bitmap can be constructed for the merged data slice, such as Figure 3 "bitmap-merging" shown.

[0163] By merging read-only data shards, storage space can be effectively saved and data retrieval efficiency can be improved. In addition, by building an associated status bitmap for the merged data shards, the merged data shards have their own independent status bitmap, so that the merged data shards are similar to the original data shards and can also perform the above-mentioned deletion, query, discard and merge operations.

[0164] Fig.10 is a block diagram of a data processing device according to an exemplary embodiment. Fig.10 , the device may include:

[0165] The monitoring module 1001 is configured to monitor a preset discarding event and determine a data shard to be discarded from the read-only data shards;

[0166] A first acquisition module 1003 is configured to execute acquisition of a read-only status bitmap associated with the to-be-discarded data slice;

[0167] The data discarding module 1005 is configured to delete the to-be-discarded data slice and the read-only status bitmap associated with the to-be-discarded data slice.

[0168] In a possible implementation, the above device may further include:

[0169] The second acquisition module is configured to execute acquisition of to-be-discarded identification mapping information and bitmap index record information associated with the to-be-discarded data slice; the to-be-discarded identification mapping information represents the correspondence between the data index information and the bitmap index information of each to-be-discarded data in the to-be-discarded data slice;

[0170] A deletion module, configured to delete the to-be-discarded identification mapping information;

[0171] The multiplexing module is configured to execute in the bitmap index record information to modify the bitmap index information in the to-be-discarded identification mapping information to an unused state.

[0172] In a possible implementation, the above device may further include:

[0173] A deletion request response module, configured to execute a response to a data deletion request, wherein the data deletion request includes first data index information of the unit data to be deleted;

[0174] The data deletion module is configured to execute in the readable and writable status bitmap, marking the status corresponding to the first data index information as a deleted status.

[0175] In a possible implementation, the above device may further include:

[0176] A query request response module, configured to execute a response to a data query request, wherein the data query request includes second data index information of the unit data to be queried;

[0177] A third acquisition module is configured to execute acquisition of the read-only status bitmap associated with each of the at least one read-only data slices and the readable and writable status bitmap associated with the readable and writable data slices;

[0178] A query module is configured to query the target state information corresponding to the second data index information in the readable and writable state bitmap and the read-only state bitmap;

[0179] a query data acquisition module, configured to acquire query data matching the second data index information when the target state information is the initial state;

[0180] The sending module is configured to send the query data to the terminal corresponding to the data query request.

[0181] In a possible implementation, the at least one read-only data shard is a plurality of read-only data shards; and the apparatus may further include:

[0182] A monitoring module, configured to monitor a first quantity of unit data in a deleted state in the readable and writable state bitmap and the read-only state bitmap, and a second quantity of unit data in the readable and writable data slice and the at least one read-only data slice;

[0183] a merged shard determination module, configured to determine at least two read-only data shards from the plurality of read-only data shards when a proportion of the first number in the second number is greater than a preset threshold;

[0184] A merging processing module is configured to perform merging processing on the unit data in the at least two read-only data shards that are in a non-deleted state to obtain a merged data shard;

[0185] A replacement module is configured to replace the at least two read-only data shards using the merged data shards.

[0186] In a possible implementation, the above device may further include:

[0187] an adding request response module, configured to execute, in response to a data adding request, dividing the data to be added in the data adding request into at least one unit data to be added;

[0188] A data index configuration module, configured to respectively configure third data index information for the at least one unit data to be added;

[0189] A first adding module is configured to execute adding the at least one unit data to be added and the third data index information to the readable and writable data slice;

[0190] The second adding module is configured to add the third data index information to the readable and writable status bitmap associated with the readable and writable data segment, and mark the status corresponding to the third data index information as an initial status in the readable and writable status bitmap.

[0191] In a possible implementation, the above device may further include:

[0192] A bitmap index configuration module, configured to configure target bitmap index information for the unit data to be added;

[0193] A storage module configured to execute storage of the third data index information and the target bitmap index information in association with the readable and writable identification mapping information associated with the readable and writable data slice;

[0194] Accordingly, the second adding module may include:

[0195] The adding unit is configured to add the target bitmap index information to the readable and writable status bitmap, and mark the state corresponding to the target bitmap identification information as an initial state in the readable and writable status bitmap.

[0196] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0197] Fig.11 is a block diagram of an electronic device for data processing according to an exemplary embodiment. The electronic device may be a terminal, and its internal structure diagram may be as shown in FIG. Fig.11As shown. The electronic device includes a processor, a memory, a network interface, a display screen and an input device connected via a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a method for data processing is implemented. The display screen of the electronic device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic device can be a touch layer covering the display screen, or a key, trackball or touchpad provided on the housing of the electronic device, or an external keyboard, touchpad or mouse, etc.

[0198] Those skilled in the art will understand that Fig.11 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present disclosure, and does not constitute a limitation on the electronic device to which the scheme of the present disclosure is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0199] Fig.12 is a block diagram of an electronic device for data processing according to an exemplary embodiment. The electronic device may be a server, and its internal structure diagram may be as shown in FIG. Fig.12 As shown. The electronic device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method of data processing is implemented.

[0200] Those skilled in the art will understand that Fig.12 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present disclosure, and does not constitute a limitation on the electronic device to which the scheme of the present disclosure is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0201] In an exemplary embodiment, an electronic device is also provided, including: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the data processing method in the embodiment of the present disclosure.

[0202] In an exemplary embodiment, a computer-readable storage medium is also provided, and when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the data processing method in the embodiment of the present disclosure. The computer-readable storage medium may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0203] In an exemplary embodiment, a computer program product containing instructions is also provided. When the computer program product is run on a computer, the computer is caused to execute the data processing method in the embodiment of the present disclosure.

[0204] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0205] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0206] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A data processing method, characterized in that: include: A preset discarding event is detected, and a data shard to be discarded is determined from at least one read-only data shard; Obtaining a read-only status bitmap associated with the to-be-discarded data slice; Deleting the to-be-discarded data slice and the read-only status bitmap associated with the to-be-discarded data slice; Wherein, the method further comprises: In response to a data adding request, dividing the data to be added in the data adding request into at least one unit data to be added; respectively configure third data index information for the at least one unit data to be added; Adding the at least one unit data to be added and the third data index information to the readable and writable data slice; The third data index information is added to the readable and writable status bitmap associated with the readable and writable data slice, and the status corresponding to the third data index information is marked as an initial status in the readable and writable status bitmap.

2. The data processing method according to claim 1, characterized in that: The method further comprises: Acquire the to-be-discarded identification mapping information and the bitmap index record information associated with the to-be-discarded data slice; the to-be-discarded identification mapping information represents the correspondence between the data index information and the bitmap index information of each to-be-discarded data in the to-be-discarded data slice; Deleting the to-be-discarded identification mapping information; In the bitmap index record information, the bitmap index information in the to-be-discarded identification mapping information is modified to an unused state.

3. The data processing method according to claim 1, characterized in that: The method further comprises: In response to a data deletion request, the data deletion request includes first data index information of the unit data to be deleted; In the readable and writable status bitmap, the status corresponding to the first data index information is marked as a deleted status.

4. The data processing method according to claim 1, characterized in that: The method further comprises: In response to a data query request, the data query request includes second data index information of the unit data to be queried; Obtaining a read-only status bitmap associated with each of the at least one read-only data slices and a readable and writable status bitmap associated with the readable and writable data slices; In the readable and writable status bitmap and the read-only status bitmap, query the target status information corresponding to the second data index information; When the target state information is in an initial state, obtaining query data matched by the second data index information; The query data is sent to a terminal corresponding to the data query request.

5. The data processing method according to claim 4, characterized in that: The at least one read-only data shard is a plurality of read-only data shards; the method further comprises: Monitoring a first quantity of unit data in the readable and writable status bitmap and the read-only status bitmap that are in a deleted state, and a second quantity of unit data in the readable and writable data slice and the at least one read-only data slice; When the proportion of the first number in the second number is greater than a preset threshold, determining at least two read-only data shards from the multiple read-only data shards; Merging the unit data in a non-deleted state in the at least two read-only data shards to obtain a merged data shard; The at least two read-only data shards are replaced with the merged data shard.

6. The data processing method according to claim 1, characterized in that: After respectively configuring data index information for the at least one unit data to be added, the method further includes: Configuring target bitmap index information for the unit data to be added; The third data index information and the target bitmap index information are associated and stored in the readable and writable identification mapping information associated with the readable and writable data slice; The adding the third data index information to the readable and writable status bitmap, and marking the status corresponding to the third data index information as the initial status in the readable and writable status bitmap, comprises: The target bitmap index information is added to the readable and writable status bitmap, and the status corresponding to the target bitmap identification information is marked as an initial status in the readable and writable status bitmap.

7. A data processing device, characterized in that: include: A monitoring module is configured to monitor a preset discarding event and determine a data shard to be discarded from at least one read-only data shard; A first acquisition module is configured to execute acquisition of a read-only status bitmap associated with the to-be-discarded data slice; A data discarding module, configured to execute deletion of the to-be-discarded data slice and a read-only status bitmap associated with the to-be-discarded data slice; Wherein, the device further comprises: an adding request response module, configured to execute, in response to a data adding request, dividing the data to be added in the data adding request into at least one unit data to be added; A data index configuration module, configured to respectively configure third data index information for the at least one unit data to be added; A first adding module is configured to execute adding the at least one unit data to be added and the third data index information to the readable and writable data slice; The second adding module is configured to add the third data index information to the readable and writable status bitmap associated with the readable and writable data segment, and mark the status corresponding to the third data index information as an initial status in the readable and writable status bitmap.

8. The data processing device according to claim 7, characterized in that: The device also includes: The second acquisition module is configured to execute acquisition of to-be-discarded identification mapping information and bitmap index record information associated with the to-be-discarded data slice; the to-be-discarded identification mapping information represents the correspondence between the data index information and the bitmap index information of each to-be-discarded data in the to-be-discarded data slice; A deletion module, configured to delete the to-be-discarded identification mapping information; The multiplexing module is configured to execute in the bitmap index record information to modify the bitmap index information in the to-be-discarded identification mapping information to an unused state.

9. The data processing device according to claim 7, characterized in that: The device also includes: A deletion request response module, configured to execute a response to a data deletion request, wherein the data deletion request includes first data index information of the unit data to be deleted; The data deletion module is configured to execute in the readable and writable status bitmap and mark the status corresponding to the first data index information as a deleted status.

10. The data processing device according to claim 7, characterized in that: The device also includes: A query request response module, configured to execute a response to a data query request, wherein the data query request includes second data index information of the unit data to be queried; A third acquisition module is configured to execute acquisition of the read-only status bitmap associated with each of the at least one read-only data slices and the readable and writable status bitmap associated with the readable and writable data slices; A query module is configured to query the target state information corresponding to the second data index information in the readable and writable state bitmap and the read-only state bitmap; a query data acquisition module, configured to acquire query data matching the second data index information when the target state information is in an initial state; The sending module is configured to send the query data to the terminal corresponding to the data query request.

11. The data processing device according to claim 10, characterized in that: The at least one read-only data shard is a plurality of read-only data shards; the device further comprises: A monitoring module, configured to monitor a first quantity of unit data in a deleted state in the readable and writable state bitmap and the read-only state bitmap, and a second quantity of unit data in the readable and writable data slice and the at least one read-only data slice; a merged shard determination module, configured to determine at least two read-only data shards from the plurality of read-only data shards when a proportion of the first number in the second number is greater than a preset threshold; A merging processing module is configured to perform merging processing on the unit data in the at least two read-only data shards that are in a non-deleted state to obtain a merged data shard; A replacement module is configured to replace the at least two read-only data shards using the merged data shards.

12. The data processing device according to claim 7, characterized in that: The device also includes: A bitmap index configuration module, configured to configure target bitmap index information for the unit data to be added; A storage module configured to execute storage of the third data index information and the target bitmap index information in association with the readable and writable identification mapping information associated with the readable and writable data slice; The second adding module comprises: The adding unit is configured to add the target bitmap index information to the readable and writable status bitmap, and mark the state corresponding to the target bitmap identification information as an initial state in the readable and writable status bitmap.

13. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the data processing method according to any one of claims 1 to 6.

14. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the data processing method according to any one of claims 1 to 6.

15. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the data processing method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Data processing method, device and system and computer readable storage medium

    CN111782134A

  • Method and device for recovering storage block

    CN112069089A