CN107590160A - A kind of method and device for monitoring radix tree internal structure - Google Patents
A kind of method and device for monitoring radix tree internal structure Download PDFInfo
- Publication number
- CN107590160A CN107590160A CN201610539360.8A CN201610539360A CN107590160A CN 107590160 A CN107590160 A CN 107590160A CN 201610539360 A CN201610539360 A CN 201610539360A CN 107590160 A CN107590160 A CN 107590160A
- Authority
- CN
- China
- Prior art keywords
- node
- layer
- radix tree
- mark
- logo collection
- 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.)
- Granted
Links
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
A kind of method and device for monitoring radix tree internal structure;Methods described includes:The logo collection of radix tree interior joint before operating is obtained, as first set;Information is changed according to the first set and node identification, determines the estimated logo collection of the radix tree interior joint;The mark of each node includes being used to describe from root node to the information of the shortest path of the node in the radix tree;The logo collection of the radix tree interior joint after operating is obtained, as second set;Compare the second set and the estimated logo collection, monitored results are obtained according to comparative result.The application can accomplish to be monitored in real time when operating every time for radix tree external morphology.
Description
Technical field
The present invention relates to computer realm, more particularly to a kind of method and device for monitoring radix tree internal structure.
Background technology
Radix tree (radix-tree) is general dictionary type data structure, and radix tree tree is also known as PAT positions tree
(Patricia Trie or crit bit tree).Radix tree is a kind of multi-fork search tree, and the leaf node of tree is actual
Data Entry.Each node has that one fixed, 2^n pointers point to child node (each pointer is referred to as groove slot), and have one
Pointer points to father node.
When using radix tree, the most frequently used operation is insertion, deletion, searches node.Wherein insertion, deletion of node can change
Become radix tree internal structure.Under different usage scenarios, consider for the balance to time complexity and space complexity, need
To use different data structure definitions and different additions and deletions node algorithms.For example it is inserting, deleting continuous chunk data
Under main scene, breadth first traversal can be searched for obtain lower time complexity than depth-first traversal;In storage data quantity
Under the scene of small and dispersion high (dispersion is higher to mean that addressing space is bigger), child node is recorded using map or hash
Pointer saves more internal memories than array..
When using radix tree, under different usage scenarios, need to do largely after data structure change or algorithm adjustment
Test just can guarantee that correctness.But for this more complicated data structure of radix tree, test and debugging work is a difficult point,
Embody in the following areas:
(a) interface that radix tree externally provides is simple, but internal data structure is complicated, and conventional method is by repeatedly grasping
Make (insertion, deletion etc.) and check that data correctness carrys out testing algorithm correctness afterwards.This debud mode granularity is thicker, can not find
The problem of the problem of occurring between multi-pass operation and " two negatives make a positive " being blanked in continuous operation.Need and fill very much
The test case divided, extremely large amount of fully test is done, just can guarantee that quality.Take time and effort, adjusted in algorithm, data structure adjustment
After can not accomplish iteratively faster, the project development requirement of iteratively faster can not be adapted to.
If (b) using the mode mentioned in (a) to debug test, once pinpoint the problems, it is difficult to trace back to problem immediately
The very first time, it is likely to internal structure has just malfunctioned in preceding insertion, deletion action several times, but arrives whole test case
Running through can just detect.Such case is run into, can only go to attempt to reappear in many cases, progressively reduce problem scope, can not
Accomplish problem exposure i.e. positioning, cause to position extremely difficult.
The content of the invention
The application provides a kind of method and device for monitoring radix tree internal structure, can be done for radix tree external morphology
Monitored in real time to when operating every time.
The application adopts the following technical scheme that.
A kind of method for monitoring radix tree internal structure, including:
The logo collection of radix tree interior joint before operating is obtained, as first set;According to the first set and section
Point identification changes information, determines the estimated logo collection of the radix tree interior joint;The mark of each node in the radix tree
Including for describing from root node to the information of the shortest path of the node;
The logo collection of the radix tree interior joint after operating is obtained, as second set;Compare the second set with
The estimated logo collection, monitored results are obtained according to comparative result.
Alternatively, the mark of the node is the layer index from root node each node into the shortest path of the node
Sequence;The different layers of the radix tree correspond to the layer index of different stage;The difference son section of each node in the radix tree
Point is made a distinction using the layer index of rank corresponding to layer where the node.
Alternatively, the layer index includes numeral and/or letter;The radix tree is every before the first set includes operation
The mark section set of node layer;Mark section of the radix tree per node layer is gathered after the second set includes operation;
The node identification change information includes the mark section of every layer of node to be changed.
Alternatively, it is described that information is changed according to first set and the node identification, determine the radix tree interior joint
Estimated logo collection include:
When the operation for insertion when, respectively to this layer in the mark section of every layer of node to be changed and first set
Union is sought in the set of mark section, by all layers of union collectively as the estimated logo collection;
When the operation is deletes, respectively to this layer in the mark section of every layer of node to be changed and first set
Difference set is sought in the set of mark section, by all layers of difference set collectively as the estimated logo collection.
Alternatively, it is described that information is changed according to the first set and node identification, it is determined that affiliated radix tree interior joint
Estimated logo collection before also include:
According to the mark of one or more leaf nodes in the radix tree for operating and being related to, it is determined that involved leaf
The mark of every layer of father node of child node, obtain the mark section of every layer of node to be changed.
Alternatively, the logo collection for obtaining the radix tree interior joint includes:
Every layer of first non-NULL node is found since the root node of the radix tree;
Respectively since every layer of node found, the pointer traversal for the sensing right node safeguarded by each node
All nodes of this layer, the mark of the node layer is recorded, the logo collection of every node layer is obtained after the completion of traversal.
A kind of device for monitoring radix tree internal structure, including:
Predicting unit, the logo collection of radix tree interior joint before being operated for acquisition, as first set;According to described
One set and node identification change information, determine the estimated logo collection of the radix tree interior joint;It is every in the radix tree
The mark of individual node includes being used to describe from root node to the information of the shortest path of the node;
Comparing unit, the logo collection of the radix tree interior joint after being operated for acquisition, as second set;Compare institute
Second set and the estimated logo collection are stated, monitored results are obtained according to comparative result.
Alternatively, the mark of the node is the layer index from root node each node into the shortest path of the node
Sequence;The different layers of the radix tree correspond to the layer index of different stage;The difference son section of each node in the radix tree
Point is made a distinction using the layer index of rank corresponding to layer where the node.
Alternatively, the layer index includes numeral and/or letter;The radix tree is every before the first set includes operation
The mark section set of node layer;Mark section of the radix tree per node layer is gathered after the second set includes operation;
The node identification change information includes the mark section of every layer of node to be changed.
Alternatively, the predicting unit changes information according to first set and the node identification, determines the radix
The estimated logo collection of tree interior joint includes:
When the operation for insertion when, respectively to this layer in the mark section of every layer of node to be changed and first set
Union is sought in the set of mark section, by all layers of union collectively as the estimated logo collection;When the operation is deletes,
Difference set is sought in the mark section set of this layer in the mark section to every layer of node to be changed and first set respectively, by all layers
Difference set collectively as the estimated logo collection.
Alternatively, described device also includes:
Determining unit, for according to the mark for operating one or more leaf nodes in the radix tree that is related to,
It is determined that the mark of every layer of father node of involved leaf node, obtains the mark section of every layer of node to be changed.
Alternatively, the predicting unit and/or the logo collection of the comparing unit acquisition radix tree interior joint include:
Every layer of first non-NULL node is found since the root node of the radix tree;The node found respectively from every layer
Start, the pointer for the sensing right node safeguarded by each node travels through all nodes of this layer, records the node layer
Identify, the logo collection of every node layer is obtained after the completion of traversal.
A kind of data processing electronics for being used to monitor radix tree internal structure, including processor, memory;It is described to deposit
Reservoir is used to store the program for being used for monitoring radix tree internal structure;The program for being used to monitor radix tree internal structure is in quilt
When the processor reads execution, following operation is performed:
The logo collection of radix tree interior joint before operating is obtained, as first set;According to the first set and section
Point identification changes information, it is determined that the estimated logo collection of affiliated radix tree interior joint;The mark of each node in the radix tree
Including for describing from root node to the information of the shortest path of the node;
The logo collection of the radix tree interior joint after operating is obtained, as second set;Compare the second set with
The estimated logo collection, monitored results are obtained according to comparative result.
The application includes advantages below:
In at least one embodiment of the application, the mark of node includes being used to describe the shortest path from root node to the node
The information in footpath, the internal structure of whole radix tree can be reflected by the set of the mark of node;In each operation to radix
Structure after tree operations is estimated, and is compared with the result obtained after practical operation, to judge radix tree internal structure
It is whether abnormal after the activation, so as to find mistake immediately when going wrong, so as to realize when operating every time pair
Radix tree is monitored in real time.
In one alternative of the embodiment of the present application, the mark of node can be the shortest path from root node to the node
The layer index sequence of each node in footpath, it so can conveniently obtain every layer of unique mark.
In one alternative of the embodiment of the present application, one or more sections can be included in the set of the mark of node
Set, node identification are changed information and also represented with range format, so can by way of union, difference set are asked in simple section
Easily to determine estimated logo collection;In alternate embodiments, the pointer for identifying and point to right node of node is passed through
Carry out the set of the mark of acquisition node, due to the two fields be not radix tree itself have to data structure, therefore in radix
Tree own data structure and algorithm will not be impacted when changing, and realize non-with the definition of radix tree internal data structure and algorithm
Chang Song coupling relies on, when internally data structure definition and algorithm change, almost without changing the logic monitored, monitoring
Function is unaffected, can ensure the efficiency of iteratively faster, and the correctness and stability of monitoring technology in itself.
Certainly, implementing any product of the application must be not necessarily required to reach all the above advantage simultaneously.
Brief description of the drawings
Fig. 1 is the schematic diagram of the method for the monitoring radix tree internal structure of embodiment one;
Fig. 2 is that will index the schematic diagram for being divided into subindex in the example of embodiment one;
Fig. 3 is the corresponding relation schematic diagram of subindex and each layer of radix tree in the example of embodiment one;
Fig. 4 be embodiment one example in subindex schematic diagram;
Fig. 5 corresponds to schematic diagram during radix tree for the subindex in Fig. 4;
Fig. 6 is that the mark of different nodes generates schematic diagram;
Fig. 7 is the monitoring schematic flow sheet of the example of embodiment one;
Fig. 8 is the schematic diagram of the method for the monitoring radix tree internal structure of embodiment two.
Embodiment
The technical scheme of the application is described in detail below in conjunction with drawings and Examples.
If it should be noted that not conflicting, each feature in the embodiment of the present application and embodiment can be tied mutually
Close, within the protection domain of the application.In addition, though logical order is shown in flow charts, but in some situations
Under, can be with the step shown or described by being performed different from order herein.
In a typical configuration, supervising device may include one or more processors (CPU), input/output interface,
Network interface and internal memory (memory).
Internal memory may include computer-readable medium in volatile memory, random access memory (RAM) and/or
The forms such as Nonvolatile memory, such as read-only storage (ROM) or flash memory (flash RAM).Internal memory is computer-readable medium
Example.Internal memory may include module 1, module 2 ... ..., module N (N is the integer more than 2).
Computer-readable medium includes permanent and non-permanent, removable and non-movable storage medium.Storage medium
It can realize that information stores by any method or technique.Information can be computer-readable instruction, data structure, the mould of program
Block or other data.The example of the storage medium of computer includes, but are not limited to phase transition internal memory (PRAM), static random-access is deposited
Reservoir (SRAM), dynamic random access memory (DRAM), other kinds of random access memory (RAM), read-only storage
(ROM), Electrically Erasable Read Only Memory (EEPROM), fast flash memory bank or other memory techniques, read-only optical disc are read-only
Memory (CD-ROM), digital versatile disc (DVD) or other optical storages, magnetic cassette tape, tape magnetic rigid disk storage or
Other magnetic storage apparatus or any other non-transmission medium, the information that can be accessed by a computing device available for storage.According to
Herein defines, and computer-readable medium does not include non-temporary computer readable media (transitory media), such as modulates
Data-signal and carrier wave.
Embodiment one, a kind of method for monitoring radix tree internal structure, as shown in figure 1, including step S110~S120:
S110, the logo collection for obtaining radix tree interior joint before operation, as first set;According to the first set with
And node identification changes information, the estimated logo collection of the radix tree interior joint is determined;Each node in the radix tree
Mark includes being used to describe from root node to the information of the shortest path of the node;
S120, the logo collection for obtaining the radix tree interior joint after operation, as second set;Compare second collection
Close and be expected logo collection with described, monitored results are obtained according to comparative result.
In the present embodiment, can be carried out when performing and the radix tree being operated every time above-mentioned steps S110~
S120, it can know whether operation causes radix tree mistake by comparative result;Therefore can be after every operation in time to base
Number tree is checked, avoids the situation of wrong " two negatives make a positive ", is also beneficial to position mistake.
In the present embodiment, because the mark of each node includes being used to describe from root node to the shortest path of the node
The mark of information, i.e. node can embody radix tree and neutralize the related structure of the node, therefore pass through radix tree interior joint
The set can of mark reflects the internal structure of whole radix tree;The estimated logo collection is determined in each operation,
Estimated equivalent to the structure after radix tree operations;The second set obtained after estimated logo collection and practical operation is entered
Row compares, it is possible to knows whether radix tree internal structure is abnormal after the activation, so as to be found immediately when going wrong
Mistake, realize the real-time monitoring to radix tree when operating every time.It is described to be supervised according to comparative result in the present embodiment
Control result can include:When comparative result is identical, judges that the radix tree is normal, i.e., do not malfunction;When comparative result is not
When identical, the radix tree error is judged.It can also include after judging to malfunction:Termination is tested or other operations, described in reservation
The field data of radix tree.Conveniently positioned when can so go wrong.
In the present embodiment, the node identification change information can determine according to operation information;The operation information is used for
Instruction carries out some operation to the radix tree, can include the operation such as insertion and/or deletion.The operation information can include
Operation requests, operational order etc. are used to indicate the message for operating the radix tree.
In the present embodiment, a kind of optional way is to intercept the operation information for being dealt into the radix tree, is first inquired about after interception
The current collection of the mark of the radix tree interior joint, the first set is obtained, then the operation information intercepted is sent to institute
State radix tree;The step of determining the estimated logo collection before the step of sending intercepted operation information, afterwards or simultaneously
Row performs;Obtain the radix tree and the set of the corresponding mark for operating posterior nodal point is carried out (i.e. according to the operation information
Second set) and be compared.Another optional way is to preserve the collection for the mark that the radix tree operates posterior nodal point every time
Close, first set during as next operation (when not carrying out any operation, preservation be node when radix tree is initial mark
The set of knowledge);Operation information for being dealt into the radix tree only carries out content monitoring and more converted to obtaining the node identification
Breath, and without intercepting;After operation information has been listened to, information is changed by the first set and node identification of preservation and determined
It is expected that logo collection, and obtain the set that the radix tree carries out the mark of corresponding operation posterior nodal point according to the operation information
(i.e. second set) is simultaneously compared.
In a kind of alternative of the present embodiment, the mark of node can be from root node into the shortest path of the node
The sequence of the layer index of each node;The different layers of the radix tree can correspond to the layer index of different stage, the radix
The layer index of rank corresponding to layer makes a distinction where the different child nodes of each node can use the node in tree.
In this alternative, the different layers of radix tree correspond to the layer index of different stage, for example layer index can include 0
Level layer index, 1 grade of layer index ... ....The layer index of layer corresponding level where the different child nodes of each node use the node
Make a distinction, for example the different child nodes of root node are represented with 0 grade of different layer indexs respectively;Each child node of root node
Different child nodes are represented with 1 grade of different layer indexs respectively;By that analogy.Therefore, every grade of layer index needs different comprising M
Index value, the number for the child node that M can at most possess for a node.
For example, root node has two sub- nodes Xs and Y, 0 grade of layer index is respectively ah and cq.Its child nodes X also has
Two child nodes W and V, 1 grade of layer index is respectively kl and sq;Then being identified as of child node W " ahkl " (root node be it is unique,
Can there is no layer index), i.e., child node X layer index (0 grade of layer index) and child node W layer index (1 grade of layer on shortest path
Index) composition sequence.It should be noted that child node Y and child node X 1 grade of layer index can be completely or partially identical,
If the same child node Y may similarly possess the child node that 1 grade of layer index is kl, but the mark of the child node will be
" cqkl ", i.e., the sequence that child node Y layer index and child node W layer index form on shortest path.
In a kind of embodiment of this alternative, the layer index can include numeral and/or letter;First collection
Mark section of the radix tree per node layer before including operation is closed to gather;After the second set includes operation, the radix
Gather in mark section of the tree per node layer;The node identification change information includes the mark section of every layer of node to be changed.
It is described that information is changed according to first set and the node identification in present embodiment, determine to save in radix tree
The estimated logo collection of point can include:
When the operation for insertion when, respectively to this layer in the mark section of every layer of node to be changed and first set
Union is sought in the set of mark section, by all layers of union collectively as the estimated logo collection;
When the operation is deletes, respectively to this layer in the mark section of every layer of node to be changed and first set
Difference set is sought in the set of mark section, by all layers of difference set collectively as the estimated logo collection.
In present embodiment, if the mark of a node layer is continuous, for example the mark of a certain node layer is respectively
0x020001,0x020002,0x020003 ... ... 0x020010 then the floor mark section set in can only include an area
Between [0x020001,0x020010], if not continuous, then can include multiple sections.
In other embodiment, the layer index can also be other symbols (single symbol or symbol sebolic addressing), can be with
It is numeral, letter, any combination of symbol.
It is described that information is changed according to the first set and node identification in present embodiment, it is determined that affiliated radix tree
It can also include before the estimated logo collection of interior joint:
According to the mark of one or more leaf nodes in the radix tree for operating and being related to, it is determined that involved leaf
The mark of every layer of father node of child node, obtain the mark section of every layer of node to be changed.
For example the operation is related to five leaf nodes of the radix tree, this five leaf nodes are involved leaf
Node;Due to can be related to the father node of these leaf nodes to leaf node operation, these father nodes are not (including root section yet
Point) it is the node to be changed.The mark of the father node of this five every layer of leaf nodes is determined respectively, obtains the five batches of father nodes
Mark (mark per a collection of every layer of father node for including a leaf node), this comprehensive five batch ID and by layer division after, just
The mark section of every layer of node to be changed can be obtained;The mark section of resulting every layer node to be changed be can be used as into institute
State estimated logo collection.Wherein, because the mark of node is the layer from root node each node into the shortest path of the node
The sequence of index, therefore can judge which the node belongs to according to the number of layer index in the mark of node or the length of mark
One layer.Such as the child node of root node, an only layer index in mark, and the child node of these child nodes, then have in identifying
Two layer indexs;By that analogy.If the length of layer index is fixed, for example a layer index is fixed as two 16 systems
Position, then can be according to the layer where the length field partial node of mark.
In a kind of alternative of the present embodiment, the logo collection for obtaining the radix tree interior joint can include:
Every layer of first non-NULL node is found since the root node of the radix tree;
Respectively since every layer of node found, the pointer traversal for the sensing right node safeguarded by each node
All nodes of this layer, the mark of the node layer is recorded, the logo collection of every node layer is obtained after the completion of traversal.
In this alternative, each node can safeguard the pointer of a sensing right node in the radix tree;Pass through
The pointer, as long as finding first every layer (i.e. first from left to right) non-NULL node, it is possible to the sensing safeguarded by the node
The pointer of right node accesses the node on the right of the node, the pointer for the sensing right node safeguarded further according to the node on the right
One node in the right again is accessed, by that analogy, the node of this layer is completed until accessing.Present embodiment by the mark of node and
Point to right node pointer come acquisition node mark set, due to the two fields be not radix tree itself have to number
According to structure, therefore will not be impacted when radix tree own data structure and algorithm change, realize and number inside radix tree
Defined according to structure and coupling that algorithm is very loose relies on.
In this alternative, when the logo collection is gathered for mark section, when recording the mark of a node layer, record
Into the form of mark section set.
In other embodiments, the other manner traversal each node of radix tree can also be used, so as to obtain every layer of section
The mark section set of point.
Illustrated below with an example, index (key) resolved into four subindexs (sub_key) in the example,
As shown in Fig. 2 key is broken down into sub_key0, sub_key1, sub_key2 and sub_key3.Each subindex respectively as
Layer index corresponding to every layer in addition to leaf node of radix tree;Assuming that all leaf nodes are in same layer, as shown in figure 3,
R is root node in figure, and N is internal node, and L is leaf node, and keylist is index sequence.Sub_key0 corresponds to root node;
Sub_key1 corresponds to the child node (the first level of child nodes, being referred to as 1 grade of internal node) of root node in itself;sub_
Key2 corresponds to the child node (the second level of child nodes, being referred to as 2 grades of internal node) of the first level of child nodes;sub_key3
Corresponding to the child node (third layer child node, being referred to as 3 grades of internal node) of the second level of child nodes, namely leaf node
Father node.
In this example, it is assumed that key is being counted without symbol shaping (uint32_t) for 32 bits, then can be split into 4
Sub_key, each sub_key are 8 bits, and 4 sub_key correspond to key from high to low four bytes respectively.Such as Fig. 4 institutes
Show, for example key 32 bit numbers are 0~31, then sub_key0 is the bit that numbering is 0~7, and sub_key1 is that numbering is
8~15 bit, sub_key2 are the bits that numbering is 16~23, and sub_key3 is the bit that numbering is 24~31.
The situation that sub_key is corresponded to radix tree is as shown in Figure 5:Sub_key0 is 0 grade of layer index;sub_key1、
Sub_key2, sub_key3 are respectively 1 grade of layer index, 2 grades of layer indexs, 3 grades of layer indexs;Wherein 0 grade of layer index is in layer index sequence
It is highest order in row, 3 grades of layer indexs are lowest order.Each than peculiar " 0 ", " 1 " two kinds of values in 8 bits, then 8 bits altogether can
To include the mutually different sequence of values of 2^8=256 kinds.If regarding the subindex of 8 bits as a binary number, 256
The different sequence of values of kind corresponds respectively to decimal value [0,255], may be respectively used for representing the layer rope of 256 child nodes
Draw.For example the 0~255 of sub_key0 represents 256 1 grade of internal node under root node respectively, the 0~255 of sub_key1
256 2 grades of internal node under 11 grade of internal node is represented respectively, and the 0~255 of sub_key2 represents 12 grades respectively
Internal node under 256 3 grades of internal node, the 0~255 of sub_key3 represents under 13 grades of internal node respectively
256 leaf nodes,.
Generating process per node layer id is as shown in fig. 6, the id of each node is the shortest path from root node to the node
The layer index sequence of each node in footpath, for example for 3 grades of internal node 61, the layer index included in layer index sequence is successively
For:2 (sub_key0), 0 (sub_key1), 1 (sub_key2) because each node (including) child node number be no more than
256, so the layer index of each node on path can be represented with a hexadecimal number, a hexadecimal number includes two
Individual hex bit, such as layer index 2 are expressed as " 02 ", and layer index 0 is expressed as " 01 ", then the id of node 61 is 0x020001,
Wherein 0x represents that Serial No. below is hexadecimal number.It can be seen that the shortest path of root node to a node can be unique
A node is determined, this id must be unique in one layer, but be not necessarily uniquely in the overall situation, because there may be this
One leaf node of sample, the layer index of each node is followed successively by 0 (sub_ in the shortest path of root node to the leaf node
Key0), 2 (sub_key1), 0 (sub_key2), 1 (sub_key3), then the id of the leaf node is also 0x00020001, although
Two hex bits more than 0x020001, but corresponding numerical value is identical.Similarly, the id of leaf node 62 is
0x020100ff。
In order to facilitate monitoring radix tree external morphology, need to safeguard per node layer (including internal node and leaf node):
One every layer unique mark (id);And (hereinafter referred to as next refers to a pointer for pointing to the adjacent node on the right of this node
Pin).
The workflow diagram of radix tree monitoring is as shown in fig. 7, wherein monitoring module is used to realize the prison to radix tree operations
Control, radix tree module are responsible for realizing radix tree function.The operation of monitoring module adapter radix tree, for that can change inside radix tree
The operation of structure is monitored, including step 501~510:
501st, monitoring module intercepts and captures operation information (operation requests or operational order etc.) of the user to radix tree, according to described
Operation information obtains the mark section [from, to] of every layer of node to be changed corresponding to this time operation (insertion or deletion etc.), i.e.,
The node identification changes information.
502nd, monitoring module obtains the state of current radix tree to radix tree module.
503rd, radix tree module returns to the status information currentStatus of every layer of radix tree, and the status information is i.e. described
First set, represent to carry out radix tree the state of preoperative radix tree.
504th, monitoring module combines 501 obtained [from, to] and currentStatus, calculates base after this time operating
Every layer of estimated status information expectedStatus of number tree, i.e., described estimated logo collection.
505th, the operation information intercepted and captured into radix tree module forwards 501.
506th, after radix tree module completes corresponding operating, return and respond to monitoring module.
507th, monitoring module obtains the state of current radix tree to radix tree module again.
508th, radix tree module returns to the status information actualStatus of every layer of radix tree, and the status information is described the
Two set, represent the state of the radix tree after being operated to radix tree.
509th, compare actualStatus and expectedStatus, if it is inconsistent, reporting an error, and record 501 and cut
All information of operation information and radix tree obtained.
If the 510, consistent, the message for representing that operation is completed is returned to user.
Wherein, [from, to] is combined in step 504 and currentStatus calculates expectedStatus details such as
Under:
For insertion (insert) operation, [from, to] is added to the mark Interval Set that currentStatus included
In conjunction, travel through each mark section s in currentStatus, if s and [from, to] have common factor, then be s and [from,
To] section add computing.A section duplicate removal is done after the completion of traversal and adjacent interval merges.
For deleting (erase) operation, each section s in currentStatus is traveled through, if s and [from, to] have
Occur simultaneously, then the section for being s and [from, to] subtracts computing.
Wherein, add computing to refer to ask two sections for having common factor union, such as [a, b], [b-1, b+10] are merged into
[a,b+10].Subtract computing and refer to that [c, d] seeks difference set to two sections for having common factor [a, b], such as [a, b]-[c, d] result root
It is different according to a, b, c, d magnitude relationship, it may be possible to one kind in [a, c], [d, b], [a, c] and [d, b] three kinds of situations.
Wherein, the status information process of current every layer of the radix tree of radix tree module acquisition includes following two step:
The first step, obtain every layer first (Far Left) node;This step only needs to access every layer since root node
First non-NULL node, very simple.
Second step, the next pointers using each node, all nodes on the right of it are directly traveled through, recorded per node layer
Id sections, such as [0,5], [8,10], [49,91] or [a, d], [m, q], [x, x].The status information of each layer of return is a mark
Know section set.This step use node id fields and next fields, the two fields be not radix tree itself have to number
It is unaffected when radix tree own data structure and algorithm change according to structure, therefore monitoring method and base can be realized
Number data tree structure and algorithm loose coupling.
The monitoring method of the present embodiment is applied to the useful numeral of institute, alphabetical or other types data index as radix tree
Scene.Described in upper example with numeral for index citing, do not indicate that this present embodiment is suitable only for radix tree of the numeral for index.
Embodiment two, a kind of device for monitoring radix tree internal structure, as shown in figure 8, including:
Predicting unit 81, the logo collection of radix tree interior joint before being operated for acquisition, as first set;According to described
First set and node identification change information, determine the estimated logo collection of the radix tree interior joint;In the radix tree
The mark of each node includes being used to describe from root node to the information of the shortest path of the node;
Comparing unit 82, for obtaining the logo collection of radix tree interior joint after the operation, as second set;Compare
The second set and the estimated logo collection, monitored results are obtained according to comparative result.
In the present embodiment, the predicting unit 81 is to be responsible for the part of the estimated logo collection of generation in described device, can be with
It is the combination of software, hardware or both.
In the present embodiment, the comparing unit 82 is to be responsible in described device by the set actually obtained and it is expected that label sets
The part being compared is closed, can be the combination of software, hardware or both.
In the present embodiment, one or more of the predicting unit 81, comparing unit 82 can with to the radix tree
The module operated is arranged in same device or equipment, can also be arranged in different device or equipment;Regardless of whether
It is arranged in same device or equipment, the predicting unit 81, comparing unit 82 can obtain the radix tree interior joint
Logo collection.The prediction module 81 and comparing unit 82 can be multiplexed or be obtained by same functional module in radix tree
The logo collection of node.
In a kind of alternative of the present embodiment, the mark of the node can be the shortest path from root node to the node
The sequence of the layer index of each node in footpath;The different layers of the radix tree can correspond to the layer index of different stage;It is described
The layer index of rank corresponding to layer makes a distinction where the different child nodes of each node can use the node in radix tree.
In a kind of embodiment of this alternative, the layer index can include numeral and/or letter;First collection
Mark section of the radix tree per node layer before can including operation is closed to gather;The second set can include institute after operation
Mark section of the radix tree per node layer is stated to gather;The node identification change information can include the mark of every layer of node to be changed
Know section;
The predicting unit changes information according to first set and the node identification, determines the radix tree interior joint
Estimated logo collection can include:
When the operation for insertion when, respectively to this layer in the mark section of every layer of node to be changed and first set
Union is sought in the set of mark section, by all layers of union collectively as the estimated logo collection;When the operation is deletes,
Difference set is sought in the mark section set of this layer in the mark section to every layer of node to be changed and first set respectively, by all layers
Difference set collectively as the estimated logo collection.
In present embodiment, described device can also include:
Determining unit, for according to the mark for operating one or more leaf nodes in the radix tree that is related to,
It is determined that the mark of every layer of father node of involved leaf node, obtains the mark section of every layer of node to be changed.
In the present embodiment, the determining unit is the part for being responsible for determining node identification change information in described device, can
To be the combination of software, hardware or both.
In a kind of alternative of the present embodiment, the predicting unit and/or comparing unit are obtained and saved in the radix tree
The logo collection of point can include:
Every layer of first non-NULL node is found since the root node of the radix tree;The node found respectively from every layer
Start, the pointer for the sensing right node safeguarded by each node travels through all nodes of this layer, records the node layer
Identify, the logo collection of every node layer is obtained after the completion of traversal.
In the present embodiment, the unit that described device is included may be respectively used for walking accordingly in execution embodiment one
Suddenly, these units realize that the details of corresponding operating can be found in embodiment one.
Embodiment three, a kind of data processing electronics for being used to monitor radix tree internal structure, including processor, storage
Device;It is characterized in that:
The memory is used to store the program for being used for monitoring radix tree internal structure;It is described to be used to monitor inside radix tree
The program of structure performs following operation when reading execution by the processor:
The logo collection of radix tree interior joint before operating is obtained, as first set;According to the first set and section
Point identification changes information, it is determined that the estimated logo collection of affiliated radix tree interior joint;The mark of each node in the radix tree
Including for describing from root node to the information of the shortest path of the node;
The logo collection of the radix tree interior joint after operating is obtained, as second set;Compare the second set with
The estimated logo collection, monitored results are obtained according to comparative result.
The above-mentioned program for being used to monitor radix tree internal structure is reading execution by the processor in the present embodiment, is held
The details of capable operation can be found in embodiment one.
One of ordinary skill in the art will appreciate that all or part of step in the above method can be instructed by program
Related hardware is completed, and described program can be stored in computer-readable recording medium, such as read-only storage, disk or CD
Deng.Alternatively, all or part of step of above-described embodiment can also be realized using one or more integrated circuits.Accordingly
Ground, each module/unit in above-described embodiment can be realized in the form of hardware, can also use the shape of software function module
Formula is realized.The application is not restricted to the combination of the hardware and software of any particular form.
Certainly, the application can also have other various embodiments, ripe in the case of without departing substantially from the application spirit and its essence
Know those skilled in the art when can be made according to the application it is various it is corresponding change and deformation, but these corresponding change and become
Shape should all belong to the protection domain of claims hereof.
Claims (13)
1. a kind of method for monitoring radix tree internal structure, including:
The logo collection of radix tree interior joint before operating is obtained, as first set;According to the first set and node mark
Know change information, determine the estimated logo collection of the radix tree interior joint;The mark of each node includes in the radix tree
For describing from root node to the information of the shortest path of the node;
The logo collection of the radix tree interior joint after operating is obtained, as second set;Compare the second set with it is described
It is expected that logo collection, monitored results are obtained according to comparative result.
2. the method as described in claim 1, it is characterised in that:
The mark of the node is the sequence from root node layer index of each node into the shortest path of the node;The base
The different layers of number tree correspond to the layer index of different stage;The different child nodes of each node use the node in the radix tree
The layer index of rank makes a distinction corresponding to the layer of place.
3. method as claimed in claim 2, it is characterised in that:
The layer index includes numeral and/or letter;The first set includes mark of the radix tree per node layer before operation
Know section set;Mark section of the radix tree per node layer is gathered after the second set includes operation;The node mark
Knowing change information includes the mark section of every layer of node to be changed.
4. method as claimed in claim 3, it is characterised in that described more to be converted to according to first set and the node identification
Breath, determining the estimated logo collection of the radix tree interior joint includes:
When the operation for insertion when, respectively to the mark of this layer in the mark section of every layer of node to be changed and first set
Union is sought in section set, by all layers of union collectively as the estimated logo collection;
When the operation is deletes, respectively to the mark of this layer in the mark section of every layer of node to be changed and first set
Difference set is sought in section set, by all layers of difference set collectively as the estimated logo collection.
5. method as claimed in claim 3, it is characterised in that described more to be converted to according to the first set and node identification
Breath, it is determined that also including before the estimated logo collection of affiliated radix tree interior joint:
According to the mark of one or more leaf nodes in the radix tree for operating and being related to, it is determined that involved leaf section
The mark of every layer of father node of point, obtains the mark section of every layer of node to be changed.
6. the method as described in claim 1, it is characterised in that the logo collection bag for obtaining the radix tree interior joint
Include:
Every layer of first non-NULL node is found since the root node of the radix tree;
Respectively since every layer of node found, the pointer for the sensing right node safeguarded by each node travels through the layer
All nodes, record the mark of the node layer, the logo collection of every node layer obtained after the completion of traversal.
A kind of 7. device for monitoring radix tree internal structure, it is characterised in that including:
Predicting unit, the logo collection of radix tree interior joint before being operated for acquisition, as first set;According to the described first collection
Close and node identification changes information, determine the estimated logo collection of the radix tree interior joint;Each saved in the radix tree
The mark of point includes being used to describe from root node to the information of the shortest path of the node;
Comparing unit, the logo collection of the radix tree interior joint after being operated for acquisition, as second set;Compare described
Two set and the estimated logo collection, monitored results are obtained according to comparative result.
8. device as claimed in claim 7, it is characterised in that:
The mark of the node is the sequence from root node layer index of each node into the shortest path of the node;The base
The different layers of number tree correspond to the layer index of different stage;The different child nodes of each node use the node in the radix tree
The layer index of rank makes a distinction corresponding to the layer of place.
9. device as claimed in claim 8, it is characterised in that:
The layer index includes numeral and/or letter;The first set includes mark of the radix tree per node layer before operation
Know section set;Mark section of the radix tree per node layer is gathered after the second set includes operation;The node mark
Knowing change information includes the mark section of every layer of node to be changed.
10. device as claimed in claim 9, it is characterised in that the predicting unit is according to first set and the node
Mark change information, determining the estimated logo collection of the radix tree interior joint includes:
When the operation for insertion when, respectively to the mark of this layer in the mark section of every layer of node to be changed and first set
Union is sought in section set, by all layers of union collectively as the estimated logo collection;When the operation is deletes, respectively
Difference set is sought in mark section set to this layer in the mark section of every layer of node to be changed and first set, by all layers of difference
Collection is collectively as the estimated logo collection.
11. device as claimed in claim 9, it is characterised in that also include:
Determining unit, for according to the mark for operating one or more leaf nodes in the radix tree that is related to, it is determined that
The mark of every layer of father node of involved leaf node, obtain the mark section of every layer of node to be changed.
12. device as claimed in claim 7, it is characterised in that the predicting unit and/or comparing unit obtain the radix
The logo collection of tree interior joint includes:
Every layer of first non-NULL node is found since the root node of the radix tree;The node found respectively from every layer is opened
Begin, the pointer for the sensing right node safeguarded by each node travels through all nodes of this layer, records the mark of the node layer
Know, the logo collection of every node layer is obtained after the completion of traversal.
13. a kind of data processing electronics for being used to monitor radix tree internal structure, including processor, memory;Its feature
It is:
The memory is used to store the program for being used for monitoring radix tree internal structure;It is described to be used to monitor radix tree internal structure
Program read by the processor perform when, perform following operation:
The logo collection of radix tree interior joint before operating is obtained, as first set;According to the first set and node mark
Change information is known, it is determined that the estimated logo collection of affiliated radix tree interior joint;The mark of each node includes in the radix tree
For describing from root node to the information of the shortest path of the node;
The logo collection of the radix tree interior joint after operating is obtained, as second set;Compare the second set with it is described
It is expected that logo collection, monitored results are obtained according to comparative result.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610539360.8A CN107590160B (en) | 2016-07-08 | 2016-07-08 | Method and device for monitoring internal structure of radix tree to realize test |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610539360.8A CN107590160B (en) | 2016-07-08 | 2016-07-08 | Method and device for monitoring internal structure of radix tree to realize test |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107590160A true CN107590160A (en) | 2018-01-16 |
CN107590160B CN107590160B (en) | 2021-08-27 |
Family
ID=61045359
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610539360.8A Active CN107590160B (en) | 2016-07-08 | 2016-07-08 | Method and device for monitoring internal structure of radix tree to realize test |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107590160B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110781255A (en) * | 2019-08-29 | 2020-02-11 | 腾讯大地通途(北京)科技有限公司 | Road aggregation method, road aggregation device and electronic equipment |
CN111597185A (en) * | 2020-04-01 | 2020-08-28 | 深圳英飞拓智能技术有限公司 | Real-time state number rapid statistical method based on tree structure resource distribution |
CN112000847A (en) * | 2020-08-19 | 2020-11-27 | 东北大学 | GPU parallel-based adaptive radix tree dynamic indexing method |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101197734A (en) * | 2007-12-27 | 2008-06-11 | 华为技术有限公司 | Test approach and device for command line interface |
US20140053134A1 (en) * | 2012-08-16 | 2014-02-20 | Fujitsu Limited | Software regression testing using symbolic execution |
CN104407977A (en) * | 2014-12-08 | 2015-03-11 | 北京航空航天大学 | Model detection based automatic joint debugging test method for staged task system |
CN104750612A (en) * | 2015-03-31 | 2015-07-01 | 腾讯科技(深圳)有限公司 | File operation testing method and device |
-
2016
- 2016-07-08 CN CN201610539360.8A patent/CN107590160B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101197734A (en) * | 2007-12-27 | 2008-06-11 | 华为技术有限公司 | Test approach and device for command line interface |
US20140053134A1 (en) * | 2012-08-16 | 2014-02-20 | Fujitsu Limited | Software regression testing using symbolic execution |
CN104407977A (en) * | 2014-12-08 | 2015-03-11 | 北京航空航天大学 | Model detection based automatic joint debugging test method for staged task system |
CN104750612A (en) * | 2015-03-31 | 2015-07-01 | 腾讯科技(深圳)有限公司 | File operation testing method and device |
Non-Patent Citations (1)
Title |
---|
BIT祝威: "重识算法(3)--用458329个测试用例全面测试二叉树和线索二叉树的遍历算法", 《CNBLOG HTTPS://WWW.CNBLOGS.COM/BITZHUWEI/P/ALGORITHM-3-458329-TEST-CASES-4-THREADED-BINARY-TREE-TRAVERSE.HTML》 * |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110781255A (en) * | 2019-08-29 | 2020-02-11 | 腾讯大地通途(北京)科技有限公司 | Road aggregation method, road aggregation device and electronic equipment |
CN110781255B (en) * | 2019-08-29 | 2024-04-05 | 腾讯大地通途(北京)科技有限公司 | Road aggregation method, road aggregation device and electronic equipment |
CN111597185A (en) * | 2020-04-01 | 2020-08-28 | 深圳英飞拓智能技术有限公司 | Real-time state number rapid statistical method based on tree structure resource distribution |
CN111597185B (en) * | 2020-04-01 | 2023-04-28 | 深圳英飞拓仁用信息有限公司 | Real-time state number rapid statistical method based on tree structure resource distribution |
CN112000847A (en) * | 2020-08-19 | 2020-11-27 | 东北大学 | GPU parallel-based adaptive radix tree dynamic indexing method |
CN112000847B (en) * | 2020-08-19 | 2021-07-20 | 东北大学 | GPU parallel-based adaptive radix tree dynamic indexing method |
Also Published As
Publication number | Publication date |
---|---|
CN107590160B (en) | 2021-08-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10649838B2 (en) | Automatic correlation of dynamic system events within computing devices | |
KR101914853B1 (en) | Method and system for embedding knowledge gragh reflecting logical property of relations, recording medium for performing the method | |
CN104756107B (en) | Using location information profile data | |
CN111612041B (en) | Abnormal user identification method and device, storage medium and electronic equipment | |
US20120124047A1 (en) | Managing log entries | |
CN109697456A (en) | Business diagnosis method, apparatus, equipment and storage medium | |
US20120297364A1 (en) | Augmented design structure matrix visualizations for software system analysis | |
CN109325062B (en) | Data dependency mining method and system based on distributed computation | |
US11777983B2 (en) | Systems and methods for rapidly generating security ratings | |
CN107590160A (en) | A kind of method and device for monitoring radix tree internal structure | |
CN112131075A (en) | Method and equipment for detecting abnormity of stored monitoring data | |
CN113992541A (en) | Network flow measuring method, system, computer equipment, storage medium and application | |
CN110147353B (en) | MongoDB data migration monitoring method and device based on log analysis | |
CN112882956B (en) | Method and device for automatically generating full-scene automatic test cases through data combination calculation, storage medium and electronic equipment | |
CN114547077A (en) | Intelligent processing system and method for basic government affair form data | |
CN113779261A (en) | Knowledge graph quality evaluation method and device, computer equipment and storage medium | |
Cheah et al. | Provenance quality assessment methodology and framework | |
US8548980B2 (en) | Accelerating queries based on exact knowledge of specific rows satisfying local conditions | |
Zhao et al. | Predicting missing provenance using semantic associations in reservoir engineering | |
CN106991116A (en) | The optimization method and device of database executive plan | |
US20240070154A1 (en) | Dynamic data aggregation | |
CN114153881A (en) | High-recall cause and effect discovery method, device and equipment based on time sequence operation and maintenance big data | |
CN117786182B (en) | Business data storage system and method based on ERP system | |
CN113836087B (en) | Big data layer storage method based on file mode | |
Liu et al. | Few-shot Knowledge Graph Relational Reasoning via Subgraph Adaptation |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |