CN102929979A - Method and device for locating page memory space - Google Patents

Method and device for locating page memory space Download PDF

Info

Publication number
CN102929979A
CN102929979A CN2012103951245A CN201210395124A CN102929979A CN 102929979 A CN102929979 A CN 102929979A CN 2012103951245 A CN2012103951245 A CN 2012103951245A CN 201210395124 A CN201210395124 A CN 201210395124A CN 102929979 A CN102929979 A CN 102929979A
Authority
CN
China
Prior art keywords
free space
tree structure
binary tree
node
space view
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.)
Pending
Application number
CN2012103951245A
Other languages
Chinese (zh)
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 CN2012103951245A priority Critical patent/CN102929979A/en
Publication of CN102929979A publication Critical patent/CN102929979A/en
Pending legal-status Critical Current

Links

Images

Abstract

The embodiment of the invention discloses a method and a device for locating a page memory space, which relates to the field of a database, and solves the problems that the query times of the page memory space is multiple and the query is still failed after the query for multiple times, and improves the query efficiency and the system stability of the page memory space. The method is used for locating the page memory space of a binary tree structure formed by a free space view, and the method specifically comprises the steps of clearing and updating all nodes of the binary tree structure corresponding to the free space view within a scheduled time period; traversing the binary tree structure after being cleared and updated from a root node outside the scheduled time period until a leaf node meeting the needed space which is larger than or equal to a field to be added is found. The method and the device are used for searching the memory space for storing the data.

Description

A kind of method and apparatus of locating page interior storage space
Technical field
The present invention relates to database field, relate in particular to a kind of method and apparatus of locating page interior storage space.
Background technology
Data storage is one of key property of database.When target data will be saved in database, how fast whether there are enough spaces to store data in the page or leaf of location and just become very important.Whether free space view (Free Space Map is called for short FSM) is to have enough spaces to come the storing one row data in the page or leaf in location (Page) fast.
The prior art scheme is to adopt object-relational DBMS (Relationship Data Base Management System is called for short RDBMS), has wherein used the FSM structure and has realized searching.The size of FSM is the speed of impact search free page directly, so the I that maintenance FSM tries one's best is to improve to greatest extent search speed.In order to reach the purpose of fast search, the structure of FSM is not simple linear array sort, but adopts the storage organization of binary tree.In binary tree structure, leaf node is stored the value of the quantity of free space in each page, the maximal value of leaf node in the root node storage subtree.Suppose to have 2 pages or leaves, the free space number of Page0 is that the free space number of 10, Page1 is 5.Then the number of left and right sides child node is 10 and 5 accordingly, and the number of its father node is 10.The concrete flow process of searching is: (1) is configured to binary tree structure with free space, the value of leaf node storage free space, and root node is stored the maximal value of free space in all subtree leaf nodes; (2) free space is searched from the root node of binary tree and is begun traversal, (wherein x is the size of data to be stored until find the leaf node of the n 〉=x that satisfies condition, it namely prepares to add to the size of the field to be added in the free space in essence,, n is the value of each node of binary tree); (3) if when running into left and right sides child node and all satisfying condition then arbitrarily select a node to continue to search.Be 9 such as the free space size that will search, the size of left and right sides child node is respectively 10 and 12, and the two optional one gets final product.
State in realization in the process of storage space in the page or leaf of search location, the inventor finds that there are the following problems at least in the prior art: when inquiring about the node that satisfies condition under current state, there is in the page or leaf the more and failed problem of inquiry still after the inquiry repeatedly of storage space querying number of times, and then cause the tree structure of FSM to recover after the system crash that also may occur meeting accident, thereby store space querying efficient and system stability in the impact page or leaf.
Summary of the invention
Embodiments of the invention provide a kind of method and apparatus of locating page interior storage space, can improve search efficiency and the system stability of page interior storage space.
For achieving the above object, embodiments of the invention adopt following technical scheme:
First aspect, a kind of method of locating page interior storage space is provided, be applied to storage space orientation in the page or leaf of the binary tree structure that the free space view consists of, within cycle predetermined time, all nodes in binary tree structure corresponding to described free space view cleaned and upgrade;
Outside described cycle predetermined time, the described binary tree structure through node cleaning and renewal is begun to travel through from root node, until find the leaf node that satisfies more than or equal to the required free space of field to be added.
In the possible implementation of the first of first aspect, described all nodes to binary tree structure corresponding to described free space view clean and renewal comprises:
Clean junk information and outdated information in the memory contents in all nodes in the described free space view, and upgrade the free space information of corresponding node.
In the possible implementation of the second of first aspect, described to through node cleaning and the described binary tree structure that upgrades begin to travel through from root node, comprising:
Generate the complete binary tree structure corresponding with described free space view;
Described complete binary tree structure is begun to travel through from root node.
In the third possible implementation of first aspect, the complete binary tree structure that described generation is corresponding with described free space view specifically comprises:
According to formula N=2 (pagefactor-3), calculate the number of leaf node, utilize the number of described leaf node to generate the complete binary tree structure corresponding with described free space view;
Pagesize=2 wherein Pagefactor, pagesize=Ph+Pd=2N+6N, wherein, pagesize is the size of page, and Ph is the size of top margin, and described Ph predefine is 2N, and Pd is the size of page data; Described page data is made of Pageview figure and free space view, Pd 〉=N*sizeof (pageid)+(2*N-1) * 1=6N-1 ≈ 6N wherein, wherein the shared byte-sized of sizeof (pageid) is 4, N*sizeof (pageid) is Pageview figure size, the size of described Pageview figure is 4N, (2*N-1) * 1 is free space view size, is 6N with the approximate value of Pd here.
In the 4th kind of possible implementation of first aspect, also comprise:
Generate new free space view;
The root node free space corresponding with the root node of the binary tree structure of described free space view of the binary tree structure of described new free space view compared, and the root node that free space is larger is as the root node of the common binary tree structure that consists of of binary tree structure of the binary tree structure of described new free space view and described free space view, and the root node of the root node of the binary tree structure of wherein said new free space view and the binary tree structure of described free space view is respectively two child nodes of described new root node.
In the 5th kind of possible implementation of first aspect, described method also comprises:
Add field in the free page of described free space view, upgrade the leaf node of the binary tree structure of described free space view corresponding to described free page, the address of wherein said free page is associated with the address of described leaf node.
In the 6th kind of possible implementation of first aspect, described method also comprises:
Upgrade to add at least one child node under the same father node in the binary tree structure of the described free space view after the field, judge the size of the remaining space that two child nodes under the described father node are indicated;
Upgrade the indicated remaining space of described father node according to the larger child node of remaining space.
Second aspect provides storage space orientation equipment in a kind of page, is applied to the interior storage of the page or leaf space orientation of the binary tree structure of free space view formation, comprising:
The node administration unit is used within cycle predetermined time all nodes to binary tree structure corresponding to described free space view and cleans and upgrade;
The traversal unit, be used for outside described cycle predetermined time, described binary tree structure corresponding to described free space view through node cleaning and renewal begun to travel through from root node, until find the leaf node that satisfies more than or equal to the required free space of field to be added.
In the possible implementation of the first of second aspect, described traversal unit comprises:
The node processing subelement, for junk information and the outdated information in the memory contents in all nodes that clean described free space view, and the free space information of renewal corresponding node.
In the possible implementation of the second of second aspect, described traversal unit also comprises:
The algorithm subelement is used for generating the complete binary tree structure corresponding with described free space view;
The traversal subelement is used for described complete binary tree structure is begun to travel through from root node.
In the third possible implementation of second aspect, described algorithm subelement specifically is used for:
According to formula N=2 (pagefactor-3), calculate the number of leaf node, utilize the number of described leaf node to generate the complete binary tree structure corresponding with described free space view;
Pagesize=2 wherein Pagefactor, pagesize=Ph+Pd=2N+6N, wherein, pagesize is the size of page, and Ph is top margin size, and described Ph predefine is 2N, and Pd is the size of page data; Described page data is made of Pageview figure and free space view, Pd 〉=N*sizeof (pageid)+(2*N-1) * 1=6N-1 ≈ 6N wherein, wherein the shared byte-sized of sizeof (pageid) is 4, N*sizeof (pageid) is Pageview figure size, described Pageview figure size is 4N, (2*N-1) * 1 is free space view size, is 6N with the approximate value of Pd here.
In the 4th kind of possible implementation of second aspect, also comprise:
Node view management unit is used for inserting new free space view; The root node free space corresponding with the root node of the binary tree structure of described free space view of the binary tree structure of described new free space view compared, and the root node that free space is larger is as the root node of the common binary tree structure that consists of of binary tree structure of the binary tree structure of described new free space view and described free space view, and the root node of the root node of the binary tree structure of wherein said new free space view and the binary tree structure of described free space view is respectively two child nodes of described new root node.
The 5th kind of possible implementation in second aspect, described node view management unit also is used for adding field in the free page of described free space view, upgrade the leaf node of the binary tree structure of described free space view corresponding to described free page, the address of wherein said free page is associated with the address of described leaf node.
In the 6th kind of possible implementation of second aspect, described node view management unit also be used for to upgrade adds at least one child node under the same father node of binary tree structure of the described free space view after the field, judges the size of the remaining space that two child nodes under the described father node are indicated; Upgrade the indicated remaining space of described father node according to the larger child node of remaining space.
The third aspect, storage space orientation equipment in a kind of page or leaf is provided, be applied to the interior storage of the page or leaf space orientation of the binary tree structure of free space view formation, comprise: at least one processor, storer, communication interface and bus, described at least one processor, storer are connected the bus connection and finish mutual communication with communication interface, wherein said storer is used for storing the binary tree structure that described free space view consists of;
Described processor is used within cycle predetermined time all nodes to binary tree structure corresponding to described free space view and cleans and upgrade; Outside described cycle predetermined time, the described binary tree structure through node cleaning and renewal is begun to travel through from root node, until find the leaf node that satisfies more than or equal to the required free space of field to be added.
In the possible implementation of the first of the third aspect, described preparation implement body is used for generating the complete binary tree structure corresponding with described free space view; Described complete binary tree structure is begun to travel through from root node.
In the possible implementation of the second of the third aspect, described processor, also for junk information and outdated information in the memory contents in all nodes that clean described free space view, and the free space information of renewal corresponding node.
In the third possible implementation of the third aspect, described preparation implement body is used for according to formula N=2 (pagefactor-3), calculate the number of leaf node, utilize the number of described leaf node to generate the complete binary tree structure corresponding with described free space view;
Pagesize=2 wherein Pagefactor, pagesize=Ph+Pd=2N+6N, wherein, pagesize is the size of page, and Ph is top margin size, and described Ph predefine is 2N, and Pd is the size of page data; Described page data is made of Pageview figure and free space view, Pd 〉=N*sizeof (pageid)+(2*N-1) * 1=6N-1 ≈ 6N wherein, wherein the shared byte-sized of sizeof (pageid) is 4, N*sizeof (pageid) is Pageview figure size, described Pageview figure size is 4N, (2*N-1) * 1 is free space view size, is 6N with the approximate value of Pd here.
In the 4th kind of possible implementation of the third aspect, described processor also is used for generating new free space view; The root node free space corresponding with the root node of the binary tree structure of described free space view of the binary tree structure of described new free space view compared, and the root node that free space is larger is as the root node of the common binary tree structure that consists of of binary tree structure of the binary tree structure of described new free space view and described free space view, and the root node of the root node of the binary tree structure of wherein said new free space view and the binary tree structure of described free space view is respectively two child nodes of described new root node.
In the 5th kind of possible implementation of the third aspect, described processor also is used for adding field in the free page of described free space view, upgrade the leaf node of the binary tree structure of described free space view corresponding to described free page, the address of wherein said free page is associated with the address of described leaf node.
In the 6th kind of possible implementation of the third aspect, described processor also be used for to upgrade adds at least one child node under the same father node of binary tree structure of the described free space view after the field, judges the size of the remaining space that two child nodes under the described father node are indicated; Upgrade the indicated remaining space of described father node according to the larger child node of remaining space.
The method and apparatus of storage space in the location page or leaf that embodiments of the invention provide, owing to increased leaf node free space quantity update mechanism, within cycle predetermined time, the node in the described free space view is cleaned and upgrade, can improve search efficiency and the system stability of page interior storage space.
Description of drawings
In order to be illustrated more clearly in the embodiment of the invention or technical scheme of the prior art, the below will do to introduce simply to the accompanying drawing of required use in embodiment or the description of the Prior Art, apparently, accompanying drawing in the following describes only is some embodiments of the present invention, for those of ordinary skills, under the prerequisite of not paying creative work, can also obtain according to these accompanying drawings other accompanying drawing.
A kind of method flow synoptic diagram of locating page interior storage space that Fig. 1 provides for embodiments of the invention;
A kind of method flow synoptic diagram of locating page interior storage space that Fig. 2 provides for another embodiment of the present invention;
A kind of page structure synoptic diagram that Fig. 3 provides for the embodiment of the invention;
A kind of complete binary tree structure synoptic diagram that Fig. 4 provides for embodiments of the invention;
Fig. 5 a kind ofly locates the structural representation that storage space-wise in the page or leaf inserts binary tree behind the new free space view for what embodiments of the invention provided;
The interior storage of a kind of page or leaf space orientation device structure synoptic diagram that Fig. 6 provides for embodiments of the invention;
The interior storage of the another kind of page or leaf space orientation device structure synoptic diagram that Fig. 7 provides for embodiments of the invention;
Storage space orientation device structure synoptic diagram in a kind of page or leaf that Fig. 8 another embodiment of the present invention provides.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the invention, the technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that obtains under the creative work prerequisite.
The free space view that adopts in the embodiment of the invention is to consist of binary tree structure by free space in the page or leaf, and adopts the value of free space in page or leaf corresponding to the leaf node storage of this binary tree structure.
Embodiments of the invention provide a kind of method of locating page interior storage space, are applied to the interior storage of the page or leaf space orientation of the binary tree structure of free space view formation, with reference to shown in Figure 1, may further comprise the steps:
101, the interior storage of page or leaf space orientation equipment cleans all nodes in binary tree structure corresponding to free space view within cycle predetermined time and upgrades.
Concrete, all nodes of binary tree structure corresponding to free space view are cleaned and be updated to junk information and the outdated information in the memory contents in all nodes in the cleaning free space view, and upgrade the free space information of corresponding node.
102, outside cycle predetermined time, the binary tree structure through node cleaning and renewal is begun to travel through from root node, until find the leaf node that satisfies more than or equal to the required free space of field to be added.
Further concrete, step 102 also comprises: generate the complete binary tree structure corresponding with the free space view, complete binary tree structure is begun to travel through from root node.
The method of storage space in the location page or leaf that embodiments of the invention provide, owing to increased leaf node free space quantity update mechanism, within cycle predetermined time, the node in the free space view is cleaned and upgrade, can improve search efficiency and the system stability of page interior storage space.
Embodiments of the invention provide a kind of method of locating page interior storage space, are applied to the interior storage of the page or leaf space orientation of the binary tree structure of free space view formation, with reference to shown in Figure 2, may further comprise the steps:
201, storage space orientation equipment cleans all nodes of binary tree structure corresponding to free space view within cycle predetermined time and upgrades in the page or leaf.
202, outside cycle predetermined time, the binary tree structure through node cleaning and renewal is begun to travel through from root node, until find the leaf node that satisfies more than or equal to the required free space of field to be added.
Concrete, all nodes of binary tree structure corresponding to free space view are cleaned and be updated to junk information and the outdated information in the memory contents in all nodes in the cleaning free space view, and upgrade the free space information of corresponding node.
Need to prove, for the free space view, data to be stored are to add in the free page in the free space view with the form of field to go, therefore field to be added is exactly in fact the size of data to be stored, or data sectional to be stored (burst) size of each minimum unit afterwards.
Further concrete, step 202 also comprises: generate the complete binary tree structure corresponding with the free space view; Complete binary tree structure is begun to travel through from root node.
With reference to Fig. 3, take the paragraph header page or leaf as example, a paragraph header page or leaf comprises following structure: top margin (PAGE HEAD), paragraph header (SEGMENT HEAD), data segment header (DATA SEG HEAD), free space viewstate (FSM POSITION), free space view head (FSM HEAD, leaf node Pageview figure (LEAF NODE PAGE MAP) and free space Views tree (FSM TREE); Generating the complete binary tree structure corresponding with the free space view is specially according to formula N=2 (pagefactot-3), calculate the number of leaf node, utilize the number of this leaf node to generate the complete binary tree structure corresponding with the free space view; Pagesize=2 wherein Pagefactor, pagesize=Ph+Pd=2N+6N, wherein, pagesize is the size of page, and Ph is top margin size, and this Ph predefine is 2N, and Pd is the page data size; Here page data is made of Pageview figure and free space view, Pd 〉=N*sizeof (pageid)+(2*N-1) * 1=6N-1 ≈ 6N wherein, wherein pageid is unsigned int variable (unsigned int), is used for the address of record page.Sizeof is a kind of operational character of c language, is used for calculating the length of the shared byte of variable.Because unsigned int type shared length in operating system is 4 bytes, so the shared byte-sized of sizeof (pageid) is 4, N*sizeof (pageid) is Pageview figure size, this Pageview figure size is 4N, (2*N-1) * 1 is free space view size, is 6N with the approximate value of Pd here.
Here because the number of leaf node is N=2 (pagefactor-3), so the binary tree structure that provides of the embodiments of the invention search efficiency of storage space in the page or leaf that can be regarded as the complete such Effective Raise of binary tree structure.
203, generate new free space view.
204, the root node free space corresponding with the root node of the binary tree structure of free space view with the binary tree structure of new free space view compares, and the root node that free space is larger is as the root node of the common binary tree structure that consists of of binary tree structure of the binary tree structure of new free space view and free space view, and wherein the root node of the binary tree structure of the root node of the binary tree structure of new free space view and free space view is respectively two child nodes of new root node.
Concrete with reference to shown in Fig. 3,5, step 203 and 204 embodiment are namely inserted the binary tree structure of the root node of binary tree structure of a root node and current free space view new idle view arranged side by side in the binary tree structure of current free space view by leaf node Pageview figure (LEAF NODE PAGE MAP), the FSM structure can expand to secondary or multistage by one-level like this, can constantly satisfy the free-space administration requirement that increases, management flexibly.
205, add field in the free page of free space view, upgrade the leaf node of the binary tree structure of free space view corresponding to free page, wherein the address of this free page is associated with the address of leaf node.
With reference to shown in Figure 4, the address that will comprise the leaf node (page0...page7) in address (pageid) and the free space view of page or leaf of residual memory space is carried out related, simultaneously with reference to shown in Figure 3, add field at the page or leaf that comprises residual memory space and in the child node of free space Views tree (FSM TREE), upgrade the remaining space value that leaf node corresponding to page address that comprise residual memory space indicated by leaf node Pageview figure (LEAF NODE PAGE MAP) later on.
Further the method also comprises:
206, upgrade to add at least one child node under the same father node in the binary tree structure of the free space view after the field, judge the size of the remaining space that two child nodes under this father node are indicated.
207, upgrade the indicated remaining space of father node according to the larger child node of remaining space.
The method of storage space in the location page or leaf that embodiments of the invention provide, owing to increased leaf node free space quantity update mechanism, within cycle predetermined time, the node in the free space view is cleaned and upgrade, can improve probability and the system stability of the successful inquiring of page interior storage space; Simultaneously owing to travel through an inquiry that realizes storage space in the page or leaf by complete binary tree structure, Effective Raise the efficient of inquiry; In addition, realize the dynamic growth of free memory by the multiple management of inserting new free space view realization free space view.
Embodiments of the invention provide storage space orientation equipment 3 in a kind of page or leaf, as shown in Figure 6, comprising: node administration unit 31 and traversal unit 32, wherein:
Node administration unit 31 is used within cycle predetermined time all nodes to binary tree structure corresponding to free space view and cleans and upgrade;
Traversal unit 32, be used for outside cycle predetermined time, binary tree structure corresponding to free space view through node cleaning and renewal begun to travel through from root node, until find the leaf node that satisfies more than or equal to the required free space of field to be added.
Concrete, with reference to shown in Figure 3, traversal unit 32 also comprises: algorithm subelement 321, traversal subelement 322 and node processing subelement 323, wherein:
Node processing subelement 323, for junk information and the outdated information in the memory contents in all nodes of cleaning free space view, and the free space information of renewal corresponding node.
Algorithm subelement 321 is used for generating the complete binary tree structure corresponding with the free space view.
Traversal subelement 322 is used for complete binary tree structure is begun to travel through from root node.
Storage space orientation equipment in the page or leaf that embodiments of the invention provide, owing to increased leaf node free space quantity update mechanism, can within cycle predetermined time, the node in the free space view be cleaned and upgrade, can improve search efficiency and the system stability of page interior storage space.
Embodiments of the invention provide storage space orientation equipment 3 in a kind of page or leaf, as shown in Figure 7, comprising: node administration unit 31 and traversal unit 32, wherein:
Node administration unit 31 is used within cycle predetermined time all nodes to binary tree structure corresponding to free space view and cleans and upgrade.
Traversal unit 32, be used for outside cycle predetermined time, binary tree structure corresponding to free space view through node cleaning and renewal begun to travel through from root node, until find the leaf node that satisfies more than or equal to the required free space of field to be added.
Concrete, with reference to shown in Figure 3, traversal unit 32 also comprises: algorithm subelement 321, traversal subelement 322 and node processing subelement 323, wherein:
Node processing subelement 323, for junk information and the outdated information in the memory contents in all nodes of cleaning free space view, and the free space information of renewal corresponding node.
Algorithm subelement 321 is used for generating the complete binary tree structure corresponding with the free space view.
Be specially: according to formula N=2 (pagefactor-3), calculate the number of leaf node, utilize the number of this leaf node to generate the complete binary tree structure corresponding with the free space view; Pagesize=2 wherein Pagefactor, pagesize=Ph+Pd=2N+6N, wherein, the size of pagesize page or leaf internal memory, Ph is top margin size, and this Ph predefine is 2N, Pd is the size of page data; This page data is made of Pageview figure and free space view, Pd 〉=N*sizeof (pageid)+(2*N-1) * 1=6N-1 ≈ 6N wherein, and wherein pageid is unsigned int variable (unsigned int), is used for the address of record page.Sizeof is a kind of operational character of c language, is used for calculating the length of the shared byte of variable.Because unsigned int type shared length in operating system is 4 bytes, so the shared byte-sized of sizeof (pageid) is 4, N*sizeof (pageid) is Pageview figure size, this Pageview figure size is 4N, (2*N-1) * 1 is free space view size, is 6N with the approximate value of Pd here.
Traversal subelement 322 is used for complete binary tree structure is begun to travel through from root node.
Node view management unit 33 is used for generating new free space view; The root node free space corresponding with the root node of the binary tree structure of free space view of the binary tree structure of new free space view compared, and the root node that free space is larger is as the root node of the common binary tree structure that consists of of binary tree structure of the binary tree structure of new free space view and free space view, and wherein the root node of the binary tree structure of the root node of the binary tree structure of new free space view and free space view is respectively two child nodes of new root node.
Simultaneously, node view management unit 33 also is used for adding field in the free page of free space view, upgrades the leaf node of the binary tree structure of free space view corresponding to free page, and wherein the address of free page is associated with the address of leaf node.Concrete with reference to shown in Figure 7.
Further node view management unit 33 also is used for managing each node of this binary tree by leaf node Pageview figure (LEAF NODE PAGE MAP).At least one child node under the same father node in the binary tree structure of the free space view after the renewal interpolation field, the size of the remaining space that two child nodes under the judgement father node are indicated; Upgrade the indicated remaining space of father node according to the child node that remaining space is larger.
Storage space orientation equipment in the page or leaf that embodiments of the invention provide, owing to increased leaf node free space quantity update mechanism, can within cycle predetermined time, the node in the free space view be cleaned and upgrade, can improve probability and the system stability of the successful inquiring of page interior storage space; Simultaneously owing to travel through an inquiry that realizes storage space in the page or leaf by complete binary tree structure, Effective Raise the efficient of inquiry; In addition, realize the dynamic growth of free memory by the multiple management of inserting new free space view realization free space view.
With reference to Figure 8 shows that embodiments of the invention provide the structural representation of storage space orientation equipment in a kind of page or leaf, as shown in Figure 8, the equipment of present embodiment comprises: at least one storer 41, processor 42, communication interface 43 and bus 44, at least one processor 42, storer 41 is connected by bus 44 connections and is finished mutual communication with communication interface, this bus 44 can be industry standard architecture (Industry Standard Architecture, referred to as ISA) bus, peripheral component interconnect (Peripheral Component, referred to as PCI) bus or extended industry-standard architecture (Extended Industry Standard Architecture is referred to as EISA) bus etc.This bus 44 can be divided into address bus, data bus, control bus etc.For ease of expression, only represent with a thick line among Fig. 8, but do not represent only to have the bus of a bus or a type.Wherein:
Storer 41 is used for the stores executable programs code, and this program code comprises computer-managed instruction.Storer 41 may comprise the high-speed RAM storer, also may also comprise nonvolatile memory (non-volatile memory), and for example at least one magnetic disk memory specifically is used for the binary tree structure that storage free space view consists of.
Processor 42 may be a central processing unit (Central Processing Unit, referred to as CPU), or specific integrated circuit (Application Specific Integrated Circuit, referred to as ASIC), or be configured to implement one or more integrated circuit of the embodiment of the invention.
Communication interface 43 is mainly used in realizing the communication between the device of present embodiment.
Processor 42 moves the program corresponding with executable program code by the executable program code of storage in the read memory 41, to be used for:
Within cycle predetermined time, all nodes of binary tree structure corresponding to free space view are cleaned and upgrade; Outside cycle predetermined time, the binary tree structure through node cleaning and renewal is begun to travel through from root node, until find the leaf node that satisfies more than or equal to the required free space of field to be added.
Storage space orientation equipment in the page or leaf that embodiments of the invention provide, owing to increased leaf node free space quantity update mechanism, can within cycle predetermined time, the node in the free space view be cleaned and upgrade, can improve search efficiency and the system stability of page interior storage space.
It should be noted that above-mentioned processor 42 also is used for generating the complete binary tree structure corresponding with the free space view except having above-mentioned functions; Complete binary tree structure is begun to travel through from root node.Generating the complete binary tree structure corresponding with the free space view is specially according to formula N=2 (pagefactor-3), calculate the number of leaf node, utilize the number of this leaf node to generate the complete binary tree structure corresponding with the free space view; Wherein the leaf node number is N:N=2 (pagefactor-3), pagesize=2 wherein PagefactorPagesize=Ph+Pd=2N+6N, wherein pagesize is the size of page, Ph is top margin size, and Ph predefine is 2N, and Pd is the size of page data, this page data is made of Pageview figure and free space view, Pd 〉=N*sizeof (pageid)+(2*N-1) * 1=6N-1 ≈ 6N wherein, wherein pageid is unsigned int variable (unsigned int), is used for the address of record page.Sizeof is a kind of operational character of c language, is used for calculating the length of the shared byte of variable.Because unsigned int type shared length in operating system is 4 bytes, so the shared byte-sized of sizeof (pageid) is 4, N*sizeof (pageid) is Pageview figure size, this Pageview figure size is 4N, (2*N-1) * 1 is free space view size, is 6N with the approximate value of Pd here.
Simultaneously, processor 42 also is used for generating new free space view; The root node free space corresponding with the root node of the binary tree structure of free space view of the binary tree structure of new free space view compared, and the root node that this free space is larger is as the root node of the common binary tree structure that consists of of binary tree structure of the binary tree structure of new free space view and free space view, and wherein the root node of the binary tree structure of the root node of the binary tree structure of new free space view and free space view is respectively two child nodes of new root node.
Concrete, processor 42 also is used for adding field in the free page of free space view, upgrades the leaf node of the binary tree structure of free space view corresponding to free page, and wherein the address of this free page is associated with the address of leaf node.
Processor 42 also is used for managing each node of binary tree by leaf node Pageview figure (LEAF NODE PAGE MAP).By at least one child node under the same father node in the binary tree structure of the free space view after the renewal interpolation field, the size of the remaining space that two child nodes under the judgement father node are indicated; Upgrade the indicated remaining space of father node according to the child node that remaining space is larger.
Storage space orientation equipment in the page or leaf that embodiments of the invention provide, owing to increased leaf node free space quantity update mechanism, can within cycle predetermined time, the node in the free space view be cleaned and upgrade, can improve probability and the system stability of the successful inquiring of page interior storage space; Simultaneously owing to travel through an inquiry that realizes storage space in the page or leaf by complete binary tree structure, Effective Raise the efficient of inquiry; In addition, realize the dynamic growth of free memory by the multiple management of inserting new free space view realization free space view.
One of ordinary skill in the art will appreciate that: all or part of step that realizes said method embodiment can be finished by the relevant hardware of programmed instruction, aforesaid program can be stored in the computer read/write memory medium, this program is carried out the step that comprises said method embodiment when carrying out; And aforesaid storage medium comprises: the various media that can be program code stored such as ROM, RAM, magnetic disc or CD.
The above; be the specific embodiment of the present invention only, but protection scope of the present invention is not limited to this, anyly is familiar with those skilled in the art in the technical scope that the present invention discloses; can expect easily changing or replacing, all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection domain of described claim.

Claims (21)

1. a method of locating page interior storage space is applied to the interior storage of the page or leaf space orientation of the binary tree structure of free space view formation, it is characterized in that, comprising:
Within cycle predetermined time, all nodes in binary tree structure corresponding to described free space view are cleaned and upgrade;
Outside described cycle predetermined time, the described binary tree structure through node cleaning and renewal is begun to travel through from root node, until find the leaf node that satisfies more than or equal to the required free space of field to be added.
2. method according to claim 1 is characterized in that, described all nodes in binary tree structure corresponding to described free space view are cleaned and upgrade, and comprising:
Clean junk information and outdated information in the memory contents in all nodes in the described free space view, and upgrade the free space information of corresponding node.
3. method according to claim 1 is characterized in that, described described binary tree structure to the cleaning of process node and renewal begins to travel through from root node, comprising:
Generate the complete binary tree structure corresponding with described free space view;
Described complete binary tree structure is begun to travel through from root node.
4. method according to claim 3 is characterized in that, the complete binary tree structure that described generation is corresponding with described free space view specifically comprises:
According to formula N=2 (pagefactor-3), calculate the number of leaf node, utilize the number of described leaf node to generate the complete binary tree structure corresponding with described free space view;
Pagesize=2 wherein Pagefactor, pagesize=Ph+Pd=2N+6N, wherein, pagesize is the size of page, and Ph is the size of top margin, and described Ph predefine is 2N, and Pd is the size of page data; Described page data is made of Pageview figure and free space view, Pd 〉=N*sizeof (pageid)+(2*N-1) * 1=6N-1 ≈ 6N wherein, wherein the shared byte-sized of sizeof (pageid) is 4, N*sizeof (pageid) is Pageview figure size, the size of described Pageview figure is 4N, (2*N-1) * 1 is free space view size, is 6N with the approximate value of Pd here.
5. described either method is characterized in that according to claim 1~4, also comprises:
Generate new free space view;
The root node free space corresponding with the root node of the binary tree structure of described free space view of the binary tree structure of described new free space view compared, and the root node that free space is larger is as the root node of the common binary tree structure that consists of of binary tree structure of the binary tree structure of described new free space view and described free space view, and the root node of the root node of the binary tree structure of wherein said new free space view and the binary tree structure of described free space view is respectively two child nodes of described new root node.
6. method according to claim 5 is characterized in that, described method also comprises:
Add field in the free page of described free space view, upgrade the leaf node of the binary tree structure of described free space view corresponding to described free page, the address of wherein said free page is associated with the address of described leaf node.
7. method according to claim 6 is characterized in that, described method also comprises:
Upgrade to add at least one child node under the same father node in the binary tree structure of the described free space view after the field, judge the size of the remaining space that two child nodes under the described father node are indicated;
Upgrade the indicated remaining space of described father node according to the larger child node of remaining space.
8. store space orientation equipment in a page or leaf, be applied to the interior storage of the page or leaf space orientation of the binary tree structure of free space view formation, it is characterized in that, comprising:
The node administration unit is used within cycle predetermined time all nodes to binary tree structure corresponding to described free space view and cleans and upgrade;
The traversal unit was used for outside described cycle predetermined time, the described binary tree structure through node cleaning and renewal was begun to travel through from root node, until find the leaf node that satisfies more than or equal to the required free space of field to be added.
9. equipment according to claim 8 is characterized in that, described traversal unit comprises:
The node processing subelement, for junk information and the outdated information in the memory contents in all nodes that clean described free space view, and the free space information of renewal corresponding node.
10. equipment according to claim 8 is characterized in that, described traversal unit also comprises:
The algorithm subelement is used for generating the complete binary tree structure corresponding with described free space view;
The traversal subelement is used for described complete binary tree structure is begun to travel through from root node.
11. equipment according to claim 10 is characterized in that, described algorithm subelement specifically is used for according to formula N=2 (pagefactor-3), calculate the number of leaf node, utilize the number of described leaf node to generate the complete binary tree structure corresponding with described free space view;
Pagesize=2 wherein Pagefactor, pagesize=Ph+Pd=2N+6N, wherein, pagesize is the size of page, and Ph is top margin size, and described Ph predefine is 2N, and Pd is the size of page data; Described page data is made of Pageview figure and free space view, Pd 〉=N*sizeof (pageid)+(2*N-1) * 1=6N-1 ≈ 6N wherein, wherein the shared byte-sized of sizeof (pageid) is 4, N*sizeof (pageid) is Pageview figure size, described Pageview figure size is 4N, (2*N-1) * 1 is free space view size, is 6N with the approximate value of Pd here.
12. described arbitrary equipment is characterized in that according to claim 8~11, described equipment also comprises:
Node view management unit is used for generating new free space view; The root node free space corresponding with the root node of the binary tree structure of described free space view of the binary tree structure of described new free space view compared, and the root node that free space is larger is as the root node of the common binary tree structure that consists of of binary tree structure of the binary tree structure of described new free space view and described free space view, and the root node of the root node of the binary tree structure of wherein said new free space view and the binary tree structure of described free space view is respectively two child nodes of described new root node.
13. equipment according to claim 12, it is characterized in that, described node view management unit also is used for adding field in the free page of described free space view, upgrade the leaf node of the binary tree structure of described free space view corresponding to described free page, the address of wherein said free page is associated with the address of described leaf node.
14. equipment according to claim 13, it is characterized in that, described node view management unit also be used for to upgrade adds at least one child node under the same father node of binary tree structure of the described free space view after the field, judges the size of the remaining space that two child nodes under the described father node are indicated; Upgrade the indicated remaining space of described father node according to the larger child node of remaining space.
15. storage space orientation equipment in the page or leaf, be applied to the interior storage of the page or leaf space orientation of the binary tree structure of free space view formation, it is characterized in that, comprise: at least one processor, storer, communication interface and bus, described at least one processor, storer are connected the bus connection and finish mutual communication with communication interface, wherein said storer is used for storing the binary tree structure that described free space view consists of;
Described processor is used within cycle predetermined time all nodes to binary tree structure corresponding to described free space view and cleans and upgrade; Outside described cycle predetermined time, the described binary tree structure through node cleaning and renewal is begun to travel through from root node, until find the leaf node that satisfies more than or equal to the required free space of field to be added.
16. equipment according to claim 15 is characterized in that, described processor is also for junk information and outdated information in the memory contents in all nodes that clean described free space view, and the free space information of renewal corresponding node.
17. equipment according to claim 15 is characterized in that, described preparation implement body is used for generating the complete binary tree structure corresponding with described free space view; Described complete binary tree structure is begun to travel through from root node.
18. equipment according to claim 17 is characterized in that, described preparation implement body is used for according to formula N=2 (pagefactor-3), calculate the number of leaf node, utilize the number of described leaf node to generate the complete binary tree structure corresponding with described free space view;
Pagesize=2 wherein Pagefactor, pagesize=Ph+Pd=2N+6N, wherein, pagesize is the size of page, and Ph is top margin size, and described Ph predefine is 2N, and Pd is the size of page data; Described page data is made of Pageview figure and free space view, Pd 〉=N*sizeof (pageid)+(2*N-1) * 1=6N-1 ≈ 6N wherein, wherein the shared byte-sized of sizeof (pageid) is 4, N*sizeof (pageid) is Pageview figure size, described Pageview figure size is 4N, (2*N-1) * 1 is free space view size, is 6N with the approximate value of Pd here.
19. described arbitrary equipment is characterized in that according to claim 15~18, described processor also is used for generating new free space view; The root node free space corresponding with the root node of the binary tree structure of described free space view of the binary tree structure of described new free space view compared, and the root node that free space is larger is as the root node of the common binary tree structure that consists of of binary tree structure of the binary tree structure of described new free space view and described free space view, and the root node of the root node of the binary tree structure of wherein said new free space view and the binary tree structure of described free space view is respectively two child nodes of described new root node.
20. equipment according to claim 19, it is characterized in that, described processor also is used for adding field in the free page of described free space view, upgrade the leaf node of the binary tree structure of described free space view corresponding to described free page, the address of wherein said free page is associated with the address of described leaf node.
21. equipment according to claim 20, it is characterized in that, described processor also be used for to upgrade adds at least one child node under the same father node of binary tree structure of the described free space view after the field, judges the size of the remaining space that two child nodes under the described father node are indicated; Upgrade the indicated remaining space of described father node according to the larger child node of remaining space.
CN2012103951245A 2012-10-17 2012-10-17 Method and device for locating page memory space Pending CN102929979A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2012103951245A CN102929979A (en) 2012-10-17 2012-10-17 Method and device for locating page memory space

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2012103951245A CN102929979A (en) 2012-10-17 2012-10-17 Method and device for locating page memory space

Publications (1)

Publication Number Publication Date
CN102929979A true CN102929979A (en) 2013-02-13

Family

ID=47644777

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2012103951245A Pending CN102929979A (en) 2012-10-17 2012-10-17 Method and device for locating page memory space

Country Status (1)

Country Link
CN (1) CN102929979A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111008195A (en) * 2019-10-31 2020-04-14 苏州浪潮智能科技有限公司 Database free space management method, system, terminal and storage medium
US11086836B2 (en) * 2019-07-24 2021-08-10 International Business Machines Corporation Index leaf page splits avoidance or reduction
CN113407111A (en) * 2020-03-17 2021-09-17 慧荣科技股份有限公司 Flash memory controller, method of flash memory controller and memory device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1143220A (en) * 1994-09-19 1997-02-19 西门子公司 Memory management system of computer system
CN101030165A (en) * 2006-03-02 2007-09-05 腾讯科技(深圳)有限公司 Magnetic disk space management and managing system
CN101315628A (en) * 2007-06-01 2008-12-03 华为技术有限公司 Internal memory database system and method and device for implementing internal memory data base

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1143220A (en) * 1994-09-19 1997-02-19 西门子公司 Memory management system of computer system
CN101030165A (en) * 2006-03-02 2007-09-05 腾讯科技(深圳)有限公司 Magnetic disk space management and managing system
CN101315628A (en) * 2007-06-01 2008-12-03 华为技术有限公司 Internal memory database system and method and device for implementing internal memory data base

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11086836B2 (en) * 2019-07-24 2021-08-10 International Business Machines Corporation Index leaf page splits avoidance or reduction
CN111008195A (en) * 2019-10-31 2020-04-14 苏州浪潮智能科技有限公司 Database free space management method, system, terminal and storage medium
CN113407111A (en) * 2020-03-17 2021-09-17 慧荣科技股份有限公司 Flash memory controller, method of flash memory controller and memory device
CN113407111B (en) * 2020-03-17 2024-03-29 慧荣科技股份有限公司 Flash memory controller, method of flash memory controller and memory device

Similar Documents

Publication Publication Date Title
CN101577662B (en) Method and device for matching longest prefix based on tree form data structure
CN113196259B (en) Key value storage using logging in selective data storage formats
WO2017071509A1 (en) File system directory tree repair method and device
CN103164490B (en) A kind of efficient storage implementation method of not fixed-length data and device
CN110147204B (en) Metadata disk-dropping method, device and system and computer-readable storage medium
CN113196260A (en) Key value storage tree capable of selectively using key portions
WO2004081711A2 (en) System and method for storing and accessing data in an interlocking trees datastore
CN101512526A (en) Dynamic fragment mapping
CN105320775A (en) Data access method and apparatus
CN103729303A (en) Data writing and data reading methods of Flash
CN102467521A (en) Easily-extensible multi-level classification search method and system
CN104615594B (en) A kind of data-updating method and device
CN102402602A (en) B+ tree indexing method and device of real-time database
CN102567415B (en) Control method and device of database
CN102929979A (en) Method and device for locating page memory space
CN104657387A (en) Data query method and device
CN103914483A (en) File storage method and device and file reading method and device
CN103473298A (en) Data archiving method and device and storage system
CN105138281A (en) Physical disk sharing method and apparatus
CN104346444A (en) Optimum site selection method based on road network reverse spatial keyword query
CN103092886B (en) A kind of implementation method of data query operation, Apparatus and system
KR20170065374A (en) Method for Hash collision detection that is based on the sorting unit of the bucket
CN104424222A (en) Database indexing method and device
CN102841894A (en) Data storage method of file allocation table
CN102682112B (en) Storage method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C12 Rejection of a patent application after its publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20130213