Data processing method and device, electronic device and storage medium

By using logical positions instead of counters when generating row identifiers in the database, the problem of I/O resource occupation when allocating row identifiers is solved, the server resource load is reduced, and the efficiency of data processing is improved.

CN112732174BActive Publication Date: 2024-09-13BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011561924.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-25
Publication Date
2024-09-13
Estimated Expiration
2040-12-25

AI Technical Summary

Technical Problem

Existing databases need to use I/O resources when allocating row identifiers, resulting in increased server resource load.

Method used

By receiving insertion instructions, it determines the associated information of the record, generates row identifiers, and inserts the record into the data page. It uses logical positions to replace counters to avoid saving to disk files and reduce dependence on I/O resources.

Benefits of technology

This eliminates the need to access I/O resources, saves CPU resources, reduces server resource load, and improves data processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112732174B
    Figure CN112732174B
Patent Text Reader

Abstract

The present application provides a data processing method and device, an electronic device and a storage medium, wherein the method includes: receiving a first insert instruction, wherein the first insert instruction is used to insert a first record corresponding to the first data in a first data page, and the first data page is a data page in a first data table on a first node; determining first association information of the first record, wherein the first association information is used to characterize the storage location of the first record on the first node; generating a first row identifier corresponding to the first record according to the first association information, wherein the first row identifier is used to uniquely identify the first record; inserting the first record into the first data page, wherein the first record contains the first data and the first row identifier. Through the present application, the problem of increased server resource load caused by the need to use I / O resources in the method of allocating row identifiers in the related art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and in particular to a data processing method and device, an electronic device and a storage medium. Background Art

[0002] Currently, databases (eg, MySQL) generate rowids (row identifiers) by accumulating counters. A self-increasing counter (accumulator) is maintained and saved in a global variable. When inserting data, a count is taken from the counter. Multiple data tables share one counter.

[0003] In order to ensure the rationality of rowid allocation after a crash, you can pre-set the growth step, save the value increased by the growth step to a file (a file on the disk), and update the file regularly to ensure data growth.

[0004] For example, if the increment step is 200, 200 is first written to the count file, indicating that the currently allocated rowids are all less than or equal to 200. When the counter value increases to 200, 400 is written to the count file again, indicating that the currently allocated rowids are all less than or equal to 400. After the server crashes, the value in the file can be directly read and rowids can be allocated according to the read value.

[0005] However, the above-mentioned method of allocating row identifiers needs to be saved to a file in a disk to update the record value in the file. Since I / O (Input / output) resources need to be used, the server resource load is increased. Summary of the invention

[0006] The present application provides a data processing method and device, an electronic device and a storage medium, so as to at least solve the problem of increased server resource load due to the need to use I / O resources in the way of allocating row identifiers in the related art.

[0007] According to one aspect of an embodiment of the present application, a data processing method is provided, including: receiving a first insert instruction, wherein the first insert instruction is used to insert a first record corresponding to first data in a first data page, and the first data page is a data page in a first data table on a first node; determining first association information of the first record, wherein the first association information is used to characterize the storage location of the first record on the first node; generating a first row identifier corresponding to the first record according to the first association information, wherein the first row identifier is used to uniquely identify the first record; and inserting the first record into the first data page, wherein the first record contains the first data and the first row identifier.

[0008] Optionally, determining the first associated information of the first record includes: determining the node serial number of the first node, the data table serial number of the first data table on the first node, and the data page serial number of the first data page in the first data table; determining the page offset of the first record in the first data page, wherein the first associated information includes: the node serial number, the data table serial number, the data page serial number, and the page offset.

[0009] Optionally, determining the page offset of the first record in the first data page includes: obtaining the starting position of a record preceding the first record in the first data page and the record length of the previous record; and determining the page offset of the first record in the first data page according to the starting position of the previous record and the record length of the previous record.

[0010] Optionally, according to the first association information, generating the first row identifier corresponding to the first record includes: initializing an initial row identifier containing multiple bytes; writing each sub-association information of the first association information into the corresponding byte position in the initial row identifier, to obtain the first row identifier, wherein the first association information includes the following sub-association information: the node serial number, the data table serial number, the data page serial number, and the page offset.

[0011] Optionally, writing each sub-association information of the first association information into the corresponding bytes in the initial row identifier includes: writing the node sequence number into the first byte position of the initial row identifier using the big-endian mode according to the number of bytes allocated for the node sequence number; writing the data table sequence number into the second byte position of the initial row identifier using the little-endian mode according to the number of bytes allocated for the data table sequence number and the data page sequence number, and writing the data page sequence number into the third byte position of the initial row identifier using the big-endian mode; writing the page offset into the fourth byte position of the initial row identifier using the big-endian mode according to the number of bytes allocated for the page offset.

[0012] Optionally, after writing the data page number to the third byte position of the initial row identifier using big-endian mode, the method further includes: when the number of bits required to store the data page number is greater than the total number of bits of bytes allocated for the data page number, obtaining at least one bit of data not stored in the data page number; and writing the at least one bit of data to at least one target data bit at the second byte position, wherein the at least one target data bit is one or more consecutive data bits adjacent to the second byte position and the third byte position.

[0013] Optionally, after inserting the first record into the first data page, the method further includes: receiving a target update instruction, wherein the target update instruction is used to update the first data recorded in the first record to target data; in response to the target update instruction, updating the data recorded in the first record to target data, wherein the row identifier of the first record is the first row identifier.

[0014] Optionally, after inserting the first record into the first data page, the method further includes: receiving a target deletion instruction, wherein the target deletion instruction is used to delete the data recorded in the first record; and in response to the target deletion instruction, deleting the data recorded in the first record and the first row identifier.

[0015] Optionally, the method also includes: after receiving the first insert instruction and before inserting the first record into the first data page, receiving a second insert instruction, wherein the second insert instruction is used to insert a second record corresponding to the second data in the second data page, and the second data page is a data page in the second data table on the second node; determining second association information of the second record, wherein the second association information is used to characterize the storage location of the second record on the second node; generating a second row identifier corresponding to the second record according to the second association information, wherein the second row identifier is used to uniquely identify the second record; and inserting the second record into the second data page, wherein the second record contains the second data and the second association information.

[0016] According to another aspect of an embodiment of the present application, a data processing device is also provided, including: a first receiving unit, used to receive a first insertion instruction, wherein the first insertion instruction is used to insert a first record corresponding to the first data in a first data page, and the first data page is a data page in a first data table on a first node; a first determination unit, used to determine first associated information of the first record, wherein the first associated information is used to characterize the storage location of the first record on the first node; a first generation unit, used to generate a first row identifier corresponding to the first record according to the first associated information, wherein the first row identifier is used to uniquely identify the first record; a first insertion unit, used to insert the first record into the first data page, wherein the first record contains the first data and the first row identifier.

[0017] Optionally, the first determination unit includes: a first determination module, used to determine the node serial number of the first node, the data table serial number of the first data table on the first node, and the data page serial number of the first data page in the first data table; a second determination module, used to determine the page offset of the first record in the first data page, wherein the first associated information includes: the node serial number, the data table serial number, the data page serial number, and the page offset.

[0018] Optionally, the second determination module includes: an acquisition submodule, used to acquire the starting position of the previous record of the first record in the first data page and the record length of the previous record; and a determination submodule, used to determine the page offset of the first record in the first data page according to the starting position of the previous record and the record length of the previous record.

[0019] Optionally, the first generation unit includes: an initialization module, used to initialize an initial row identifier containing multiple bytes; a writing module, used to write each sub-association information of the first association information into the corresponding byte position in the initial row identifier, to obtain the first row identifier, wherein the first association information includes the following sub-association information: the node serial number, the data table serial number, the data page serial number, and the page offset.

[0020] Optionally, the write module includes: a first write submodule, used to write the node sequence number to the first byte position of the initial row identifier using the big-endian mode according to the number of bytes allocated for the node sequence number; a second write submodule, used to write the data table sequence number to the second byte position of the initial row identifier using the little-endian mode according to the number of bytes allocated for the data table sequence number and the data page sequence number, and write the data page sequence number to the third byte position of the initial row identifier using the big-endian mode; a third write submodule, used to write the page offset to the fourth byte position of the initial row identifier using the big-endian mode according to the number of bytes allocated for the page offset.

[0021] Optionally, the device also includes: an acquisition unit, used to acquire at least one bit of data not stored in the data page number after writing the data page number to the third byte position of the initial row identifier in big-endian mode, when the number of bits required to store the data page number is greater than the total number of bits of bytes allocated for the data page number; and a writing unit, used to write the at least one bit of data to at least one target data bit at the second byte position, wherein the at least one target data bit is one or more consecutive data bits adjacent to the second byte position and the third byte position.

[0022] Optionally, the device also includes: a second receiving unit, used to receive a target update instruction after inserting the first record into the first data page, wherein the target update instruction is used to update the first data recorded in the first record to target data; an update unit, used to respond to the target update instruction, to update the data recorded in the first record to target data, wherein the row identifier of the first record is the first row identifier.

[0023] Optionally, the device also includes: a third receiving unit, used to receive a target deletion instruction after inserting the first record into the first data page, wherein the target deletion instruction is used to delete the data recorded in the first record; and a deletion unit, used to respond to the target deletion instruction and delete the data recorded in the first record and the first row identifier.

[0024] Optionally, the device also includes: a fourth receiving unit, used to receive a second insert instruction after receiving the first insert instruction and before inserting the first record into the first data page, wherein the second insert instruction is used to insert a second record corresponding to the second data in the second data page, and the second data page is a data page in the second data table on the second node; a second determination unit, used to determine second association information of the second record, wherein the second association information is used to characterize the storage location of the second record on the second node; a second generation unit, used to generate a second row identifier corresponding to the second record according to the second association information, wherein the second row identifier is used to uniquely identify the second record; a second insertion unit, used to insert the second record into the second data page, wherein the second record contains the second data and the second association information.

[0025] According to another aspect of the embodiments of the present application, there is also provided an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; wherein the memory is used to store a computer program; and the processor is used to execute the method steps in any of the above embodiments by running the computer program stored in the memory.

[0026] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the method steps in any of the above embodiments when executed.

[0027] In an embodiment of the present application, a logical position is used to replace a counter. By receiving a first insert instruction, wherein the first insert instruction is used to insert a first record corresponding to the first data in a first data page, and the first data page is a data page in a first data table on a first node; determining first association information of the first record, wherein the first association information is used to characterize the storage position of the first record on the first node; generating a first row identifier corresponding to the first record according to the first association information, wherein the first row identifier is used to uniquely identify the first record; inserting the first record into the first data page, wherein the first record contains the first data and the first row identifier. Since a rowid is generated for the record according to the association information of the record instead of taking a value from a counter, the rowid does not need to be saved to a file on a disk, and the record in the file does not need to be updated, so that the purpose of not accessing I / O resources can be achieved; and since the position of the record is known, there is no need for a CPU (Central Processing Unit) to calculate (for example, calculate the value taken from the counter, calculate the value updated to the disk), so that the purpose of saving CPU resources can be achieved, and the technical effect of reducing the server resource load is achieved, thereby solving the problem of an increase in server resource load due to the need to use I / O resources in the method of allocating row identifiers in the related art. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0029] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0030] Figure 1 is a schematic diagram of a hardware environment of an optional data processing method according to an embodiment of the present invention;

[0031] Figure 2 is a flowchart of an optional data processing method according to an embodiment of the present application;

[0032] Figure 3 is a schematic diagram of an optional data page according to an embodiment of the present application;

[0033] Figure 4 is a schematic diagram of an optional data page storage method according to an embodiment of the present application;

[0034] Figure 5 is a flowchart of another optional data processing method according to an embodiment of the present application;

[0035] Figure 6 is a structural block diagram of an optional data processing device according to an embodiment of the present application;

[0036] Figure 7 It is a structural block diagram of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0037] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0038] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application 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 interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0039] According to one aspect of an embodiment of the present application, a method for processing data is provided. Optionally, in this embodiment, the method for processing data can be applied to Figure 1 In the hardware environment composed of the terminal 102 and the server 104 shown in FIG. Figure 1 As shown, the server 104 is connected to the terminal 102 via a network, and can be used to provide services (such as game services, application services, etc.) for the terminal or a client installed on the terminal. A database can be set up on the server or independently of the server to provide data storage services for the server 104.

[0040] The network 104 includes but is not limited to at least one of the following: a wired network, a wireless network, the wired network may include but is not limited to at least one of the following: a wide area network, a metropolitan area network or a local area network, the wireless network may include but is not limited to at least one of the following: Bluetooth, WIFI (Wireless Fidelity) and other networks that implement wireless communication. The terminal 102 may be a terminal for computing data, such as a mobile terminal (such as a mobile phone, a tablet computer), a laptop computer, a PC, etc. The server may include but is not limited to any hardware device that can perform computing.

[0041] The data processing method of the embodiment of the present application can be executed by the server 104, or by other devices that can provide database services. Taking the data processing method of the embodiment of the present application as an example, Figure 2 is a flow chart of an optional data processing method according to an embodiment of the present application, such as Figure 2 As shown, the process of the method may include the following steps:

[0042] Step S202: receiving a first insert instruction, wherein the first insert instruction is used to insert a first record corresponding to the first data into a first data page, and the first data page is a data page in a first data table on a first node.

[0043] The data processing method in this embodiment can be applied to the scenario of assigning row identifiers (rowids) to records in a database (eg, MySQL). For other scenarios where row identifiers need to be assigned, the data processing method in this embodiment is also applicable.

[0044] The server may receive a first insert instruction, where the first insert instruction is used to insert a first record corresponding to the first data into a first data page, and the first data page is a data page in a first data table on a first node.

[0045] The first node may be a DN (Data Node), which is a single-node database. In a distributed database, the first node may be one of multiple nodes of the distributed database. The first node may contain multiple data tables, and the data table to be inserted into the first record is the first data table. The first data table may contain multiple data pages, and the first record is to be inserted into the first data page in the first data table.

[0046] For example, in a database (eg, a distributed database), data is stored in blocks in the format of pages, as shown in Table 1:

[0047] Table 1

[0048] Page1 Page2 Page3 Page4 Page5 Page6 Page7 Page8 …… 16k 16k 16k 16k 16k 16k 16k 16k ……

[0049] Table 1 shows a storage area of ​​table structure data, including multiple pages (data pages), each of which is 16k by default. The first record to be inserted may be a data page (eg, page 200) in a data table.

[0050] Step S204: determine first association information of the first record, wherein the first association information is used to represent a storage location of the first record on the first node.

[0051] For the first record, the server can determine the associated information of the record, that is, the first associated information, which is used to characterize the storage location of the first record on the first node, for example, which data page in which data table it is stored in, or at what position on a certain data page it is stored.

[0052] The storage location may be a logical location for storing the first record, which may be represented by all or part of a data table, a data page, and a page offset (record offset) recorded in the data page. Correspondingly, the first association information may include but is not limited to at least one of the following: an identifier of a data table (e.g., a logical sequence number of a data table), an identifier of a data page (e.g., a logical sequence number of a data page), a page offset, etc.

[0053] Step S206: Generate a first row identifier corresponding to the first record according to the first association information, wherein the first row identifier is used to uniquely identify the first record.

[0054] According to the first association information, the server may generate a first row ID corresponding to the first record, and the first row ID is used to uniquely identify the first record. Since the association information of the record is used to characterize the storage location of the record on the node, the storage locations of different records are different, and the row IDs generated according to the association information of different records are also different, so that the record can be uniquely identified.

[0055] The first association information may include multiple sub-association information, for example, a data table identifier, a data page identifier, a page offset, etc. The method of generating the above-mentioned first row identifier according to the first association information may be: generating the above-mentioned first row identifier according to the pre-configured order of different sub-association information and the size of the space occupied by each sub-association information.

[0056] For example, the first row identifier of the first record may be generated in the order of the data table identifier, the data page identifier, and the page offset.

[0057] Step S208: inserting a first record into a first data page, wherein the first record includes first data and a first row identifier.

[0058] After obtaining the above-mentioned first row identifier, the server may insert it into the first record, that is, insert it into the position where the row identifier is located in the record, to obtain the first record. The obtained first record may include the first data and the first row identifier.

[0059] For the first record, the server may insert it into the first data page. The method of inserting the record into the data page may refer to the relevant technology, which will not be described in detail in this embodiment.

[0060] Through the above steps S202 to S208, by receiving a first insert instruction, wherein the first insert instruction is used to insert a first record corresponding to the first data in the first data page, and the first data page is a data page in the first data table on the first node; determining first association information of the first record, wherein the first association information is used to characterize the storage location of the first record on the first node; generating a first row identifier corresponding to the first record according to the first association information, wherein the first row identifier is used to uniquely identify the first record; inserting the first record into the first data page, wherein the first record contains the first data and the first row identifier, thereby solving the problem of increased server resource load due to the need to use I / O resources in the method of allocating row identifiers in the related art, and reducing the server resource load.

[0061] As an optional embodiment, determining the first association information of the first record includes:

[0062] S11, determining a node serial number of a first node, a data table serial number of a first data table on the first node, and a data page serial number of a first data page in the first data table;

[0063] S12, determining a page offset of the first record in the first data page, wherein the first associated information includes: a node serial number, a data table serial number, a data page serial number, and a page offset.

[0064] In the related art, the rowid of each node in the distributed database is accumulated starting from 1, which will cause data duplication between different nodes. If the system is scaled down (data from different nodes are stored on one node), there will be a situation where the rowid corresponds to multiple records.

[0065] Optionally, in this embodiment, the row identifier of the record can be generated according to the node number, data table number, data page number and page offset. By recording the position of the node and adding the node information to the rowid, it can be ensured that there will be no duplication of rowids between different nodes in the distributed database, thereby avoiding the problem of duplicate row identifiers caused by system shrinkage, etc.

[0066] In a distributed database, each node can have a serial number. When the distributed database is started, a global variable can be initialized to record the node information (node ​​serial number), and the node serial number can be used to distinguish different nodes.

[0067] Each data table can have a logical serial number, and the data table serial number can be used to distinguish different data tables on the same node. The data in the data table can be stored in blocks in the format of pages. Each page has a logical serial number (page serial number), which is recorded as pageNo. The pageNo can be used to distinguish different data pages in the same data table, and then distinguish the record offsets in different page information to avoid duplication of rowid.

[0068] The starting position of the storage position recorded in the data page is the page offset recorded in the data page. In a data page, different records have different page offsets. Different records in the same data page can be distinguished by the page offset of the record.

[0069] For the first record, the server may respectively determine the node serial number of the first node, the data table serial number of the first data table on the first node, the data page serial number of the first data page in the first data table, and the page offset of the first record in the first data page, thereby obtaining first association information of the first record. The obtained first association information may uniquely represent the first record.

[0070] Through this embodiment, by obtaining the node serial number, data table serial number, data page serial number and page offset corresponding to the record, since the associated information of the record includes the ID of each node, it can be ensured that in a distributed database, there will be no data duplication in the rowid between different nodes.

[0071] As an optional embodiment, determining the page offset of the first record in the first data page includes:

[0072] S21, obtaining the starting position of a record before the first record in the first data page and the record length of the previous record;

[0073] S22, determining a page offset of the first record in the first data page according to the start position of the previous record and the record length of the previous record.

[0074] Page offset refers to the offset position of a record within a data page, that is, the starting position of the storage location of the record within the data page. The starting position of the first record generally starts from a specific position, which can be 120. The first 120 bits of the data page header can record some related information of some auxiliary records. The second record is the starting position of the first record plus the length of the first record, the third record is the starting position of the second record plus the length of the second record, and so on.

[0075] For example, Figure 3 In the data page shown, the offset address of the first record is 120, and the record length is 20; the offset address of the second record is 140, and the record length is 50; the offset address of the third record is 190, and the record length is 20; the offset address of the fourth record is 210, and the record length is 30. For a record, the first few bytes can store the rowid of the record, and then the data stored in the record can be stored.

[0076] For the first record, if the first record is the first record of the first data page, the server may determine the specific position as the page offset of the first record in the first data page.

[0077] If the first record is not the first record of the first data page, in order to determine the page offset (offset address) of the first record, the server can obtain the starting position of the previous record of the first record in the first data page and the record length of the previous record, and determine the page offset of the first record in the first data page according to the starting position of the previous record and the record length of the previous record. For example, the sum of the starting position of the previous record and the record length of the previous record is determined as the page offset of the first record in the first data page.

[0078] Through this embodiment, the page offset of the current record is determined according to the page offset and record length of the previous record of the current record, so that the accuracy of determining the page offset can be improved.

[0079] As an optional embodiment, generating a first row identifier corresponding to the first record according to the first association information includes:

[0080] S31, initializing an initial row identifier including multiple bytes;

[0081] S32, writing each sub-association information of the first association information into the corresponding byte position in the initial row identifier to obtain the first row identifier, wherein the first association information includes the following sub-association information: node serial number, data table serial number, data page serial number, page offset.

[0082] The sub-association information included in the first association information may include: a node sequence number, a data table sequence number, a data page sequence number, and a page offset. The server may generate a first row identifier corresponding to the first record according to the node sequence number, the data table sequence number, the data page sequence number, and the page offset. The order of different sub-association information (node ​​sequence number, data table sequence number, data page sequence number, and page offset) in the row identifier and the number of bytes occupied may be pre-configured.

[0083] The number of bytes allowed to be occupied by the row identifier and the byte position occupied by each sub-association information can be pre-configured. In order to generate the first row identifier corresponding to the first record, the server can first initialize an initial row identifier containing multiple bytes, and the number of bytes contained in the multiple bytes is the number of bytes allowed to be occupied by the row identifier; then, each sub-association information is written to the corresponding byte position in the initial row identifier, thereby obtaining the first row identifier.

[0084] When writing the sub-association information, different sub-association information can be written sequentially or in parallel. If there is an association relationship between the sub-association information, they are written in the order indicated by the association relationship, which is not limited in this embodiment.

[0085] Through this embodiment, by writing the node sequence number, data table sequence number, data page sequence number and page offset into the corresponding byte positions in the initial row identifier, the required row identifier is obtained, which can improve the efficiency of determining the row identifier and improve the ability of the row identifier to identify records.

[0086] As an optional embodiment, writing each sub-association information of the first association information into the corresponding bytes in the initial row identifier includes:

[0087] S41, writing the node sequence number to the first byte position of the initial row identifier in big endian mode according to the number of bytes allocated for the node sequence number;

[0088] S42, according to the total number of bytes allocated for the data table sequence number and the data page sequence number, write the data table sequence number into the second byte position of the initial row identifier in a little-endian mode, and write the data page sequence number into the third byte position of the initial row identifier in a big-endian mode;

[0089] S43, writing the page offset to the fourth byte position of the initial row identifier in big endian mode according to the number of bytes allocated for the page offset.

[0090] When writing each sub-association information, the server may adopt the same writing mode for writing, and the above writing mode may include but is not limited to at least one of the following: big endian mode, little endian mode.

[0091] Big endian mode (big endian mode) means: the high byte of the data is stored in the low address of the memory, and the low byte of the data is stored in the high address of the memory. This storage mode is similar to treating the data as a string sequence: the address increases from small to large, and the data is placed from high to low.

[0092] Little endian mode (little endian mode) means that the high byte of the data is stored in the high address of the memory, and the low byte of the data is stored in the low address of the memory. This storage mode can combine the high and low addresses with the data bit weights. The high address part has a high weight, and the low address part has a low weight.

[0093] For the node sequence number and page offset, the server may first convert them into corresponding string forms according to the number of bytes allocated, and store them in corresponding byte positions in bytes.

[0094] For example, the node number is 2, and the number of bytes allocated to it is 2. The server can convert it into the corresponding string form: 00000000|00000010, and write it to the corresponding two characters in big endian mode, with 00000000 occupying the first character position and 00000010 occupying the second character position.

[0095] For the data table sequence number and the data page sequence, the two can be assigned byte positions as a whole, the data table sequence number and the data page sequence number can share one or more bytes, and the byte positions occupied by the two can also be limited. For example, the data table sequence number occupies the first M bytes (or binary bits), and the data table sequence number occupies the following N bytes (or binary bits).

[0096] In order to ensure the flexibility of configuring the number of data tables and data pages, the server can use the little endian mode to write the data table number to the second byte position of the initial row identifier, and use the big endian mode to write the data page number to the third byte position of the initial row identifier. The second byte position and the third byte position can be complete byte positions or partial byte positions.

[0097] For example, a total of 4 bytes are allocated for the data table number and the data page number, wherein the first two bytes are allocated to the data table number by default, and the last two bytes are allocated to the data page number by default. The number of bytes occupied by the data table number and the data page number can be adjusted according to the allocation instruction.

[0098] After the node sequence number, data table sequence number, data page sequence number and page offset are respectively written into the corresponding byte positions in the initial row identifier, the first row identifier corresponding to the first record can be obtained.

[0099] Through this embodiment, a variety of data storage modes are used to write different sub-association information, which can improve the flexibility of row sequence determination and the flexibility of configuring the number of data tables and the number of data pages.

[0100] As an optional embodiment, after writing the data page sequence number into the third byte position of the initial row identifier in big endian mode, the method further includes:

[0101] S51, when the number of bits required to store the data page sequence number is greater than the total number of bits of bytes allocated for the data page sequence number, obtaining at least one bit of data not stored in the data page sequence number;

[0102] S52, writing at least one bit of data to at least one target data bit at the second byte position, wherein the at least one target data bit is one or more consecutive data bits adjacent to the second byte position and the third byte position.

[0103] After the data page number is written to the third byte position of the initial row identifier using the big-endian mode, if the number of bits required to store the data page number is greater than the total number of bytes allocated for the data page number, then what is stored at the third byte position is partial information of the data page number, and there is at least one bit of data that is not stored.

[0104] For example, the default number of bytes allocated for the data page number is 2 bytes, and the data page number requires a 20-bit binary number to identify it, so there are 4 bits of data that are not stored. Since the big-endian mode is used, these 4 bits of data are the high-order data of the data page number.

[0105] The server can obtain at least one bit of data not stored in the data page sequence number and write it to at least one target data bit at the second byte position. The at least one target data bit is one or more consecutive data bits adjacent to the second byte position and the third byte position.

[0106] The second byte position is a byte position for storing the data table sequence number, and may include one or more bytes. If the second byte position includes one byte, the at least one target data bit is a high data bit of the byte. If the second byte position includes multiple bytes, the at least one target data bit is a high data bit of a byte adjacent to the third byte position in the multiple bytes.

[0107] The number of data bits of at least one target data bit can be one or more. The threshold value of the number of data bits allowed to be occupied by the data page number can be configured as needed, and the number of data bits occupied by the data page number does not exceed the threshold value; alternatively, the number of data bits occupied by the data page number can be configured as needed, regardless of whether there are unstored data page numbers or whether the number of bits of the data of the unstored data page numbers reaches the configured number, these data bits will be occupied (0 can be added when the bit data is insufficient).

[0108] For example, the server can generate a rowid based on the node number, the data table number (table number), the data page number (page number, PageNo) and the page offset (record offset). The generated rowid includes three parts: the first part corresponding to the node number, the second part corresponding to the table number and page number, and the third part corresponding to the page offset. The order of these three parts can be: node information | table number and PageNo | page offset, and the number of bytes required to store the rowid is 8 bytes.

[0109] When generating a rowid, the server can define an 8-byte string to store the information of each part of the rowid. The rowid is defined as: Unsigned char rowid[8].

[0110] The node number is N, stored in the first part of the rowid, and is defined as:

[0111] rowid[0] = (unsigned char), stores (N>>8), that is, the value of N shifted right by 8 bits, or divided by 2 8 The value obtained later;

[0112] rowid[1]=(unsigned char), stores (N), that is, the first 8 bits of N.

[0113] The first part is the first two bytes of the rowid, which is applicable to systems with a maximum of 65536 nodes.

[0114] The table number is T, stored in the first two bytes (or the first half byte) of the second part of the rowid, generated in little-endian mode, and defined as follows:

[0115] rowid[2] = (unsigned char), stores T, i.e., the first 8 bits of T;

[0116] rowid[3]=(unsigned char), stores (T>>8), that is, the value obtained by shifting the binary number of T right by 8 bits.

[0117] The table number occupies a maximum of 12 bits of the second part. If it exceeds 12 bits, it may be overwritten (or directly overwritten), thereby weakening the existence of the table.

[0118] The page number is P, which is stored in the last two bytes (or the last two half bytes) of the second part of the rowid and is generated in big-endian mode. It is defined as follows:

[0119] rowid[4] = (unsigned char), stores (P>>8), that is, the first 8 bits of the value obtained by shifting the binary number of P right by 8 bits;

[0120] rowid[5]=(unsigned char), stores P, that is, the first 8 bits of P.

[0121] If two bytes cannot store the page number, multiple bits in rowid[3] need to be occupied. The page number occupies up to 20 bits, so it can occupy up to four bits (high four bits) in rowid[3]. Alternatively, the high four bits of rowid[3] can be directly configured to be occupied. When occupying, the occupation starts from the high bit. The binary value that needs to be occupied may be (P>>16). After occupation, rowid[3] is: rowid[3]|((P>>16)&0x1)<<7|((P>>16)&0x2)<<5|((P>>16)&0x4)<<3|((P>>16)&0x8)<<1.

[0122] If the page number is stored in more than 16 bits, that is, greater than 65535, the part greater than 65535, such as Figure 5 As shown, the high four bits of rowid[3] are stored in the same way as the low bits are stored in the high bits:

[0123] ((P>>16)&0x1)<<7, the first bit is stored at bit 7 (counting starts at 0);

[0124] ((P>>16)&0x2)<<5, the second bit is stored at bit 6 (counting starts at 0);

[0125] ((P>>16)&0x4)<<3, the third bit is stored at bit 5 (counting starts at 0);

[0126] ((P>>16)&0x8)<<1, the fourth bit is stored at position 4 (counting starts at 0).

[0127] The page offset is F, which is stored in the third part of the rowid (two characters in total), generated in big-endian mode, and is defined as:

[0128] rowid[6] = (unsigned char), stores (F>>8), that is, the value obtained by shifting the binary number of F right by 8 bits;

[0129] rowid[7]=(unsigned char), stores (F), that is, the first 8 bits of F.

[0130] Through this embodiment, at least one bit of data not stored in the page number is stored in one or more consecutive data bits adjacent to the third byte position in the second byte position, so that the existence of the table can be weakened. This is suitable for scenarios with a large number of data pages and improves the ability of the generated row identifier to represent the data page.

[0131] It should be noted that rowid is used to identify a record, not to find records. Therefore, even if the data bits storing the data table sequence number are overwritten, it does not affect the use of rowid.

[0132] As an optional embodiment, after inserting the first record into the first data page, the method further includes:

[0133] S61, receiving a target update instruction, wherein the target update instruction is used to update first data recorded in a first record to target data;

[0134] S62, in response to the target update instruction, updating the data recorded in the first record to the target data, wherein the row identifier of the first record is the first row identifier.

[0135] If the server receives a target update instruction (update), the target update instruction is used to update the first data recorded in the first record to the target data. In response to the target update instruction, the server can update the data recorded in the first record to the target data.

[0136] If the storage location of the first record remains unchanged, the rowid remains unchanged, and the row identifier of the updated first record is the first row identifier. If the first record is stored in a new location, since the rowid is used to record the uniqueness of the identified data rather than the logical address of the data, the rowid still retains the original value and uses the rowid of the original data. The row identifier of the updated first record is still the first row identifier.

[0137] Through this embodiment, the row identifier is kept unchanged when the recorded data is updated, which can ensure the convenience of data recording and reduce the resource consumption of calculating the row identifier.

[0138] As an optional embodiment, after inserting the first record into the first data page, the method further includes:

[0139] S71, receiving a target deletion instruction, wherein the target deletion instruction is used to delete data recorded in the first record;

[0140] S72, responding to the target deletion instruction, deleting the data recorded in the first record and the first row identifier.

[0141] If the server receives a target deletion instruction (delete), the target deletion instruction is used to delete the data recorded in the first record. In response to the target update instruction, the server can delete the data recorded in the first record.

[0142] Since rowid is used to record the uniqueness of the identified data, after the data is deleted, the rowid will become useless information, and the rowid can be deleted together when deleting the data. For the first record, the server can delete both the data recorded in the first record and the first row identifier.

[0143] Through this embodiment, the row identifier is deleted while the data is deleted, so that the occupation of storage resources by the row identifier can be reduced, thereby saving storage resources.

[0144] In addition, it should be noted that if the location of the newly inserted data is the location of a previously deleted record, since the associated information (node ​​number, data table number, data page number and page offset) are the same, the generated rowid remains consistent with the rowid of the original record.

[0145] As an optional embodiment, the above method further includes:

[0146] S81, after receiving the first insert instruction and before inserting the first record into the first data page, receiving a second insert instruction, wherein the second insert instruction is used to insert a second record corresponding to the second data into the second data page, and the second data page is a data page in the second data table on the second node;

[0147] S82, determining second association information of the second record, wherein the second association information is used to represent a storage location of the second record on the second node;

[0148] S83, generating a second row identifier corresponding to the second record according to the second association information, wherein the second row identifier is used to uniquely identify the second record;

[0149] S84, inserting a second record into the second data page, wherein the second record includes second data and second association information.

[0150] The use of logical position generation counters can avoid problems caused by accumulators. For example, when multiple threads are running concurrently, they need to take values ​​from the same accumulator. Therefore, serial access needs to be locked, which affects high concurrency performance.

[0151] Optionally, in this embodiment, since there is no need to fetch values ​​from the same accumulator, when one thread (the thread inserting data) is executing the operation of generating a rowid, if other threads also need to execute the operation of generating a rowid, these threads can access in parallel.

[0152] For the first record, while the first data is inserted by the first thread, if a second insert instruction is received, the second insert instruction is used to insert a second record corresponding to the second data in the second data page, and the second data page is a data page in the second data table on the second node.

[0153] In response to the second insert instruction, the server may generate a second row identifier for the second record and insert the second record into the second data page in the same or similar manner as the above-mentioned processing of the first insert instruction, which is not described in detail here.

[0154] Through this embodiment, when multiple threads are concurrent, parallel access is used for processing, thereby improving the concurrent performance.

[0155] The following is an explanation of the data processing method in the embodiment of the present application in conjunction with an optional example. In this example, the database is a distributed database, the row identifier is rowid, the node information occupies 2 bytes, the data table sequence number and the data page sequence number occupies a total of 4 bytes (the data table sequence number occupies the first 1 byte), and the page offset occupies 2 bytes.

[0156] like Figure 5 As shown, the process of the data processing method in this optional example may include the following steps:

[0157] Step S502: receiving an instruction to insert data.

[0158] A server of a distributed database (which may be a node in a distributed database) may receive an instruction to insert a piece of data.

[0159] Step S504: Generate a rowid for the record corresponding to the data.

[0160] In the distributed database, this data is routed to the node with the node number 02 and stored in the data table with the data table number 03 in the node. In the table data file, the table already has 500 data pages (pages), and this data needs to be added to the 500th data page, which has the data page number 499. There are already three data on this page, and this page should be inserted at the position of the fourth data, and the page offset of this position is 210.

[0161] The node number (N) is 02, then the first 8 bits of N are 2, (N>>8) is 0, and the first two bytes of rowid are: 00000000|00000010. The table number (T) is 003, then the first 8 bits of T are 3, (T>>8) is 0, and the 3rd and 4th bytes of rowid are: 00000011|00000000. The page number (P) is 499, then the first 8 bits of P are 243, (T>>8) is 1, and the 5th and 6th bytes of rowid are: 00000001|11110011. The page offset (F) is 210, then the first 8 bits of F are 210, (F>>8) is 0, and the 7th and 8th bytes of rowid are: 00000000|11010010. Then, the rowid generated for this data record is: 00002|50332147|00210.

[0162] Step S506: write the record corresponding to the data into the data page.

[0163] After obtaining the rowid, the server can store the rowid and data as a record and write the record to the 200th data page.

[0164] Through this example, rowid does not need to be saved to a file or update records. Therefore, there is no need to access I / O resources, which can reduce the server resource load. When multiple threads are concurrent, parallel access can be performed to improve concurrency performance. In addition, since CPU calculation is not required, CPU resources can be saved. In addition, in a distributed database, rowid contains the id of each node, and rowid data will not be repeated between different nodes.

[0165] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0166] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, 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 application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM (Read-Only Memory) / RAM (Random Access Memory), a disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0167] According to another aspect of an embodiment of the present application, a data processing device for implementing the above-mentioned data processing method is also provided. Figure 6 is a structural block diagram of an optional data processing device according to an embodiment of the present application, such as Figure 6 As shown, the device may include:

[0168] A first receiving unit 602 is configured to receive a first insert instruction, wherein the first insert instruction is configured to insert a first record corresponding to the first data into a first data page, where the first data page is a data page in a first data table on a first node;

[0169] A first determining unit 604, connected to the first receiving unit 602, and configured to determine first associated information of the first record, wherein the first associated information is used to represent a storage location of the first record on the first node;

[0170] A first generating unit 606, connected to the first determining unit 604, is used to generate a first row identifier corresponding to the first record according to the first association information, wherein the first row identifier is used to uniquely identify the first record;

[0171] The first inserting unit 608 is connected to the first generating unit 606 and is used to insert a first record into the first data page, wherein the first record includes first data and a first row identifier.

[0172] It should be noted that the first receiving unit 602 in this embodiment can be used to execute the above step S202, the first determining unit 604 in this embodiment can be used to execute the above step S204, the first generating unit 606 in this embodiment can be used to execute the above step S206, and the first inserting unit 608 in this embodiment can be used to execute the above step S208.

[0173] Through the above module, by receiving a first insert instruction, wherein the first insert instruction is used to insert a first record corresponding to the first data in a first data page, and the first data page is a data page in a first data table on a first node; determining first association information of the first record, wherein the first association information is used to characterize the storage location of the first record on the first node; generating a first row identifier corresponding to the first record according to the first association information, wherein the first row identifier is used to uniquely identify the first record; inserting the first record into the first data page, wherein the first record contains the first data and the first row identifier, thereby solving the problem of increased server resource load due to the need to use I / O resources in the method of allocating row identifiers in the related art, and reducing the server resource load.

[0174] As an optional embodiment, the first determining unit 604 includes:

[0175] A first determining module, used to determine a node serial number of a first node, a data table serial number of a first data table on the first node, and a data page serial number of a first data page in the first data table;

[0176] The second determination module is used to determine the page offset of the first record in the first data page, wherein the first associated information includes: a node serial number, a data table serial number, a data page serial number, and a page offset.

[0177] As an optional embodiment, the second determining module includes:

[0178] An acquisition submodule, used for acquiring a starting position of a record preceding a first record in a first data page and a record length of the previous record;

[0179] The determination submodule is used to determine the page offset of the first record in the first data page according to the starting position of the previous record and the record length of the previous record.

[0180] As an optional embodiment, the first generating unit 606 includes:

[0181] An initialization module, used for initializing an initial row identifier containing multiple bytes;

[0182] The writing module is used to write each sub-association information of the first association information into the corresponding byte position in the initial row identifier to obtain the first row identifier, wherein the first association information includes the following sub-association information: node serial number, data table serial number, data page serial number, page offset.

[0183] As an optional embodiment, the writing module includes:

[0184] A first writing submodule, used for writing the node sequence number to the first byte position of the initial row identifier in a big endian mode according to the number of bytes allocated for the node sequence number;

[0185] A second writing submodule is used to write the data table sequence number to the second byte position of the initial row identifier in a little-endian mode according to the number of bytes allocated for the data table sequence number and the data page sequence number, and to write the data page sequence number to the third byte position of the initial row identifier in a big-endian mode;

[0186] The third writing submodule is used to write the page offset to the fourth byte position of the initial row identifier in big endian mode according to the number of bytes allocated for the page offset.

[0187] As an optional embodiment, the above device also includes:

[0188] an acquisition unit, configured to, after writing the data page sequence number to the third byte position of the initial row identifier in a big-endian mode, acquire at least one bit of data not stored in the data page sequence number when the number of bits required to store the data page sequence number is greater than the total number of bits of bytes allocated for the data page sequence number;

[0189] A writing unit is used to write at least one bit of data to at least one target data bit at the second byte position, wherein the at least one target data bit is one or more consecutive data bits adjacent to the second byte position and the third byte position.

[0190] As an optional embodiment, the above device also includes:

[0191] A second receiving unit, configured to receive a target update instruction after inserting the first record into the first data page, wherein the target update instruction is used to update the first data recorded in the first record to the target data;

[0192] The updating unit is used to respond to the target update instruction and update the data recorded in the first record to the target data, wherein the row identifier of the first record is the first row identifier.

[0193] As an optional embodiment, the above device also includes:

[0194] A third receiving unit, configured to receive a target deletion instruction after inserting the first record into the first data page, wherein the target deletion instruction is used to delete the data recorded in the first record;

[0195] The deleting unit is used to respond to the target deletion instruction and delete the data recorded in the first record and the first row identifier.

[0196] As an optional embodiment, the above device also includes:

[0197] a fourth receiving unit, configured to receive a second insert instruction after receiving the first insert instruction and before inserting the first record into the first data page, wherein the second insert instruction is used to insert a second record corresponding to the second data into the second data page, and the second data page is a data page in the second data table on the second node;

[0198] A second determining unit, configured to determine second associated information of the second record, wherein the second associated information is used to represent a storage location of the second record on the second node;

[0199] A second generating unit, configured to generate a second row identifier corresponding to the second record according to the second association information, wherein the second row identifier is used to uniquely identify the second record;

[0200] The second inserting unit is used to insert a second record into the second data page, wherein the second record includes second data and second associated information.

[0201] It should be noted that the examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the contents disclosed in the above embodiments. It should be noted that the above modules as part of the device can be run in Figure 1 In the hardware environment shown, it can be implemented by software or by hardware, wherein the hardware environment includes a network environment.

[0202] According to another aspect of an embodiment of the present application, an electronic device for implementing the above-mentioned data processing method is also provided. The electronic device may be a server, a terminal, or a combination thereof.

[0203] Figure 7 is a structural block diagram of an optional electronic device according to an embodiment of the present application, such as Figure 7 As shown, it includes a processor 702, a communication interface 704, a memory 706 and a communication bus 708, wherein the processor 702, the communication interface 704 and the memory 706 communicate with each other through the communication bus 708, wherein,

[0204] Memory 706, used to store computer programs;

[0205] The processor 702 is used to implement the following steps when executing the computer program stored in the memory 706:

[0206] S1, receiving a first insert instruction, wherein the first insert instruction is used to insert a first record corresponding to first data in a first data page, and the first data page is a data page in a first data table on a first node;

[0207] S2, determining first association information of the first record, wherein the first association information is used to represent a storage location of the first record on the first node;

[0208] S3, generating a first row identifier corresponding to the first record according to the first association information, wherein the first row identifier is used to uniquely identify the first record;

[0209] S4, inserting a first record into a first data page, wherein the first record includes first data and a first row identifier.

[0210] Optionally, in this embodiment, the communication bus may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0211] The communication interface is used for communication between the above electronic device and other devices.

[0212] The memory may include RAM, or may include non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0213] As an example, the memory 706 may include, but is not limited to, the first receiving unit 602, the first determining unit 604, the first generating unit 606, and the first inserting unit 608 in the data processing device. In addition, other module units in the data processing device may also be included but are not limited to, which will not be described in detail in this example.

[0214] The processor can be a general-purpose processor, including but not limited to: CPU, NP (Network Processor), etc.; it can also be DSP (Digital Signal Processing), ASIC (Application Specific Integrated Circuit), FPGA (Field-Programmable Gate Array) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0215] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment will not be described in detail here.

[0216] It can be understood by those skilled in the art that Figure 7 The structure shown is for illustration only. The device for implementing the above data processing method may be a terminal device, which may be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, MID), a PAD, and other terminal devices. Figure 7 The structure of the electronic device is not limited. Figure 7 More or fewer components (such as network interfaces, display devices, etc.) shown in, or having Figure 7 Different configurations shown.

[0217] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, which can include: a flash drive, ROM, RAM, a magnetic disk or an optical disk, etc.

[0218] According to another aspect of the embodiments of the present application, a storage medium is further provided. Optionally, in this embodiment, the storage medium can be used to execute the program code of any of the above data processing methods in the embodiments of the present application.

[0219] Optionally, in this embodiment, the storage medium may be located on at least one network device among a plurality of network devices in the network shown in the above embodiment.

[0220] Optionally, in this embodiment, the storage medium is configured to store program codes for executing the following steps:

[0221] S1, receiving a first insert instruction, wherein the first insert instruction is used to insert a first record corresponding to first data in a first data page, and the first data page is a data page in a first data table on a first node;

[0222] S2, determining first association information of the first record, wherein the first association information is used to represent a storage location of the first record on the first node;

[0223] S3, generating a first row identifier corresponding to the first record according to the first association information, wherein the first row identifier is used to uniquely identify the first record;

[0224] S4, inserting a first record into a first data page, wherein the first record includes first data and a first row identifier.

[0225] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, which will not be described in detail in this embodiment.

[0226] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media that can store program codes, such as a USB flash drive, a ROM, a RAM, a mobile hard disk, a magnetic disk, or an optical disk.

[0227] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0228] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.

[0229] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0230] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0231] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution provided in this embodiment.

[0232] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0233] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A data processing method, characterized in that: include: A first insert instruction is received, wherein the first insert instruction is used to insert a first record corresponding to the first data in a first data page, and the first data page is a data page in a first data table on a first node; Determine first association information of the first record, the first association information is used to characterize the storage location of the first record on the first node, the first association information includes: a node sequence number, a data table sequence number, a data page sequence number, and a page offset; wherein determining the first association information of the first record includes: determining the node sequence number of the first node, the data table sequence number of the first data table on the first node, the data page sequence number of the first data page in the first data table, and the page offset of the first record in the first data page; Generate a first row identifier corresponding to the first record according to the first association information, wherein the first row identifier is used to uniquely identify the first record; Inserting the first record into the first data page, wherein the first record includes the first data and the first row identifier; receiving a target update instruction, wherein the target update instruction is used to update the first data recorded in the first record to target data; In response to the target update instruction, the data recorded in the first record is updated to target data, wherein the row identifier of the first record is the first row identifier.

2. The method according to claim 1, characterized in that Determining the page offset of the first record in the first data page includes: Obtaining a starting position of a record preceding the first record in the first data page and a record length of the previous record; The page offset of the first record in the first data page is determined according to the starting position of the previous record and the record length of the previous record.

3. The method according to claim 1, characterized in that Generating the first row identifier corresponding to the first record according to the first association information includes: Initialize the initial row identifier containing multiple bytes; Each sub-association information of the first association information is written into the corresponding byte position in the initial row identifier to obtain the first row identifier, wherein the first association information includes the following sub-association information: the node serial number, the data table serial number, the data page serial number, and the page offset.

4. The method according to claim 3, characterized in that Writing each sub-association information of the first association information into corresponding bytes in the initial row identifier includes: Writing the node sequence number to the first byte position of the initial row identifier in big endian mode according to the number of bytes allocated for the node sequence number; According to the total number of bytes allocated for the data table sequence number and the data page sequence number, the data table sequence number is written into the second byte position of the initial row identifier in a little endian mode, and the data page sequence number is written into the third byte position of the initial row identifier in a big endian mode; The page offset is written to the fourth byte position of the initial row identifier in big endian mode according to the number of bytes allocated for the page offset.

5. The method according to claim 4, characterized in that After writing the data page sequence number into the third byte position of the initial row identifier in big endian mode, the method further includes: When the number of bits required to store the data page sequence number is greater than the total number of bits of bytes allocated for the data page sequence number, obtaining at least one bit of data not stored in the data page sequence number; The at least one bit of data is written to at least one target data bit of the second byte position, wherein the at least one target data bit is one or more consecutive data bits of the second byte position adjacent to the third byte position.

6. The method according to claim 1, characterized in that After inserting the first record into the first data page, the method further includes: receiving a target deletion instruction, wherein the target deletion instruction is used to delete the data recorded in the first record; In response to the target deletion instruction, the data recorded in the first record and the first row identifier are deleted.

7. The method according to any one of claims 1 to 6, characterized in that The method further comprises: After receiving the first insert instruction and before inserting the first record into the first data page, receiving a second insert instruction, wherein the second insert instruction is used to insert a second record corresponding to the second data into the second data page, and the second data page is a data page in the second data table on the second node; Determine second association information of the second record, wherein the second association information is used to represent a storage location of the second record on the second node; Generate a second row identifier corresponding to the second record according to the second association information, wherein the second row identifier is used to uniquely identify the second record; Insert the second record into the second data page, wherein the second record includes the second data and the second association information.

8. A data processing device, characterized in that: include: A first receiving unit, configured to receive a first insert instruction, wherein the first insert instruction is used to insert a first record corresponding to the first data in a first data page, and the first data page is a data page in a first data table on a first node; a first determining unit, configured to determine first associated information of the first record, the first associated information being used to characterize a storage location of the first record on the first node, the first associated information comprising: a node serial number, a data table serial number, a data page serial number, and a page offset; wherein determining the first associated information of the first record comprises: determining the node serial number of the first node, the data table serial number of the first data table on the first node, the data page serial number of the first data page in the first data table, and the page offset of the first record in the first data page; a first generating unit, configured to generate a first row identifier corresponding to the first record according to the first association information, wherein the first row identifier is used to uniquely identify the first record; a first inserting unit, configured to insert the first record into the first data page, wherein the first record includes the first data and the first row identifier; A second receiving unit, configured to receive a target update instruction, wherein the target update instruction is used to update the first data recorded in the first record to target data; An updating unit is used to respond to the target update instruction and update the data recorded in the first record to target data, wherein the row identifier of the first record is the first row identifier.

9. An electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein: The processor, the communication interface and the memory communicate with each other via the communication bus, wherein: The memory is used to store computer programs; The processor is configured to execute the method steps of any one of claims 1 to 7 by running the computer program stored in the memory.

10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method steps described in any one of claims 1 to 7 when run.