A method, device, electronic device and storage medium for releasing large field data

By releasing the data page of large field data as a whole, the problems of low release efficiency and many concurrent conflicts in the prior art are solved, and the effect of rapid release and reduction of concurrent conflicts is achieved.

CN114328565BActive Publication Date: 2025-04-22SHANGHAI DAMENG DATABASE
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111681593.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-29
Publication Date
2025-04-22
Estimated Expiration
2041-12-29

AI Technical Summary

Technical Problem

When the prior art releases large-field data in the database, the input/output volume is large, the release cost is high, and the header information on the homepage of the table segment is frequently modified, resulting in an increase in concurrent conflicts.

Method used

By collecting the data page information of the large field data to be released based on the field release information, and releasing the corresponding data pages as a whole, the input and output amount is reduced, the release cost is reduced, and the segment header occupation time is reduced.

Benefits of technology

It realizes the rapid release of large-field data, reduces the time of segment header occupation, and reduces concurrent conflicts in large-field type data operations in the database.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114328565B_ABST
    Figure CN114328565B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, device, electronic device and storage medium for releasing large field data, wherein the method comprises: collecting data page information of large field data to be released according to field release information; and releasing the corresponding data page as a whole according to the data page information. The embodiment of the present invention collects the data page information corresponding to the large field data so that each data page is released as a whole, thereby improving the data release efficiency, reducing the time occupied by the segment header, and reducing the concurrent conflicts of large field operations in the database processing process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of database technology, and in particular to a method, device, electronic device and storage medium for releasing large field data. Background Art

[0002] Large fields in the database are a common data type that takes up a huge amount of space in the database. Common large field data types include BLOB, CLOB, TEXT, and IMAGE. Data of large field data types are usually stored independently. The table does not store specific data of the large field data, but stores summary information such as the data storage location. Large field data is generally implemented based on data pages. Large field data is sequentially written into a series of data pages. These data pages use the previous page address and the next page address in the page header information to ensure the order of data. See Figure 1 , a data page can include page header control information, data, and row offset groups. The page header control information includes information such as page type and page address. The data is stored in the middle of the data page, and some space is reserved at the end of the data page for storing row offset groups. The row offset group is used to identify the space occupancy on the data page, which is convenient for managing the space of the data page itself. In the database, data storage is mostly organized in a segment structure. A segment consists of a group of clusters, and a cluster consists of multiple continuous data pages on the disk. The data page is used to centrally store data of multiple columns of large field data types in the same table, and the data is all located in the same table segment. Usually, when deleting several records of multiple large field columns of a table, it is necessary to release the space occupied by the large field data, that is, it is necessary to release the data pages of the table segment.

[0003] When releasing table segment data pages, the traditional approach is to release them page by page. Figure 2 First, all the data pages that need to be released are loaded into the cache one by one according to the segment header information of the table segment, and then the data pages are released one by one. Each time a data page is released, the segment header information of the table segment is re-captured to obtain the data page that needs to be released. The above method leads to: 1. The input / output volume of the database is large, and the cost of data release is high; 2. The page header information of the table segment homepage is frequently modified, and the segment header takes too long, resulting in an increase in concurrent conflicts of large field columns in the database. Summary of the invention

[0004] The present invention provides a large field data release method, device, electronic device and storage medium to achieve data release efficiency, reduce segment header occupancy time, and reduce concurrent conflicts of large field type data operations in a database.

[0005] In a first aspect, an embodiment of the present invention provides a method for releasing large field data, the method comprising:

[0006] Collect data page information of large field data to be released according to field release information;

[0007] The corresponding data page is released as a whole according to the data page information.

[0008] In a second aspect, an embodiment of the present invention further provides a large field data release device, the device comprising:

[0009] An information collection module, used for collecting data page information of large field data to be released according to field release information;

[0010] The data release module is used to release the corresponding data page as a whole according to the data page information.

[0011] In a third aspect, an embodiment of the present invention further provides a computer device, the computer device comprising:

[0012] one or more processors;

[0013] a memory for storing one or more programs,

[0014] When the one or more programs are executed by the one or more processors, the one or more processors implement any method as described in the embodiments of the present invention.

[0015] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the methods described in the embodiments of the present invention.

[0016] The embodiment of the present invention collects data page information of large field data to be released according to the received field release information, and releases the data page corresponding to the field to be released as a whole according to the data page information, thereby realizing the rapid release of large field data, reducing the input and output volume, reducing the cost of release, and reducing the segment header occupancy time, which can reduce the concurrent conflicts of large field type data operations in the database. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 It is a structural schematic diagram of a data page in the prior art;

[0018] Figure 2 This is an example diagram of large field data release in the prior art;

[0019] Figure 3 This is a flow chart of releasing large field data provided by the first embodiment of the present invention;

[0020] Figure 4 This is another flow chart of releasing large field data provided by the second embodiment of the present invention;

[0021] Figure 5 This is an example diagram of a control page provided by Embodiment 2 of the present invention;

[0022] Figure 6 This is another flow chart of releasing large field data provided by Embodiment 3 of the present invention;

[0023] Figure 7 This is an example diagram of an organizational format of a control page provided in Embodiment 3 of the present invention;

[0024] Figure 8 This is an example diagram of the organizational format of a general control item provided in Embodiment 3 of the present invention;

[0025] Fig. 9 This is an example diagram of the organizational format of a control unit provided in Embodiment 3 of the present invention;

[0026] Fig.10 This is an example diagram of releasing large field data provided by the third embodiment of the present invention;

[0027] Fig.11a It is a structural diagram of an FPO provided by Embodiment 3 of the present invention;

[0028] Fig.11b is a schematic diagram of the structure of another FPO provided in Embodiment 3 of the present invention;

[0029] Fig.11c is a schematic diagram of the structure of another FPO provided in Embodiment 3 of the present invention;

[0030] Fig.11d is a schematic diagram of the structure of another FPO provided in Embodiment 3 of the present invention;

[0031] Fig.12 It is a structural schematic diagram of a large field data release device provided by Embodiment 4 of the present invention;

[0032] Fig.13 It is a structural schematic diagram of a point electronic device provided by Embodiment 5 of the present invention. DETAILED DESCRIPTION

[0033] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention are shown in the accompanying drawings, rather than all structures. In addition, the embodiments of the present invention and the features in the embodiments may be combined with each other without conflict.

[0034] In an embodiment of the present invention, the large field data in the database may be a data type that adopts an independent storage method, which may also be referred to as out-of-row storage. The storage method is specifically to use a storage address in the table instead of storing the large field column value. Common large field data types in the database may include BLOB, CLOB, TEXT, IMAGE, etc. Large field data are generally implemented based on data pages, and the large field data is sequentially written into continuous data pages. These data pages ensure the order of data through the previous page address and the next page address in the page header information. The address information of the first page of the data page can be stored in the row record. In an embodiment of the present invention, the data page in the database includes page header control information, data, free space and row offset array, wherein the row offset data is located at the end of the data page to identify the space occupancy of the current data page. In the database, data pages can be organized in the form of table segments, and the table segment can be composed of a group of clusters, and the cluster is composed of a group of continuous data pages. The data of the records storing multiple columns of large field data of the same table can all be located in the same table segment. For example, referring to the following table, when table T1 is stored, all data of columns C1, C2 and C3 are stored together in one table segment. The entire table has only one segment first page, which does not store data and is a management page. Columns C1 and C3 are both large field columns, and the page before the first data page of each large field data is the control page of the large field. There is a control page before the large field data "ABCD1", "ABCD2", "CDEF1" and "CDEF2".

[0035] Data of table T1

[0036] C1 C2 C3 ABCD1 10 CDEF1 ABCD2 20 CDEF2

[0037] Embodiment 1

[0038] Figure 3 is a flowchart of a large field data release provided by the first embodiment of the present invention. This embodiment is applicable to the case of large field data release. The method can be executed by a large field data release device. The device can be implemented in hardware and / or software. Figure 3 The method provided in the embodiment of the present invention specifically includes the following steps:

[0039] Step 110: Collect data page information of the large field data to be released according to the field release information.

[0040] The field release information may be information that triggers the release of the memory space occupied by the large field data. The field release information may include identification information or address information of the large field data. The field release information may be triggered when the large field data is deleted or the transaction is rolled back. The large field data to be released may be the large field data corresponding to the field release information, for example, it may be the large field data corresponding to the identification information or address information in the field release information. The data page information may be information that marks the data page occupied by the large field, and may include the first page address, last page address, and number of pages of the data page.

[0041] Step 120: releasing the corresponding data page as a whole according to the data page information.

[0042] In the embodiment of the present invention, multiple data pages occupied by the large field data to be released can be released as a whole according to the data page information, which can improve the data page release efficiency and reduce the resource overhead when locking the data page.

[0043] The embodiment of the present invention collects data page information of large field data to be released according to the received field release information, and releases the data page corresponding to the field to be released as a whole according to the data page information, thereby realizing the rapid release of large field data, reducing the segment header occupancy time, and reducing the concurrent conflicts of large field type data operations in the database.

[0044] Embodiment 2

[0045] Figure 4 is another flow chart of releasing large field data provided by the second embodiment of the present invention. The embodiment of the present invention is a specific implementation based on the above-mentioned embodiment of the invention. Figure 4 The method provided in the embodiment of the present invention specifically includes the following steps:

[0046] Step 210, obtaining the segment homepage of the large field data to be released and the data page homepage of the large field data to be released according to the field release information, and determining that the type information of the data page homepage is a large field type.

[0047] The first page of the segment and the first page of the data of the large field are locked respectively to prevent other operations from modifying the first page of the segment and the data during this period. The type information can be used to determine whether the data page is of the large field type.

[0048] In an embodiment of the present invention, the data homepage of the large field data to be released can be read according to the field release information, and it can be determined whether the large field data to be released is of a large field type according to the large field type stored in the data homepage. If so, continue to execute step 220; if not, the data page of a non-large field type can be processed according to the processing method in the prior art.

[0049] Step 220 , extracting data page information from the control page of the data first page of the large field data to be released, wherein the data page information at least includes a first page address, a last page address and a page number.

[0050] The control page may be a management page set when the number of data pages occupied by large field data is greater than M pages. The management page may store information of each data page to facilitate management of each data page. Figure 5 The control page can be the previous data page of a data page occupied by a large field of data. This data page is used to manage the data pages occupied by the large field of data and does not store data, so it is called a management page. The first page address can be the address information of the first data page in the data pages occupied by the large field of data to be released, the last page address can be the address information of the last data page in the data pages occupied by the large field of data to be released, and the number of pages can be the number of data pages occupied by the large field of data to be released.

[0051] In an embodiment of the present invention, the control page corresponding to the data first page of the large field data to be released can be determined, and the first page address, last page address and number of pages of the data page of the large field to be released can be extracted from the control page as data page information.

[0052] Step 230: temporarily store the data page information in the information collection address space.

[0053] The information collection address space may be a space for temporarily storing data page information, and each large field of data to be released may have its own information collection address space.

[0054] Specifically, the data page information corresponding to the large field data to be released may be stored in the corresponding information collection address space, and the information collection address space may be located on the data homepage of the large field data to be released or other designated locations.

[0055] Step 240: merge data page information of at least two large field data to be released, and store the merged data page information in the address space to be released of the segment home page.

[0056] Among them, the address space to be released can be the address space for storing all large field data to be released, and can store the merged data page information. The merged data page information in the address space to be released can be stored in the form of queues, sequences, etc. The merged data page information can reduce the locking time of the first page of the large field release pair.

[0057] In an embodiment of the present invention, the acquired data page information of two or more large fields of data to be released can be merged so that the merged data page information can be used to release the large fields to be released as a whole during the release process. It can be understood that the merging can include storing the data page information in the same address space or connecting the first page address and the last page address of the data page information in sequence.

[0058] Step 250: extract the stored data page information in the to-be-released address space of the segment home page.

[0059] Specifically, the data page information stored in the address space to be released in the segment home page can be extracted. The data page information may include the home page address, the last page address and the number of pages of the field to be released. It can be understood that the data page information may be the data page information after multiple large field data to be released are merged. The home page address may be the home page address of the first large field data to be released, the last page address may be the last page address of the last large field data to be released, and the number of pages may be the total number of data pages occupied by multiple large field data to be released.

[0060] Step 260: Release the data pages in sequence according to the home page address and page number of the data page information.

[0061] In an embodiment of the present invention, the first data page of the large field data to be released can be obtained according to the home page address in the data page information, and the data pages of the corresponding number of pages can be released in sequence starting from the first page of data according to the address sequence of the data pages, thereby realizing the overall release of the data pages occupied by the large field data. Since the segment home page is locked only once when the home page address and the number of pages are obtained, there is no need to lock it multiple times due to the release of multiple data pages, thus reducing the locking time of the segment home page and reducing the conflict between different large field data operations.

[0062] According to an embodiment of the present invention, a segment home page and a data home page of large field data to be released are obtained through field release information, the segment home page and the data home page of large field data are locked respectively in turn, data page information of the field data to be released is extracted based on a control page of the data home page of the large field data to be released, the extracted data page information is stored in an information collection address space, data page information of at least one large field data to be released is stored or merged and stored in the address space to be released of the segment home page, the data page information of the address space to be released is obtained, and the data pages are released in sequence according to the home page address and the number of pages of the data page information, so as to realize the overall release of the data pages of the large field data, improve the data release efficiency, reduce the locking time of the segment home page, and reduce the conflict of large field data operations.

[0063] Embodiment 3

[0064] Figure 6is another flow chart of releasing large field data provided by Embodiment 3 of the present invention. Embodiment 3 of the present invention is a specific implementation of the above-mentioned embodiment of the invention. Figure 6 The method provided in the embodiment of the present invention specifically includes the following steps:

[0065] Step 310: Obtain the segment homepage of the large field data to be released and the data page homepage of the large field data to be released according to the field release information, and determine that the type information of the data page homepage is a large field type.

[0066] Step 320 : When the control page pointer of the control page is invalid, sequentially scan at least one data page occupied by the large field data to be released to obtain data page information.

[0067] The control page pointer may be a pointer from the data homepage of the large field data to be released to the control page. The control page pointer may be used to determine whether a control page exists on the data page. Since not all large field data have control pages, the large field control page will be used only when the data pages occupied by the large field data are greater than or equal to a certain number. The control page may refer to a data page whose page address of the previous page of the first data page occupied by the large field data is not Null and the type of the data page corresponding to the page address of the previous page is a control page.

[0068] In the embodiment of the present invention, the control page pointer corresponding to the data home page of the large field data to be released can be obtained, and it is determined whether the control page pointer is empty. If so, it indicates that the data page occupied by the large field data to be released does not meet the requirements for enabling the control page, and the control page cannot be directly used to obtain the data page information of all data pages of the large field to be released. It is necessary to scan all data pages occupied by the large field to be released to obtain the address of each data page and the total number of data pages as data page information. This situation is a situation without a control page.

[0069] Step 330: When the control page pointer of the control page is valid and the control page identifier is valid, read the control page corresponding to the control page pointer, extract the statistical information in the total control items and the tail control items in the control page to obtain the data page information.

[0070] The control page can be an information page that stores statistical information of large field data and fragmentation units, and the fragmentation unit can be an information page that stores the allocation information of large fields outside the row. Figure 7 The control page may include the number of fragments, whether there is a last page information, the file number of the last page, the page number of the last page, and whether the control information is valid. The number of fragments can indicate how many fragments the large field is divided into, the last page information is used to determine whether the large field has a last page, and the last page number and the last page file number can be used to locate the last page data page. See Figure 8 and Fig. 9The control page may consist of a main control item and multiple control items (or control units), wherein the last control item may be a tail control item.

[0071] Specifically, when the control page pointer of the data home page of the large field data to be released is not empty, the large field data to be released is a data page managed by the control page, and the control page identifier in the control page can be judged to determine whether the control page of the large field data to be released is valid.

[0072] It can be understood that when the control page pointer of the data homepage of the large field data to be released is valid and the control page identifier is valid, the total control item and tail control item information in the control page can be extracted to obtain the data page information. The data page information obtained is the start page address to be released, the tail page address and the total number of data pages to be released. The control page address is the previous page address of the data page, and the address of the tail page can be directly obtained in the total control item. The control page address is used as the start page address to be released. Before calculating the total number of data pages to be released, because the tail page control item may be invalid, it is necessary to make a judgment based on the actual situation. After obtaining the valid tail control item page number, the total number of pages to be released can be calculated. The total number of data pages to be released = the number of control pages (1 page) + the cumulative value of the number of pages in all control items. That is, the start page address to be released, the tail page address and the total number of data pages to be released are used as data page information.

[0073] The number of pages in the tail control item is the number of pages of the tail control unit. When the tail control item is valid, the number of pages in the tail control item can be directly used as the number of pages of the last control item to participate in the calculation. When the tail control item is invalid, it means that the current tail page has been released by other sessions. At this time, it is necessary to re-acquire the valid tail control item information. The specific method of obtaining a valid tail control item is to obtain a valid tail control item by scanning the large field data pages of the last control unit in sequence. That is, start from the first page of the tail control item, and then scan the data pages in sequence, find the next page address through the page header, and finally get the number of pages and the last page address in the valid tail control item. At this time, the number of pages and the last page address can be used as the number of pages of the last control item to participate in the calculation.

[0074] Step 340: When the control page pointer of the control page is valid and the control page identifier is invalid, the data pages of the large field data to be released are scanned in sequence to obtain data page information.

[0075] In an embodiment of the present invention, when the control page pointer of the data home page of the large field data to be released is valid and the control page identifier is invalid, it indicates that although the data page of the large field data to be released has a control page, the control page is invalid due to other reasons, and the control page cannot be directly used to obtain the data page information of all data pages of the large field to be released. It is necessary to scan all data pages occupied by the large field to be released to obtain the address of the last page and the total number of data pages as the data page information.

[0076] Step 350: extract the data page information of each large field data to be released stored in the information collection address space of the data page home page of the large field data to be released.

[0077] Specifically, the data page information of each large field data to be released can be extracted from the information collection address space of the data home page of the large field data, wherein the data page stored in the information collection address space can be the data page information of the large field data to be released collected each time.

[0078] Step 360: Store the first page address and the last page address of each data page information in a to-be-released address space of the segment first page in a head-to-tail manner according to the address sequence.

[0079] In an embodiment of the present invention, the first page address and the last page address in the data page information of each large field data to be released can be connected end to end in address order, and the data page information of multiple large field data to be released can be merged, and the merged data page information can be stored in the address space to be released.

[0080] Step 370: Mark the identification number of the corresponding large field data to be released as an invalid identification number in the segment homepage.

[0081] Specifically, after the data page information of the large field data to be released is collected, the identification number of the large field data to be released can be marked as an invalid identification number in the segment home page to prevent the large field data to be released from being released repeatedly.

[0082] Step 380: Release the corresponding data page as a whole according to the data page information.

[0083] In the embodiment of the present invention, the data of the segment home page and the large field data to be released are obtained through field release information, the segment home page and the data home page are locked respectively, and when the control page pointer of the control page of the data home page is invalid, the data page of the large field data to be released is scanned to obtain the data page information, and when the control page pointer of the control page of the data home page is valid and the control page identifier is valid, the statistical information of the total control items and the tail control items in the control page is read to obtain the data page information, and according to the information of the total control items and the tail control items, the start page address, the tail page address and the total number of data pages to be released are obtained as the data page information. When the control page pointer of the data home page of the large field data to be released is valid and the control page identifier is invalid, the data page information is obtained by scanning the data pages of the large field data to be released in sequence. The home page address and the tail page address in the data page information are sequentially connected and stored in the address space to be released, and the data identification number of each large field to be released is marked as an invalid identification number, and the corresponding data page is released as a whole according to the data page information, so that the large field data is quickly released, the segment header occupancy time is reduced, and the concurrent conflict of large field type data operations in the database can be reduced.

[0084] Further, based on the above-mentioned embodiments of the invention, statistical information in the total control items and tail control items in the control page is extracted to obtain the data page information, including: based on the information of the total control items and the tail control items, the starting page address, the tail page address and the total number of data pages to be released are obtained as the data page information.

[0085] In an exemplary embodiment, see Fig.10, since the large field data page of the same column and the same row in the large field data page is often composed of multiple continuous pages, the continuous pages related to the large field can be released together when releasing the space. Therefore, when creating a large field for the first time, a new address space FPO (SEG_FPO) can be added for subsequent registration of large field data (first page address unit, last page address unit, number of pages N of the large field). If SEG_FPO already exists, it does not need to be created again. When a large field data is deleted, when releasing the space, the continuous N data pages starting from the first page address recorded in the address space SEG_FPO to be released and ending at the last page address are directly released as a whole at one time. In this way, the operation of the page unit when releasing the large field is changed to the operation corresponding to an entire unit, and the temporary LOB_FPO is registered to the SEG_FPO of the segment first page, that is, the first page, last page address unit and the number of pages N of the large field are recorded in the address space area to be released on the segment first page. When deleting large field records to release space or inserting rollback, the address of the record to be processed can be the first page address of the large field data page. In the external database processing, only the first page address can be transmitted. When creating a large field, a structure FPO is added to the segment first page to store the first and last address information and the number of data pages of the large field to be released, where the page address can be composed of the file number and the page number. The processing process may include the following steps:

[0086] 1. Start a large field delete or rollback transaction.

[0087] 2. Obtain the first page of the table segment according to the large field memory object to be released, and lock the first page of the segment. The memory structure of the large field object to be released is obtained according to the table.

[0088] 3. Read the data homepage of large field data and lock it when loading.

[0089] 4. Determine whether there is a control page based on the first page of the large field data. If the first page of the large field data is known, when the pointer address pointing to the previous page in the first page of the large field data is not null, and determine whether the previous page is a control page based on the control page identifier (identified as a control page) in the first page of the large field data. If the control page identifier is valid, it means there is a control page, which means that the large field data page is larger than M pages, and go to step (1); if the control page identifier is invalid, it means that the large field data page has been released by other sessions. Here, the first and last page addresses can be obtained by scanning, and go to step (2); if the pointer address pointing to the previous page in the first page of the large field data is null, it means that the large field data page is less than or equal to M pages, the control page is not enabled, and there is no control page, so go to step (3).

[0090] (1) If there is a control page identifier and it is valid, control page positioning is used. The control page of the large field object is read into the memory. After the control page verification is successful, the tail page address and the number of data pages of the last control item are obtained through the total control item. The tail control item in the control information (i.e., the file_id, page_no of the last unit of the control block) also records the tail page address information. The tail control item can be located to obtain the number of data pages of the last control item. Adjust the first page of the large field to be released of FPO to start from the control page. The control page must also be released.

[0091] If the VALID FLAG of the tail page control item in the control page is TRUE, it means that there is a tail page and the last unit information is reliable, and the page count statistics information TOTAL BYTES of the last unit is used directly. If the VALIDFLAG of the tail control item is FALSE, the number of pages must be scanned in the last control unit. That is, first set the current page address to the first page of the tail control item, then scan the data pages one by one, find the next page address through the page header, gradually get the page number of the last control unit, and also get the valid last tail page address. The total number of data pages = the number of control pages (1 page) + the cumulative value of the number of pages in all control items. Adjust the first page of the large field to be released of FPO starting from the control page. The control page must also be released.

[0092] (2) If there is a control page identifier and it is invalid, it means that the control page (lob_ctl page) is invalid, and the first and last page address information required by FPO is obtained by scanning the large field data page (i.e., conventional positioning). The invalid control page identifier indicates that although the data page of the large field data to be released has a control page, the control page is invalid due to other reasons. The control page cannot be used directly to obtain the data page information of all data pages of the large field to be released. It is necessary to scan all data pages occupied by the large field to be released to obtain the address of the last page and the total number of data pages as data page information.

[0093] (3) If the address of the previous page of the first page of the large field data page is invalid (null), that is, there is no control page, then the total number of data pages will not exceed M pages (for example, 4 pages), so in this case of small IO volume, the conventional method is also used for positioning. Because the next page address can only be known from the previous page of the table segment, the first page of the data has been blocked before, and then the next data page is located one by one from the first page of the large field data page until the last page address is obtained. The number of data pages = the total number of all large field data pages searched.

[0094] 5. After collecting FPO, because FPO records the data page information to be deleted, the data page information to be deleted can be merged into the FPO of the segment homepage, and the large field data identifier BLOBid in the segment homepage is set to an invalid ID to avoid repeated release. See the table below, the page header control information of a segment homepage can contain BLOBid:

[0095] 1 BLOBid 2 N_bytes 3 N_chars

[0096] 6. Release the large field data and update the FPO information in the segment homepage. The following table shows the control information of a segment homepage:

[0097]

[0098] FPO start offset: In order to quickly locate the information of the large field data page unit to be released in the segment header, when the page header stores the first and last address information of the large field data page to be released, it directly skips the first 5 offsets and directly locates to the FPO start offset. Skip the segment header and write the FPO start offset at the 6th offset as the start address. This is to write the FPO to be released into the segment header, indicating that the data page of FPO is no longer used.

[0099] After confirming the location, it only needs to occupy the segment header lock once, that is, block the segment header, and store the large field data page information to be released in this address space. When the lock is released, the large field is released.

[0100] Address space: Position 6 in the first page of the segment is called address space because it is used to record the address units and page numbers of multiple large fields to be released so that they can be physically released uniformly later.

[0101] The FPO address space in the segment home page records the number of pages to be released last time in the segment home page, the first page address unit, and the last page address unit.

[0102] In an embodiment of the present invention, FPO can exist in two forms, LOB_FPO and SEG_FPO. LOB_FPO is a temporary space, and SEG_FPO is the information collection address space of the segment home page. LOB_FPO is the FPO of a single large field to be released, which is used to collect before release. SEG_FPO is the sum of FPOs that have been collected in the segment home page. All LOB_FPOs to be released are connected end to end and added to SEG_FPO. Then, when the data page of the field to be released is physically released, all large data pages to be released can be located at one time through SEG_FPO. After the physical release is completed, SEG_FPO is deleted.

[0103] Before the first release, you need to construct the address space SEG_FPO information of the segment header in the segment home page. When released for the second time, SEG_FPO already exists. SEG_FPO can be reused, and each time the release is completed, immediately set SEG_FPO to NULL. SEG_FPO is valid (non-NULL) if there is FPO (it will only exist for the second release, not for the first release), otherwise it is NULL. When SEG_FPO is used again, if the SEG_FPO address space is NULL, it means that the large field in SEG_FPO has been released. In this case, the LOB_FPO information of the large field data to be released is set to the address space SEG_FPO. The effective address space is recorded as SEG_FPO, and LOB_FPO is merged with SEG_FPO;

[0104] 1. The address of LOB_FPO and the segment home page address space SEG_FPO are merged in a head-to-tail manner to ensure seamless connection between data page addresses. The address of the current home page, the address of the last page, and the number of pages to be released are registered in the address space. First, connect the existing last page number of the SEG_FPO in the address space of the segment home page with the current first page number to be released; the next time a new LOB_FPO to be released is added to SEG_FPO, it only needs to be connected to the back of the new last page in the address space, so that it can be registered quickly.

[0105] Merging method: Store or merge the large field data page information to be released into this address space. If the first page address in the effective address space SEG_FPO is invalid (physically released), and SEG_FPO is NULL, then directly set the LOB_FPO of the current large field to the address space, and end and return. If the address space SEG_FPO is not NULL, modify the next page address of the last page data page in the address space SEG_FPO to the first page address of the current large field LOB_FPO. Set the last page address in the address space SEG_FPO to the last page address of the current large field LOB_FPO.

[0106] 2. The segment homepage FPO is updated, the transaction ends, and the locks of the data homepage and segment homepage of the large field data are released. It can be seen that when one or more large field records are released using the embodiment of the present invention, even if the data page is huge, the segment homepage is not frequently modified, and the control information of the table segment is not frequently modified.

[0107] First merge segment data pages:

[0108] Collect FPO->determine the address space location, set the first and last page addresses and page numbers in the address space to the first and last page addresses and page numbers of LOB_FPO; assign LOB_FPO to SEG_FPO. The merger is completed to become SEG_FPO. Fig.11a , is a FPO structure.

[0109] The second merge segment data page:

[0110] Collect FPO->Determine the address space SEG_FPO position, SEG_FPO is also composed of the first page, the last page, and the number of pages, see Fig.11b ,After the first merge, the addresses in FPO are still in order. After the second merge, see Fig.11c , the addresses in FPO are still in order. Finally, see Fig.11d When the large field data pages to be released are released uniformly and physically, you only need to select (first page, last page of Lob_FPO2, total number of pages) for one-time batch physical release. After physical release, set SEQ_FPO to NULL, specifically delete the content of SEQ_FPO, clean up the FPO information of the first page of the segment, the number of pages = 0, and set the file number and page number of the first and last pages to NULL.

[0111] Embodiment 4

[0112] Fig.12 401 and 402. The device is a schematic diagram of a large field data release device provided in the fourth embodiment of the present invention, which can execute the large field data release method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method. The device can be implemented by software and / or hardware, and specifically includes: an information collection module 401 and a data release module 402.

[0113] The information collection module 401 is used to collect data page information of the large field data to be released according to the field release information.

[0114] The data release module 402 is used to release the corresponding data page as a whole according to the data page information.

[0115] In an embodiment of the present invention, an information collection module collects data page information of large field data to be released according to received field release information, and a data release module releases the data page corresponding to the field to be released as a whole according to the data page information, thereby realizing rapid release of large field data, reducing the time occupied by segment headers, and reducing concurrent conflicts in large field type data operations in the database.

[0116] Further, based on the above-mentioned embodiment of the invention, the information collection module 401 in the device includes:

[0117] The data homepage unit is used to obtain the segment homepage of the large field data to be released and the data homepage of the large field data to be released according to the field release information, and determine that the type information of the large field data to be released on the data page homepage of the large field data is a large field type.

[0118] The information extraction unit is used to extract the data page information from the control page of the data first page of the large field data to be released, wherein the data page information at least includes the first page address, the last page address and the number of pages.

[0119] Further, based on the above-mentioned embodiment of the invention, the data homepage unit is specifically used for:

[0120] When the control page pointer of the control page is invalid, at least one data page occupied by the large field data to be released is scanned in sequence to obtain the data page information; when the control page pointer of the control page is valid and the control page identifier is valid, the control page corresponding to the control page pointer is read, and the statistical information in the total control items and the tail control items in the control page is extracted to obtain the data page information; when the control page pointer of the control page is valid and the control page identifier is invalid, the data pages of the large field data to be released are scanned in sequence to obtain the data page information.

[0121] Further, based on the above-mentioned embodiment of the invention, the information extraction unit is specifically used to obtain the start page address, the end page address and the total number of data pages to be released as the data page information according to the information of the total control item and the tail control item.

[0122] Further, based on the above-mentioned embodiment of the invention, the device further includes:

[0123] The information merging module is used to merge the data page information of at least two large field data to be released, and store the merged data page information in the address space to be released of the segment home page.

[0124] Further, based on the above-mentioned embodiment of the invention, the information merging module includes:

[0125] The information extraction unit is used to extract the data page information of each large field data to be released temporarily stored in the information collection address space.

[0126] The merging storage unit is used to store the first page address and the last page address of each data page information in a head-to-tail manner in the address space to be released of the segment first page in the address sequence.

[0127] The invalid marking unit is used to mark the identification number of the corresponding large field data to be released as an invalid identification number in the segment home page.

[0128] Further, based on the above-mentioned embodiment of the invention, the data release module 402 includes:

[0129] The address acquisition unit is used to extract the data page information stored in the address space to be released of the segment home page.

[0130] The space release unit is used to release the data pages in sequence according to the home page address and page number of the data page information.

[0131] Furthermore, based on the above-mentioned embodiment of the invention, it further includes: an information storage unit, which is used to temporarily store the data page information in the information collection address space.

[0132] Embodiment 5

[0133] Fig.13 is a schematic diagram of the structure of a point electronic device provided by Embodiment 5 of the present invention, such as Fig.13 As shown, the electronic device includes a processor 70, a memory 71, an input device 72 and an output device 73; the number of processors 70 in the electronic device can be one or more. Fig.13 A processor 70 is taken as an example; the processor 70, the memory 71, the input device 72 and the output device 73 in the electronic device can be connected by a bus or other means. Fig.13 The example of connecting through bus is taken in the following.

[0134] The memory 71 is a computer-readable storage medium that can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the large field data release method in the embodiment of the present invention (for example, the information collection module 401 and the data release module 402 in the large field data release device). The processor 70 executes various functional applications and data processing of the electronic device by running the software programs, instructions and modules stored in the memory 71, that is, implements the above-mentioned large field data release method.

[0135] The memory 71 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the terminal, etc. In addition, the memory 71 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 71 may further include a memory remotely arranged relative to the processor 70, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0136] The input device 72 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the electronic device. The output device 73 may include a display device such as a display screen.

[0137] Embodiment 6

[0138] Embodiment 6 of the present invention further provides a storage medium including computer executable instructions, wherein the computer executable instructions are used to execute a large field data release method when executed by a computer processor, the method comprising:

[0139] Collect data page information of large field data to be released according to field release information;

[0140] The corresponding data page is released as a whole according to the data page information.

[0141] Of course, the computer executable instructions of a storage medium containing computer executable instructions provided by an embodiment of the present invention are not limited to the operations of the method described above, and can also execute related operations in the large field data release method provided by any embodiment of the present invention.

[0142] Through the above description of the implementation methods, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software and necessary general hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.

[0143] It is worth noting that in the above-mentioned embodiment of the large field data release device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0144] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A method for releasing large field data, characterized in that: The method comprises: Collecting data page information of the large field data to be released according to the field release information, wherein the field release information is information that triggers the release of the memory occupied space of the large field data, and the data page information includes the first page address, the last page address and the number of pages of the data page of the large field to be released; Merging data page information of at least two large fields of data to be released, and storing the merged data page information in the address space to be released of the segment home page; releasing the corresponding data page as a whole according to the data page information; The step of merging at least two data page information of the large field data to be released includes: Extracting the data page information of each of the large field data to be released temporarily stored in the information collection address space of the data page homepage of the large field data to be released; The first page address and the last page address of each data page information are connected end to end and stored in the address space to be released of the first page of the segment in the order of addresses; In the segment homepage, marking the identification number of the corresponding large field data to be released as an invalid identification number; The releasing the corresponding data page as a whole according to the data page information includes: Extracting the stored data page information in the to-be-released address space of the segment home page; The data pages are released in sequence according to the home page address and the number of pages of the data page information.

2. The method according to claim 1, characterized in that: The step of collecting data page information of the large field data to be released according to the field release information includes: Acquire the segment homepage of the large field data to be released and the data homepage of the large field data to be released according to the field release information, and determine that the type information of the data page homepage is a large field type; The data page information is extracted from the control page of the data home page of the large field data to be released.

3. The method according to claim 2, characterized in that: The extracting the data page information on the control page of the data homepage of the large field data to be released includes: When the control page pointer of the control page is invalid, sequentially scan at least one data page occupied by the large field data to be released to obtain the data page information; If the control page pointer of the control page is valid and the control page identifier is valid, read the control page corresponding to the control page pointer, extract the statistical information in the total control items and the tail control items in the control page to obtain the data page information; When the control page pointer of the control page is valid and the control page identifier is invalid, the data pages of the large field data to be released are scanned in sequence to obtain data page information.

4. The method according to any one of claims 1 to 3, characterized in that: Also includes: The data page information is temporarily stored in the information collection address space.

5. A large field data release device, characterized in that: The device comprises: An information collection module is used to collect data page information of the large field data to be released according to the field release information, wherein the field release information is information that triggers the release of the memory occupied space of the large field data, and the data page information includes the first page address, the last page address and the number of pages of the data page of the large field to be released; An information merging module, used for merging data page information of at least two large field data to be released, and storing the merged data page information in the address space to be released in the segment home page; A data release module, used to release the corresponding data page as a whole according to the data page information; Wherein, the information merging module includes: An information extraction unit, used for extracting the data page information of each of the large field data to be released temporarily stored in the information collection address space of the data page homepage of the large field data to be released; A merging storage unit, used for storing the first page address and the last page address of each data page information in a head-to-tail manner in the address space to be released in the first page of the segment in address order; An invalid marking unit, used for marking the identification number of the corresponding large field data to be released as an invalid identification number in the segment home page; The data release module comprises: An address acquisition unit, used for extracting the data page information stored in the address space to be released of the segment home page; The space release unit is used to release the data pages in sequence according to the home page address and page number of the data page information.

6. An electronic device, characterized in that: The electronic device comprises: one or more processors; a memory for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method as claimed in any one of claims 1 to 4.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Processing method and device of big-field data

    CN106156302A