CN-121979881-A - Data page management method, electronic equipment and computer program product
Abstract
The embodiment of the application is applicable to the technical field of storage and provides a data page management method, electronic equipment and a computer program product, wherein the method comprises the steps of determining transaction information corresponding to a transaction request under the condition of acquiring the transaction request; the embodiment of the application can realize that O (1) time complexity searches continuous space with proper size, and can rapidly locate the use states of all data pages of different transaction versions through the bitmap corresponding to the transaction version, realize the management efficiency of the use states of the data pages among a plurality of transactions and realize efficient multi-version bitmap management.
Inventors
- DUAN HAO
- SUN YANG
- YANG CUIHUA
- CHEN WEITAO
- Chen Juelin
- LIN YANGPING
Assignees
- 杭州高新区(滨江)区块链与数据安全研究院
Dates
- Publication Date
- 20260505
- Application Date
- 20251224
Claims (10)
- 1. A data page management method, comprising: under the condition of acquiring a transaction request, determining transaction information corresponding to the transaction request, wherein the transaction information comprises a transaction version and a transaction state; The hash index of the data page is obtained, and the index is used for recording continuous idle page intervals; processing the data page corresponding to the data page set mapping information based on the transaction state, and updating the hash index and the data page set mapping information corresponding to the transaction version, wherein the data page set mapping information is used for recording the data page set corresponding to the transaction version; based on the transaction version and the usage status of the data page, a bitmap of the data page is updated.
- 2. The method of claim 1, wherein the processing the data page corresponding to the data page set mapping information based on the transaction state and updating the hash index and the data page set mapping information corresponding to the transaction version comprises: determining the number of continuous data pages corresponding to the transaction request under the condition that the transaction state is the starting of a new transaction; Determining each continuous free page interval based on the hash index; determining a first target interval in each of the consecutive free page intervals based on the number of consecutive data pages; determining the first target interval as a new allocation page set of the transaction request; And updating the hash index and the data page set mapping information corresponding to the transaction version based on the first target interval.
- 3. The method of claim 2, wherein the hash index includes characteristic information of a consecutive free page interval, the characteristic information includes an interval size of the consecutive free page interval, a start page number set, the data page set mapping information includes new allocation page set information, and the updating the hash index and the data page set mapping information corresponding to the transaction version based on the first target interval includes: Deleting the characteristic information of the first target interval in the hash index; And recording the data page identification corresponding to the first target interval in the newly allocated page set information.
- 4. The method of claim 1, wherein the data page set mapping information includes page set information to be released, wherein the processing the data page corresponding to the data page set mapping information based on the transaction state and updating the hash index and the data page set mapping information corresponding to the transaction version comprises: determining data page set mapping information corresponding to the transaction version under the condition that the transaction state is the transaction end; Determining a page set to be released corresponding to the page set information to be released; and updating the hash index and the data page set mapping information corresponding to the transaction version based on the page set to be released.
- 5. The method of claim 4, wherein updating the hash index and the data page set mapping information corresponding to the transaction version based on the set of pages to be released comprises: Determining a second target interval based on the page set to be released and characteristic information of the second target interval; adding the characteristic information of the second target interval into the hash index; and deleting the page set information to be released.
- 6. The method of claim 5, wherein the determining a second target interval based on the set of pages to be released comprises: Obtaining interval boundary mapping information, wherein the interval boundary mapping information comprises a starting point, an ending point and an interval size of a continuous idle page interval; identifying a continuous free page interval adjacent to the set of pages to be released based on the boundary mapping information; Merging the set of pages to be released and the continuous idle page interval adjacent to the set of pages to be released under the condition that the continuous idle page interval adjacent to the set of pages to be released exists, so as to obtain a second target interval; and determining the page set to be released as a second target interval under the condition that no continuous idle page interval adjacent to the page set to be released exists.
- 7. The method of claim 3, wherein the transaction version is generated incrementally according to a generation time of the transaction request, the method further comprising: Determining a target transaction version in response to the received rollback instruction; performing the following atomic operations based on the target transaction version: determining a rollback version set that is greater than the target transaction version; Recovering new allocation data page sets recorded in the new allocation page set information corresponding to the rollback version set; The use state of the data page set to be released recorded in the information of each page set to be released corresponding to the rollback version set is reserved; and deleting the data page set mapping information corresponding to the rollback version set.
- 8. The method of claim 7, wherein the rollback instruction is generated when any of the transaction requests crashes, wherein the target transaction version is determined based on a most recently recorded checked-through bitmap, and wherein the method further comprises: and regenerating the hash index based on the bitmap corresponding to the target transaction version.
- 9. An electronic device comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, which when executed by the processor causes the electronic device to implement the method of any one of claims 1-8.
- 10. A computer program product comprising a computer program which, when run, causes the method of any one of claims 1-8 to be performed.
Description
Data page management method, electronic equipment and computer program product Technical Field The embodiment of the application belongs to the technical field of storage, and particularly relates to a data page management method, electronic equipment and a computer program product. Background In modern database and blockchain storage systems, data for tree structures is typically stored in Page-based memory units. With continuous writing, deleting and version switching of data, allocation and recycling management of pages become important links affecting system performance and consistency. The conventional free page management scheme mainly includes: (1) Chain table free page management (LINKED LIST FREE SPACE MANAGEMENT) typical application: FREE SPACE MAP (FSM) of PostgreSQL. The scheme tracks the use of page space by maintaining a free page linked list or tree linked list. The FSM records the residual space proportion of each data page, traverses the linked list structure from top to bottom when distributing pages, and re-hangs the pages into the free list when releasing the pages. However, the scheme is easy to generate lock competition in high concurrency and MVCC environment, and FSM needs to be reconstructed in full quantity after the system crashes, so that the recovery cost is high. (2) Interval Page management (Span-based FREE SPACE MANAGEMENT) typical application InnoDB storage Engine (MySQL). The storage engine divides the pages into Extent (intervals), each of which typically contains 64 pages. The system manages the idle interval through SEGMENT HEADER to realize batch distribution and recovery. However, the small transaction frequently causes interval splitting and merging, the interval metadata structure is complex, and reconstruction is still needed during crash recovery. (3) Non-versioned page management of blockchain state databases-typical applications: SQLite, levelDB, etc. embedded databases. The underlying storage of a blockchain system typically relies on designated storage engines, but these engines are not aware of "blockheight" or "state version". The old version page is only logically discarded after the state update and not immediately reclaimed. However, the scheme can not release the history pages in real time due to delayed recovery, has high risk of page multiplexing errors, needs full reconstruction state during version switching or rollback, and has extremely low performance. The existing idle page management method has the technical problems of serious lock competition, difficult state recovery, low page allocation efficiency and the like in a multi-version transaction environment. Disclosure of Invention In view of the above, embodiments of the present application provide a method, an electronic device, and a computer program product for efficient maintenance, fast recovery, and concurrent friendly management of multi-version page status. A first aspect of an embodiment of the present application provides a data page management method, including: under the condition of acquiring the transaction request, determining transaction information corresponding to the transaction request, wherein the transaction information comprises a transaction version and a transaction state; the hash index of the data page is obtained, and the index is used for recording continuous idle page intervals; processing the data page corresponding to the data page set mapping information based on the transaction state, and updating the hash index and the data page set mapping information corresponding to the transaction version; Based on the transaction version and the usage status of the data page, the bitmap of the data page is updated. In some implementations of the first aspect, processing the data page corresponding to the data page set mapping information based on the transaction state, and updating the hash index and the data page set mapping information corresponding to the transaction version includes: Determining the number of continuous data pages corresponding to the transaction request in the case that the transaction state is the start of a new transaction; determining each continuous idle page interval based on the hash index; Determining a first target interval in each continuous free page interval based on the number of continuous data pages; determining a first target interval as a new allocation page set of the transaction request; and updating the hash index and the data page set mapping information corresponding to the transaction version based on the first target interval. In some implementations of the first aspect, the hash index includes feature information of a continuous free page interval, the feature information includes an interval size of the continuous free page interval, a start page number set, the data page set mapping information includes new allocation page set information, and updating the hash index and the data page set mapping information corresponding to t