Data storage method and device
By dynamically adjusting the storage type according to data access conditions, it solves the access efficiency problems and data deletion difficulties caused by the mixture of hot and cold data in file groups in distributed storage, and achieves efficient data storage management.
Patent Information
- Application Number
- CN201911055807.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-10-31
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2039-10-31
AI Technical Summary
In distributed storage, the storage method of both hot and cold data in the file group leads to the import of hot data into EC storage mode, which affects high concurrent access efficiency, and file data in EC storage mode cannot be directly deleted, affecting file management.
Re-determine the storage type according to the access situation of the data. By obtaining the access probability and comparing it with the preset storage conditions, it is decided whether to convert the data into multi-copy storage or erasure code EC storage, thereby optimizing the storage method and supporting the dynamic import and export of data. delete.
It realizes data storage management that adapts to access needs, saves storage resources, and solves the problem of inconvenient access and management caused by converting multi-copy data to EC storage.
Smart Images

Figure CN112748868B
Abstract
Description
Technical Field
[0001] This article relates to the field of computer Internet, and in particular to a data storage method and device. Background Art
[0002] The different popularity of data in distributed storage leads to different data access frequencies. Data with a high access frequency is usually called hot data, and data with a low access frequency or almost no access is called cold data.
[0003] Due to the different access requirements of hot and cold data, hot data is generally stored in multiple copies to meet the high concurrent access of files. For cold data, EC (Erasure Code) cold storage can be used to reduce storage costs. Considering the limited storage resources, data needs to be imported from multiple copies to EC storage to save resources.
[0004] In distributed storage, the storage method for multiple copies of data is to store K redundant copies of the file data, and the K copies are distributed in storage devices with a specified fault isolation level (for example, if the isolation level is disk, the K copies of data are distributed in different disks); the EC storage method is to calculate the file data through EC encoding to obtain M+N copies of data (M is the number of data blocks, and N is the number of encoding blocks). In this way, the storage cost is (M+N) / N, which reduces the storage cost by K times the data redundancy of multiple copies of hot data.
[0005] In most distributed storage, multi-copy data generally places multiple file data in a file group. The storage capacity of the file group is fixed (such as 10GB). When the data in the file group exceeds the capacity of the file group, the file group is set to read-only status. After the file group is set to read-only status, the data is imported into the EC storage method storage in file groups.
[0006] The method of importing EC storage in file groups has the following problems:
[0007] 1. File data is imported in file groups. There may be both hot data and cold data in the file group. In this way, the hot data will be imported into the EC storage mode for storage, affecting the high concurrent access efficiency of the file. Frequent access to data in the EC storage mode will cause a heavy burden on system resources.
[0008] 2. File data in EC storage mode cannot be directly deleted. If the file group where the file data is located has been imported into EC storage mode, the file data cannot be directly deleted, which affects file management. Summary of the invention
[0009] In order to overcome the problems existing in the related art, this article provides a data storage method and device.
[0010] According to one aspect of the present invention, there is provided a data storage method, comprising:
[0011] Re-determining the storage type of the data according to the data access situation;
[0012] The data is stored according to the re-determined storage type.
[0013] Preferably, the step of re-determining the storage type of the data according to the data access situation includes:
[0014] Obtaining access probability of the data being accessed;
[0015] comparing the access probability with at least one preset storage condition, the storage condition comprising an access probability interval and a corresponding storage type;
[0016] In a case where the access probability meets the access probability interval of the preset storage condition, the corresponding storage type is determined as the storage type of the data.
[0017] Preferably, the storage type includes at least one or more of the following types:
[0018] Multi-copy storage, erasure code EC storage,
[0019] The method further includes:
[0020] Configure at least one storage condition, which includes at least one or more of the following conditions:
[0021] When the access probability is within the first access probability interval, the data storage type is determined to be multi-copy storage.
[0022] When the access probability is within the second access probability interval, the storage type of the data is determined to be EC storage.
[0023] The lower limit of the first access probability interval is greater than or equal to the upper limit of the second access probability interval.
[0024] Preferably, the first access probability interval and the second access probability interval are both time intervals, and the step of obtaining the access probability of the data being accessed includes:
[0025] The access time when the data was most recently accessed is obtained, and the access time is used as an input parameter for calculating the access probability.
[0026] Preferably, when the storage type of the data is changed from the multi-copy type to the EC type, the step of storing the data according to the re-determined storage type includes:
[0027] Determine the import scope;
[0028] The file records of the multi-copy storage type data existing in the import range are imported as the EC type for storage, and the deletion records of the multi-copy storage type data deleted in the import range are imported as the EC type for storage.
[0029] Preferably, the step of determining the import range includes:
[0030] The data of the multi-copy storage type whose access probability meets the storage condition and is within the SHA1 range is selected as the import range.
[0031] Preferably, the method further comprises:
[0032] The storage range of the data of the multi-copy storage type is updated.
[0033] Preferably, the method further comprises:
[0034] In EC type storage, when there is data of multi-copy storage type being converted to EC type and a record of deletion of the multi-copy storage type, the data is deleted from the EC type storage.
[0035] Preferably, before the step of re-determining the storage type of the data according to the data access situation, the method further includes:
[0036] The data is stored in a multi-copy type, where the data structure of the multi-copy type includes at least one or more of the following information:
[0037] SHA1 key value, file name, access timestamp, and deletion information.
[0038] According to another aspect of the present invention, there is provided a data storage device, comprising:
[0039] A storage type determination module, used to re-determine the storage type of the data according to the data access situation;
[0040] A data import module is used to store the data according to the re-determined storage type.
[0041] Preferably, the storage type determination module includes:
[0042] An access probability acquisition unit, used to acquire the access probability of the data being accessed;
[0043] A storage condition matching unit, used to compare the access probability with at least one preset storage condition, wherein the storage condition includes an access probability interval and a corresponding storage type;
[0044] The type determination unit is used to determine the corresponding storage type as the storage type of the data when the access probability meets the access probability interval of the preset storage condition.
[0045] Preferably, the storage type includes at least one or more of the following types:
[0046] Multi-copy storage, erasure code EC storage,
[0047] The device also includes:
[0048] The storage condition setting module is used to configure at least one storage condition, wherein the storage condition includes at least one or more of the following conditions:
[0049] When the access probability is within the first access probability interval, the data storage type is determined to be multi-copy storage.
[0050] When the access probability is within the second access probability interval, the storage type of the data is determined to be EC storage.
[0051] The lower limit of the first access probability interval is greater than or equal to the upper limit of the second access probability interval.
[0052] Preferably, when the storage type of the data is changed from the multi-copy type to the EC type, the data import module includes:
[0053] An import range determination unit, used for determining an import range;
[0054] The import execution unit is used to import the file records of the multi-copy storage type data existing in the import range as the EC type for storage, and import the deletion records of the multi-copy storage type data deleted in the import range as the EC type for storage.
[0055] Preferably, the import range determination unit is specifically used to select data of a multi-copy storage type whose access probability meets the storage condition and is within the SHA1 range as the import range.
[0056] Preferably, the device further comprises:
[0057] The storage range updating module is used to update the storage range of the data of the multi-copy storage type.
[0058] Preferably, the device further comprises:
[0059] The data deletion module is used to delete the data from the EC type storage when there are records of data of the multi-copy storage type being transferred to the EC type and deletion records of the data of the multi-copy storage type in the EC type storage.
[0060] Preferably, the device further comprises:
[0061] The multi-copy storage module is used to store data as a multi-copy type, wherein the data structure of the multi-copy type includes at least one or more of the following information:
[0062] SHA1 key value, file name, access timestamp, and deletion information.
[0063] According to another aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed, the steps of the above data storage method are implemented.
[0064] According to another aspect of the present invention, a computer device is provided, including a processor, a memory and a computer program stored in the memory, wherein the processor implements the steps of the above data storage method when executing the computer program.
[0065] This paper re-determines the storage type of the data according to the data access situation, and stores the data according to the re-determined storage type. This solves the problem of affecting access when converting files from multiple copies to EC type storage based on file groups as a whole, and realizes data storage management that adapts to access requirements.
[0066] 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 invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] The accompanying drawings constituting a part of this document are used to provide a further understanding of this document. The exemplary embodiments and descriptions of this document are used to explain this document and do not constitute an improper limitation on this document. In the accompanying drawings:
[0068] Figure 1 The invention is a flow chart showing a data storage method according to an exemplary embodiment.
[0069] Figure 2 The invention is a flowchart of determining a data storage type according to an exemplary embodiment.
[0070] Figure 3 The present invention is a flowchart showing the method of storing the data according to the re-determined storage type according to an exemplary embodiment.
[0071] Figure 4The invention is a flow chart showing a data storage method according to an exemplary embodiment.
[0072] Figure 5 The diagram is an example diagram showing storage records within a SHA1 range in a multi-copy storage system according to an exemplary embodiment.
[0073] Figure 6 The diagram is an example diagram showing storage records within a SHA1 range in a multi-copy storage system after an import is completed according to an exemplary embodiment.
[0074] Figure 7 The following is an example diagram showing an imported range that is updated after the import is completed according to an exemplary embodiment.
[0075] Figure 8 is a block diagram of a data storage device according to an exemplary embodiment.
[0076] Fig. 9 is a structural block diagram of a storage type determination module 801 according to an exemplary embodiment.
[0077] Fig.10 is a structural block diagram of a data import module 802 according to an exemplary embodiment.
[0078] Fig.11 It is a block diagram of a computer device (general structure of a server) according to an exemplary embodiment. DETAILED DESCRIPTION
[0079] In order to make the purpose, technical solutions and advantages of the embodiments of this article clearer, the technical solutions in the embodiments of this article will be clearly and completely described below in conjunction with the drawings in the embodiments of this article. Obviously, the described embodiments are part of the embodiments of this article, not all of the embodiments. Based on the embodiments in this article, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this article. It should be noted that the embodiments in this article and the features in the embodiments can be combined with each other arbitrarily without conflict.
[0080] In most distributed storage, multi-copy data generally places multiple file data in a file group. The storage capacity of the file group is fixed (such as 10GB). When the data in the file group exceeds the capacity of the file group, the file group is set to read-only status. After the file group is set to read-only status, the data is imported into the EC storage method storage in file groups.
[0081] The method of importing EC storage in file groups has the following problems:
[0082] 1. File data is imported in file groups. There may be both hot data and cold data in the file group. In this way, the hot data will be imported into the EC storage mode for storage, affecting the high concurrent access efficiency of the file. Frequent access to data in the EC storage mode will cause a heavy burden on system resources.
[0083] 2. File data in EC storage mode cannot be directly deleted. If the file group where the file data is located has been imported into EC storage mode, the file data cannot be directly deleted, which affects file management.
[0084] In order to solve the above problems, the embodiments of the present disclosure provide a data storage method. According to the access situation, different data are stored in different storage methods, which saves storage resources while meeting the access requirements and solves the problem of inconvenience in access and management caused by batch conversion of multiple copies of data into EC storage.
[0085] An exemplary embodiment of the present disclosure provides a data storage method, which uses the method to complete the process of converting multi-copy storage type data into EC type data for storage. Figure 1 As shown, including:
[0086] Step 101: Configure at least one storage condition.
[0087] The storage condition includes an access probability interval and a corresponding storage type, and the storage type includes at least one or more of the following types:
[0088] Multi-copy storage and erasure code EC storage.
[0089] The storage conditions include at least one or more of the following conditions:
[0090] When the access probability is within the first access probability interval, the data storage type is determined to be multi-copy storage.
[0091] When the access probability is within the second access probability interval, the storage type of the data is determined to be EC storage.
[0092] The lower limit of the first access probability interval is greater than or equal to the upper limit of the second access probability interval.
[0093] That is, when the access probability of data decreases from the second access probability interval to the first access probability interval, it indicates that the access popularity of the data decreases and the access demand decreases. For the data in this case, it can be converted to EC storage type to save storage resources.
[0094] Step 102: Store the data as multiple copies.
[0095] In this step, the data structure of the multi-copy type includes at least one or more of the following information:
[0096] SHA1 key value, file name, access timestamp, and deletion information.
[0097] In the disclosed embodiment, the access time of the most recent access to the data can be determined according to the access timestamp, and the access probability is calculated using the access time as a parameter, and the data with the access timestamp closer to the present is used as the data with higher access probability. Accordingly, the access probability interval is set to a time interval.
[0098] Preferably, the above data structure also includes information such as the size and upload time of the data file.
[0099] Step 103: Re-determine the storage type of the data according to the data access situation.
[0100] In this step, when data transfer is required, such as when the amount of data stored in the file group reaches the upper capacity limit or reaches the preset time condition, the data transfer is initiated. Figure 2 As shown, including:
[0101] Step 201: Obtain the access probability of the data being accessed.
[0102] In this step, the access time when the data was last accessed can be obtained, and the access time is used as an input parameter for calculating the access probability. Specifically, the access timestamp of the data of the multi-copy type is obtained, which records the time when the data was last accessed. The closer the time of the last access is to the current time, the higher the probability that the data will be accessed again in a short time. An access probability standard can be configured, whose value is a time point. If the time when the data was last accessed is before this time point, it indicates that the probability of the data being accessed in a short time is low, and it can be imported as an EC storage type; if the time when the data was last accessed is after this time point, it indicates that the probability of the data being accessed in a short time is high, and the multi-copy storage type is still maintained to ensure access efficiency.
[0103] Step 202: Compare the access probability with at least one preset storage condition.
[0104] Step 203: When the access probability meets the access probability interval of the preset storage condition, determine the corresponding storage type as the storage type of the data.
[0105] Step 104: Store the data according to the re-determined storage type.
[0106] This step is as follows Figure 3 As shown, including:
[0107] Step 301: Determine the import range.
[0108] Considering that the amount of data involved is uncertain and may be quite large, in this step, the amount of data converted from the multi-copy storage type to the EC storage type at one time is limited by defining the import range to ensure the normal operation of the system.
[0109] Specifically, data of a multi-copy storage type whose access probability meets the storage condition and is within a SHA1 range may be selected as the import range.
[0110] Step 302: import the file records of the data of the multi-copy storage type within the import range as the EC type for storage, and import the deletion records of the data of the multi-copy storage type that has been deleted within the import range as the EC type for storage.
[0111] In this step, conversion is performed from the multi-copy storage type to the EC type. When a deletion record of deleted multi-copy storage type data is found, the deletion record is also converted to the EC type for storage. In the EC type storage, when there are both multi-copy storage type data transferred to the EC type and deletion records of the multi-copy storage type data, the data is deleted from the EC type storage. For example, when the EC type storage data is subsequently traversed and the original data corresponding to the deletion record is found, the original data can be deleted and the deletion record can also be removed, thereby realizing data deletion management under the data transfer mechanism.
[0112] Step 105: Update the storage range of data of the multi-copy storage type.
[0113] After the conversion is completed, the storage range of the data of the multi-copy storage type can be updated. Preferably, the range of the data that has been imported as the EC type can be updated.
[0114] An exemplary embodiment of the present disclosure also provides a data storage method, which uses the method to perform different types of data storage according to access probability. Figure 4 As shown, including:
[0115] In the embodiment of the present disclosure, the distributed storage system includes a multi-copy storage cluster and an EC storage cluster. The multi-copy storage cluster uses the multi-copy storage type for data storage, and the EC storage cluster uses the EC storage type for data storage. In the embodiment of the present disclosure, data is stored in units of file data.
[0116] The difference in the storage methods of hot and cold data leads to the need for a data import method to import data from the multi-copy storage type to the EC storage type. The data import method invented by this patent is: import file data of a certain time and within the sha1 range according to the data timestamp ts and sha1 secure hash algorithm 1. Based on the principle that the file uploaded recently is most likely to be accessed recently, the hot and cold of file data are distinguished according to the upload timestamp, and the data within a certain timestamp is defined as hot data, and the data before a certain timestamp is defined as cold data; and it is impossible to import all file data at once, so the file data within a certain sha1 range is imported at once according to sha1.
[0117] This can be achieved through an importer, which is responsible for importing some data with a lower access probability in the multi-replica storage cluster into the EC storage cluster. Specifically, a list of files that meet the data conditions is obtained from the multi-replica storage cluster according to the specified SHA1 and timestamp (ts), and the data is imported into the data block of the EC storage cluster. The imported SHA1 range and timestamp are written back to the multi-replica storage cluster so that the multi-replica storage cluster can record the data import status.
[0118] Step 401: Store file data in a multi-copy storage cluster.
[0119] In the embodiment of the present disclosure, a data structure of a multi-copy type is used in a multi-copy storage cluster, specifically, a multi-copy hot data file meta information structure, which includes the following information:
[0120] -SHA1#SHA1 of the file, i.e. the key value of SHA1
[0121] -filename#File name
[0122] -ts#The ts version information of the file, that is, the access timestamp of the last access
[0123] -is_del#deletion information, used to indicate whether the file is deleted
[0124] -size#File size
[0125] -upload_ts#File upload time
[0126] <SHA1,filename,ts,is_del> The unique index of the file data. Different versions of the same file data can be distinguished by ts. Deleting files in a multi-copy storage cluster is done by adding a<SHA1,filename,ts,is_del=1> This is achieved by deleting records.
[0127] If there are two file records in the EC storage cluster<SHA1,filename,ts> The first is_del=0 (set is_del of the data to 0 when adding file data), and the second is_del=1. These two file records constitute a pair of file records, indicating that the file data has been deleted. The physical file can be safely deleted.
[0128] Step 402: Import the cold data in the multi-copy storage cluster into the EC storage cluster.
[0129] In the embodiment of the present disclosure, a RangeDict data structure is defined, and the import process is managed through the data structure. In order to better illustrate the technical solution provided by the embodiment of the present disclosure, first, the RangeDict data structure is described.
[0130] The RangeDict data structure is a two-dimensional array, each element of which is a one-dimensional array (called range). Each range contains 3 elements, of which the first 2 elements are the start and end points of the range information, and the range is a left-closed and right-open interval; the third element is the value corresponding to the range. The following is an example of implementing this data structure in yaml format:
[0131] rangDict:
[0132] -[" <left> "," <right> ", <value>]
[0133] Among them, left and right are the starting and ending endpoints, and value is the value corresponding to the range. In the following, "r[i].left", "r[i].right", and "r[i].value" are used to refer to the left, right, and value of the i-th element of the rangDict.
[0134] Preferably, the range interval recorded by the first two elements of range is a SHA1 range, and the third element is the timestamp ts corresponding to the import of the SHA1 range.
[0135] For the RangeDict data structure, you can perform the following operations:
[0136] 1. Merger
[0137] When the SHA1 of adjacent elements of the RangeDict two-dimensional array are adjacent (that is, rngDict[i][1] is equal to rndDict[i+1][1]) and ts is also equal, the two adjacent elements can be merged into one element. The following is an example of the RangeDict data structure in yaml format:
[0138] rngDict:
[0139] -["a1","a5",1568778001]
[0140] -["a5","a8",1568778001]
[0141] Since rngDict[i][1] is equal to rndDict[i+1][1], and ts are equal, rngDict[i][1] and rndDict[i+1][1] can be merged to obtain:
[0142] rngDict:
[0143] -["a1","a8",1568778001]
[0144] 2. Add
[0145] Add a rangeDict to another rangeDict. After adding, the range intervals that have intersections will be merged.
[0146] 3. Take the intersection (indicated by the mathematical symbol ∩)
[0147] Intersection of two Rangedicts. If there are elements with overlapping ranges in the two Rangedicts, the intersection operation can be performed. The value corresponding to the final intersection range is the value of the first Rangedict. The following is an example expressed in YAML format:
[0148] rngDict1:
[0149] -["a1","a5",1568778001]
[0150] -["a5","a8",1568778002]
[0151] rngDict2:
[0152] -["a0","a4",1568778003]
[0153] Then, rngDit3=rngDit1∩rngDict2, which is equal to:
[0154] rngDict3:
[0155] -["a2","a4",1568778001]
[0156] The multi-replica storage cluster stores the imported information in the path=" / ec / imported / range" node of the zookeeper of the multi-replica storage cluster. The node value is a RangeDict data structure. In the embodiment of the present disclosure, a RangeDict is used to record the range information of the file data imported into the EC storage cluster. The following is an example expressed in yaml format:
[0157] imported_ts:#Imported range
[0158] -["<left_SHA1> ","<right_SHA1> ", <ts1>]
[0159] -["<left_SHA1>","<right_SHA1>", <ts2>]
[0160] The RangeDict named imported_ts records the SHA1 range and timestamp information that has been imported into EC cold storage. Each import adds an element to imported_ts.
[0161] In the disclosed embodiment, cold data and hot data are distinguished by access probability, and cold data in the multi-copy storage cluster is imported into the EC storage cluster. Specifically, the access probability is calculated with the access time as input, and the time of the most recent access is obtained. If the time is later than the preset access time standard, it is determined that the access frequency is high, and if the time is earlier than the preset access time standard, it is determined that the access frequency is low.
[0162] In the disclosed embodiment, specifically, the time of the last access can be determined by the timestamp. In this step, the SHA1 range and time range of the imported file are first determined. Assuming that the timestamp ts1 is the access time standard, the file data with the last access time before ts1 is cold data, and it is necessary to import all the file data with the last access time before ts1 in the SHA1 range.
[0163] Since the amount of data that needs to be imported into the EC storage cluster may be large, the amount of data executed in each batch needs to be further divided. This can be done by SHA1 range.
[0164] Specifically, in the EC storage cluster, the file data to be imported is divided into multiple areas (i.e., regions) according to the SHA1 range. The range of a region (hereinafter referred to as region.range) stores the start and end range of the SHA1 contained in the region, expressed as [left, right], which is a left-closed and right-open interval. Only file data within the SHA1 range will be imported into the region.
[0165] The process of determining the scope of data to be imported includes:
[0166] 1. Select a region and get the region.range: [left, right] to determine the range of data to be imported.
[0167] 2. Read the imported record imported_ts (a RangeDict) from the multi-replica cluster zookeeper.
[0168] 3. Get the intersection, region_imported = imported_ts∩region.range, and obtain the records that have an intersection with the currently selected region.range and have been imported.
[0169] 4. If region_imported contains multiple ranges, among the first n ranges, select the range r with the smallest region_imported[i].value, and take start_ts = r.value; take end_ts as the smallest range.value of the ranges adjacent to r.
[0170] If region_imported has only one range: r, take start_ts = r.value, end_ts = ts1.
[0171] If region_imported does not have any records, take r = region.range, start_ts = 0, end_ts = ts1.
[0172] Finally, the SHA1 range: [r.left, r.right] and the timestamp range: [start_ts, end_ts] are determined as parameters indicating the range of the imported data, and all the file data to be imported are listed in the front end of the multi-copy storage cluster. The purpose of this selection method is to eventually make the value of each range in imported_ts consistent.
[0173] like Figure 5 The following is an example of a record stored in the SHA1 range in a multi-replica storage system. There are two regions in the system, and the imported_ts recorded in the zookeeper of the multi-replica cluster has six imported records. If region[0] is selected to start importing data:
[0174] 1. Take the intersection imported_ts∩region[0].range, and get region_imported: r[0], r[1], r[2]. The imported timestamps ts corresponding to these three ranges are: 2017-05-02, 2017-06-02, 2017-07-02.
[0175] 2. Select r[2] with the smallest ts as the SHA1 range for this import, and set start_ts=2017-05-02.
[0176] 3. r[1] adjacent to r[2], ts = 2017-06-02, serves as end_ts for this import.
[0177] 4. At the end of the final import, the difference in ts between r[1] and r[2] will narrow (if all eligible files are imported, they will become equal). As Figure 6 shown.
[0178] 5. During the next import, r[1] will be selected. After the import is completed and imported_ts is updated, the r[1] and r[2] of imported_ts will also be merged into one range. As Figure 7 shown.
[0179] After determining the import range, the import of file data within the import range into the EC storage cluster can be executed. According to the left, right, start_ts, and end_ts parameters in the determined import range, the file data f to be imported is retrieved from the multi-copy columns. Then, from the multi-copy cluster, starting from f.SHA1 >= left, the file records f are listed one by one. The file records where start_ts < f.ts < end_ts are selected for import until f.SHA1 < right, indicating that the file data within the entire import range has been processed.
[0180] If there are two file records in the EC storage cluster with equal <SHA1, filename, ts>, the first one has is_del = 0 (when adding file data, the is_del of the data is set to 0), and the second one has is_del = 1. These two file records form a pair of file records, indicating that the file data has been deleted, and the physical file can be safely deleted.
[0181] During the import process, if two file records form a pair of file records, it means that the file has been deleted in the multi-copy storage cluster, and there is no need to import it anymore. Just filter the file data. Since it is not imported, the actual effect is deletion, realizing the data deletion operation during the import process.
[0182] If only one deletion record marked with is_del = 1 is encountered, the deletion record is imported instead of the actual data because the unmarked file records with is_del = 0 may have been imported into the EC storage cluster before. After importing this deletion record into the EC storage cluster this time, when these two file records meet (i.e., a pair of file records are matched in the EC storage cluster), the actual physical data is deleted.
[0183] After this import is completed, the following rangeDict is finally obtained:
[0184] importedDict:
[0185] -[left,right,end_ts]
[0186] Step 403: Update the range of the data that has been imported into the EC storage cluster in the multi-copy storage cluster according to the import result.
[0187] In this step, the importedDict just imported is added to the imported imported_ts, and then the updated imported_ts is written to the zookeeper of the multi-replica cluster.
[0188] For example:
[0189] rst=zk.get(" / ec / imported / range")
[0190] r1=RangeDict(rst.imported_ts)
[0191] r1.add(importedDict)
[0192] zk.set(" / ec / imported / range",r1)
[0193] An exemplary embodiment of the present disclosure further provides a data storage device, the structure of which is as follows: Figure 8 As shown, including:
[0194] The storage type determination module 801 is used to re-determine the storage type of the data according to the data access situation;
[0195] The data import module 802 is used to store the data according to the re-determined storage type.
[0196] Preferably, the structure of the storage type determination module 801 is as follows: Fig. 9 As shown, including:
[0197] An access probability acquisition unit 901 is used to acquire the access probability of the data being accessed;
[0198] A storage condition matching unit 902, configured to compare the access probability with at least one preset storage condition, wherein the storage condition includes an access probability interval and a corresponding storage type;
[0199] The type determination unit 903 is used to determine the corresponding storage type as the storage type of the data when the access probability meets the access probability interval of the preset storage condition.
[0200] Preferably, the storage type includes at least one or more of the following types:
[0201] Multi-copy storage, erasure code EC storage,
[0202] The device also includes:
[0203] The storage condition setting module 803 is used to configure at least one storage condition, where the storage condition includes at least one or more of the following conditions:
[0204] When the access probability is within the first access probability interval, the data storage type is determined to be multi-copy storage.
[0205] When the access probability is within the second access probability interval, the storage type of the data is determined to be EC storage.
[0206] The lower limit of the first access probability interval is greater than or equal to the upper limit of the second access probability interval.
[0207] Preferably, when the storage type of the data is changed from the multi-copy type to the EC type, the structure of the data import module 802 is as follows: Fig.10 As shown, including:
[0208] An import range determining unit 1001, used to determine an import range;
[0209] The import execution unit 1002 is used to import the file records of the multi-copy storage type data existing in the import range as the EC type for storage, and import the deletion records of the multi-copy storage type data deleted in the import range as the EC type for storage.
[0210] Preferably, the import range determination unit 1001 is specifically used to select data of a multi-copy storage type whose access probability meets the storage condition and is within the SHA1 range as the import range.
[0211] Preferably, the device further comprises:
[0212] The storage range updating module 804 is used to update the storage range of the data of the multi-copy storage type.
[0213] Preferably, the device further comprises:
[0214] The data deletion module 805 is used to delete the data from the EC type storage when there are records of data of the multi-copy storage type being converted to the EC type and deletion records of the data of the multi-copy storage type in the EC type storage.
[0215] Preferably, the device further comprises:
[0216] The multi-copy storage module 806 is used to store data as a multi-copy type, where the data structure of the multi-copy type at least includes any one or more of the following information:
[0217] SHA1 key value, file name, access timestamp, and deletion information.
[0218] An exemplary embodiment of the present disclosure further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed, the steps of the data storage method provided by the embodiment of the present disclosure are implemented.
[0219] An exemplary embodiment of the present disclosure further provides a computer device, including a processor, a memory, and a computer program stored in the memory, wherein the processor implements the steps of the data storage method provided by the embodiment of the present disclosure when executing the computer program.
[0220] The embodiment of the present disclosure provides a data storage method, which re-determines the storage type of the data according to the data access situation, and stores the data according to the re-determined storage type. The problem of affecting access when converting a file from a multi-copy type to an EC type storage with a file group as the whole file is solved, and data storage management that adapts to access requirements is realized.
[0221] By marking the deletion status in the file record, the file deletion operation across multiple copy storage systems and EC storage systems is realized, solving the problem of being unable to delete due to the lack of synchronization between the deletion operation and the data transfer operation between systems.
[0222] Fig.11 1 is a block diagram of a computer device 1100 for data storage according to an exemplary embodiment. For example, the computer device 1100 may be provided as a server. Fig.11 The computer device 1100 includes a processor 1101, and the number of processors can be set to one or more as needed. The computer device 1100 also includes a memory 1102, which is used to store instructions that can be executed by the processor 901, such as application programs. The number of memories can be set to one or more as needed. The application programs stored therein can be one or more. The processor 901 is configured to execute instructions to perform the above method.
[0223] It should be understood by those skilled in the art that the embodiments of this article can be provided as methods, devices (equipment), or computer program products. Therefore, this article can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this article can adopt the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program codes. Computer storage media include volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data), including but not limited to RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassette, magnetic tape, disk storage or other magnetic storage device, or any other medium that can be used to store desired information and can be accessed by a computer. In addition, it is well known to those of ordinary skill in the art that communication media generally contain computer-readable instructions, data structures, program modules or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
[0224] This document is described with reference to flowcharts and / or block diagrams of methods, apparatuses (devices) and computer program products according to the embodiments of this document. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0225] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0226] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0227] In this article, the term "comprises", "includes" or any other variation thereof is intended to cover non-exclusive inclusion, so that an article or device comprising a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such article or device. In the absence of more restrictions, the elements defined by the sentence "comprising..." do not exclude the presence of other identical elements in the article or device comprising the elements.
[0228] Although the preferred embodiments of this invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of this invention.
[0229] Obviously, those skilled in the art can make various changes and modifications to this article without departing from the spirit and scope of this article. Thus, if these modifications and variations of this article fall within the scope of the claims and their equivalents, then the intention of this article also includes these modifications and variations. < / value> < / right> < / left>
Claims
1. A data storage method, characterized in that: include: Re-determine the storage type of the data based on the data access situation, including: When the amount of data stored in the file group reaches the capacity limit or the preset time condition is reached, the data transfer is started; The data is stored according to the re-determined storage type, wherein, in the case where the storage type of the data is changed from a multi-copy type to an EC type, storing the data according to the re-determined storage type includes: determining an import range, importing file records of data of the multi-copy storage type within the import range as the EC type for storage, and importing deletion records of data of the multi-copy storage type that has been deleted within the import range as the EC type for storage; in the case where, in EC type storage, there are both data of the multi-copy storage type converted to the EC type and deletion records of data of the multi-copy storage type, deleting the data from the EC type storage.
2. The data storage method according to claim 1, characterized in that: The step of re-determining the storage type of the data according to the data access situation includes: Obtaining access probability of the data being accessed; comparing the access probability with at least one preset storage condition, the storage condition comprising an access probability interval and a corresponding storage type; In a case where the access probability meets the access probability interval of the preset storage condition, the corresponding storage type is determined as the storage type of the data.
3. The data storage method according to claim 2, characterized in that: The storage type includes at least one or more of the following types: Multi-copy storage, erasure code EC storage, The method further includes: Configure at least one storage condition, which includes at least one or more of the following conditions: When the access probability is within the first access probability interval, the data storage type is determined to be multi-copy storage. When the access probability is within the second access probability interval, the storage type of the data is determined to be EC storage. The lower limit of the first access probability interval is greater than or equal to the upper limit of the second access probability interval.
4. The data storage method according to claim 3, characterized in that: The first access probability interval and the second access probability interval are both time intervals, and the step of obtaining the access probability of the data being accessed includes: The access time when the data was most recently accessed is obtained, and the access time is used as an input parameter for calculating the access probability.
5. The data storage method according to claim 2, characterized in that: The step of determining the import range comprises: The data of the multi-copy storage type whose access probability meets the storage condition and is within the SHA1 range is selected as the import range.
6. The data storage method according to claim 5, characterized in that: The method further includes: The storage range of the data of the multi-copy storage type is updated.
7. The data storage method according to claim 3, characterized in that: Before the step of re-determining the storage type of the data according to the data access situation, the method further includes: The data is stored in a multi-copy type, where the data structure of the multi-copy type includes at least one or more of the following information: SHA1 key value, file name, access timestamp, and deletion information.
8. A data storage device, characterized in that: include: A storage type determination module is used to re-determine the storage type of the data according to the data access situation, and start the data transfer when the amount of data stored in the file group reaches the capacity limit or reaches the preset time condition; A data import module, used to store the data according to the re-determined storage type, wherein, when the storage type of the data is changed from the multi-copy type to the EC type, the data import module includes: An import range determination unit, used for determining an import range; An import execution unit, used to import file records of multi-copy storage type data existing in the import range as the EC type for storage, and import deletion records of multi-copy storage type data deleted in the import range as the EC type for storage; The data deletion module is used to delete the data from the EC type storage when there are records of data of the multi-copy storage type being transferred to the EC type and deletion records of the data of the multi-copy storage type in the EC type storage.
9. The data storage device according to claim 8, characterized in that: The storage type determination module includes: An access probability acquisition unit, used to acquire the access probability of the data being accessed; A storage condition matching unit, used to compare the access probability with at least one preset storage condition, wherein the storage condition includes an access probability interval and a corresponding storage type; The type determination unit is used to determine the corresponding storage type as the storage type of the data when the access probability meets the access probability interval of the preset storage condition.
10. The data storage device according to claim 9, characterized in that: The storage type includes at least one or more of the following types: Multi-copy storage, erasure code EC storage, The device also includes: The storage condition setting module is used to configure at least one storage condition, wherein the storage condition includes at least one or more of the following conditions: When the access probability is within the first access probability interval, the data storage type is determined to be multi-copy storage. When the access probability is within the second access probability interval, the storage type of the data is determined to be EC storage. The lower limit of the first access probability interval is greater than or equal to the upper limit of the second access probability interval.
11. The data storage device according to claim 9, characterized in that: The import range determination unit is specifically used to select data of a multi-copy storage type whose access probability meets the storage condition and is within the SHA1 range as the import range.
12. The data storage device according to claim 11, characterized in that: The device also includes: The storage range updating module is used to update the storage range of the data of the multi-copy storage type.
13. The data storage device according to claim 10, characterized in that: The device also includes: The multi-copy storage module is used to store data as a multi-copy type, wherein the data structure of the multi-copy type includes at least one or more of the following information: SHA1 key value, file name, access timestamp, and deletion information.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed, the steps of the method according to any one of claims 1 to 7 are implemented.
15. A computer device comprising a processor, a memory and a computer program stored in the memory, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
