Embodiment
Method provided by the invention mainly comprises: A is the identical storage unit group of more than 1 size by the spatial division except retaining space in disk array; Be the identical storage unit of more than 1 size by the spatial division except secondary index space in each storage unit group; B, the buffer memory of this disk array writes to same storage unit taking the unit interval as interval by the data order receiving in the same unit interval, and after completing and writing, in described retaining space and described secondary index space, add respectively one-level concordance list and the secondary index table of EC passage corresponding to every circuit-switched data, for this circuit-switched data of inquiry.Pass through the method, realize the object to data writing in disk array with all-cis sequential mode, improve data write efficiency, also improved the I/O processing power of disk array simultaneously, and, by one-level concordance list and the secondary index table of EC passage are set, can realize fast playback and the inquiry of data.
In order to make the object, technical solutions and advantages of the present invention clearer, the disc array structure first embodiment of the present invention being provided is below described.
If such as the storage plan of passage 1 has been selected redundant array of inexpensive disks 1, wherein, the data that comprise passage 1 time brush in storage plan need to be saved the code stream size of time (being designated as data holding time T1) and passage 1 etc. according to EC passage.If this redundant array of inexpensive disks 1 is to be selected first, this disk array is carried out to following operation, to obtain the structure shown in Fig. 2:
First, the space that reservation size is 9MB in redundant array of inexpensive disks 1, it is generally the space of a 9MB in redundant array of inexpensive disks 1.This space can comprise: the superblock space that the one-level index space that size is 8MB and size are 1MB.Wherein, one-level index space is for depositing the one-level concordance list (specifically below describing) of EC passage; And superblock space is for recording the superblock information of EC passage, it is little with the implementation relation of the embodiment of the present invention, no longer detailed description.
Secondly, spatial division except retaining space in redundant array of inexpensive disks 1 is become to M the storage unit group (group) that size is identical, and the spatial division of removing in each storage unit group outside default secondary index space (for depositing the secondary index table of EC passage, specifically in below description) is become to N the storage unit that size is identical.Conventionally, in the time dividing storage unit group, can determine 1 storage unit group according to practical application comprises how many storage unit (in the present embodiment, storage unit is by the unit of unit interval store data, therefore, it in fact namely determines that 1 storage unit group holds at most the data that receive in how many unit interval), determine M according to the data holding time T1 in this definite number and storage plan afterwards.
Such as, unit interval is 1 second, the number N that 1 group comprises storage unit is 1024, represent that 1 group holds at most the data that receive in 1024 seconds, so, if data holding time T1 is 20 days (be designated as 20*24*3600 second) in storage plan, the group number M dividing is:
M=20*24*3600 (second)/1024 (second)=1688.
If the space in redundant array of inexpensive disks 1 except retaining space is 16TB, the size of each storage unit group is: 16*1024*1024/1688=9939MB.
In addition, if secondary index space size is 16MB in each storage unit group, be generally the space of a 16MB in each storage unit group, the size of storage unit group is 9939B, and in storage unit group, the size of each storage unit is (9939-16)/1024=9.69MB.
So, by top-operation, redundant array of inexpensive disks 1 can form the structure shown in Fig. 2.
Based on the disc array structure shown in Fig. 2, the flow process below embodiment of the present invention being provided is described in detail.
Referring to Fig. 3, the detail flowchart that Fig. 3 provides for the embodiment of the present invention.As shown in Figure 3, this flow process can comprise the following steps:
Step 301, for each passage of EC, for this passage (taking passage 1 as example) is formulated storage plan.
Step 302, is that passage 1 is selected disk array according to the data holding time T1 in storage plan, and the disk array of this selection, for the data of 1 time brush of memory channel, is designated as redundant array of inexpensive disks 1.
This step can be that passage 1 is selected disk array according to existing mode, if the disk array quantity of selecting is many, can be using one of them as redundant array of inexpensive disks 1, and carry out following step.
Step 303, judges that whether redundant array of inexpensive disks 1 is by other EC channel selecting, if not, and execution step 304, if so, execution step 305.
Because redundant array of inexpensive disks 1 is to select according to the data holding time in storage plan, and in the storage plan of different EC passages, can comprise the identical data holding time, so exist redundant array of inexpensive disks 1 by the possibility of other EC channel selecting.So, while carrying out step 303, just need to judge that whether redundant array of inexpensive disks 1 is by other EC channel selecting, and carry out different operations according to different judged results, see that respectively step 304 is to step 305.
Step 304, becomes M the storage unit group that size is identical by the spatial division except retaining space in redundant array of inexpensive disks 1, and the spatial division except secondary index space in each storage unit group is become to N the storage unit that size is identical.The concrete operations of this step are described above.Perform step afterwards 307.
Step 305, judges whether redundant array of inexpensive disks 1 can also hold the data volume of 1 time brush of passage, if not, and execution step 306, if so, execution step 307.
If before execution step 302, existing passage 2 and 3 has been selected redundant array of inexpensive disks 1, and also selected redundant array of inexpensive disks 1 for passage 1 in step 302, so, while carrying out this step 305, judge this redundant array of inexpensive disks 1 except holding the data volume of 2 and 3 times brushes of passage, whether can also further hold the data volume of 1 time brush of passage, wherein, the data volume of brushing under passage is to calculate according to the code stream size of the data holding time in the storage plan of this passage and this passage, if can not, execution step 306, if can, execution step 307.
Step 306, if can also select other disk arrays except redundant array of inexpensive disks 1 to carry out the data that storage channels is brushed for 1 time according to the data holding time T1 in storage plan, carries out the operation of redundant array of inexpensive disks 1 according to step 303 for the disk array of this selection; Otherwise, finish current flow process.
Selection operation in this step 306 can be carried out according to existing mode.
Step 307, allows passage 1 to brush data under redundant array of inexpensive disks 1.Perform step afterwards 308.
Can determine to the passage of brushing data under redundant array of inexpensive disks 1 by above step 305 to step 307.All be allowed to brush data under redundant array of inexpensive disks 1 if determine multichannel EC passage by above-mentioned steps 305 to step 307, when this multichannel EC passage is simultaneously when brushing data under redundant array of inexpensive disks 1, execution step 308.
Step 308, the buffer memory of redundant array of inexpensive disks 1 writes to same storage unit taking the unit interval as interval by the data order receiving in the same unit interval, and after completing and writing, in the retaining space (being specially the one-level index space in this retaining space) of redundant array of inexpensive disks 1 and the secondary index space of this storage unit place storage unit group, add respectively one-level concordance list and the secondary index table of EC passage corresponding to every circuit-switched data, for this circuit-switched data of inquiry.
How to realize as for step 308, be described below by the flow process shown in Fig. 4:
Step 401, in the time writing to redundant array of inexpensive disks 1 the data that receive in the current unit interval, judge current whether first to redundant array of inexpensive disks 1 data writing, if so, execution step 402; Otherwise, execution step 403;
Step 402, writes to the data that receive in this current unit interval first storage unit of first storage unit group in redundant array of inexpensive disks 1, performs step afterwards 406;
Step 403, if last storage unit that a upper storage unit is last storage unit group in redundant array of inexpensive disks 1 performs step 404; Otherwise, execution step 405.
The storage unit that the data that a described upper storage unit received for a upper unit interval write.
Step 404, the data of upgrading first storage unit in first storage unit group are the data that receive in the current unit interval, perform step afterwards 406.
That is to say, when data write on redundant array of inexpensive disks 1 after all storage unit, need to come back to first storage unit of first storage unit group, the data of preserving before covering.
Step 405, if the current data that are not also written into of the next storage unit of a upper storage unit directly write to this next one storage unit by the data that receive in the current unit interval, performs step 406 afterwards; Otherwise the data of upgrading in this next one storage unit are the data that receive in the current unit interval, perform step afterwards 406.
Can find out to step 405 by above step 401, the present embodiment is, taking the unit interval as interval, the data that receive in the same unit interval are write to same storage unit.Certainly, because the storage unit in redundant array of inexpensive disks 1 was divided according to the unit interval, if storage unit can not be held the data that receive in the same unit interval completely, can first fill up current storage unit to be written, the data that have more are write to next storage unit, and in the time writing the data of next unit interval reception, the data that this next one unit interval is received then write the vacant space of this storage unit, the like.
Realize with all-cis sequential mode to disk array data writing by above step 401 to step 405.
Step 406, for the every circuit-switched data that newly writes to storage unit, determines the EC passage that this route data is corresponding, judge whether the data of brushing under this EC passage last time write to the storage unit group at this storage unit place, to perform step 407, otherwise, execution step 408.
The every circuit-switched data that newly writes to storage unit in this step 406 specifically can be every circuit-switched data that step 402 or step 405 write, and also can be every circuit-switched data that renewal occurs in step 404 or step 405.
Step 407 is added the one-level concordance list of this EC passage in one-level index space, performs step afterwards 408.
That is to say, if data of this lower brush of EC passage and the deposit data of brushing under last time are in different storage unit groups, can write to after storage unit in the data of this lower brush, in one-level index space, record the one-level concordance list of this EC passage.
Preferably, the present embodiment adds operating speed for accelerating, and can first in buffer memory, carry out this interpolation operation, afterwards the one-level concordance list of interpolation is copied to one-level index space.
Step 408 is added the secondary index table of this EC passage in the secondary index space of this storage unit place storage unit group.
In the present embodiment, one-level concordance list and secondary index table are to be mainly convenient to follow-up data query manipulation, below one-level concordance list and secondary index table are described.
In the present embodiment, one-level concordance list size can be 128KB, and it is for recording the one-level index information of EC passage.The data of brushing under position in storage unit group of the title that wherein, the one-level index information of EC passage comprises this EC passage, the secondary index table of this EC passage (its can by start offset quantitative character), this EC passage write to the time of storage unit group and the numbering of this storage unit group.Taking the definite EC tunnel name of step 406 as EC_206-204 is as example, the one-level concordance list of this EC passage in one-level index space is as shown in table 1:
Table 1
Video channel title |
EC2004_206-204 |
Secondary index table start offset amount |
24 |
Storage unit group # |
Write time |
1 |
2010_6_4_8:45:15 |
2 |
2010_6_4_8:50:15 |
3 |
2010_6_4_9:15:23 |
4 |
2010_6_4_9:30:23 |
…… |
…… |
In table 1, the secondary index table of EC passage is identical (certainly, also can be different, principle is similar) in the position of each storage unit group, and the start offset amount of secondary index table is identical.
As for secondary index table, its size can be 256KB, for recording the secondary index information of EC passage.Wherein, the secondary index packets of information of EC passage containing the size (by block quantitaes) of the data of brushing under this EC passage, position (numbering and start offset scale by storage unit show) in storage unit and accordingly acquisition time (be specially the time being gathered by EC passage, be designated as data time), specifically can join and be shown in Table 2.
Table 2
In table 2, occur that storage unit numbering is identical, but the situation that storage unit start offset amount is different, such as, in table 2, be numbered 2 storage unit, why there will be this situation, mainly owing to usually existing labile factor such as the different data of multiple data time that unstable networks etc. causes are brushed the buffer memory to redundant array of inexpensive disks 1 under quilt within a unit interval in video traffic, the data that are respectively 2010_6_49:00:08 and 2010_6_49:00:09 such as data time in table 2 arrive buffer memory in the same unit interval, buffer memory will enter these two data sequential write to the i.e. storage unit 2 in table 2 of same storage unit, there is above-mentioned situation.
So far, complete the description of one-level concordance list and secondary index table.Realize the one-level concordance list of EC passage and the interpolation of secondary index table operation by step 407 to step 408 above.It should be noted that, if in above-mentioned data writing process, need to delete the storage plan of a certain road EC passage, search and delete the one-level concordance list of this EC passage from the one-level index space of redundant array of inexpensive disks 1, and the location lookup of this EC passage secondary index table comprising according to this deleted one-level concordance list delete the secondary index table of this EC passage.
It should be noted that, in above-mentioned ablation process, if suspending, certain road EC passage brushes data under redundant array of inexpensive disks 1, here, EC passage suspends to brushing data under redundant array of inexpensive disks 1 and normally represents currently the data of the lower brush of this EC passage to be verified, in order to facilitate this verification work, need to ensure that the data of brushing under this EC passage are not updated, specifically can realize by following operation: the EC passage that first makes to suspend issues and suspends the buffer memory of notifying to redundant array of inexpensive disks 1; When receiving, buffer memory suspends after notice, in one-level index space, search the one-level concordance list of the EC passage of this time-out, find the secondary index table of this EC passage according to EC passage secondary index table position in this one-level concordance list, and in the secondary index table finding, obtain the position of the data of brushing under this EC passage in storage unit, lock afterwards this position, so that the data of this position are not updated.Such as, passage 1 needs to suspend brushes data under redundant array of inexpensive disks 1, this passage 1 will issue to suspend and notify the buffer memory of informing to redundant array of inexpensive disks 1, when this buffer memory receives after notice, in one-level index space, find the one-level concordance list of passage 1, the location lookup of this passage 1 secondary index table comprising according to this one-level concordance list finding is to the secondary index table of passage 1, the position of the data of obtaining this passage 1 time brush in the secondary index table that this finds in each storage unit, lock afterwards this position, so that the data of this position are not updated.
So, the renewal operation that above-mentioned steps 404 or step 405 are carried out specifically can comprise: if this storage unit comprises latched position, upgrading the data except latched position in this storage unit is the data that receive in the current unit interval; Otherwise the data of upgrading in this storage unit are the data that receive in the current unit interval.
In addition, this embodiment is for saving one-level index space and secondary index space resources, can be before step 404 or step 405 execution renewal operation, carry out following steps: the whether latched position of storage unit that first judges current data to be written, if so, determine EC passage corresponding to the data except latched position in this storage unit; If not, determine EC passage corresponding to data of depositing in this storage unit; Afterwards, in one-level index space, delete the one-level concordance list of this definite EC passage, and in the secondary index space of this storage unit place storage unit group, delete the secondary index table of this definite EC passage.
Step 409, the data that receive within for the per unit time complete data and write flow process after all carrying out according to above-mentioned steps 401 to step 408.
So far the data that, realized the embodiment of the present invention and provide write flow process.
Afterwards, if a certain passage such as passage 1 is to the cache request reading out data of redundant array of inexpensive disks 1, the time period of reading out data has been carried in this request, the flow process shown in execution graph 5.
Step 501 finds the one-level concordance list of passage 1 in one-level index space.
The title that comprises passage due to one-level concordance list, therefore, the name that this step 501 can passage 1 is called the one-level concordance list that key word comprises this key word the search of one-level index space.
Step 502, from this one-level concordance list, determine the write time early than and approach the numbering of the storage unit group of this time period initial time most, and determine the numbering of the storage unit group that is later than and approaches most this end time time period.
Such as, if the time period of carrying in request is 2010_6_4_8:55:10 to 2010_6_4_9:28:10, the name of passage 1 is called EC_206-204, according to table 1 can obtain the write time early than and approach most 2010_6_4_8:55:10 storage unit group be numbered 2, and be later than and approach most 2010_6_4_9:28:10 storage unit group be numbered 4.
Step 503, the secondary index table that finds this EC passage in one-level concordance list respectively each between above-mentioned two numberings and above-mentioned two numberings is numbered the position in corresponding storage unit group, the data time, Data Position and the described time period data query that comprise according to this locational secondary index table.
Can find out according to table 1, data are each storage unit groups that write to successively disk array according to time order and function order, therefore, when two storage unit groups corresponding to numbering determining in step 502 meet the above-mentioned time period, each between these two numberings numbered corresponding storage unit group and certainly also met the above-mentioned time period.Such as, if step 502 determine the write time early than, and approach most 2010_6_4_8:55:10 storage unit group be numbered 2, be later than, and approach most 2010_6_4_9:28:10 storage unit group be numbered 4, can know according to table 1, the corresponding storage unit group of numbering 3 between this numbering 2 and numbering 4 also meets this time period, therefore, this step need to determine that the secondary index table of this EC passage is respectively in numbering 2, position in 3 and 4 three storage unit groups, the data time comprising according to this locational secondary index table afterwards, Data Position, and described time period data query.
So far, realize data and read flow process.
The method above embodiment of the present invention being provided is described, and the device below embodiment of the present invention being provided is described.
Referring to Fig. 6, the structure drawing of device that Fig. 6 provides for the embodiment of the present invention.As shown in Figure 6, this device comprises: writing module 601, interpolation module 602 and enquiry module 603,
Wherein, writing module 601, at multichannel EC passage simultaneously when brushing data under disk array, the each circuit-switched data order receiving in the same unit interval is write to storage unit;
Add module 602, for after completing at writing module 601 and writing, in retaining space and secondary index space, add respectively one-level concordance list and the secondary index table of EC passage corresponding to every circuit-switched data, for enquiry module 603 these circuit-switched data of inquiry;
Wherein, described storage unit is by the spatial division except described secondary index space in storage unit group is obtained, and described storage unit group is by the spatial division except retaining space in disk array is obtained.
As shown in Figure 6, while adding module 602 specific implementation, can comprise:
First judges submodule 6021, for the corresponding EC passage of every circuit-switched data writing for writing module 601, judge whether the data of brushing under this EC passage last time write to the storage unit group at described storage unit place, if so, send second and add notice to the second interpolation submodule 6023; Otherwise, send first and add notice to the first interpolation submodule 6022;
First adds submodule 6022, while notice, adds the one-level concordance list of this EC passage in retaining space for receiving described the first interpolation, sends afterwards the 3rd and adds notice to the second interpolation submodule 6023; Numbering, the data that this one-level concordance list comprises described storage unit group write to time, the title of this EC passage and the position of secondary index table thereof of this storage unit group;
Second adds submodule 6023, while adding notice, adds the secondary index table of this EC passage in the secondary index space of this storage unit group for receiving described the second interpolation notice or the 3rd; This secondary index table comprises this circuit-switched data at the position of storage unit and collected data time.
Preferably, as shown in Figure 6, writing module 601 can comprise:
Second judges submodule 6011, in the time writing to disk array the data that receive in the current unit interval, judge current whether first to disk array data writing, if so, send first write notice to writing submodule 6012; Otherwise, judge whether a upper storage unit is last storage unit of last storage unit group in disk array, a described upper storage unit is the storage unit writing a upper unit interval, if so, sends second and writes notice to writing submodule 6012; Otherwise, send the 3rd and write notice to writing submodule 6012;
Write submodule 6012, receive first and write after notice, the data that receive are write to first storage unit of first storage unit group in described disk array in the current unit interval; Receive second and write after notice, the data of upgrading first storage unit in first storage unit group are the data that receive in the current unit interval; Receiving the 3rd writes after notice, if also data writing not of the next storage unit of a upper storage unit, the data that receive in the current unit interval are write to this next one storage unit, otherwise the data of upgrading in this next one storage unit are the data that receive in the current unit interval.
Preferably, as shown in Figure 6, when enquiry module 603 specific implementation, can comprise:
Search submodule 6031, when receiving the data of EC channel request reading disk array, described request has been carried the time period of reading out data, finds the one-level concordance list of this EC passage in retaining space;
Determine submodule 6032, for from search one-level concordance list that submodule 6031 finds determine the write time early than and approach the numbering 1 of the storage unit group of this time period initial time most, and determine the numbering 2 of the storage unit group that is later than and approaches most this end time time period;
Inquiry submodule 6033, for the secondary index table that finds this EC passage at the one-level concordance list position in each storage unit group corresponding to each numbering between numbering 1, numbering 2 and numbering 1 and numbering 2 respectively, the data time comprising according to this locational secondary index table, Data Position and described time period data query.
As can be seen from the above technical solutions, in the present invention, when multichannel EC passage is simultaneously when brushing data under same disk array, taking the unit interval as interval, the multichannel data order receiving in the same unit interval is write to same storage unit, realized the object of order to disk array data writing, improve data write efficiency, also improved the I/O processing power of disk array, reduced the risk that slowly causes loss of data in video traffic due to the response of storage end simultaneously.
The foregoing is only preferred embodiment of the present invention, in order to limit the present invention, within the spirit and principles in the present invention not all, any amendment of making, be equal to replacement, improvement etc., within all should being included in the scope of protection of the invention.