CN105512325B - Update, deletion and the method for building up and device of multi-edition data index - Google Patents

Update, deletion and the method for building up and device of multi-edition data index Download PDF

Info

Publication number
CN105512325B
CN105512325B CN201510966748.1A CN201510966748A CN105512325B CN 105512325 B CN105512325 B CN 105512325B CN 201510966748 A CN201510966748 A CN 201510966748A CN 105512325 B CN105512325 B CN 105512325B
Authority
CN
China
Prior art keywords
index
layer
data
version
primary
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201510966748.1A
Other languages
Chinese (zh)
Other versions
CN105512325A (en
Inventor
于传帅
张程伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201510966748.1A priority Critical patent/CN105512325B/en
Publication of CN105512325A publication Critical patent/CN105512325A/en
Application granted granted Critical
Publication of CN105512325B publication Critical patent/CN105512325B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention discloses update, deletion and the method for building up and device of a kind of multi-edition data index.Technical solution provided in an embodiment of the present invention, the index entry of laminated tissue's data constitutes multilayer index, the corresponding data of different index entries version order having the same in every layer index, and, in every layer index, to the feature structure or characteristic information of each index entry setting characterize data version, thus the version information of data can be obtained from index entry.When being indexed update and deleting, the feature structure and information of characterize data version in index entry are changed, index entry is then moved to index level corresponding with the feature structure of characterize data version and information, is not related to issued transaction.Technical solution provided in an embodiment of the present invention, index structure is simple, and expense is small, and recall precision is high, updates and the treatment processes such as deletion are easy, read and write concurrent situation substantially suitable for handling.

Description

Update, deletion and the method for building up and device of multi-edition data index
Technical field
The present invention relates to update, deletion and method for building up that database technical field more particularly to multi-edition data index And device.
Background technique
It, can be to the same data in order to improve the concurrency, reliability and trackability of data in data-storage system Multiple versions are saved, that is, are not by the data when data-storage system does a update operation to some data Old version (old version) is deleted, then the new version covering of the data is got on, but old version is done a label To be isolated with new version, then increases new version newly again and complete to update, therefore the old version of the data and new version are all It is present in data-storage system, wherein new version is also known as current version.The old version and current version of data all store In data-storage system, the operation of generation can read suitable version as needed, although being conducive to data in this way Retrospect, improves the reliability of data, but when concurrent operations occur, and the consistency of data becomes as big problem, to prevent Mistakes, the data-storage system such as dirty reading (Dirty Read) and unreal reading (Phantom Read) generally use MVCC (Multi- Version Concurrency Control, Multi version concurrency control) mechanism carries out the processing of concurrent operations.
The realization of MVCC mainly has following manner:
1, the storage organization indexed using heap, heap are stored among memory.By taking PostgreSQL as an example, using heap plus B+ The storage organization for setting index, data include version information in heap, PostgreSQL by the latest edition of data or old version all It is stored in heap.Two attributes of t_xmin and t_xmax are recorded in heap on every data head, respectively indicate creation and delete this In addition the affairs ID of version records t_ctid attribute, indicates the RID (Row of the version of the next update of the data Identification, line identifier), thus multiple versions of data are constituted from most experienced newest single-track link table.Delete one When data, t_xmax is set, data are not deleted really;When updating a data, it is one new version of insertion, will be updated The t_xmax t_ctid that is set as the ID of Current transaction, and the version being updated is set of version be directed toward the new version of insertion.Number According to all versions all there is corresponding index entry in the index, but do not include version information then in indexing.
2, using the storage organization of index organization's table, without heap, data are stored in major key index, each of major key index Index entry all includes the major key of corresponding data, and other indexes are known as secondary index.Major key index possesses version information, but only deposits The latest edition of data is stored up, the information of old version is then centrally stored in roll-back segment.Include on the head of major key index data Affairs ID and the pointer for being directed toward old version in roll-back segment, also comprising being directed toward more preceding go through in the old version information in roll-back segment The pointer of history version, i.e. version chained list are from the new to the old, only delete label without real to data when deleting data Ground is deleted, and carries out local update to data when more new data, and the preceding picture of data (version before update) is write in roll-back segment. Secondary index stores the corresponding index entry of multiple versions of every data, and each index entry does not simultaneously include version information.
In the first way that above-mentioned MVCC is realized, there are multiple versions for data, and index only one, delete data When, index cannot be deleted, therefore with the increase of update, index can store many useless nodes, cause recall precision more next It is lower.In addition, data query is all a scanning index, required attribute is directly returned to from index, due to not having completely in index There is version information, first way can not achieve covering index scanning (Coverage Index Scan).What above-mentioned MVCC was realized The second way, major key index data are connected by being directed toward the pointer of old version in roll-back segment on head with each version, are needed Time new version can be obtained by reading latest edition, and carry out needing to clear up all modifications made by affairs when transaction rollback, It may result in that rollback is very slow, thus the access efficiency of data is low, furthermore secondary index does not include version information yet, can not achieve Covering index scanning.In addition, above two mode is all specifically applied to the transaction concurrency of data-storage system, each version of data It is needed in this comprising information such as affairs numbers, and the version information needed in data-storage system is often simply very much, two kinds The data structure of mode is all very complicated, and expense is big, indexed search low efficiency, and the processing low efficiency such as update and deletion is not suitable for Only concurrent situation is read and write in processing substantially.
Summary of the invention
The embodiment of the invention provides update, deletion and the method for building up and device of a kind of multi-edition data index, with solution Certainly data-storage system reads and writes the problem of indexed search low efficiency in concurrent processing substantially.
In a first aspect, the embodiment of the present invention provides a kind of update method of multi-edition data index, comprising:
Changed according to the version for being updated the corresponding multiple edition datas of data, is updated respectively multiple described in multilayer index The feature structure or characteristic information of characterize data version in the corresponding multiple index entries of edition data;
The multiple index entry is respectively moved to corresponding with the feature structure of its characterize data version or characteristic information In index level;
The corresponding new index entry write-in of data will be updated to correspond in the index level of latest edition data,
Wherein, the corresponding data of index entry version having the same time different in every layer index of the multilayer index Sequence, the version order are the new and old order of versions of data, the version of the new and old order of the versions of data previously according to data Setting, and the feature structure or characteristic information of characterize data version are provided in the index entry of every layer index.
With reference to first aspect, in a first possible implementation of that first aspect, if an index level corresponds to one Version order, the feature structure or characteristic information pair the multiple index entry being respectively moved to its characterize data version In the index level answered, comprising:
To each index entry a in the multiple index entryi, judge a in multilayer indexiWhether the primary index layer at place In the presence of a layer index layer;
If aiA layer index layer in the presence of the primary index layer at place, by aiNext layer of rope of the primary index layer is written Draw in layer, and deletes a in the primary index layeri
If aiNext layer index layer is not present in the primary index layer at place, then deletes ai,
Wherein, i=1 ... m, m are the number of the multiple index entry, version corresponding to next layer index layer time Sequence and aiVersion order corresponding to the primary index layer of place is adjacent, and is older than aiVersion corresponding to the primary index layer of place time Sequence.
The first possible implementation with reference to first aspect, in a second possible implementation of that first aspect, institute State multi-edition data index update method, with the current version of data be newest version, n version of data it is new and old Order is successively redefined for 1,2 ... n, the multilayer index, including n-layer index according to sequence from the new to the old, wherein the The version order of the corresponding data of index entry is n in n-layer index,
If aiA layer index layer in the presence of the primary index layer at place, by aiThe next of the primary index layer is written In layer index layer, comprising:
By aiT is writtenaiIn+1 layer index layer, wherein taiFor the corresponding version order of the primary index layer, taiIt is less than n。
With reference to first aspect, in first aspect in the third possible implementation, correspond to if existing in multilayer index The index level of multiple version order, the feature structure the multiple index entry being respectively moved to its characterize data version Or in the corresponding index level of characteristic information, comprising:
To each index entry a in the multiple index entryi, judge a in multilayer indexiIt is in the primary index layer at place It is no to exist except aiIn addition other are described to belong to the multiple index entry with number index entry with number index entry;
If aiExist in the primary index layer at place and removes aiIn addition other judge a with number index entryiIt whether is its place Primary index layer in oldest same several index entries;
Judge a in multilayer indexiThe primary index layer at place whether there is next layer index layer;
If aiThere is no remove a in the primary index layer at placeiOther same number index entries in addition, and aiThe original rope at place Draw a layer index layer in the presence of layer, alternatively, aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiOldest same several index entries in primary index layer where it, and aiA layer index layer in the presence of the primary index layer at place, Then by aiIt is written in next layer index layer of the primary index layer, and deletes a in the primary index layeri
If aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiThe not original where it Oldest same several index entries in beginning index level, and aiA layer index layer, then keep a in the presence of the primary index layer at placei, by ai Oldest same several index entries are written in next layer index layer of the primary index layer in the primary index layer at place;
If aiThere is no remove a in the primary index layer at placeiOther same number index entries in addition, and aiThe original rope at place Drawing layer, there is no next layer index layers, alternatively, aiExist in the primary index layer at place and removes aiIn addition other are the same as number index entry ak, and aiOldest same several index entries in primary index layer where it, and aiNext layer is not present in the primary index layer at place Index level then deletes a in the primary index layeri
If aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiThe not original where it Oldest same several index entries in beginning index level, and aiNext layer index layer is not present in the primary index layer at place, then keeps ai, will aiOldest same number index entry deletion in the primary index layer at place,
Wherein, oldest same several index entries are that corresponding versions of data is same compared to other in the primary index layer The oldest same several index entries of the corresponding versions of data of number index entry, i=1 ... m, m are the number of the multiple index entry, described Version order and a corresponding to next layer index layeriVersion order corresponding to the primary index layer of place is adjacent, and is older than aiInstitute The version order corresponding to primary index layer.
Second aspect, the embodiment of the present invention provide a kind of index entry delet method of multi-edition data index, comprising:
Changed according to the version of the corresponding multiple edition datas of deleted data, is updated respectively multiple described in multilayer index The feature structure or characteristic information of characterize data version in the corresponding multiple index entries of edition data;
The multiple index entry is respectively moved to corresponding with the feature structure of its characterize data version or characteristic information In index level,
Wherein, the corresponding data of index entry version having the same time different in every layer index of the multilayer index Sequence, the version order are the new and old order of versions of data, the version of the new and old order of the versions of data previously according to data Setting, and the feature structure or characteristic information of characterize data version are provided in the index entry of every layer index.
In conjunction with second aspect, in second aspect in the first possible implementation, if an index level corresponds to one Version order, the feature structure or characteristic information pair the multiple index entry being respectively moved to its characterize data version In the index level answered, comprising:
To each index entry a in the multiple index entryi, judge a in multilayer indexiWhether the primary index layer at place In the presence of a layer index layer;
If aiA layer index layer in the presence of the primary index layer at place, by aiNext layer of rope of the primary index layer is written Draw in layer, and deletes a in the primary index layeri
If aiNext layer index layer is not present in the primary index layer at place, then deletes ai,
Wherein, i=1 ... m, m are the number of the multiple index entry, version corresponding to next layer index layer time Sequence and aiVersion order corresponding to the primary index layer of place is adjacent, and is older than aiVersion corresponding to the primary index layer of place time Sequence.
In conjunction with second aspect, in second of second aspect possible implementation, correspond to if existing in multilayer index The index level of multiple version order, the feature structure the multiple index entry being respectively moved to its characterize data version Or in the corresponding index level of characteristic information, comprising:
To each index entry a in the multiple index entryi, judge a in multilayer indexiIt is in the primary index layer at place It is no to exist except aiIn addition other are described to belong to the multiple index entry with number index entry with number index entry;
If aiExist in the primary index layer at place and removes aiIn addition other judge a with number index entryiIt whether is its place Primary index layer in oldest same several index entries;
Judge a in multilayer indexiThe primary index layer at place whether there is next layer index layer;
If aiThere is no remove a in the primary index layer at placeiOther same number index entries in addition, and aiThe original rope at place Draw a layer index layer in the presence of layer, alternatively, aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiOldest same several index entries in primary index layer where it, and aiA layer index layer in the presence of the primary index layer at place, Then by aiIt is written in next layer index layer of the primary index layer, and deletes a in the primary index layeri
If aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiThe not original where it Oldest same several index entries in beginning index level, and aiA layer index layer, then keep a in the presence of the primary index layer at placei, by ai Oldest same several index entries are written in next layer index layer of the primary index layer in the primary index layer at place;
If aiThere is no remove a in the primary index layer at placeiOther same number index entries in addition, and aiThe original rope at place Drawing layer, there is no next layer index layers, alternatively, aiExist in the primary index layer at place and removes aiIn addition other are the same as number index entry ak, and aiOldest same several index entries in primary index layer where it, and aiNext layer is not present in the primary index layer at place Index level then deletes a in the primary index layeri
If aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiThe not original where it Oldest same several index entries in beginning index level, and aiNext layer index layer is not present in the primary index layer at place, then keeps ai, will aiOldest same number index entry deletion in the primary index layer at place,
Wherein, oldest same several index entries are that corresponding versions of data is same compared to other in the primary index layer The oldest same several index entries of the corresponding versions of data of number index entry, i=1 ... m, m are the number of the multiple index entry, described Version order and a corresponding to next layer index layeriVersion order corresponding to the primary index layer of place is adjacent, and is older than aiInstitute The version order corresponding to primary index layer.
The third aspect, the embodiment of the present invention provide a kind of method for building up of multi-edition data index, comprising:
Multilayer index is organized, and the feature structure or characteristic information of characterize data version are set in index entry, wherein is every The corresponding data of different index entry version order having the same in layer index, the version order are the new and old of versions of data The new and old order of order, the versions of data is set previously according to the version of data.
In conjunction with the third aspect, in the third aspect in the first possible implementation, the multi-edition data index is built Cube method, characteristic information of the position that data are stored in a storage medium using in index entry as characterize data version.
In conjunction with the third aspect, in second of the third aspect possible implementation, using the version information of data as table Levy the characteristic information of versions of data.
In conjunction with the third aspect, in the third aspect in the third possible implementation, the multi-edition data index is built Cube method, further includes:
For every layer index, memory storage priority is set;
Storage threshold value is periodically arranged according to the storage condition of memory;
Judge the index level for being less than the storage threshold value in memory with the presence or absence of memory storage priority;
If there are the index level that memory storage priority is less than the storage threshold value in memory, memory storage priority is small Other specified solid storage mediums are stored in the index level of the storage threshold value, and are deleted from memory;
Judge whether there is the index level that memory storage priority is greater than or equal to the storage threshold value;
Memory storage priority is greater than or equal to the index level of the storage threshold value if it exists, judges memory storage priority Whether the index level more than or equal to the storage threshold value is stored in memory;
If the index level that memory storage priority is greater than or equal to the storage threshold value is stored in except memory, memory is deposited The index level that storage priority is greater than or equal to the storage threshold value is stored in memory.
In conjunction with the third aspect, in the 4th kind of possible implementation of the third aspect, the new and old order of the versions of data Previously according to data version setting, comprising: with the current version of data be newest version, n version of data it is new and old Order is successively redefined for 1,2 ... n according to sequence from the new to the old;
The tissue multilayer index, comprising:
The first layer index is organized, the version order of the corresponding data of index entry is 1 in first layer index;
Other layer indexs are organized, the version order of the corresponding data of index entry is one or more in other layer indexs.
In conjunction with the 4th kind of possible implementation of the third aspect, in the 5th kind of possible implementation of the third aspect, institute State tissue multilayer index, comprising: tissue n-layer index, wherein the version order of the corresponding data of index entry is in n-th layer index n。
In conjunction with the 4th kind of possible implementation of the third aspect, in the 6th kind of possible implementation of the third aspect, institute State tissue multilayer index, comprising:
The first layer index is organized, the version order of the corresponding data of index entry is 1 in first layer index;
The second layer index is organized, the version order of the corresponding data of index entry is 2 in second layer index;
Third layer index is organized, the version order of the corresponding data of index entry is 3 to n in the third layer index,
Wherein, n is greater than 3.
In conjunction with the 4th kind to the 6th kind possible implementation any of them of the third aspect, at the 7th kind of the third aspect In possible implementation, the method for building up of the multi-edition data index, further includes: deposit first layer index fixation It is stored in memory.
In conjunction with the third aspect, in the 8th kind of possible implementation of the third aspect, the new and old order of the versions of data Previously according to data version setting, comprising: with the current version of data be newest version, n version of data it is new and old Order is successively redefined for 1,2 ... n according to sequence from the new to the old, wherein n is greater than 2;
The tissue multilayer index, comprising:
The first layer index is organized, the version order of the corresponding data of index entry is 1 and 2 in first layer index;
Other layer indexs are organized, the version order of the corresponding data of index entry is one or more in other layer indexs.
Fourth aspect, the embodiment of the present invention provide a kind of updating device of multi-edition data index, comprising:
First version updating unit, for according to the version variation for being updated the corresponding multiple edition datas of data, difference Update the feature structure or feature of characterize data version in the corresponding multiple index entries of multiple edition datas described in multilayer index Information;
First index entry mobile unit, for the multiple index entry to be respectively moved to the spy with its characterize data version It levies in structure or the corresponding index level of characteristic information;
New index entry writing unit corresponds to latest edition data for that will be updated the corresponding new index entry write-in of data Index level in,
Wherein, the corresponding data of index entry version having the same time different in every layer index of the multilayer index Sequence, the version order are the new and old order of versions of data, the version of the new and old order of the versions of data previously according to data Setting, and the feature structure or characteristic information of characterize data version are provided in the index entry of every layer index.
The first possible implementation in conjunction with fourth aspect, in second of fourth aspect possible implementation, if One index level corresponds to a version order, and the index entry mobile unit is specifically used for:
To each index entry a in the multiple index entryi, judge a in multilayer indexiWhether the primary index layer at place In the presence of a layer index layer;
If aiA layer index layer in the presence of the primary index layer at place, by aiNext layer of rope of the primary index layer is written Draw in layer, and deletes a in the primary index layeri
If aiNext layer index layer is not present in the primary index layer at place, deletes ai,
Wherein, i=1 ... m, m are the number of the multiple index entry, version corresponding to next layer index layer time Sequence and aiVersion order corresponding to the primary index layer of place is adjacent, and is older than aiVersion corresponding to the primary index layer of place time Sequence.
It is newest with the current version of data in second of fourth aspect possible implementation in conjunction with fourth aspect Version, the new and old order of n version of data is successively redefined for 1,2 ... n according to sequence from the new to the old, described more Layer index, including n-layer index, wherein the version order of the corresponding data of index entry is n in n-th layer index, and the index entry moves Moving cell, if in aiA layer index layer in the presence of the primary index layer at place, by aiNext layer of rope of the primary index layer is written When drawing in layer, it is specifically used for:
By aiT is writtenaiIn+1 layer index layer, wherein taiFor the corresponding version order of the primary index layer, taiIt is less than n。
In conjunction with fourth aspect, in fourth aspect in the third possible implementation, correspond to if existing in multilayer index The index level of multiple version order, the index entry mobile unit, is specifically used for:
To each index entry a in the multiple index entryi, judge a in multilayer indexiIt is in the primary index layer at place It is no to exist except aiIn addition other are described to belong to the multiple index entry with number index entry with number index entry;
If aiExist in the primary index layer at place and removes aiIn addition other judge a with number index entryiIt whether is its place Primary index layer in oldest same several index entries;
Judge a in multilayer indexiThe primary index layer at place whether there is next layer index layer;
If aiThere is no remove a in the primary index layer at placeiOther same number index entries in addition, and aiThe original rope at place Draw a layer index layer in the presence of layer, alternatively, aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiOldest same several index entries in primary index layer where it, and aiA layer index layer in the presence of the primary index layer at place, Then by aiIt is written in next layer index layer of the primary index layer, and deletes a in the primary index layeri
If aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiThe not original where it Oldest same several index entries in beginning index level, and aiA layer index layer, then keep a in the presence of the primary index layer at placei, by ai Oldest same several index entries are written in next layer index layer of the primary index layer in the primary index layer at place;
If aiThere is no remove a in the primary index layer at placeiOther same number index entries in addition, and aiThe original rope at place Drawing layer, there is no next layer index layers, alternatively, aiExist in the primary index layer at place and removes aiIn addition other are the same as number index entry ak, and aiOldest same several index entries in primary index layer where it, and aiNext layer is not present in the primary index layer at place Index level then deletes a in the primary index layeri
If aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiThe not original where it Oldest same several index entries in beginning index level, and aiNext layer index layer is not present in the primary index layer at place, then keeps ai, will aiOldest same number index entry deletion in the primary index layer at place,
Wherein, oldest same several index entries are that corresponding versions of data is same compared to other in the primary index layer The oldest same several index entries of the corresponding versions of data of number index entry, i=1 ... m, m are the number of the multiple index entry, described Version order and a corresponding to next layer index layeriVersion order corresponding to the primary index layer of place is adjacent, and is older than aiInstitute The version order corresponding to primary index layer.
5th aspect, the embodiment of the present invention provide a kind of index entry deletion device of multi-edition data index, comprising:
Second edition updating unit, for according to the version variation for being deleted the corresponding multiple edition datas of data, difference Update the feature structure or feature of characterize data version in the corresponding multiple index entries of multiple edition datas described in multilayer index Information;
Second index entry mobile unit, for the multiple index entry to be respectively moved to the spy with its characterize data version It levies in structure or the corresponding index level of characteristic information,
Wherein, the corresponding data of index entry version having the same time different in every layer index of the multilayer index Sequence, the version order are the new and old order of versions of data, the version of the new and old order of the versions of data previously according to data Setting, and the feature structure or characteristic information of characterize data version are provided in the index entry of every layer index.
In conjunction with the 5th aspect, in the 5th aspect the first possible implementation, if index level corresponds to one Version order, the second index entry mobile unit, is specifically used for:
To each index entry a in the multiple index entryi, judge a in multilayer indexiWhether the primary index layer at place In the presence of a layer index layer;
If aiA layer index layer in the presence of the primary index layer at place, by aiNext layer of rope of the primary index layer is written Draw in layer, and deletes a in the primary index layeri
If aiNext layer index layer is not present in the primary index layer at place, deletes ai,
Wherein, i=1 ... m, m are the number of the multiple index entry, version corresponding to next layer index layer time Sequence and aiVersion order corresponding to the primary index layer of place is adjacent, and is older than aiVersion corresponding to the primary index layer of place time Sequence.
Correspond in the 5th second of possible implementation of aspect if existing in multilayer index in conjunction with the 5th aspect The index level of multiple version order, the second index entry mobile unit, is specifically used for:
To each index entry a in the multiple index entryi, judge a in multilayer indexiIt is in the primary index layer at place It is no to exist except aiIn addition other are described to belong to the multiple index entry with number index entry with number index entry;
If aiExist in the primary index layer at place and removes aiIn addition other judge a with number index entryiIt whether is its place Primary index layer in oldest same several index entries;
Judge a in multilayer indexiThe primary index layer at place whether there is next layer index layer;
If aiThere is no remove a in the primary index layer at placeiOther same number index entries in addition, and aiThe original rope at place Draw a layer index layer in the presence of layer, alternatively, aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiOldest same several index entries in primary index layer where it, and aiA layer index layer in the presence of the primary index layer at place, Then by aiIt is written in next layer index layer of the primary index layer, and deletes a in the primary index layeri
If aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiThe not original where it Oldest same several index entries in beginning index level, and aiA layer index layer, then keep a in the presence of the primary index layer at placei, by ai Oldest same several index entries are written in next layer index layer of the primary index layer in the primary index layer at place;
If aiThere is no remove a in the primary index layer at placeiOther same number index entries in addition, and aiThe original rope at place Drawing layer, there is no next layer index layers, alternatively, aiExist in the primary index layer at place and removes aiIn addition other are the same as number index entry ak, and aiOldest same several index entries in primary index layer where it, and aiNext layer is not present in the primary index layer at place Index level then deletes a in the primary index layeri
If aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiThe not original where it Oldest same several index entries in beginning index level, and aiNext layer index layer is not present in the primary index layer at place, then keeps ai, will aiOldest same number index entry deletion in the primary index layer at place,
Wherein, oldest same several index entries are that corresponding versions of data is same compared to other in the primary index layer The oldest same several index entries of the corresponding versions of data of number index entry, i=1 ... m, m are the number of the multiple index entry, described Version order and a corresponding to next layer index layeriVersion order corresponding to the primary index layer of place is adjacent, and is older than aiInstitute The version order corresponding to primary index layer.
6th aspect, what the embodiment of the present invention provided a kind of multi-edition data index establishes device, comprising:
Index organization's unit, index organization's unit are used for tissue multilayer index, wherein different rope in every layer index Draw the corresponding data of item version order having the same, the version order is the new and old order of versions of data, the data version This new and old order is set previously according to the version of data;
Feature setting unit, for the feature structure or characteristic information of characterize data version to be arranged in index entry.
In conjunction with the 6th aspect, the 6th aspect the first possible implementation in, be stored in and deposited with data in index entry Feature structure of the position as characterize data version in storage media.
In conjunction with the 6th aspect, in the 6th second of possible implementation of aspect, using the version information of data as table Levy the characteristic information of versions of data.
In conjunction with the 6th aspect, in the 6th aspect the third possible implementation, the described multi-edition data index Establish device, further includes:
Memory storage priority setting unit, for memory storage priority to be arranged for every layer index;
Threshold setting unit is stored, for storage threshold value periodically to be arranged according to the storage condition of memory;
First judging unit, the rope for judging to be less than the storage threshold value in memory with the presence or absence of memory storage priority Draw layer;
First execution unit, if for there are memory storage priority to be less than the index level for storing threshold value in memory, The index level that memory storage priority is less than the storage threshold value is stored in other specified solid storage mediums, and from memory Middle deletion;
Second judgment unit, the rope for being greater than or equal to the storage threshold value for judging whether there is memory storage priority Draw layer;
Third judging unit is greater than or equal to the index level of the storage threshold value for memory storage priority if it exists, Judge that memory storage priority is greater than or equal to whether the index level for storing threshold value is stored in memory;
Second execution unit, if the index level for memory storage priority to be greater than or equal to the storage threshold value is stored in Except memory, the index level that memory storage priority is greater than or equal to the storage threshold value is stored in memory.
In conjunction with the 6th aspect, in the 6th the 4th kind of possible implementation of aspect, the new and old order of the versions of data Previously according to data version setting, comprising: with the current version of data be newest version, n version of data it is new and old Order is successively redefined for 1,2 ... n according to sequence from the new to the old;
Index organization's unit, is specifically used for:
The first layer index is organized, the version order of the corresponding data of index entry is 1 in first layer index;
Other layer indexs are organized, the version order of the corresponding data of index entry is one or more in other layer indexs.
In conjunction with the 6th the 4th kind of possible implementation of aspect, in the 6th the 5th kind of possible implementation of aspect, institute Index organization's unit is stated, is specifically used for: tissue n-layer index, wherein the version time of the corresponding data of index entry in n-th layer index Sequence is n.
In conjunction with the 6th the 4th kind of possible implementation of aspect, in the 6th the 6th kind of possible implementation of aspect, institute Index organization's unit is stated, is specifically used for:
The first layer index is organized, the version order of the corresponding data of index entry is 1 in first layer index;
The second layer index is organized, the version order of the corresponding data of index entry is 2 in second layer index;
Third layer index is organized, the version order of the corresponding data of index entry is 3 to n in the third layer index,
Wherein, n is greater than 3.
In conjunction with the 6th the 4th kind to the 6th kind possible implementation any of them of aspect, at the 6th the 7th kind of aspect In possible implementation, the multi-edition data index establishes device, further includes:
Static memory cell is used for the first layer index fixed storage in memory.
In conjunction with the 6th aspect, in the 6th the 8th kind of possible implementation of aspect, the new and old order of the versions of data Previously according to data version setting, comprising: with the current version of data be newest version, n version of data it is new and old Order is successively redefined for 1,2 ... n according to sequence from the new to the old, wherein n is greater than 2;
Index organization's unit, is specifically used for:
The first layer index is organized, the version order of the corresponding data of index entry is 1 and 2 in first layer index;
Other layer indexs are organized, the version order of the corresponding data of index entry is one or more in other layer indexs.
The index entry of technical solution provided in an embodiment of the present invention, laminated tissue's data constitutes multilayer index, every layer index The corresponding data version order having the same of middle different index entry, the version order are the new and old order of versions of data, The new and old order of the versions of data is set previously according to the version of data, such as versions of data is divided into currently by new and old order The index entry tissue of each data current version can be then the by version, secondary new version, third new version ... and so on One layer, the index entry tissue by each data time new version is the second layer, by the index entry tissue of each data third new version For third layer ... and so on.Also, in every layer index, to the feature structure of each index entry setting characterize data version Or characteristic information, thus the version information of data can be obtained from index entry.The version layering group of data is pressed due to that will index It knits, rather than only one is indexed, and includes version information in index entry, thus covering index scanning may be implemented.And it is examining Corresponding index level first can be found according to the version of data when rope, then be found in corresponding index level corresponding specific Index entry is not required to be scanned all indexes, and in addition the data of each version have corresponding index entry, the rope retrieved Draw item and correspond directly to data, be not required to first retrieve other data and then pass through the data that series relationship obtains being retrieved, from And it can be improved recall precision.The update method of multi-edition data index provided by the invention is based on protecting version table in index entry The multilayer index of sign changes according to the version for being updated the corresponding multiple edition datas of data, updates the multiple version respectively The feature structure or characteristic information of characterize data version, the multiple index entry is moved respectively in the corresponding multiple index entries of data After moving into index level corresponding with the feature structure of its characterize data version or characteristic information, then will to be updated data corresponding New index entry write-in corresponds in the index level of latest edition data;The deletion side of multi-edition data index provided by the invention Method, equally based on the multilayer index for protecting version characterization in index entry, further according to the corresponding multiple edition datas of deleted data Version variation, update characterize data version in the corresponding multiple index entries of multiple edition datas described in multilayer index respectively The multiple index entry is respectively moved to the feature structure or feature with its characterize data version by feature structure or characteristic information After in the corresponding index level of information, that is, complete the deletion of index entry.The update of above-mentioned multi-edition data index and delet method, mistake Journey is not related to issued transaction, does not generate hash, updates high-efficient and succinct.
Technical solution provided in an embodiment of the present invention, index structure is simple, and expense is small, and recall precision is high, updates, deletes Processing is convenient, reads and writes concurrent situation substantially suitable for handling.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, for those of ordinary skill in the art Speech, without any creative labor, is also possible to obtain other drawings based on these drawings.
Fig. 1 is a kind of flow diagram of the update method of multi-edition data index provided in an embodiment of the present invention.
Fig. 2 is a kind of example of multilayer index provided in an embodiment of the present invention.
Fig. 3 is the example of another multilayer index provided in an embodiment of the present invention.
Fig. 4 is the example of another multilayer index provided in an embodiment of the present invention.
Fig. 5 is the example of another multilayer index provided in an embodiment of the present invention.
Fig. 6 is the process signal of the index entry delet method of another multi-edition data index provided in an embodiment of the present invention Figure.
Fig. 7 is a kind of flow diagram of the method for building up of multi-edition data index provided in an embodiment of the present invention.
Fig. 8 is the flow diagram of the method for building up of another multi-edition data index provided in an embodiment of the present invention.
Fig. 9 is a kind of block diagram of the updating device of multi-edition data index provided in an embodiment of the present invention.
Figure 10 is a kind of block diagram of the index entry deletion device of multi-edition data index provided in an embodiment of the present invention.
Figure 11 is a kind of block diagram for establishing device of multi-edition data index provided in an embodiment of the present invention.
Figure 12 is the block diagram for establishing device of another multi-edition data index provided in an embodiment of the present invention.
Specific embodiment
Below in conjunction with attached drawing, technical solution in the embodiment of the present invention is described.
It is a kind of flow diagram of the update method of multi-edition data index provided in an embodiment of the present invention referring to Fig. 1, As shown in Figure 1, this method comprises the following steps:
Step S101 changes according to the version for being updated the corresponding multiple edition datas of data, updates multilayer index respectively Described in the corresponding multiple index entries of multiple edition datas characterize data version feature structure or characteristic information;
The multiple index entry is respectively moved to believe with the feature structure of its characterize data version or feature by step S102 It ceases in corresponding index level;
Step S103 will be updated the corresponding new index entry write-in of data and correspond in the index level of latest edition data,
Wherein, the corresponding data of index entry version having the same time different in every layer index of the multilayer index Sequence, the version order are the new and old order of versions of data, the version of the new and old order of the versions of data previously according to data Setting, and the feature structure or characteristic information of characterize data version are provided in the index entry of every layer index.
In multi-edition data storage system, data include multiple versions, are by current latest edition when data update occurs Data saved as time new data, while the versions of data of other historical datas also successively moves back, such as former new data becomes For third new data, former third new data becomes the 4th new data, and so on, then using updated data as it is current most The data of new version.For the multilayer index of feature structure or characteristic information for being provided with characterize data version in index entry, After data update occurs, not only needs to increase the new index entry of data after updating, be correspondingly updated multiple version numbers of data It to be also updated according to corresponding multiple index entries, change the feature structure or characteristic information of characterize data version in index entry, For example, former latest data becomes time new data, correspondingly, the feature of characterize data version in the corresponding index entry of former latest data Structure or characteristic information will become characterizing time new version from characterization latest edition, characterize number in the former corresponding index entry of new data To become characterizing third new version from time new version is characterized according to the feature structure or characteristic information of version, and so on.
In the present invention, index structure is multilayer index, and the corresponding data of different index entry have identical in every layer index Version order, the version order be versions of data new and old order, the new and old order of the versions of data is previously according to number According to version setting, and the feature structure or characteristic information of characterize data version are provided in the index entry of every layer index.
Specifically, each version of each data can be by new in the data-storage system of storage multi-edition data Old sequential arrangement, that is, each version of data are owned by a new and old order, and the current version of usual data is latest edition This, and then current version is time new version, and and then secondary new version is third new version ... and so on.For convenience It program processing and illustrates, the new and old order of n version of data successively can be redefined for 1 according to sequence from the new to the old, 2 ... n, that is, the new and old order of current version is 1, and the new and old order of secondary new version is 2 ... and so on.Certainly, number According to the new and old order of n version can also be redefined for other and can characterize the number or letter of order.
It is a layer index by the corresponding index entry tissue of the data of version order having the same, if all data are all only There is a version, then only one layer of index made of final tissue, but usually data there are multiple versions, it is possible thereby to be organized into Multilayer index.It should be noted that the multilayer index, refers in the case where data have multiple versions, the index number of plies of tissue It is an index greater than 1, that is, not by all index entry tissues.In a layer index, index entry can correspond to data One version may correspond to multiple versions of data.
When constructing the index entry in index level, the feature structure or feature letter of characterize data version are set in index entry Breath.Can be directly using the version information of data as the characteristic information of characterize data version, that is, number is added in index entry According to version information.The new and old order of version is contained in the version information of data, the new and old order can be to preset Characterization order number or letter, due to passing through pointer between general multi-edition data for edition data string from the new to the old Connection, so the new and old order for including in the version information of data may be sequence of pointers.It is indexed when by one in index level When item corresponds to a version of a data, directly using the version information of data as versions of data preferably in index entry Characteristic information, index entry structure can be as follows with simple examples:
part hash ops type offset version info
Wherein, part hash indicates the part hash value for retrieval, and ops type and offset indicate the operation of data Type and the storage address in storage medium, version info are the version information of data.
It, can be in index entry directly when an index entry in index level to be corresponded to multiple versions of a data Characteristic information of the multiple version informations of data as versions of data is set, two for corresponding to a data with an index entry For version, index entry structure can be as follows with simple examples:
part hash ops type1 offset1 version1 info ops type2 offset2 version2 info
Wherein, part hash indicates the part hash value for retrieval, and ops type1 and offset1 indicate the of data The action type and the storage address in storage medium of one version, for example, data current version action type and depositing Storage address in storage media, version1 info are the version information of first version of data, such as the version of current version This information, the action type of second version of ops type2 and offset2 expression data and the storage in storage medium Location, for example, data secondary new version action type and the storage address in storage medium, version2 info be data The version information of second version, such as the version information of secondary new version.Version1 info and version2 info can also To merge, then index entry structure can be as follows with simple examples:
part hash ops type1 offset1 ops type2 offset2 version info
Wherein viersion info is the information after version1 info and version2 info merge, and is passed through Version info can obtain the version information of two versions simultaneously.
It, can also be with rope in index entry when an index entry in index level to be corresponded to multiple versions of a data Draw the characteristic information of position that data in item are stored in a storage medium as characterize data version, without directly with the version of data Characteristic information of this information as versions of data.By taking an index entry corresponds to two versions of a data as an example, index entry Structure can be as follows with simple examples:
part hash ops type1 offset1 ops type2 offset2
Wherein, part hash indicates the part hash value for retrieval, and in storage medium, the address of offset1 meaning exists Before the address of offset2 meaning, then ops type1 and offset1 indicate first version of data action type and Storage address in storage medium, ops type2 and offset2 indicate the action type of second version of data and are depositing Storage address in storage media.Namely it is previously defined in the version of the corresponding data in the preceding address of storage location in storage medium This, the version than the corresponding data in the posterior address of storage location in storage medium is new, since offset1 is in offset2 Before, and index entry storage be data first version and the corresponding index entry of the second edition, therefore offset1 is signified Address in storage medium is the address of first version of data, and the address in the storage medium of offset2 meaning is data Second version address, be known that corresponding to the address from there through the front and back of address in index entry be data which A version.
The feature structure that characterize data version also can be set in index entry, without directly being made with the version information of data For the characteristic information of versions of data, such as space bit is set in index entry, no space bit indicates that data are current version, also It is latest edition, a space bit is set in index entry, indicates that data are time new version, two space bits are set, indicate data For third new version, and so on, but this mode will generate many space bits, more wasteful space.
Organizing in how many layer index and each layer index index entry to correspond to several versions of data can come according to actual needs It determines, such as data volume is few, the versions of data of reservation is few, then two layer indexs, if data volume is few, but versions of data It is more, it the corresponding index entry group of several versions can wherein will be woven in a layer index, to reduce the index number of plies, if though data volume It is more, but versions of data is few, then the index number of plies, if data volume is more, data version can be determined according to the number of versions of data This is also more, then the corresponding index entry group of several versions can wherein will be woven in a layer index, drops too much to avoid the index number of plies Low recall precision.
With the current version of data for newest version, the new and old order of n version of data is successively according to from the new to the old Sequence be redefined for 1,2 ... n, the multilayer index may include:
First layer index, the version order of the corresponding data of index entry is 1 in first layer index;
Other layer indexs, the version order of the corresponding data of index entry is one or more in other layer indexs.
It wherein, is first layer, the corresponding index entry group of other versions by the corresponding index entry tissue of the data of current version It is woven to one or more layers, the version order that the corresponding data of every layer index item have can be one or more.Since data are deposited Storage system be to the operation of the data of current version it is most, the corresponding index entry of the data of current version is individually organized as one Layer is conducive to improve recall precision.Fig. 2 is a kind of example of multilayer index, and data have n version, then organize n-layer to index, In, the version order of the corresponding data of index entry is n in n-th layer index, indicates version order n with Vn in Fig. 2.In the following figure Version order n is indicated with Vn.
With the current version of data for newest version, the new and old order of n version of data is successively according to from the new to the old Sequence be redefined for 1,2 ... n, the multilayer index can be with are as follows:
First layer index, the version order of the corresponding data of index entry is 1 in first layer index;
Second layer index, the version order of the corresponding data of index entry is 2 in second layer index;
Third layer index, the version order of the corresponding data of index entry is 3 to n in the third layer index;
Wherein, n is greater than 3.Fig. 3 is the example of another multilayer index, in Fig. 3, the corresponding version order of the first layer index For V1, the corresponding version order of the second layer index is V2, and the corresponding version order of third layer index is V3 to Vn.
Still with the current version of data for newest version, the new and old order of n version of data is successively according to from new 1,2 ... n are redefined for old sequence.If n is greater than 2, the multilayer index may include:
First layer index, the version order of the corresponding data of index entry is 1 and 2 in first layer index;
Other layer indexs, the version order of the corresponding data of index entry is one or more in other layer indexs.
Fig. 4 is the example of another multilayer index, wherein data-storage system retains 5 versions of data, first layer rope The version order for drawing the corresponding data of middle index entry is 1 and 2, i.e., the corresponding version order of the first layer index is V1 and V2 in figure, In addition, the corresponding version order of the second layer index is V3 and V4, the corresponding version order of third layer index is V5.
Fig. 5 is the example of another multilayer index, wherein data-storage system retains 5 versions of data, first layer rope The version order for drawing the corresponding data of middle index entry is 1 and 2, i.e., the corresponding version order of the first layer index is V1 and V2 in figure, In addition, the corresponding version order of the second layer index is V3, the corresponding version order of third layer index is V4 and V5.
It is updated when data occur, when needing to update index, according to the version for being updated the corresponding multiple edition datas of data Variation updates the feature knot of characterize data version in the corresponding multiple index entries of multiple edition datas described in multilayer index respectively Structure or characteristic information, that is, by the feature structure or characteristic information of characterize data version in the corresponding index entry of former latest data Become characterizing time new version from characterization latest edition, the feature structure of characterize data version in the former corresponding index entry of new data Or characteristic information will become characterizing third new version from time new version is characterized, and so on.If using characteristic information in index entry Characterize data version, such as directly use the version information of data as characteristic information characterize data version, then modify the spy Reference breath.If then modifying rope using the storage location predetermined in storage medium as characteristic information characterize data version Draw the address information item in item.If characterizing versions of data using feature structure in index entry, the feature structure is modified, such as Space bit is set in index entry, and no space bit indicates that data are latest edition, a space bit is arranged in index entry, indicates number According to for time new version, two space bits are set, and expressions data are third new version, then when updating, in script and latest edition number According to index entry in be arranged a vacancy, in index entry of the script with secondary new edition notebook data setting increase a vacancy, with this Analogize.
Update the feature knot of characterize data version in the corresponding multiple index entries of multiple edition datas described in multilayer index After structure or characteristic information, the multiple index entry is respectively moved to the feature structure or characteristic information with its characterize data version In corresponding index level.After the feature structure of characterize data version or characteristic information change namely in index entry, it should move Extremely in corresponding index level, for example, feature structure or characteristic information are become after characterizing time new version from characterization latest edition, rope The index level for corresponding to time new version, the index level of latest edition will be also moved to by the index level for corresponding to latest edition by drawing item In there would not be the index entry.
Update the feature knot of characterize data version in the corresponding multiple index entries of multiple edition datas described in multilayer index It is described to move the multiple index entry respectively if an index level corresponds to a version order after structure or characteristic information To in index level corresponding with the feature structure of its characterize data version or characteristic information, may include:
(A1) to each index entry a in the multiple index entryi, judge a in multilayer indexiThe primary index layer at place With the presence or absence of next layer index layer;
(A2) if aiA layer index layer in the presence of the primary index layer at place, by aiThe next of the primary index layer is written In layer index layer, and delete a in the primary index layeri
(A3) if aiNext layer index layer is not present in the primary index layer at place, then deletes ai
Wherein, i=1 ... m, m are the number of the multiple index entry, version corresponding to next layer index layer time Sequence and aiVersion order corresponding to the primary index layer of place is adjacent, and is older than aiVersion corresponding to the primary index layer of place time Sequence.
For example, as shown in Fig. 2, with the current version of data for newest version, the new and old order of n version of data according to It is secondary to be redefined for 1,2 ... n, the multilayer index, including n-layer index according to sequence from the new to the old, wherein n-th layer rope The version order for drawing the corresponding data of middle index entry is n.Being equal to 3 with n is specific example, and the first layer index corresponds to version order 1, that is, correspond to latest data, the second layer index corresponds to version order 2, that is, corresponds to time new data, third layer Index corresponds to version order 3, that is, corresponds to third new data, then when updating index:
Judge a1、a2And a3The primary index layer at place whether there is next layer index layer, that is, judge first layer respectively Index, the second layer index and third layer index whether there is next layer index, by judging it is found that a1Primary index layer be the One layer, in the presence of a layer index layer, i.e. the second layer index, a2Primary index layer be the second layer, in the presence of a layer index layer, i.e., Third layer index, a3Primary index layer be third layer, for the last layer index, be not present next layer index layer.Then by aiIt writes Enter taiIn+1 layer index layer, wherein taiFor the corresponding version order of the primary index layer, taiIt less than n, that is, is by a1 1+1 layers, that is, the second layer is written, and deletes a in first layer1;By a22+1 layers, that is, third layer is written, and deletes Except a in the second layer2;And delete a in third layer3.Later, the corresponding new index entry write-in of data will be updated to correspond to most In the index level of new edition notebook data, that is, be written in the first layer index.
Update the feature knot of characterize data version in the corresponding multiple index entries of multiple edition datas described in multilayer index It is described by the multiple rope if there is the index level corresponding to multiple version order in multilayer index after structure or characteristic information Draw item to be respectively moved in index level corresponding with the feature structure of its characterize data version or characteristic information, may include:
(B1) to each index entry a in the multiple index entryi, judge a in multilayer indexiThe primary index layer at place In with the presence or absence of remove aiIn addition other are described to belong to the multiple index entry with number index entry with number index entry;
(B2) if aiExist in the primary index layer at place and removes aiIn addition other judge a with number index entryiIt whether is it Oldest same several index entries in the primary index layer at place;
(B3) judge a in multilayer indexiThe primary index layer at place whether there is next layer index layer;
(B4) if aiThere is no remove a in the primary index layer at placeiOther same number index entries in addition, and aiThe original at place A layer index layer in the presence of beginning index level, alternatively, aiExist in the primary index layer at place and removes aiIn addition other are the same as number index , and aiOldest same several index entries in primary index layer where it, and aiOne layer of rope in the presence of the primary index layer at place Draw layer, then by aiIt is written in next layer index layer of the primary index layer, and deletes a in the primary index layeri
(B5) if aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiNot where it Primary index layer in oldest same several index entries, and aiA layer index layer, then keep a in the presence of the primary index layer at placei, By aiOldest same several index entries are written in next layer index layer of the primary index layer in the primary index layer at place;
(B6) if aiThere is no remove a in the primary index layer at placeiOther same number index entries in addition, and aiThe original at place Next layer index layer is not present in beginning index level, alternatively, aiExist in the primary index layer at place and removes aiIn addition other are the same as number index , and aiOldest same several index entries in primary index layer where it, and aiNext layer is not present in the primary index layer at place Index level then deletes a in the primary index layeri
(B7) if aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiNot where it Primary index layer in oldest same several index entries, and aiNext layer index layer is not present in the primary index layer at place, then keeps ai, by aiOldest same number index entry deletion in the primary index layer at place,
Wherein, oldest same several index entries are that corresponding versions of data is same compared to other in the primary index layer The oldest same several index entries of the corresponding versions of data of number index entry, i=1 ... m, m are the number of the multiple index entry, described Version order and a corresponding to next layer index layeriVersion order corresponding to the index level of place is adjacent, and is older than aiPlace rope Draw version order corresponding to layer.
For the index level shown in Fig. 3, the multilayer index includes:
First layer index, the version order of the corresponding data of index entry is 1 in first layer index;
Second layer index, the version order of the corresponding data of index entry is 2 in second layer index;
Third layer index, the version order of the corresponding data of index entry is 3 to n in the third layer index.
Specifically by taking n is equal to 4 as an example, to each index entry a in the multiple index entryi, that is, a1、a2、a3And a4, point A is not judgediWith the presence or absence of except a in the primary index layer at placeiIn addition other are with number index entry, that is, judge first layer rope A is removed in drawing1It whether there is a in addition2、a3And a4, judge in the second layer index except a2It whether there is a in addition1、a3And a4, judge third A is removed in layer index3It whether there is a in addition1、a2And a4, and judge in third layer index except a4It whether there is a in addition1、a2And a3。 By judgement it is found that there was only a in the first layer index1, only a in the second layer index2, a is removed in third layer index3And a4Outside without it He is the same as number index entry.
Due to a3There is a in the third layer index at place4, then judge a3It whether is same number index oldest in third layer index ?;Due to a4There is a in the third layer index at place3, then also judge a4It whether is same several index entries oldest in third layer index. The a known to judgement3It is not same several index entries oldest in third layer index, a4It is same several index entries oldest in third layer index.
And a is judged respectively1、a2、a3And a4The primary index layer at place whether there is next layer index layer, that is, divide The first layer index, the second layer index and third layer index are not judged with the presence or absence of next layer index, by judging it is found that a1Original Beginning index level be first layer, in the presence of a layer index layer, i.e. the second layer index, a2Primary index layer be the second layer, in the presence of One layer index layer, i.e. third layer index, a3And a4Primary index layer be third layer, for the last layer index, be not present next layer Index level.
Due to a1There is no other with number index entries in first layer index at place, and in the presence of a layer index layer, therefore by a1 The second layer index is written, and deletes a in the first layer index1.Due to a2There is no other with number index in second layer index at place , and in the presence of a layer index layer, therefore by a2Third layer index is written, and deletes a in the second layer2.Due to a3The of place There are other with number index entry a in three layer indexs4, and a3It is not same several index entries oldest in third layer index, and third index is not In the presence of a layer index layer, therefore keep a3, delete a in third layer index4.For the example, a is handled3A afterwards4It has deleted It removes, thus while a known to judgement4There are other with number index entry a in the third layer index at place3, and a4It is oldest in third layer With number index entry, and next layer index layer is not present in third index, but may not necessarily execute again to a4Delete processing.
a1、a2、a3And a4After being disposed, the corresponding new index entry write-in of data will be updated and correspond to latest edition number According to index level in, that is, be written in the first layer index.
By taking multilayer index shown in Fig. 4 as an example, in multilayer index, the version of the corresponding data of index entry in the first layer index Order is 1 and 2, and the corresponding version order of the second layer index is 3 and 4, and the corresponding version order of third layer index is 5.Then to institute State each index entry a in multiple index entriesi, that is, a1、a2、a3、a4And a5, a is judged respectivelyiIn the primary index layer at place With the presence or absence of except aiIn addition other are with number index entry, that is, judge in the first layer index except a1It whether there is a in addition2、a3、a4 And a5And first remove a in layer index2It whether there is a in addition1、a3、a4And a5, judge in the second layer index except a3In addition whether There are a1、a2、a4And a5, and judge in the second layer index except a4It whether there is a in addition1、a2、a3And a5, judge third layer index In remove a5It whether there is a in addition1、a2、a3And a4.By judgement it is found that removing a in the first layer index1And a2Outside without other with number rope Draw item, removes a in the first layer index3And a4A is removed in third layer index with index entry is counted without other outside5Outside without other with number rope Draw item.
Due to a1There is a in first layer index at place2, therefore judge a1It whether is same number index oldest in third layer index ?;Due to a2There is a in first layer index at place1, therefore judge a2Whether it is same several index entries oldest in third layer index, sentences A known to disconnected2It is same several index entries oldest in the first layer index.Due to a3There is a in second layer index at place2, therefore judge a3It is No is same several index entries oldest in the second layer index;Due to a4There is a in second layer index at place3, then judge a4It whether is Oldest same several index entries in two layer indexs, a known to judgement4It is same several index entries oldest in third layer index.
And a is judged respectively1、a2、a3、a4And a5The primary index layer at place whether there is next layer index layer, that is, The first layer index, the second layer index and third layer index are judged respectively with the presence or absence of next layer index, by judging it is found that a1With a2Primary index layer be first layer, in the presence of a layer index layer, i.e. the second layer index, a3And a4Primary index layer be second Layer, in the presence of a layer index layer, i.e. third layer index, a5Primary index layer be third layer, for the last layer index, be not present Next layer index layer.
Due to a1There are other same number index entries, but a in first layer index at place1It is not oldest same in the first layer index Number index entry, a2It is same several index entries oldest in the first layer index, and a layer index layer in the presence of the first layer index, therefore protects Hold a1, and by a2The second layer index is written.For the example, at this time by a2The second layer index is written, therefore is not required to according to upper Judging result is stated again for a2It is primary that the second layer index is written, naturally it is also possible to according to above-mentioned judging result, due to a2It is first layer rope Oldest same several index entries in drawing, and a layer index layer in the presence of the first layer index, therefore by a2The second layer index, a is written2It writes After entering the second layer index, a in the first layer index is deleted2
Due to a3There are other same number index entries, but a in second layer index at place3It is not oldest same in the second layer index Number index entry, a4It is same several index entries oldest in the second layer index, and a layer index layer in the presence of the second layer index, therefore protects Hold a3, and by a4Third layer index is written.With to a2Processing similarly, for the example, at this time by a4Third layer rope is written Draw, therefore is not required to according to above-mentioned judging result again by a4It is primary that third layer index is written, naturally it is also possible to according to above-mentioned judgement knot Fruit, due to a4It is same several index entries oldest in the second layer index, and a layer index layer in the presence of the second layer index, therefore by a4 Third layer index, a is written4After third layer index is written, a in the second layer is deleted4
Due to a5There are not other with number index entry in the third layer index at place, and one layer in the absence of third layer index Index level, therefore delete a in third layer5
a1、a2、a3、a4And a5After being disposed, the corresponding new index entry write-in of data will be updated and correspond to latest edition In the index level of data, that is, in write-in first layer.
By taking multilayer index shown in fig. 5 as an example, in multilayer index, the version of the corresponding data of index entry in the first layer index Order is 1 and 2, and the corresponding version order of the second layer index is 3, and the corresponding version order of third layer index is 4 and 5.Then to institute State each index entry a in multiple index entriesi, that is, a1、a2、a3、a4And a5, a is judged respectivelyiIn the primary index layer at place With the presence or absence of except aiIn addition other are with number index entry, that is, judge in the first layer index except a1It whether there is a in addition2、a3、a4 And a5And first remove a in layer index2It whether there is a in addition1、a3、a4And a5, judge in the second layer index except a3In addition whether There are a1、a2、a4And a5, and judge in the second layer index except a4It whether there is a in addition1、a2、a3And a5, judge third layer index In remove a5It whether there is a in addition1、a2、a3And a4.By judgement it is found that removing a in the first layer index1And a2Outside without other with number rope Draw item, removes a in the first layer index3A is removed in third layer index with index entry is counted without other outside4And a5Outside without other with number rope Draw item.
Due to a1There is a in first layer index at place2, therefore judge a1It whether is same number index oldest in third layer index ?;Due to a2There is a in first layer index at place1, therefore judge a2Whether it is same several index entries oldest in third layer index, sentences A known to disconnected2It is same several index entries oldest in the first layer index.Due to a4There is a in the third layer index at place5, therefore judge a4It is No is same several index entries oldest in third layer index;Due to a5There is a in the third layer index at place4, then judge a5It whether is Oldest same several index entries in three layer indexs, a known to judgement5It is same several index entries oldest in third layer index.
And a is judged respectively1、a2、a3、a4And a5The primary index layer at place whether there is next layer index layer, that is, The first layer index, the second layer index and third layer index are judged respectively with the presence or absence of next layer index, by judging it is found that a1With a2Primary index layer be first layer, in the presence of a layer index layer, i.e. the second layer index, a3Primary index layer be the second layer, deposit In next layer index layer, i.e. third layer index, a4And a5Primary index layer be third layer, for the last layer index, in the absence of One layer index layer.
Due to a1There are other same number index entries, but a in first layer index at place1It is not oldest same in the first layer index Number index entry, a2It is same several index entries oldest in the first layer index, and a layer index layer in the presence of the first layer index, therefore protects Hold a1, and by a2The second layer index is written.For the example, at this time by a2The second layer index is written, therefore is not required to according to upper Judging result is stated again for a2It is primary that the second layer index is written, naturally it is also possible to according to above-mentioned judging result, due to a2It is first layer rope Oldest same several index entries in drawing, and a layer index layer in the presence of the first layer index, therefore by a2The second layer index, a is written2It writes After entering the second layer index, a in the first layer index is deleted2
Due to a3There are other same number index entries, and a layer index in the presence of the second layer index in second layer index at place Layer, therefore by a3Third layer index is written, and deletes a in the second layer index3
Due to a4There are other with number index entry a in the third layer index at place5, but a4It is not oldest in third layer index With number index entry, a5It is not same several index entries oldest in third layer index, and next layer index layer is not present in third index, because This keeps a4, delete a in third layer index5.For the example, a is handled4A afterwards5It has been deleted that, thus while a known to judgement5 There are other with number index entry a in the third layer index at place4, and a5It is same several index entries oldest in third layer, and third indexes There is no next layer index layers, but may not necessarily execute again to a4Delete processing.
a1、a2、a3、a4And a5After being disposed, the corresponding new index entry write-in of data will be updated and correspond to latest edition In the index level of data, that is, in write-in first layer.
The update method of multi-edition data index provided by the invention is based on the multilayer that index entry includes that versions of data characterizes Index is not related to the processing of affairs correlation etc. for the update processing of other multi-edition data index structures, more simple Just.
Referring to Fig. 6, for a kind of process of the index entry delet method of multi-edition data index provided in an embodiment of the present invention Schematic diagram, as shown in fig. 6, this method comprises the following steps:
Step S601 changes according to the version for being updated the corresponding multiple edition datas of data, updates multilayer index respectively Described in the corresponding multiple index entries of multiple edition datas characterize data version feature structure or characteristic information;
The multiple index entry is respectively moved to believe with the feature structure of its characterize data version or feature by step S602 It ceases in corresponding index level,
Wherein, the corresponding data of index entry version having the same time different in every layer index of the multilayer index Sequence, the version order are the new and old order of versions of data, the version of the new and old order of the versions of data previously according to data Setting, and the feature structure or characteristic information of characterize data version are provided in the index entry of every layer index.
In multi-edition data storage system, deletes data and be often referred to delete the latest edition of data, but the deletion is non-physical It deletes, but the latest edition of data is saved as into time new version, then delete original latest edition, needed after deleting data Correspondingly change corresponding index entry.It deletes data and the difference of more new data essentially consists in, more new data is to change and moving After the dynamic corresponding multiple index entries of data, the write-in of new index entry is corresponded to the index level of data latest edition, when deleting data Process multiple indexes corresponding with more new data time-varying and mobile data of variation and the corresponding multiple index entries of mobile data The process of item is identical, but no the step of new index entry is written later, is also not required to execute other steps.Therefore the embodiment of the present invention The step of update method of the delet method of provided multi-edition data index, step S601 and multi-edition data index S601 is identical, and step S602 is identical as the step S602 for the update method that multi-edition data indexes, and can specifically refer to step The explanation of S601 and step S602.
The delet method of multi-edition data index provided by the invention is based on the multilayer that index entry includes that versions of data characterizes It indexes, for the delete processing compared to other multi-edition data index structures, is not related to the processing of affairs correlation etc., more simply Quickly.
It is a kind of flow diagram of the method for building up of multi-edition data index provided in an embodiment of the present invention referring to Fig. 7, As shown in fig. 7, this method comprises the following steps:
Step S701 organizes multilayer index, and the feature structure or feature letter of characterize data version are arranged in index entry Breath, wherein the corresponding data of different index entry version order having the same in every layer index, the version order are data The new and old order of the new and old order of version, the versions of data is set previously according to the version of data.
Specifically, each version of each data can be by new in the data-storage system of storage multi-edition data Old sequential arrangement, that is, each version of data are owned by a new and old order, and the current version of usual data is latest edition This, and then current version is time new version, and and then secondary new version is third new version ... and so on.For convenience It program processing and illustrates, the new and old order of n version of data successively can be redefined for 1 according to sequence from the new to the old, 2 ... n, that is, the new and old order of current version is 1, and the new and old order of secondary new version is 2 ... and so on.Certainly, number According to the new and old order of n version can also be redefined for other and can characterize the number or letter of order.
It is a layer index by the corresponding index entry tissue of the data of version order having the same, if all data are all only There is a version, then only one layer of index made of final tissue, but usually data there are multiple versions, it is possible thereby to be organized into Multilayer index.It should be noted that the multilayer index, refers in the case where data have multiple versions, the index number of plies of tissue It is an index greater than 1, that is, not by all index entry tissues.Every layer index can be used Hash table (Hash table), The modes such as LSM tree (Log-Structured Merge Tree, log-structured merging tree) or B+ tree come tissue, all indexes Layer can be used identical mode and carry out tissue, such as all carry out tissue using Hash table, and different modes also can be used Tissue, such as the first layer index carry out tissue using Hash table, other layers carry out tissue using LSM tree, or, first Layer index carrys out tissue using Hash table, and the second layer index uses B+ tree tissue, other layers carry out tissue using LSM tree, etc. Deng.In a layer index, index entry can correspond to a version of data, may correspond to multiple versions of data.
When constructing the index entry in index level, the feature structure or feature letter of characterize data version are set in index entry Breath.In one embodiment, directly using the version information of data as the characteristic information of characterize data version, that is, in rope Draw the version information that data are added in item.The new and old order of version is contained in the version information of data, the new and old order can The number or letter for thinking preset characterization order, will from the new to the old due to passing through pointer between general multi-edition data Edition data series connection so the new and old order for including in the version information of data may be sequence of pointers, but uses pointer sequence It arranges this mode and wants complicated compared to using the number or letter of characterization order, therefore not preferred scheme.When by one in index level When index entry corresponds to a version of a data, directly using the version information of data as data version preferably in index entry This characteristic information, index entry structure can be as follows with simple examples:
Part hash ops type offset version info
Wherein, part hash indicates the part hash value for retrieval, and ops type and offset indicate the operation of data Type and the storage address in storage medium, version info are the version information of data.
It, can be in index entry directly when an index entry in index level to be corresponded to multiple versions of a data Characteristic information of the multiple version informations of data as versions of data is set, two for corresponding to a data with an index entry For version, index entry structure can be as follows with simple examples:
part hash ops type1 offset1 version1 info ops type2 offset2 version2 info
Wherein, part hash indicates the part hash value for retrieval, and ops type1 and offset1 indicate the of data The action type and the storage address in storage medium of one version, for example, data current version action type and depositing Storage address in storage media, version1 info are the version information of first version of data, such as the version of current version This information, the action type of second version of ops type2 and offset2 expression data and the storage in storage medium Location, for example, data secondary new version action type and the storage address in storage medium, version2 info be data The version information of second version, such as the version information of secondary new version.Version1 info and version2 info can also To merge, then index entry structure can be as follows with simple examples:
part hash ops type1 offset1 ops type2 offset2 version info
Wherein viersion info is the information after version1 info and version2 info merge, and is passed through Version info can obtain the version information of two versions simultaneously, and this mode can shorten the length of index entry, save Index entry the space occupied.
It, can also be with rope in index entry when an index entry in index level to be corresponded to multiple versions of a data Draw the characteristic information of position that data in item are stored in a storage medium as characterize data version, without directly with the version of data Characteristic information of this information as versions of data.By taking an index entry corresponds to two versions of a data as an example, index entry Structure can be as follows with simple examples:
part hash ops type1 offset1 ops type2 offset2
Wherein, part hash indicates the part hash value for retrieval, and in storage medium, the address of offset1 meaning exists Before the address of offset2 meaning, then ops type1 and offset1 indicate first version of data action type and Storage address in storage medium, ops type2 and offset2 indicate the action type of second version of data and are depositing Storage address in storage media.Namely it is previously defined in the version of the corresponding data in the preceding address of storage location in storage medium This, the version compared with the corresponding data in the posterior address of storage location in storage medium is new, due to offset1 offset2 it Before, and index entry storage be data first version and the corresponding index entry of the second edition, therefore offset1 is signified deposits Address in storage media is the address of first version of data, and the address in the storage medium of offset2 meaning is data The address of second version, be known that corresponding to the address from there through the front and back of address in index entry be data which Version.Index entry structure is more succinct under this mode.
In another embodiment, the feature structure of characterize data version is set in index entry, without directly with number According to characteristic information of the version information as versions of data, such as space bit is set in index entry, no space bit indicates data For current version, that is, latest edition, a space bit is set in index entry, indicates that data are time new version, is arranged two Space bit, expression data are third new version, and so on, but this mode will generate many space bits, waste of resource space, Therefore not preferred mode.
Organizing in how many layer index and each layer index index entry to correspond to several versions of data can come according to actual needs It determines, such as data volume is few, the versions of data of reservation is few, then two layer indexs, if data volume is few, but versions of data It is more, it the corresponding index entry group of several versions can wherein will be woven in a layer index, to reduce the index number of plies, if though data volume It is more, but versions of data is few, then the index number of plies, if data volume is more, data version can be determined according to the number of versions of data This is also more, then the corresponding index entry group of several versions can wherein will be woven in a layer index, drops too much to avoid the index number of plies Low recall precision.
In one embodiment, with the current version of data for newest version, the new and old order of n version of data 1,2 ... n successively are redefined for according to sequence from the new to the old, the tissue multilayer index may include:
The first layer index is organized, the version order of the corresponding data of index entry is 1 in first layer index;
Other layer indexs are organized, the version order of the corresponding data of index entry is one or more in other layer indexs.
It wherein, is first layer, the corresponding index entry group of other versions by the corresponding index entry tissue of the data of current version It is woven to one or more layers, the version order that the corresponding data of every layer index item have can be one or more.This is because number Be to the operation of the data of current version according to storage system it is most, the corresponding index entry of the data of current version is individually organized It is one layer, is conducive to improve recall precision.Fig. 2 is a kind of example of multilayer index, by multi version provided in an embodiment of the present invention Data directory method for building up is established, and data have n version, then organize n-layer to index, wherein index entry is corresponding in n-th layer index The version order of data is n, indicates version order n with Vn in Fig. 2.Also to indicate version order n in the following figure with Vn.
In another embodiment, with the current version of data for newest version, new and old time of n version of data Sequence is successively redefined for 1,2 ... n according to sequence from the new to the old, and the tissue multilayer index may include:
The first layer index is organized, the version order of the corresponding data of index entry is 1 in first layer index;
The second layer index is organized, the version order of the corresponding data of index entry is 2 in second layer index;
Third layer index is organized, the version order of the corresponding data of index entry is 3 to n in the third layer index;
Wherein, n is greater than 3.Fig. 3 is the example of another multilayer index, by multi-edition data provided in an embodiment of the present invention Index establishing method is established, and in Fig. 3, the corresponding version order of the first layer index is V1, the corresponding version order of the second layer index For V2, the corresponding version order of third layer index is V3-Vn.Compared to the corresponding index level of version order each in Fig. 2 Example, few, few suitable for the versions of data situation of the index number of plies in Fig. 3.
In the example of Fig. 2 and Fig. 3, first layer index is preferably fixed storage in memory, this is because data Storage system is most to the data manipulation of current version, and the corresponding index level of the data of current version is resided in memory, can To improve the speed of effectiveness of retrieval and operation.
Still with the current version of data for newest version, the new and old order of n version of data is successively according to from new 1,2 ... n are redefined for old sequence.If n is greater than 2, the tissue multilayer index may include:
The first layer index is organized, the version order of the corresponding data of index entry is 1 and 2 in first layer index;
Other layer indexs are organized, the version order of the corresponding data of index entry is one or more in other layer indexs.
Fig. 4 is the example of another multilayer index, by multi-edition data index establishing method provided in an embodiment of the present invention It establishes, wherein data-storage system retains 5 versions of data, the version time of the corresponding data of index entry in the first layer index Sequence is 1 and 2, i.e., the corresponding version order of the first layer index is V1 and V2 in figure, in addition, the corresponding version order of the second layer index For V3 and V4, the corresponding version order of third layer index is V5.
Fig. 5 is the example of another multilayer index, by multi-edition data index establishing method provided in an embodiment of the present invention It establishes, wherein data-storage system retains 5 versions of data, the version time of the corresponding data of index entry in the first layer index Sequence is 1 and 2, i.e., the corresponding version order of the first layer index is V1 and V2 in figure, in addition, the corresponding version order of the second layer index For V3, the corresponding version order of third layer index is V4 and V5.
Since data manipulation of the data-storage system to current version is most, the corresponding index of the data of current version The data of other versions should be corresponded in layer simultaneously as little as possible, to improve the speed of effectiveness of retrieval and operation, therefore Fig. 4 and Fig. 5 is poor example compared to Fig. 2 and Fig. 3.
The method for building up of multi-edition data index provided in an embodiment of the present invention, is different from the feelings of conventional single index level Condition, the index entry of laminated tissue's data, different index entries corresponds to the data of version order having the same in every layer index, and And in every layer index, to the feature structure or characteristic information of each index entry setting characterize data version, the index entry is set to include The version information of data.The version laminated tissue of data is pressed due to that will index, and includes version information in index entry, thus can be with Realize covering index scanning.In addition corresponding index level first can be found according to the version of data in retrieval, then in correspondence Index level in find corresponding specific index entry, be not required to be scanned all indexes, and the data of each version are all There is corresponding index entry, the index entry retrieved corresponds directly to data, is not required to first retrieve other data and then pass through Series relationship obtains the data to be retrieved, so as to improve recall precision.Furthermore index structure is simple, and index establishes expense It is small, and indexed search is high-efficient, reads and writes concurrent situation substantially suitable for handling.
Index level made of tissue can be all stored in memory, but if index level takes up space very greatly, then be occupied interior System operational speed can excessively be reduced by depositing space, therefore a part of index level can be stored in memory, and other parts are indexed Layer is stored in other specified solid storage mediums.Since the data manipulation to current version is most, it is therefore preferred to will The corresponding index level of the data of current version is stored in memory, and fixed storage is in memory, that is, is resided in memory, Be conducive to improve data processing speed, other layers then can store in other specified solid storage mediums.Multilayer index The dynamic change that memory headroom can be regarded, using the scheme of dynamic memory, that is, according to the size of current memory space, to move Which is stored in memory for the adjustment of state, which is stored in except memory.
Referring to Fig. 8, for the process signal of the method for building up of another multi-edition data index provided in an embodiment of the present invention Figure, as shown in figure 8, this method comprises the following steps:
Step S801 organizes multilayer index, and the feature structure or feature letter of characterize data version are arranged in index entry Breath, wherein the corresponding data of different index entry version order having the same in every layer index, the version order are data The new and old order of the new and old order of version, the versions of data is set previously according to the version of data;
Memory storage priority is arranged for every layer index in step S802;
Periodically storage threshold value is arranged according to the storage condition of memory in step S803;
Step S804 judges the index level for being less than the storage threshold value in memory with the presence or absence of memory storage priority;
Step S805, if depositing memory there are the index level that memory storage priority is less than the storage threshold value in memory The index level that storage priority is less than the storage threshold value is stored in other specified solid storage mediums, and deletes from memory;
Step S806 judges whether there is the index level that memory storage priority is greater than or equal to the storage threshold value;
Step S807, memory storage priority is greater than or equal to the index level of the storage threshold value if it exists, judges memory Whether the index level that storage priority is greater than or equal to the storage threshold value is stored in memory;
Step S808, if memory storage priority be greater than or equal to it is described storage threshold value index level be stored in memory it Outside, the index level that memory storage priority is greater than or equal to the storage threshold value is stored in memory.
Wherein, when organizing index level, memory storage priority is set for every layer index, the memory storage of every layer index is excellent First grade can be determined according to the system operating frequency of the corresponding data of the layer index, for example, the data of current version are corresponding Index entry tissue be first layer index, then the memory storage priority of the layer index is set as highest, by the number of secondary new version It is second layer index according to corresponding index entry tissue, sets time height for the memory storage priority of the layer index.
System operation in, periodically according to the storage condition of memory be arranged storage threshold value, it is described periodically can be according to memory The setting of historical storage situation of change, such as system periodically will appear the data manipulation of big handling capacity, and main memory cycle occurs The case where free space substantially reduces and free space is significantly increased after the data manipulation of big handling capacity, then it is described fixed Phase can be set to be arranged larger by storage threshold value in the data manipulation period for big handling capacity occur with the cycle synchronisation, When the data manipulation of the big handling capacity finishes, storage threshold value is arranged smaller.It is described periodically can also by technical staff according to Experience setting.The storage threshold value is the memory storage priority cut off value whether index level can be stored in memory, memory storage The index level that priority is greater than or equal to the storage threshold value can be stored in memory, and memory storage priority is less than the storage threshold The index level of value is not stored in memory then.The storage threshold value can be accounted for according to the idle condition of memory and the space of each index level It is determined with size, therefore the storage threshold value being arranged every time may be different.For example, index haves three layers, current memory is idle empty Between be 350M, the first layer index (memory storage priority is Top) the space occupied is 200M, the second layer index (memory storage Priority is Second) the space occupied is 100M, third layer index (memory storage priority is Third) the space occupied is 100M, then it is Second, above-mentioned memory storage priority Top > Second > Third that storage threshold value, which is arranged,.
After storage threshold value changes, being originally stored in index level in memory may be no longer suitable for being stored in memory, example If memory free space becomes smaller, correspondingly stores threshold value and become larger, then the memory storage for being stored in the index level of memory originally is preferential Grade becomes smaller than storage threshold value.Therefore in system operation, dynamically judge to be less than in memory with the presence or absence of memory storage priority The index level of the storage threshold value, if there are the index level that memory storage priority is less than the storage threshold value in memory, it will be interior The index level that storage priority is less than the storage threshold value is stored in other specified solid storage mediums, and deletes from memory It removes, to discharge more memory headrooms, improves the speed of service of system.
On the other hand, after storage threshold value changes, being originally stored in the index level except memory can be adapted to be stored in In memory, for example, memory free space becomes larger, correspondingly stores threshold value and become smaller, be then stored in the index level outside memory originally Memory storage priority becomes larger than or is equal to storage threshold value.Therefore in system operation, dynamically judges whether there is memory and deposit The index level that priority is greater than or equal to the storage threshold value is stored up, memory storage priority is greater than or equal to the storage if it exists The index level of threshold value then further judges that memory storage priority is greater than or equal to whether the index level for storing threshold value stores In memory, if having been stored in memory, any operation need not be carried out, if memory storage priority is more than or equal to described The index level of storage threshold value is stored in except memory, and memory storage priority is greater than or equal to the index level of the storage threshold value It is stored in memory, to improve the recall precision and operating efficiency to the corresponding data of index level.
In some data-storage systems, the storage medium of data is divided into high speed storing medium and low speed storage medium, high Fast storage medium can be memory, for real time high-speed handle data, so-called " low speed " of low speed storage medium be relative to For high speed storing medium, processing speed is lower than high speed storing medium, therefore above-mentioned memory may be replaced by high speed storing Jie Matter, corresponding " other specified solid storage mediums " could alternatively be low speed storage medium.
Referring to Fig. 9, for a kind of block diagram of the updating device of multi-edition data index provided in an embodiment of the present invention, such as Fig. 9 Shown, which includes:
First version updating unit U901, for being changed according to the version for being updated the corresponding multiple edition datas of data, Update in the corresponding multiple index entries of multiple edition datas described in multilayer index respectively the feature structure of characterize data version or Characteristic information;
First index entry mobile unit U902, for the multiple index entry to be respectively moved to and its characterize data version Feature structure or the corresponding index level of characteristic information in;
New index entry writing unit U903 corresponds to latest edition for that will be updated the corresponding new index entry write-in of data In the index level of data,
Wherein, the corresponding data of index entry version having the same time different in every layer index of the multilayer index Sequence, the version order are the new and old order of versions of data, the version of the new and old order of the versions of data previously according to data Setting, and the feature structure or characteristic information of characterize data version are provided in the index entry of every layer index.
Optionally, if an index level corresponds to a version order, that is, each index entry is only right in multilayer index Ying Yuyi version order, the index entry mobile unit, can be specifically used for:
To each index entry a in the multiple index entryi, judge a in multilayer indexiWhether the primary index layer at place In the presence of a layer index layer;
If aiA layer index layer in the presence of the primary index layer at place, by aiNext layer of rope of the primary index layer is written Draw in layer, and deletes a in the primary index layeri
If aiNext layer index layer is not present in the primary index layer at place, deletes ai,
Wherein, i=1 ... m, m are the number of the multiple index entry, version corresponding to next layer index layer time Sequence and aiVersion order corresponding to the primary index layer of place is adjacent, and is older than aiVersion corresponding to the primary index layer of place time Sequence.
Wherein, if with the current version of data be newest version, the new and old order of n version of data successively according to from It newly arrives old sequence and is redefined for 1,2 ... n, the multilayer index, including n-layer index, wherein indexed in n-th layer index The version order of the corresponding data of item is n, in this case, the index entry mobile unit, if in aiThe primary index at place A layer index layer in the presence of layer, by aiWhen being written in next layer index layer of the primary index layer, it is specifically used for:
By aiT is writtenaiIn+1 layer index layer, wherein taiFor the corresponding version order of the primary index layer, taiIt is less than n。
Optionally, if there is the index level corresponding to multiple version order in multilayer index, the index entry is mobile single Member can be specifically used for:
To each index entry a in the multiple index entryi, judge a in multilayer indexiIt is in the primary index layer at place It is no to exist except aiIn addition other are described to belong to the multiple index entry with number index entry with number index entry;
If aiExist in the primary index layer at place and removes aiIn addition other judge a with number index entryiIt whether is its place Primary index layer in oldest same several index entries;
Judge a in multilayer indexiThe primary index layer at place whether there is next layer index layer;
If aiThere is no remove a in the primary index layer at placeiOther same number index entries in addition, and aiThe original rope at place Draw a layer index layer in the presence of layer, alternatively, aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiOldest same several index entries in primary index layer where it, and aiA layer index layer in the presence of the primary index layer at place, Then by aiIt is written in next layer index layer of the primary index layer, and deletes a in the primary index layeri
If aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiThe not original where it Oldest same several index entries in beginning index level, and aiA layer index layer, then keep a in the presence of the primary index layer at placei, by ai Oldest same several index entries are written in next layer index layer of the primary index layer in the primary index layer at place;
If aiThere is no remove a in the primary index layer at placeiOther same number index entries in addition, and aiThe original rope at place Drawing layer, there is no next layer index layers, alternatively, aiExist in the primary index layer at place and removes aiIn addition other are the same as number index entry ak, and aiOldest same several index entries in primary index layer where it, and aiNext layer is not present in the primary index layer at place Index level then deletes a in the primary index layeri
If aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiThe not original where it Oldest same several index entries in beginning index level, and aiNext layer index layer is not present in the primary index layer at place, then keeps ai, will aiOldest same number index entry deletion in the primary index layer at place,
Wherein, oldest same several index entries are that corresponding versions of data is same compared to other in the primary index layer The oldest same several index entries of the corresponding versions of data of number index entry, i=1 ... m, m are the number of the multiple index entry, described Version order and a corresponding to next layer index layeriVersion order corresponding to the primary index layer of place is adjacent, and is older than aiInstitute The version order corresponding to primary index layer.
Referring to Figure 10, for a kind of frame of the index entry deletion device of multi-edition data index provided in an embodiment of the present invention Figure, as shown in Figure 10, which includes:
Second edition updating unit U1001, for being changed according to the version for being deleted the corresponding multiple edition datas of data, Update in the corresponding multiple index entries of multiple edition datas described in multilayer index respectively the feature structure of characterize data version or Characteristic information;
Second index entry mobile unit U1002, for the multiple index entry to be respectively moved to and its characterize data version In this corresponding index level of feature structure or characteristic information,
Wherein, the corresponding data of index entry version having the same time different in every layer index of the multilayer index Sequence, the version order are the new and old order of versions of data, the version of the new and old order of the versions of data previously according to data Setting, and the feature structure or characteristic information of characterize data version are provided in the index entry of every layer index.
Wherein, the first version of the second edition updating unit and the updating device of the index of multi-edition data shown in Fig. 9 Updating unit is identical.First rope of the second index entry mobile unit and the updating device of the index of multi-edition data shown in Fig. 9 It is identical to draw a mobile unit.
Optionally, if an index level corresponds to a version order, the second index entry mobile unit can be specific For:
To each index entry a in the multiple index entryi, judge a in multilayer indexiWhether the primary index layer at place In the presence of a layer index layer;
If aiA layer index layer in the presence of the primary index layer at place, by aiNext layer of rope of the primary index layer is written Draw in layer, and deletes a in the primary index layeri
If aiNext layer index layer is not present in the primary index layer at place, deletes ai,
Wherein, i=1 ... m, m are the number of the multiple index entry, version corresponding to next layer index layer time Sequence and aiVersion order corresponding to the primary index layer of place is adjacent, and is older than aiVersion corresponding to the primary index layer of place time Sequence.
Optionally, if there is the index level corresponding to multiple version order in multilayer index, second index entry is mobile Unit can be specifically used for:
To each index entry a in the multiple index entryi, judge a in multilayer indexiIt is in the primary index layer at place It is no to exist except aiIn addition other are described to belong to the multiple index entry with number index entry with number index entry;
If aiExist in the primary index layer at place and removes aiIn addition other judge a with number index entryiIt whether is its place Primary index layer in oldest same several index entries;
Judge a in multilayer indexiThe primary index layer at place whether there is next layer index layer;
If aiThere is no remove a in the primary index layer at placeiOther same number index entries in addition, and aiThe original rope at place Draw a layer index layer in the presence of layer, alternatively, aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiOldest same several index entries in primary index layer where it, and aiA layer index layer in the presence of the primary index layer at place, Then by aiIt is written in next layer index layer of the primary index layer, and deletes a in the primary index layeri
If aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiThe not original where it Oldest same several index entries in beginning index level, and aiA layer index layer, then keep a in the presence of the primary index layer at placei, by ai Oldest same several index entries are written in next layer index layer of the primary index layer in the primary index layer at place;
If aiThere is no remove a in the primary index layer at placeiOther same number index entries in addition, and aiThe original rope at place Drawing layer, there is no next layer index layers, alternatively, aiExist in the primary index layer at place and removes aiIn addition other are the same as number index entry ak, and aiOldest same several index entries in primary index layer where it, and aiNext layer is not present in the primary index layer at place Index level then deletes a in the primary index layeri
If aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiThe not original where it Oldest same several index entries in beginning index level, and aiNext layer index layer is not present in the primary index layer at place, then keeps ai, will aiOldest same number index entry deletion in the primary index layer at place,
Wherein, oldest same several index entries are that corresponding versions of data is same compared to other in the primary index layer The oldest same several index entries of the corresponding versions of data of number index entry, i=1 ... m, m are the number of the multiple index entry, described Version order and a corresponding to next layer index layeriVersion order corresponding to the primary index layer of place is adjacent, and is older than aiInstitute The version order corresponding to primary index layer.
Such as scheme referring to Figure 11 for a kind of block diagram for establishing device of multi-edition data index provided in an embodiment of the present invention Shown in 11, which includes:
Index organization unit U1101, index organization's unit are used for tissue multilayer index, wherein phase in every layer index The corresponding data of different index entry version order having the same, the version order is the new and old order of versions of data, described The new and old order of versions of data is set previously according to the version of data;
Feature setting unit U1102, for the feature structure or characteristic information of characterize data version to be arranged in index entry.
Wherein, the feature setting unit, can be with when the feature structure or characteristic information of characterize data version is arranged Feature structure of the position that data are stored in a storage medium in index entry as characterize data version, or directly with data Characteristic information of the version information as characterize data version.
Wherein it is possible to the current version of data be newest version, the new and old order of n version of data successively according to Sequence from the new to the old is redefined for 1,2 ... n, and in one embodiment, index organization's unit can be used specifically In:
The first layer index is organized, the version order of the corresponding data of index entry is 1 in first layer index;
Other layer indexs are organized, the version order of the corresponding data of index entry is one or more in other layer indexs.
More specifically, index organization's unit, can be used for: tissue n-layer index, wherein index entry in n-th layer index The version order of corresponding data is n.
When n is greater than 3, more specifically, index organization's unit, can be used for:
The first layer index is organized, the version order of the corresponding data of index entry is 1 in first layer index;
The second layer index is organized, the version order of the corresponding data of index entry is 2 in second layer index;
Third layer index is organized, the version order of the corresponding data of index entry is 3 to n in the third layer index,
When it is the data of current version that the first layer index is corresponding, summarize in preferred embodiment, described more editions Notebook data index establishes device, can also include static memory cell, and the static memory cell is used for the first layer rope Draw fixed storage in memory, is conducive to improve data processing speed, other layers then can store to be deposited in other specified solid-states In storage media.
With the current version of data for newest version, the new and old order of n version of data is successively according to from the new to the old Sequence be redefined for 1,2 ... n, wherein n is greater than 2, and in another embodiment, index organization's unit can be with It is specifically used for:
The first layer index is organized, the version order of the corresponding data of index entry is 1 and 2 in first layer index;
Other layer indexs are organized, the version order of the corresponding data of index entry is one or more in other layer indexs.
When n is greater than 3, more specifically, index organization's unit, can be used for:
The first layer index is organized, the version order of the corresponding data of index entry is 1 and 2 in first layer index;
The second layer index is organized, the version order of the corresponding data of index entry is 3 to n in the third layer index.
When n is greater than 4, more specifically, index organization's unit, can be used for:
The first layer index is organized, the version order of the corresponding data of index entry is 1 and 2 in first layer index;
The second layer index is organized, the version order of the corresponding data of index entry is 3 in the third layer index;
Third layer index is organized, the version order of the corresponding data of index entry is 4 to n in the third layer index.
Multi-edition data index provided in an embodiment of the present invention establishes device, and the index entry of laminated tissue's data constitutes multilayer It indexes, the different corresponding data of index entry version order having the same in every layer index, also, in every layer index, to every The feature structure or characteristic information of characterize data version is all arranged in a index entry, thus the version of data can be obtained from index entry This information realizes covering index scanning.Multi-edition data index provided in an embodiment of the present invention establishes device, and index establishes expense Small, index structure is simple, and recall precision is high, reads and writes concurrent situation substantially suitable for handling.
It is the block diagram for establishing device of another multi-edition data index provided in an embodiment of the present invention, such as referring to Figure 12 Shown in Fig. 2, which includes:
Index organization unit U201, index organization's unit are used for tissue multilayer index, wherein different in every layer index The corresponding data of index entry version order having the same, the version order be versions of data new and old order, the number It is set according to the new and old order of version previously according to the version of data;
Feature setting unit U1202, for the feature structure or characteristic information of characterize data version to be arranged in index entry.
Memory storage priority setting unit U1203, for memory storage priority to be arranged for every layer index;
Threshold setting unit U1204 is stored, for storage threshold value periodically to be arranged according to the storage condition of memory;
First judging unit U1205 is less than the storage threshold with the presence or absence of memory storage priority in memory for judging The index level of value;
First execution unit U1206, if for there are the ropes that memory storage priority is less than the storage threshold value in memory Draw layer, the index level that memory storage priority is less than the storage threshold value is stored in other specified solid storage mediums, and It is deleted from memory;
Second judgment unit U1207, for judging whether there is memory storage priority more than or equal to the storage threshold The index level of value;
Third judging unit U1208 is greater than or equal to the rope of the storage threshold value for memory storage priority if it exists Draw layer, judges that memory storage priority is greater than or equal to whether the index level for storing threshold value is stored in memory;
Second execution unit U1209, if being greater than or equal to the index level of the storage threshold value for memory storage priority It is stored in except memory, the index level that memory storage priority is greater than or equal to the storage threshold value is stored in memory.
When organizing index level, memory storage priority setting unit U1203 is that every layer index setting memory storage is preferential Grade, the memory storage priority of every layer index can be determined according to the system operating frequency of the corresponding data of the layer index.? In system operation, periodically storage threshold value is arranged according to the storage condition of memory in storage threshold setting unit U1204, described periodically To be arranged according to the historical storage situation of change of memory, such as system periodically will appear the data manipulation of big handling capacity, memory Periodically there are the feelings that free space substantially reduces and free space is significantly increased after the data manipulation of big handling capacity Condition, then it is described periodically to can be set to set storage threshold value in the data manipulation period for big handling capacity occur with the cycle synchronisation It sets larger, when the data manipulation of the big handling capacity finishes, storage threshold value is arranged smaller.It is described periodically can also be by skill Art personnel are rule of thumb arranged.The storage threshold value is the memory storage priority boundary whether index level can be stored in memory Value, the index level that memory storage priority is greater than or equal to the storage threshold value can be stored in memory, and memory storage priority is small It is not stored in memory then in the index level of the storage threshold value.The storage threshold value can idle condition according to memory and each rope The storage threshold value drawing the space hold size of layer to determine, therefore being arranged every time may be different.
In system operation, the first judging unit U1205 dynamically judges in memory with the presence or absence of memory storage priority Less than the index level of the storage threshold value, if there are memory storage priority to be less than the index level for storing threshold value in memory, Then the index level that memory storage priority is less than the storage threshold value is stored in other and specified consolidated by the first execution unit U1206 State storage medium, and deleted from memory, to discharge more memory headrooms, improve the speed of service of system.
System operation in, second judgment unit U1207 dynamically judge whether there is memory storage priority be greater than or Equal to the index level of the storage threshold value, memory storage priority is greater than or equal to the index level of the storage threshold value if it exists, Then third judging unit U1208 further judges whether memory storage priority is greater than or equal to the index level for storing threshold value It is stored in memory, if having been stored in memory, any operation need not be carried out, if memory storage priority is greater than or equal to The index level of the storage threshold value is stored in except memory, then the second execution unit U1209 memory storage priority is greater than or Index level equal to the storage threshold value is stored in memory, to improve the recall precision to the corresponding data of index level and behaviour Make efficiency.
In some data-storage systems, the storage medium of data is divided into high speed storing medium and low speed storage medium, high Fast storage medium can be memory, for real time high-speed handle data, so-called " low speed " of low speed storage medium be relative to For high speed storing medium, processing speed is lower than high speed storing medium, therefore above-mentioned memory may be replaced by high speed storing Jie Matter, corresponding " other specified solid storage mediums " could alternatively be low speed storage medium.
It is required that those skilled in the art can be understood that the technology in the embodiment of the present invention can add by software The mode of general hardware platform realize.Based on this understanding, the technical solution in the embodiment of the present invention substantially or Say that the part that contributes to existing technology can be embodied in the form of software products, which can deposit Storage is in storage medium, such as ROM/RAM, magnetic disk, CD, including some instructions are used so that computer equipment (can be with It is personal computer, server or the network equipment etc.) execute certain part institutes of each embodiment of the present invention or embodiment The method stated.
All the embodiments in this specification are described in a progressive manner, same and similar portion between each embodiment Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for device reality For applying example, since it is substantially similar to the method embodiment, so being described relatively simple, related place is referring to embodiment of the method Part explanation.
It should be noted that in the present specification, the relational terms of such as " first " and " second " or the like are used merely to One unit or operation are distinguished with another unit or operation, without necessarily requiring or implying these units or behaviour There are any this actual relationship or backwards between work.
The embodiments of the present invention described above are not intended to limit the scope of the present invention.It is any in the present invention Spirit and principle within made modifications, equivalent substitutions and improvements etc., should all be included in the protection scope of the present invention.

Claims (32)

1. a kind of update method of multi-edition data index characterized by comprising
Changed according to the version for being updated the corresponding multiple edition datas of data, updates multiple versions described in multilayer index respectively The feature structure or characteristic information of characterize data version in the corresponding multiple index entries of data;
The multiple index entry is respectively moved to index corresponding with the feature structure of its characterize data version or characteristic information In layer;
The corresponding new index entry write-in of data will be updated to correspond in the index level of latest edition data,
Wherein, the corresponding data of index entry version order having the same different in every layer index of the multilayer index, institute The new and old order that version order is versions of data is stated, the new and old order of the versions of data is set previously according to the version of data, And the feature structure or characteristic information of characterize data version are provided in the index entry of every layer index.
2. the update method of multi-edition data index as described in claim 1, which is characterized in that if an index level corresponds to One version order, it is described to be respectively moved to believe with the feature structure of its characterize data version or feature by the multiple index entry It ceases in corresponding index level, comprising:
To each index entry a in the multiple index entryi, judge a in multilayer indexiThe primary index layer at place whether there is Next layer index layer;
If aiA layer index layer in the presence of the primary index layer at place, by aiNext layer index layer of the primary index layer is written In, and delete a in the primary index layeri
If aiNext layer index layer is not present in the primary index layer at place, then deletes ai,
Wherein, i=1 ... m, m are the number of the multiple index entry, version order corresponding to next layer index layer with aiVersion order corresponding to the primary index layer of place is adjacent, and is older than aiVersion order corresponding to the primary index layer of place.
3. the update method of multi-edition data index as claimed in claim 2, which is characterized in that be with the current version of data Newest version, the new and old order of n version of data are successively redefined for 1,2 ... n, institute according to sequence from the new to the old State multilayer index, including n-layer index, wherein the version order of the corresponding data of index entry is n in n-th layer index,
If aiA layer index layer in the presence of the primary index layer at place, by aiNext layer of rope of the primary index layer is written Draw in layer, comprising:
By aiT is writtenaiIn+1 layer index layer, wherein taiFor the corresponding version order of the primary index layer, taiLess than n.
4. the update method of multi-edition data as described in claim 1 index, which is characterized in that if existing in multilayer index pair It should be in the index level of multiple version order, the feature the multiple index entry being respectively moved to its characterize data version In structure or the corresponding index level of characteristic information, comprising:
To each index entry a in the multiple index entryi, judge a in multilayer indexiWhether deposited in the primary index layer at place Removing aiIn addition other are described to belong to the multiple index entry with number index entry with number index entry;
If aiExist in the primary index layer at place and removes aiIn addition other judge a with number index entryiIt whether is original where it Oldest same several index entries in beginning index level;
Judge a in multilayer indexiThe primary index layer at place whether there is next layer index layer;
If aiThere is no remove a in the primary index layer at placeiOther same number index entries in addition, and aiThe primary index layer at place In the presence of a layer index layer, alternatively, aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiFor Oldest same several index entries in primary index layer where it, and aiA layer index layer in the presence of the primary index layer at place, then By aiIt is written in next layer index layer of the primary index layer, and deletes a in the primary index layeri
If aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiThe not original rope where it Draw same several index entries oldest in layer, and aiA layer index layer, then keep a in the presence of the primary index layer at placei, by aiPlace Primary index layer in oldest same several index entries be written in next layer index layer of the primary index layer;
If aiThere is no remove a in the primary index layer at placeiOther same number index entries in addition, and aiThe primary index layer at place There is no next layer index layers, alternatively, aiExist in the primary index layer at place and removes aiIn addition other are the same as number index entry ak, and aiOldest same several index entries in primary index layer where it, and aiNext layer index is not present in the primary index layer at place Layer, then delete a in the primary index layeri
If aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiThe not original rope where it Draw same several index entries oldest in layer, and aiNext layer index layer is not present in the primary index layer at place, then keeps ai, by aiInstitute Primary index layer in oldest same number index entry deletions,
Wherein, oldest same several index entries are corresponding versions of data compared to the same number rope of other in the primary index layer Draw the oldest same several index entries of the corresponding versions of data of item, i=1 ... m, m are the number of the multiple index entry, described next Version order and a corresponding to layer index layeriVersion order corresponding to the primary index layer of place is adjacent, and is older than aiPlace is former Version order corresponding to beginning index level.
5. a kind of index entry delet method of multi-edition data index characterized by comprising
Changed according to the version of the corresponding multiple edition datas of deleted data, updates multiple versions described in multilayer index respectively The feature structure or characteristic information of characterize data version in the corresponding multiple index entries of data;
The multiple index entry is respectively moved to index corresponding with the feature structure of its characterize data version or characteristic information In layer,
Wherein, the corresponding data of index entry version order having the same different in every layer index of the multilayer index, institute The new and old order that version order is versions of data is stated, the new and old order of the versions of data is set previously according to the version of data, And the feature structure or characteristic information of characterize data version are provided in the index entry of every layer index.
6. the index entry delet method of multi-edition data index as claimed in claim 5, which is characterized in that if an index level Corresponding to a version order, it is described by the multiple index entry be respectively moved to the feature structure of its characterize data version or In the corresponding index level of characteristic information, comprising:
To each index entry a in the multiple index entryi, judge a in multilayer indexiThe primary index layer at place whether there is Next layer index layer;
If aiA layer index layer in the presence of the primary index layer at place, by aiNext layer index layer of the primary index layer is written In, and delete a in the primary index layeri
If aiNext layer index layer is not present in the primary index layer at place, then deletes ai,
Wherein, i=1 ... m, m are the number of the multiple index entry, version order corresponding to next layer index layer with aiVersion order corresponding to the primary index layer of place is adjacent, and is older than aiVersion order corresponding to the primary index layer of place.
7. the index entry delet method of multi-edition data index as claimed in claim 5, which is characterized in that if in multilayer index It is described to be respectively moved to the multiple index entry and its characterize data version in the presence of the index level for corresponding to multiple version order Feature structure or the corresponding index level of characteristic information in, comprising:
To each index entry a in the multiple index entryi, judge a in multilayer indexiWhether deposited in the primary index layer at place Removing aiIn addition other are described to belong to the multiple index entry with number index entry with number index entry;
If aiExist in the primary index layer at place and removes aiIn addition other judge a with number index entryiIt whether is original where it Oldest same several index entries in beginning index level;
Judge a in multilayer indexiThe primary index layer at place whether there is next layer index layer;
If aiThere is no remove a in the primary index layer at placeiOther same number index entries in addition, and aiThe primary index layer at place In the presence of a layer index layer, alternatively, aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiFor Oldest same several index entries in primary index layer where it, and aiA layer index layer in the presence of the primary index layer at place, then By aiIt is written in next layer index layer of the primary index layer, and deletes a in the primary index layeri
If aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiThe not original rope where it Draw same several index entries oldest in layer, and aiA layer index layer, then keep a in the presence of the primary index layer at placei, by aiPlace Primary index layer in oldest same several index entries be written in next layer index layer of the primary index layer;
If aiThere is no remove a in the primary index layer at placeiOther same number index entries in addition, and aiThe primary index layer at place There is no next layer index layers, alternatively, aiExist in the primary index layer at place and removes aiIn addition other are the same as number index entry ak, and aiOldest same several index entries in primary index layer where it, and aiNext layer index is not present in the primary index layer at place Layer, then delete a in the primary index layeri
If aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiThe not original rope where it Draw same several index entries oldest in layer, and aiNext layer index layer is not present in the primary index layer at place, then keeps ai, by aiInstitute Primary index layer in oldest same number index entry deletions,
Wherein, oldest same several index entries are corresponding versions of data compared to the same number rope of other in the primary index layer Draw the oldest same several index entries of the corresponding versions of data of item, i=1 ... m, m are the number of the multiple index entry, described next Version order and a corresponding to layer index layeriVersion order corresponding to the primary index layer of place is adjacent, and is older than aiPlace is former Version order corresponding to beginning index level.
8. a kind of method for building up of multi-edition data index characterized by comprising
Multilayer index is organized, and the feature structure or characteristic information of characterize data version are set in index entry, wherein every layer of rope The corresponding data of different index entry version order having the same in drawing, the version order are new and old time of versions of data The new and old order of sequence, the versions of data is set previously according to the version of data.
9. the method for building up of multi-edition data index as claimed in claim 8, which is characterized in that stored with data in index entry Characteristic information of the position as characterize data version in storage medium.
10. the method for building up of multi-edition data index as claimed in claim 8, which is characterized in that with the version information of data Characteristic information as characterize data version.
11. the method for building up of multi-edition data index as claimed in claim 8, which is characterized in that further include:
For every layer index, memory storage priority is set;
Storage threshold value is periodically arranged according to the storage condition of memory;
Judge the index level for being less than the storage threshold value in memory with the presence or absence of memory storage priority;
If memory storage priority is less than institute there are the index level that memory storage priority is less than the storage threshold value in memory The index level for stating storage threshold value is stored in other specified solid storage mediums, and deletes from memory;
Judge whether there is the index level that memory storage priority is greater than or equal to the storage threshold value;
Memory storage priority is greater than or equal to the index level of the storage threshold value if it exists, judges that memory storage priority is greater than Or whether it is stored in memory equal to the index level of the storage threshold value;
If the index level that memory storage priority is greater than or equal to the storage threshold value is stored in except memory, and memory storage is excellent The index level that first grade is greater than or equal to the storage threshold value is stored in memory.
12. the method for building up of multi-edition data as claimed in claim 8 index, which is characterized in that the versions of data it is new Old order is set previously according to the version of data, comprising: with the current version of data for newest version, n version of data New and old order be successively redefined for 1,2 ... n according to sequence from the new to the old;
The tissue multilayer index, comprising:
The first layer index is organized, the version order of the corresponding data of index entry is 1 in first layer index;
Other layer indexs are organized, the version order of the corresponding data of index entry is one or more in other layer indexs.
13. the method for building up of multi-edition data index as claimed in claim 12, which is characterized in that the tissue multilayer rope Draw, comprising: tissue n-layer index, wherein the version order of the corresponding data of index entry is n in n-th layer index.
14. the method for building up of multi-edition data index as claimed in claim 12, which is characterized in that the tissue multilayer rope Draw, comprising:
The first layer index is organized, the version order of the corresponding data of index entry is 1 in first layer index;
The second layer index is organized, the version order of the corresponding data of index entry is 2 in second layer index;
Third layer index is organized, the version order of the corresponding data of index entry is 3 to n in the third layer index,
Wherein, n is greater than 3.
15. such as the method for building up of the described in any item multi-edition data indexes of claim 12 to 14, which is characterized in that also wrap It includes: by the first layer index fixed storage in memory.
16. the method for building up of multi-edition data as claimed in claim 8 index, which is characterized in that the versions of data it is new Old order is set previously according to the version of data, comprising: with the current version of data for newest version, n version of data New and old order be successively redefined for 1,2 ... n according to sequence from the new to the old, wherein n be greater than 2;
The tissue multilayer index, comprising:
The first layer index is organized, the version order of the corresponding data of index entry is 1 and 2 in first layer index;
Other layer indexs are organized, the version order of the corresponding data of index entry is one or more in other layer indexs.
17. a kind of updating device of multi-edition data index characterized by comprising
First version updating unit, for being updated respectively according to the version variation for being updated the corresponding multiple edition datas of data The feature structure or characteristic information of characterize data version in the corresponding multiple index entries of multiple edition datas described in multilayer index;
First index entry mobile unit, for the multiple index entry to be respectively moved to the feature knot with its characterize data version In structure or the corresponding index level of characteristic information;
New index entry writing unit corresponds to the rope of latest edition data for that will be updated the corresponding new index entry write-in of data Draw in layer,
Wherein, the corresponding data of index entry version order having the same different in every layer index of the multilayer index, institute The new and old order that version order is versions of data is stated, the new and old order of the versions of data is set previously according to the version of data, And the feature structure or characteristic information of characterize data version are provided in the index entry of every layer index.
18. the updating device of multi-edition data index as claimed in claim 17, which is characterized in that if an index level is corresponding In a version order, the index entry mobile unit is specifically used for:
To each index entry a in the multiple index entryi, judge a in multilayer indexiThe primary index layer at place whether there is Next layer index layer;
If aiA layer index layer in the presence of the primary index layer at place, by aiNext layer index layer of the primary index layer is written In, and delete a in the primary index layeri
If aiNext layer index layer is not present in the primary index layer at place, deletes ai,
Wherein, i=1 ... m, m are the number of the multiple index entry, version order corresponding to next layer index layer with aiVersion order corresponding to the primary index layer of place is adjacent, and is older than aiVersion order corresponding to the primary index layer of place.
19. the updating device of multi-edition data index as claimed in claim 18, which is characterized in that with the current version of data For newest version, the new and old order of n version of data is successively redefined for 1,2 ... n according to sequence from the new to the old, The multilayer index, including n-layer index, wherein the version order of the corresponding data of index entry is n, the rope in n-th layer index Draw a mobile unit, if in aiA layer index layer in the presence of the primary index layer at place, by aiIt is written under the primary index layer When in one layer index layer, it is specifically used for:
By aiT is writtenaiIn+1 layer index layer, wherein taiFor the corresponding version order of the primary index layer, taiLess than n.
20. the updating device of multi-edition data index as claimed in claim 17, which is characterized in that if existing in multilayer index Corresponding to the index level of multiple version order, the index entry mobile unit is specifically used for:
To each index entry a in the multiple index entryi, judge a in multilayer indexiWhether deposited in the primary index layer at place Removing aiIn addition other are described to belong to the multiple index entry with number index entry with number index entry;
If aiExist in the primary index layer at place and removes aiIn addition other judge a with number index entryiIt whether is original where it Oldest same several index entries in beginning index level;
Judge a in multilayer indexiThe primary index layer at place whether there is next layer index layer;
If aiThere is no remove a in the primary index layer at placeiOther same number index entries in addition, and aiThe primary index layer at place In the presence of a layer index layer, alternatively, aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiFor Oldest same several index entries in primary index layer where it, and aiA layer index layer in the presence of the primary index layer at place, then By aiIt is written in next layer index layer of the primary index layer, and deletes a in the primary index layeri
If aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiThe not original rope where it Draw same several index entries oldest in layer, and aiA layer index layer, then keep a in the presence of the primary index layer at placei, by aiPlace Primary index layer in oldest same several index entries be written in next layer index layer of the primary index layer;
If aiThere is no remove a in the primary index layer at placeiOther same number index entries in addition, and aiThe primary index layer at place There is no next layer index layers, alternatively, aiExist in the primary index layer at place and removes aiIn addition other are the same as number index entry ak, and aiOldest same several index entries in primary index layer where it, and aiNext layer index is not present in the primary index layer at place Layer, then delete a in the primary index layeri
If aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiThe not original rope where it Draw same several index entries oldest in layer, and aiNext layer index layer is not present in the primary index layer at place, then keeps ai, by aiInstitute Primary index layer in oldest same number index entry deletions,
Wherein, oldest same several index entries are corresponding versions of data compared to the same number rope of other in the primary index layer Draw the oldest same several index entries of the corresponding versions of data of item, i=1 ... m, m are the number of the multiple index entry, described next Version order and a corresponding to layer index layeriVersion order corresponding to the primary index layer of place is adjacent, and is older than aiPlace is former Version order corresponding to beginning index level.
21. a kind of index entry deletion device of multi-edition data index characterized by comprising
Second edition updating unit, for being updated respectively according to the version variation for being deleted the corresponding multiple edition datas of data The feature structure or characteristic information of characterize data version in the corresponding multiple index entries of multiple edition datas described in multilayer index;
Second index entry mobile unit, for the multiple index entry to be respectively moved to the feature knot with its characterize data version In structure or the corresponding index level of characteristic information,
Wherein, the corresponding data of index entry version order having the same different in every layer index of the multilayer index, institute The new and old order that version order is versions of data is stated, the new and old order of the versions of data is set previously according to the version of data, And the feature structure or characteristic information of characterize data version are provided in the index entry of every layer index.
22. the index entry deletion device of multi-edition data index as claimed in claim 21, which is characterized in that if an index Layer corresponds to a version order, and the second index entry mobile unit is specifically used for:
To each index entry a in the multiple index entryi, judge a in multilayer indexiThe primary index layer at place whether there is Next layer index layer;
If aiA layer index layer in the presence of the primary index layer at place, by aiNext layer index layer of the primary index layer is written In, and delete a in the primary index layeri
If aiNext layer index layer is not present in the primary index layer at place, deletes ai,
Wherein, i=1 ... m, m are the number of the multiple index entry, version order corresponding to next layer index layer with aiVersion order corresponding to the primary index layer of place is adjacent, and is older than aiVersion order corresponding to the primary index layer of place.
23. the index entry deletion device of multi-edition data index as claimed in claim 21, which is characterized in that if multilayer index Middle to there is the index level for corresponding to multiple version order, the second index entry mobile unit is specifically used for:
To each index entry a in the multiple index entryi, judge a in multilayer indexiWhether deposited in the primary index layer at place Removing aiIn addition other are described to belong to the multiple index entry with number index entry with number index entry;
If aiExist in the primary index layer at place and removes aiIn addition other judge a with number index entryiIt whether is original where it Oldest same several index entries in beginning index level;
Judge a in multilayer indexiThe primary index layer at place whether there is next layer index layer;
If aiThere is no remove a in the primary index layer at placeiOther same number index entries in addition, and aiThe primary index layer at place In the presence of a layer index layer, alternatively, aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiFor Oldest same several index entries in primary index layer where it, and aiA layer index layer in the presence of the primary index layer at place, then By aiIt is written in next layer index layer of the primary index layer, and deletes a in the primary index layeri
If aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiThe not original rope where it Draw same several index entries oldest in layer, and aiA layer index layer, then keep a in the presence of the primary index layer at placei, by aiPlace Primary index layer in oldest same several index entries be written in next layer index layer of the primary index layer;
If aiThere is no remove a in the primary index layer at placeiOther same number index entries in addition, and aiThe primary index layer at place There is no next layer index layers, alternatively, aiExist in the primary index layer at place and removes aiIn addition other are the same as number index entry ak, and aiOldest same several index entries in primary index layer where it, and aiNext layer index is not present in the primary index layer at place Layer, then delete a in the primary index layeri
If aiExist in the primary index layer at place and removes aiOther same number index entries in addition, and aiThe not original rope where it Draw same several index entries oldest in layer, and aiNext layer index layer is not present in the primary index layer at place, then keeps ai, by aiInstitute Primary index layer in oldest same number index entry deletions,
Wherein, oldest same several index entries are corresponding versions of data compared to the same number rope of other in the primary index layer Draw the oldest same several index entries of the corresponding versions of data of item, i=1 ... m, m are the number of the multiple index entry, described next Version order and a corresponding to layer index layeriVersion order corresponding to the primary index layer of place is adjacent, and is older than aiPlace is former Version order corresponding to beginning index level.
24. a kind of multi-edition data index establishes device, which is characterized in that including
Index organization's unit, index organization's unit are used for tissue multilayer index, wherein different index entry in every layer index Corresponding data version order having the same, the version order are the new and old order of versions of data, the versions of data New and old order is set previously according to the version of data;
Feature setting unit, for the feature structure or characteristic information of characterize data version to be arranged in index entry.
25. multi-edition data index as claimed in claim 24 establishes device, which is characterized in that deposited with data in index entry Store up feature structure of the position as characterize data version in storage medium.
26. multi-edition data index as claimed in claim 24 establishes device, which is characterized in that with the version information of data Characteristic information as characterize data version.
27. multi-edition data index as claimed in claim 24 establishes device, which is characterized in that further include:
Memory storage priority setting unit, for memory storage priority to be arranged for every layer index;
Threshold setting unit is stored, for storage threshold value periodically to be arranged according to the storage condition of memory;
First judging unit, the index for judging to be less than the storage threshold value in memory with the presence or absence of memory storage priority Layer;
First execution unit, if for there are memory storage priority to be less than the index level for storing threshold value in memory, it will be interior The index level that storage priority is less than the storage threshold value is stored in other specified solid storage mediums, and deletes from memory It removes;
Second judgment unit, the index for being greater than or equal to the storage threshold value for judging whether there is memory storage priority Layer;
Third judging unit is greater than or equal to the index level of the storage threshold value, judgement for memory storage priority if it exists Whether the index level that memory storage priority is greater than or equal to the storage threshold value is stored in memory;
Second execution unit, if the index level for memory storage priority to be greater than or equal to the storage threshold value is stored in memory Except, the index level that memory storage priority is greater than or equal to the storage threshold value is stored in memory.
28. multi-edition data as claimed in claim 24 index establishes device, which is characterized in that the versions of data it is new Old order is set previously according to the version of data, comprising: with the current version of data for newest version, n version of data New and old order be successively redefined for 1,2 ... n according to sequence from the new to the old;
Index organization's unit, is specifically used for:
The first layer index is organized, the version order of the corresponding data of index entry is 1 in first layer index;
Other layer indexs are organized, the version order of the corresponding data of index entry is one or more in other layer indexs.
29. multi-edition data index as claimed in claim 28 establishes device, which is characterized in that the index organization is single Member is specifically used for: tissue n-layer index, wherein the version order of the corresponding data of index entry is n in n-th layer index.
30. multi-edition data index as claimed in claim 28 establishes device, which is characterized in that the index organization is single Member is specifically used for:
The first layer index is organized, the version order of the corresponding data of index entry is 1 in first layer index;
The second layer index is organized, the version order of the corresponding data of index entry is 2 in second layer index;
Third layer index is organized, the version order of the corresponding data of index entry is 3 to n in the third layer index,
Wherein, n is greater than 3.
31. establishing device such as the described in any item multi-edition data indexes of claim 28 to 30, which is characterized in that also wrap It includes:
Static memory cell is used for the first layer index fixed storage in memory.
32. multi-edition data as claimed in claim 24 index establishes device, which is characterized in that the versions of data it is new Old order is set previously according to the version of data, comprising: with the current version of data for newest version, n version of data New and old order be successively redefined for 1,2 ... n according to sequence from the new to the old, wherein n be greater than 2;
Index organization's unit, is specifically used for:
The first layer index is organized, the version order of the corresponding data of index entry is 1 and 2 in first layer index;
Other layer indexs are organized, the version order of the corresponding data of index entry is one or more in other layer indexs.
CN201510966748.1A 2015-12-21 2015-12-21 Update, deletion and the method for building up and device of multi-edition data index Active CN105512325B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510966748.1A CN105512325B (en) 2015-12-21 2015-12-21 Update, deletion and the method for building up and device of multi-edition data index

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510966748.1A CN105512325B (en) 2015-12-21 2015-12-21 Update, deletion and the method for building up and device of multi-edition data index

Publications (2)

Publication Number Publication Date
CN105512325A CN105512325A (en) 2016-04-20
CN105512325B true CN105512325B (en) 2018-12-25

Family

ID=55720305

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510966748.1A Active CN105512325B (en) 2015-12-21 2015-12-21 Update, deletion and the method for building up and device of multi-edition data index

Country Status (1)

Country Link
CN (1) CN105512325B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109815240A (en) * 2019-01-29 2019-05-28 北京百度网讯科技有限公司 For managing method, apparatus, equipment and the storage medium of index

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106503260B (en) * 2016-11-18 2020-04-28 北京奇虎科技有限公司 Method and device for improving effective storage space of database
CN109582666A (en) * 2018-09-29 2019-04-05 阿里巴巴集团控股有限公司 Data major key generation method, device, electronic equipment and storage medium
CN112579117A (en) * 2019-09-30 2021-03-30 北京国双科技有限公司 Data upgrading method and device
CN113064886B (en) * 2021-03-04 2023-08-29 广州中国科学院计算机网络信息中心 Method for storing and marking management of identification resource

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101162469A (en) * 2007-11-09 2008-04-16 清华大学 Fine grit document and catalogs version management method based on snapshot
CN101295323A (en) * 2008-06-30 2008-10-29 腾讯科技(深圳)有限公司 Processing method and system for index updating
US7702640B1 (en) * 2005-12-29 2010-04-20 Amazon Technologies, Inc. Stratified unbalanced trees for indexing of data items within a computer system
US20140081917A1 (en) * 2010-12-21 2014-03-20 Microsoft Corporation Searching files
CN103714090A (en) * 2012-10-09 2014-04-09 阿里巴巴集团控股有限公司 Multi-index based database transaction processing method and database
CN103714121A (en) * 2013-12-03 2014-04-09 华为技术有限公司 Index record management method and device
CN104809237A (en) * 2015-05-12 2015-07-29 百度在线网络技术(北京)有限公司 LSM-tree (The Log-Structured Merge-Tree) index optimization method and LSM-tree index optimization system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7702640B1 (en) * 2005-12-29 2010-04-20 Amazon Technologies, Inc. Stratified unbalanced trees for indexing of data items within a computer system
CN101162469A (en) * 2007-11-09 2008-04-16 清华大学 Fine grit document and catalogs version management method based on snapshot
CN101295323A (en) * 2008-06-30 2008-10-29 腾讯科技(深圳)有限公司 Processing method and system for index updating
US20140081917A1 (en) * 2010-12-21 2014-03-20 Microsoft Corporation Searching files
CN103714090A (en) * 2012-10-09 2014-04-09 阿里巴巴集团控股有限公司 Multi-index based database transaction processing method and database
CN103714121A (en) * 2013-12-03 2014-04-09 华为技术有限公司 Index record management method and device
CN104809237A (en) * 2015-05-12 2015-07-29 百度在线网络技术(北京)有限公司 LSM-tree (The Log-Structured Merge-Tree) index optimization method and LSM-tree index optimization system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Multi-version Software Updates;Cristian Cadar;《2012 4th International Workshop on Hot Topics in Software Upgrades (HotSWUp)》;20120603;36-40 *
NGB智能终端数据访问关键技术研究;刘贤焯;《中国博士学位论文全文数据库 信息科技辑》;20131015(第10期);I136-86 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109815240A (en) * 2019-01-29 2019-05-28 北京百度网讯科技有限公司 For managing method, apparatus, equipment and the storage medium of index
CN109815240B (en) * 2019-01-29 2022-02-25 北京百度网讯科技有限公司 Method, apparatus, device and storage medium for managing index
KR102368775B1 (en) * 2019-01-29 2022-02-28 베이징 바이두 넷컴 사이언스 앤 테크놀로지 코., 엘티디. Method, apparatus, device and storage medium for managing index

Also Published As

Publication number Publication date
CN105512325A (en) 2016-04-20

Similar Documents

Publication Publication Date Title
CN105512325B (en) Update, deletion and the method for building up and device of multi-edition data index
RU2672719C2 (en) Extended storage without locks for multiple access methods
US7418544B2 (en) Method and system for log structured relational database objects
US11119978B2 (en) Snapshot version control
CN103473239A (en) Method and device for updating data of non relational database
US9576038B1 (en) Consistent query of local indexes
US6804680B2 (en) Extensible database
CN103106286B (en) Method and device for managing metadata
CN104239443B (en) A kind of storage method of serialized data operation log
CN111399777A (en) Differentiated key value data storage method based on data value classification
US20180210914A1 (en) Consistent query of local indexes
US20090187582A1 (en) Efficient update methods for large volume data updates in data warehouses
CN107003935A (en) Optimize database duplicate removal
CN106716409A (en) Method and system for adaptively building and updating column store database from row store database based on query demands
CN104854582B (en) Storage is efficient, updates the method and system of the affairs type full-text index view maintenance of optimization
CN103186622B (en) The update method of index information and device in a kind of text retrieval system
CN101523391A (en) Information search system, information search method, and program
CN106951375A (en) The method and device of snapped volume is deleted within the storage system
CN102385633A (en) File management system using virtual storage directory
CN110389942A (en) A kind of the key assignments separate-storage method and system of no garbage reclamation
US20110153580A1 (en) Index Page Split Avoidance With Mass Insert Processing
CN102779088B (en) Transaction facility, transaction methods and transaction processing program
CN108153804A (en) A kind of metadata daily record update method of symmetric distributed file system
CN102609531B (en) Method for pegging files according to keywords
US20180011897A1 (en) Data processing method having structure of cache index specified to transaction in mobile environment dbms

Legal Events

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