Data page processing method and device, electronic equipment and storage medium
By determining the compressed data page structure, including the extensible data slot area, based on the byte length of the original data page, the problem of not supporting large data page compression in the prior art is solved, and effective compression of data pages of different byte lengths is achieved, and data storage efficiency is improved.
Patent Information
- Application Number
- CN202411973499.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-25
AI Technical Summary
Existing data page compression methods do not support the compression of large data pages, and it is impossible to achieve effective compression of data pages of different byte lengths.
By obtaining the byte length of the original data page, the compressed data page structure is determined, including an expandable data slot area, for positioning the compressed data records in the compressed data page. The byte length of the expandable data slot area is associated with the byte length of the original data page, and supports compression of data pages of different byte lengths.
It realizes the compression of data pages of different byte lengths, supports larger data page compression, and enhances the efficiency of data storage.
Smart Images

Figure CN119884120A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of database technology, and in particular to a data page processing method, device, electronic equipment and storage medium. Background Art
[0002] In a database storage node with a B+tree-based storage structure, data is usually stored in the disk in the format of data pages. Each data page is simply divided into three parts: "page header", "data", and "page footer". Among them, the page header is mainly used to mark the position of the data page in the entire B+tree, and also contains the main definition and attributes of the page; the data part, as the name implies, mainly stores the data of each row of the table in the database; the page footer stores the retrieval offset within the data page, which is used to locate the position of each row of data in the data page. According to the positioning of these three structures, since the "page header" and "page footer" need to accurately locate the data during the query process, and the compressed data cannot be used to locate the data, only the "data" part can be compressed when compressing the data page.
[0003] In traditional compression technology based on data pages, a fixed data page size is usually used as the basic condition. For example, MySQL supports compression of data pages up to 16K, and PostgreSQL supports compression of data pages up to 32K. It is impossible to compress large data pages. Summary of the invention
[0004] The present invention provides a data page processing method, device, electronic device and storage medium to solve the problem that the existing data page compression method does not support large data page compression.
[0005] According to one aspect of the present invention, a data page processing method is provided, comprising:
[0006] Get the original data page;
[0007] Determining a compressed data page structure based on the byte length of the original data page;
[0008] Compressing the original data stream in the original data page to obtain a compressed data stream; encapsulating the compressed data stream into a compressed data page based on the compressed data page structure;
[0009] The compressed data page structure includes an expandable data slot area for locating compressed data records in the compressed data page, and the byte length of the expandable data slot area is associated with the byte length of the original data page.
[0010] According to another aspect of the present invention, there is provided a data page processing device, comprising:
[0011] The original data page acquisition module is used to acquire the original data page;
[0012] A compressed data page structure determination module, used to determine a compressed data page structure based on the byte length of the original data page;
[0013] A data page compression module, configured to compress the original data stream in the original data page to obtain a compressed data stream; and encapsulate the compressed data stream into a compressed data page based on the compressed data page structure;
[0014] The compressed data page structure includes an expandable data slot area for locating compressed data records in the compressed data page, and the byte length of the expandable data slot area is associated with the byte length of the original data page.
[0015] The technical solution of the embodiment of the present invention obtains the original data page; determines the compressed data page structure based on the byte length of the original data page; compresses the original data stream in the original data page to obtain the compressed data stream; and encapsulates the compressed data stream into the compressed data page based on the compressed data page structure; wherein the compressed data page structure includes an expandable data slot area for locating the compressed data record in the compressed data page, and the byte length of the expandable data slot area is associated with the byte length of the original data page. Compression of data pages with different byte lengths can be supported.
[0016] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0018] Figure 1 is a flow chart of a data page processing method provided by Embodiment 1 of the present invention;
[0019] Figure 2 is a schematic diagram of the structure of a 2-byte data slot area provided in Embodiment 1 of the present invention;
[0020] Figure 3 This is a schematic diagram of the structure of a 3-byte expandable data slot area of a compressed data page provided in Embodiment 1 of the present invention;
[0021] Figure 4is a structural diagram of a data page processing device provided by Embodiment 2 of the present invention;
[0022] Figure 5 It is a structural schematic diagram of an electronic device provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION
[0023] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0024] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0025] Embodiment 1
[0026] Figure 1 1 is a flow chart of a data page processing method provided by the first embodiment of the present invention. This embodiment is applicable to the case of compressing data pages in a database. The method can be executed by a data page processing device. The data page processing device can be implemented in the form of hardware and / or software. The data page processing device can be configured in a database server. Figure 1 As shown, the method includes:
[0027] S110, obtaining an original data page.
[0028] In the embodiment of the present invention, in the database system, data is usually stored in the form of data pages. Each data page contains a certain number of data records. Before data compression, the original data page to be compressed needs to be read from the database.
[0029] S120. Determine a compressed data page structure based on the byte length of the original data page.
[0030] The compressed data page structure mainly includes three parts: page header, data record area, expandable data slot area and page footer. The page header includes but is not limited to data page checksum, page type, number of records in the page, pointer to record, data page identifier, version number, free space list, insertion direction, compression mark and other fields. The compression mark field is used to mark the compression status of the data page.
[0031] The data record area is the main part of the data page, storing the actual data records, such as a row of a table. The expandable data slot area includes multiple data slots, which are used to store the offset of the compressed data in the compressed data page and locate the compressed data records in the compressed data page. It should be noted that the byte length of the expandable data slot area is associated with the byte length of the original data page. The page footer is used to store the page verification information and some other metadata. For example, in MySQL's InnoDB storage engine, the page footer may contain the page checksum and the corresponding log sequence position when the page was last modified.
[0032] It should be noted that, since the existing storage nodes have only one data page structure, all data page access, deletion, and addition operations only need to follow one mode. However, the compressed data page structure in the present invention uses different data page structures for different byte lengths, so it is necessary to mark whether the data page is compressed in the data page, otherwise the correct format interface cannot be used to parse the data page at the bottom layer.
[0033] It is understandable that in compression technology based on data pages, a fixed data page size is usually the basic condition. Taking the MySQL database as an example, the fundamental reason for not supporting larger data pages is that the traditional data page structure can only use a 2-byte data slot area to represent the offset of the compressed data within the data page. Figure 2 : is a schematic diagram of the structure of a 2-byte data slot area provided in Embodiment 1 of the present invention. Figure 2 As shown in the figure, the first bit and the second bit of these two bytes are used as the deleted mark and the owned mark. The deleted mark indicates the deletion of data, and the owned mark indicates the number of data rows. The remaining 14 bits are used to indicate the specific offset. 14 bits means that the offset range it can indicate is [0-16384]. Therefore, only 16K data page compression is supported in the MySQL database. This data structure greatly limits the development of data page compression. Therefore, we need to design a new data page format to support larger data page compression and be compatible with the existing data page structure without causing major damage to the existing process.
[0034] In an embodiment of the present invention, the compressed data page structure can be determined according to the byte length of the original data page, so as to meet the compression requirements of data pages with different byte lengths. Figure 3 Schematic diagram of the structure of the 3-byte expandable data slot area of the compressed data page provided by the first embodiment of the present invention. Figure 3 As shown, the 3-byte expandable data slot area is used to mark the offset of compressed data in 32K and 64K data pages. The expandable data slot area uses a 3-byte length to represent the offset of the compressed data in the data page, and the writing method is from the high address bit to the low address bit. The highest bit reserves the delete mark, and the second highest bit reserves the owned mark. The remaining 22 bits take the low address 16 bits to represent the offset in the data page, and the remaining 6 bits are left blank for later expansion of larger data pages. It can be understood that the compressed data page structure can cover all the functions of the existing data page structure and can support the offset representation of the length [0 to 4194304].
[0035] Based on the above embodiment, optionally, determining the compressed data page structure based on the byte length of the original data page includes: obtaining an association relationship table between the expandable data slot area and the byte length of the data page; and determining the expandable data slot area corresponding to the original data page based on the byte length of the original data page and the association relationship table.
[0036] The association table is used to store the association between the byte length of the data page and the expandable data slot area of the compressed data page. For example, 32K and 64K data pages correspond to 3-byte expandable data slot areas. In an embodiment of the present invention, an association table between the expandable data slot area and the byte length of the data page is obtained; based on the byte length of the original data page, a search is performed in the association table to obtain the expandable data slot area corresponding to the original data page, thereby determining the compressed data page structure based on the expandable data slot area corresponding to the original data page.
[0037] S130, compressing the original data stream in the original data page to obtain a compressed data stream; and encapsulating the compressed data stream into a compressed data page based on the compressed data page structure.
[0038] The original data stream refers to the data sequence to be compressed in the original data page, and the compressed data stream refers to the compressed data sequence. In the embodiment of the present invention, the original data stream in the original data page is compressed based on a preset compression algorithm to obtain a compressed data stream; and the compressed data stream is encapsulated into a compressed data page based on the compressed data page structure. The compression algorithm includes but is not limited to LZ4, Zlib, Zstd, Snappy, etc.
[0039] Based on the above embodiment, optionally, the original data stream in the original data page is compressed to obtain a compressed data stream, including: obtaining the compression attribute of the original data page; determining the compression algorithm corresponding to the original data page based on the compression attribute; calling the compression interface corresponding to the compression algorithm to compress the original data stream to obtain a compressed data stream.
[0040] Among them, the compression attribute refers to the metadata related to the original data page that affects the compression effect. Specifically, the compression attribute includes but is not limited to the type of data, the structure of the data, the size of the data, etc. In an embodiment of the present invention, the compression attribute related to the original data page is obtained, and the compression algorithm that is most suitable for the original data page can be determined according to the compression attribute. It can be understood that different algorithms may have different compression effects for data of different types and structures. Further, the compression interface provided by the compression algorithm is called to compress the original data stream to obtain a compressed data stream; specifically, the original data stream is passed as input to the compression function or method, and the compressed data stream is received as output. In this process, the compression algorithm will apply its specific algorithm logic to reduce the volume of the data while retaining the original information of the data as much as possible.
[0041] It should be noted that for data pages of different byte lengths, the compression algorithm needs to be adjusted. For example, taking the zlib compression algorithm as an example, for data pages of different byte lengths, different sliding windows are used, for example, a 32K data page uses a 29-length sliding window, and a 64K data page uses a 30-length sliding window.
[0042] Based on the above embodiment, optionally, encapsulating the compressed data stream into a compressed data page based on the compressed data page structure includes: constructing a compressed data page based on the compressed data page structure; writing the compressed data stream into the data portion of the compressed data page, and updating the page header, expandable data slot area and page footer of the compressed data page.
[0043] In an embodiment of the present invention, a compressed data page is constructed based on the compressed data page structure, and the fields in the compressed data page are filled in the header part of the compressed data page, such as: compression algorithm identifier, page size, checksum / check code, timestamp, etc. It should be noted that for the compression mark field in the page header, the compression mark field is marked as compressed. In the data recording area of the compressed data page, the compressed data stream is written to the data recording area of the compressed data page. In the expandable data slot area of the compressed data page, the offset of each compressed data block is recorded. It should be noted that if the data is compressed in segments, it is also necessary to record the boundaries of each segment, and some additional indexes or pointers may be required to speed up data access. In the footer part of the compressed data page, the fields corresponding to the footer are filled, such as: checksum, data integrity mark, etc.
[0044] The technical solution of this embodiment obtains the original data page; determines the compressed data page structure based on the byte length of the original data page; compresses the original data stream in the original data page to obtain a compressed data stream; and encapsulates the compressed data stream into the compressed data page based on the compressed data page structure; wherein the compressed data page structure includes an expandable data slot area for locating compressed data records in the compressed data page, and the byte length of the expandable data slot area is associated with the byte length of the original data page. Compression of data pages with different byte lengths can be supported.
[0045] In some embodiments, optionally, the method further includes: when creating a data page, if the data page is a compressed data page, creating a compressed data page based on the compressed data page structure.
[0046] In the embodiment of the present invention, when creating a data page, it is determined whether the data page to be created is a compressed data page based on the user's request, the configuration information of the data page, or the default setting of the system. If the data page to be created is a compressed data page, the data page is created according to the structure of the compressed data page. It should be noted that the compression mark field in the page header of the created compressed data page is in a compressed state.
[0047] In some embodiments, when a data page is split, if the data page to be split is a compressed data page, the split data page is constructed based on the compressed data page structure.
[0048] In some embodiments, optionally, the method further includes: in response to a management command for a data page, determining a compression mark field of the data page; if the compression mark field is in a compressed state, decompressing the data page, and processing the decompressed data page based on the management command.
[0049] The management commands of the data page include but are not limited to access, insert, delete and other commands. In an embodiment of the present invention, in response to the management command of the data page, the compression mark field of the data page is judged to obtain a judgment result. The judgment result includes a compression state and a non-compression state to determine whether the data page is a compressed data page. If the compression mark field is in a compressed state, it indicates that the data page is a compressed data page, and the data page is decompressed, and the decompressed data page is processed based on the management command. For example, if the management command is an access operation, data can be retrieved from the decompressed data page.
[0050] Embodiment 2
[0051] Figure 4 Schematic diagram of a data page processing device provided by Embodiment 2 of the present invention. Figure 4 As shown, the device comprises:
[0052] The original data page acquisition module 210 is used to acquire the original data page;
[0053] A compressed data page structure determination module 220, configured to determine a compressed data page structure based on the byte length of the original data page;
[0054] The data page compression module 230 is used to compress the original data stream in the original data page to obtain a compressed data stream; and encapsulate the compressed data stream into a compressed data page based on the compressed data page structure;
[0055] The compressed data page structure includes an expandable data slot area, which is associated with the byte length of the original data page and is used to locate the compressed data record in the compressed data page.
[0056] The technical solution of this embodiment obtains the original data page; determines the compressed data page structure based on the byte length of the original data page; compresses the original data stream in the original data page to obtain a compressed data stream; and encapsulates the compressed data stream into the compressed data page based on the compressed data page structure; wherein the compressed data page structure includes an expandable data slot area for locating compressed data records in the compressed data page, and the byte length of the expandable data slot area is associated with the byte length of the original data page. Compression of data pages with different byte lengths can be supported.
[0057] Based on the above embodiment, optionally, the compressed data page structure determination module 220 is used to:
[0058] Obtaining an association relationship table between an expandable data slot area and a byte length of a data page;
[0059] An expandable data slot area corresponding to the original data page is determined based on the byte length of the original data page and the association relationship table.
[0060] Based on the above embodiment, optionally, the data page compression module 230 includes a data stream compression unit, which is used to:
[0061] Obtaining a compression attribute of the original data page;
[0062] Determining a compression algorithm corresponding to the original data page based on the compression attribute;
[0063] The compression interface corresponding to the compression algorithm is called to compress the original data stream to obtain a compressed data stream.
[0064] Based on the above embodiment, optionally, the data page compression module 230 includes a compressed data page encapsulation unit, which is used to:
[0065] constructing a compressed data page based on the compressed data page structure;
[0066] The compressed data stream is written to the data portion of the compressed data page, and a page header, an expandable data slot area, and a page footer of the compressed data page are updated.
[0067] Based on the above embodiment, optionally, the page header of the compressed data page structure includes a compression mark field for marking the compression state of the data page; and the compressed data page encapsulation unit is used to:
[0068] The compression flag field is marked as compressed.
[0069] Based on the above embodiment, optionally, the device further includes a data page creation module, which is used to:
[0070] When creating a data page, if the data page is a compressed data page, a compressed data page is created based on the compressed data page structure.
[0071] Based on the above embodiment, optionally, the device further includes a data page management module, which is used to:
[0072] In response to a management command for a data page, determining a compression flag field of the data page;
[0073] If the compression mark field is in a compressed state, the data page is decompressed, and the decompressed data page is processed based on the management command.
[0074] The data page processing device provided in the embodiment of the present invention can execute the data page processing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0075] Embodiment 3
[0076] Figure 5 1 is a schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. The electronic device 10 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0077] like Figure 5 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0078] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0079] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs the various methods and processes described above, such as a data page processing method.
[0080] In some embodiments, the data page processing method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the data page processing method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the data page processing method in any other appropriate manner (e.g., by means of firmware).
[0081] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0082] The computer programs for implementing the data page processing method of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program can be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.
[0083] Embodiment 4
[0084] Embodiment 4 of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to execute a data page processing method, the method comprising:
[0085] Get the original data page;
[0086] Determining a compressed data page structure based on the byte length of the original data page;
[0087] Compressing the original data stream in the original data page to obtain a compressed data stream; encapsulating the compressed data stream into a compressed data page based on the compressed data page structure;
[0088] The compressed data page structure includes an expandable data slot area for locating compressed data records in the compressed data page, and the byte length of the expandable data slot area is associated with the byte length of the original data page.
[0089] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0090] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0091] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0092] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0093] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0094] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A data page processing method, characterized in that: include: Get the original data page; Determining a compressed data page structure based on the byte length of the original data page; Compressing the original data stream in the original data page to obtain a compressed data stream; Encapsulating the compressed data stream into a compressed data page based on the compressed data page structure; The compressed data page structure includes an expandable data slot area for locating compressed data records in the compressed data page, and the byte length of the expandable data slot area is associated with the byte length of the original data page.
2. The method according to claim 1, characterized in that The step of determining the compressed data page structure based on the byte length of the original data page comprises: Obtaining an association relationship table between an expandable data slot area and a byte length of a data page; An expandable data slot area corresponding to the original data page is determined based on the byte length of the original data page and the association relationship table.
3. The method according to claim 1, characterized in that The compressing the original data stream in the original data page to obtain a compressed data stream includes: Obtaining a compression attribute of the original data page; Determining a compression algorithm corresponding to the original data page based on the compression attribute; The compression interface corresponding to the compression algorithm is called to compress the original data stream to obtain a compressed data stream.
4. The method according to claim 1, characterized in that: The encapsulating the compressed data stream into a compressed data page based on the compressed data page structure comprises: constructing a compressed data page based on the compressed data page structure; The compressed data stream is written to the data portion of the compressed data page, and a page header, an expandable data slot area, and a page footer of the compressed data page are updated.
5. The method according to claim 4, characterized in that The page header of the compressed data page structure includes a compression mark field for marking the compression status of the data page; The updating of the header of the compressed data page includes: The compression flag field is marked as compressed.
6. The method according to claim 1, characterized in that The method further comprises: When creating a data page, if the data page is a compressed data page, a compressed data page is created based on the compressed data page structure.
7. The method according to claim 1, characterized in that The method further comprises: In response to a management command for a data page, determining a compression flag field of the data page; If the compression mark field is in a compressed state, the data page is decompressed, and the decompressed data page is processed based on the management command.
8. A data page processing device, characterized in that: include: The original data page acquisition module is used to acquire the original data page; A compressed data page structure determination module, used to determine a compressed data page structure based on the byte length of the original data page; A data page compression module, used for compressing the original data stream in the original data page to obtain a compressed data stream; Encapsulating the compressed data stream into a compressed data page based on the compressed data page structure; The compressed data page structure includes an expandable data slot area for locating compressed data records in the compressed data page, and the byte length of the expandable data slot area is associated with the byte length of the original data page.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the data page processing method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the data page processing method according to any one of claims 1 to 7 when executed.
Citation Information
Cited By
Database page integrity verification method and system based on national cryptographic algorithm and medium
CN122333547A