An index entry generation method, device and equipment for a large object data block index
By retrieving and determining the adjacent sequence numbers of large object data in the database, and using the branch index sequence number encoding method, the write amplification problem during LOB type data insertion is solved, simplifying data insertion operations and reducing management complexity.
Patent Information
- Application Number
- CN202211295550.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-21
- Publication Date
- 2026-02-24
- Estimated Expiration
- 2042-10-21
AI Technical Summary
Existing databases are prone to significant write amplification issues when performing LOB type data insertion operations, resulting in complex and inefficient data insertion operations.
By obtaining the sequence number of the preceding large object data adjacent to the target data in the stored large object data, it is determined whether its subsequent sequence number is occupied. If it is occupied, the branch index sequence number is determined based on the different encoding arrangement order and added to the large object data block index, thus avoiding the need to re-encode all large object data block indexes.
It effectively reduces read/write amplification issues in large object management, simplifies data insertion processes, and avoids affecting the sequence number encoding order of stored large object data block indexes.
Smart Images

Figure CN115577009B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of database technology, and in particular to a method, apparatus and device for generating index entries for a large object data block index. Background Technology
[0002] LOB (Large Object) is a data type used to store large amounts of data, applicable to business areas with very large data volumes, such as medical records (e.g., X-rays), videos, and images. Currently, LOB is divided into two types: BLOB and CLOB: (1) CLOB, which is a character-based large object, related to the character set and suitable for storing text data such as documents and large books, as well as XML data. (2) BLOB, which is a binary large object, suitable for storing byte stream data such as images and audio. Extra-large LOB data has two meanings: 1. The value of a certain LOB field in a specific row of the table is huge; 2. The value of the LOB field itself is not very large, but the number of rows in the table is large, resulting in a huge total amount of data in the LOB field.
[0003] In most commercial or open-source databases, management is based on storage blocks (e.g., Page / Chunk / Block). For ordinary data types, a data row does not span multiple storage blocks. Large objects can support very large data (e.g., Oracle can support 128TB large objects), and the data columns of large objects generally exceed a single storage block, thus requiring a separate storage management method for large objects.
[0004] In existing technologies, such as commercial databases or open-source databases, the main approach is to perform complex and special processing on large objects in the storage engine to handle the differences between large objects and ordinary data types. However, this can easily introduce significant write amplification problems in operations such as inserting large objects. Summary of the Invention
[0005] The embodiments of this specification provide a method, apparatus, and device for generating index entries for a large object data block index, which can effectively solve the write amplification problem caused by existing databases when performing LOB type data insertion operations.
[0006] To solve the above-mentioned technical problems, the embodiments in this specification are implemented as follows:
[0007] This specification provides an embodiment of a method for generating index entries for a large object data block index, the method comprising:
[0008] Obtain a first sequence number, which is the sequence number of the preceding large object data that is adjacent to the target data in the data dimension in the stored large object data. The target data is the data to be inserted into the stored large object data. The first sequence number is generated according to the first encoding arrangement order.
[0009] According to the first coding arrangement order, determine whether the second sequence number adjacent to and following the first sequence number is occupied, and obtain the first determination result;
[0010] If the first determination result indicates that the second sequence number is occupied, then based on the second encoding arrangement order, the branch index sequence number of the target data in the large object data block index is determined;
[0011] An index entry containing the branch index sequence number is added to the large object data block index, wherein the index entry containing the branch index sequence number is located in the large object data block index between the index entry with the first sequence number and the index entry with the second sequence number.
[0012] This specification provides an embodiment of an index entry generation apparatus for a large object data block index, the apparatus comprising:
[0013] The acquisition module acquires a first sequence number, which is the sequence number of the preceding large object data that is adjacent to the target data in the data dimension in the stored large object data. The target data is the data to be inserted into the stored large object data. The first sequence number is generated according to the first encoding arrangement order.
[0014] The judgment module determines, according to the first encoding arrangement order, whether the second sequence number adjacent to and following the first sequence number is occupied, and obtains the first judgment result;
[0015] If the first judgment result indicates that the second sequence number is occupied, the determination module determines the branch index sequence number of the target data in the large object data block index based on the second encoding arrangement order.
[0016] The generation module adds an index entry containing the branch index sequence number to the large object data block index, wherein the index entry containing the branch index sequence number is located in the large object data block index between the index entry with the first sequence number and the index entry with the second sequence number.
[0017] This specification provides an embodiment of an index entry generation device for a large object data block index, comprising:
[0018] At least one processor; and,
[0019] A memory communicatively connected to the at least one processor; wherein,
[0020] The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enable the at least one processor to:
[0021] Obtain a first sequence number, which is the sequence number of the preceding large object data that is adjacent to the target data in the data dimension in the stored large object data. The target data is the data to be inserted into the stored large object data. The first sequence number is generated according to the first encoding arrangement order.
[0022] According to the first coding arrangement order, determine whether the second sequence number adjacent to and following the first sequence number is occupied, and obtain the first determination result;
[0023] If the first determination result indicates that the second sequence number is occupied, then based on the second encoding arrangement order, the branch index sequence number of the target data in the large object data block index is determined;
[0024] An index entry containing the branch index sequence number is added to the large object data block index, wherein the index entry containing the branch index sequence number is located in the large object data block index between the index entry with the first sequence number and the index entry with the second sequence number.
[0025] At least one embodiment provided in this specification can achieve the following beneficial effects:
[0026] When inserting target data, the first sequence number of the preceding large object data adjacent to the target data in the data dimension is obtained from the stored large object data. If the second sequence number is occupied, the branch index sequence number of the target data is determined based on a second encoding arrangement order different from the first encoding arrangement order. The index entry containing the branch index sequence number is then added to the large object data block index. This transforms the management of large object data into the management of large object data block indexes, effectively reducing the read / write amplification problem in large object management. Furthermore, using branch index sequence number encoding avoids the influence of the encoding order of the sequence numbers of the stored large object data block indexes, eliminating the need to re-encode all large object data block indexes and significantly simplifying the data insertion process. Attached Figure Description
[0027] To more clearly illustrate the technical solutions in the embodiments or prior art of this specification, the drawings used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0028] Figure 1 A flowchart illustrating a method for generating index entries for a large object data block index, provided in an embodiment of this specification.
[0029] Figure 2 The embodiments provided in this specification correspond to Figure 1 A swimlane diagram of a method for generating index entries in a large object data block index;
[0030] Figure 3 This diagram illustrates the correspondence between the main table, the large object data block index table, and the large object data block in the embodiments of this specification.
[0031] Figure 4 The embodiments provided in this specification correspond to Figure 1 A flowchart illustrating the specific application of sequence number encoding in an index entry generation method for a large object data block index;
[0032] Figure 5 This is a schematic diagram illustrating an example of a method for generating index entries for a large object data block index provided in the embodiments of this specification.
[0033] Figure 6 A schematic diagram illustrating another example of the method for generating index entries for a large object data block index provided in the embodiments of this specification;
[0034] Figure 7 This is a schematic diagram illustrating an example of offline updating of forward sequence number encoding in the index entry generation method for the large object data block index provided in the embodiments of this specification;
[0035] Figure 8 This is a schematic diagram illustrating an example of offline updating of sequence number encoding in the index entry generation method for the large object data block index provided in the embodiments of this specification;
[0036] Figure 9 This is a schematic diagram illustrating an example of offline updating of backward sequence number encoding in the index entry generation method for the large object data block index provided in the embodiments of this specification;
[0037] Figure 10 The embodiments provided in this specification correspond to Figure 1 A schematic diagram of the structure of an index entry generation device for a large object data block index;
[0038] Figure 11 The embodiments provided in this specification correspond to Figure 1 A schematic diagram of the structure of an index entry generation device for a large object data block index. Detailed Implementation
[0039] To make the objectives, technical solutions, and advantages of one or more embodiments of this specification clearer, the technical solutions of one or more embodiments of this specification will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this specification, and not all of them. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort are within the protection scope of one or more embodiments of this specification.
[0040] The technical solutions provided in the various embodiments of this specification are described in detail below with reference to the accompanying drawings.
[0041] In existing technologies, due to the Insert operation in Lob types, inserting large objects often involves inserting a new storage block between two consecutive storage blocks. Current techniques typically shift the content or sequence number following the inserted block one level to the right. This often requires relocating or recoding all storage blocks after the inserted data, increasing operational complexity. This disrupts the original ordered storage blocks, leading to sequence number confusion and introducing significant write amplification issues. Therefore, existing technologies for inserting Lob type data in databases are not user-friendly; the data insertion process is complex, inefficient, and fails to meet expectations.
[0042] To address the shortcomings of existing technologies, this solution provides the following embodiments:
[0043] Figure 1 This is a flowchart illustrating a method for generating index entries for a large object data block index according to an embodiment of this specification. The execution entity of the large object management method provided in this embodiment can be a database server.
[0044] like Figure 1 As shown, the method for generating index entries for the large object data block index may include the following steps:
[0045] Step 101: Obtain the first sequence number. The first sequence number is the sequence number of the preceding large object data that is adjacent to the target data in the data dimension in the stored large object data. The target data is the data to be inserted into the stored large object data. The first sequence number is generated according to the first encoding arrangement order.
[0046] In the embodiments of this specification, the target data can be large object data to be stored, which needs to be inserted into the already stored large object data. Specifically, it can be a data slice, a complete data, or a collection of multiple data, without being specifically limited here.
[0047] In specific application scenarios, during a single data insertion process, the number of target data can be one or more, and the insertion positions of multiple target data can be the same or different, without specific limitations.
[0048] In the stored large object data into which the target data needs to be inserted, for the data dimension, the insertion position of the target data has a preceding large object and a following large object that are adjacent to each other. The first sequence number can be the sequence number mapped by the preceding large object.
[0049] The first encoding arrangement order can be the sequence number encoding arrangement rule of the level sequence number where the first sequence number is located. The first sequence number is generated according to the first encoding arrangement order.
[0050] For example, if the first sequence number is a level sequence number located in the first level (level 1), then the level sequence numbers of the first level are arranged sequentially according to the first code arrangement order. The first code arrangement order can be natural numbers, letters, or other identification symbols that can represent the order of precedence, etc., without specific limitations.
[0051] In this embodiment of the specification, before performing step 101, a correspondence between the large object data block index and the storage location of the large object data can be pre-constructed. The large object data block index is sequentially encoded with serial numbers according to a preset order. Specifically, the preset order can refer to the predetermined arrangement order of the large object data block index, such as the first encoding arrangement order, etc., which is not specifically limited here.
[0052] A Lob Meta index can refer to a stored Lob DataPiece or a query index for large object data. Each Lob DataPiece or large object data is managed using a Lob Meta index, and each Lob Meta index is encoded with a corresponding Sequence ID to generate a matching sequence number. Lob Meta index records are generally small, occupying minimal memory space. By transforming the management of large object data into the management of a set of Lob Meta indexes, the read / write amplification problem in large object management can be effectively reduced.
[0053] In large object management, data rows are sorted based on the primary key, and Lob Meta is managed based on tables. To achieve good location-based query performance, accurate storage location information of the Lob DataPiece needs to be incorporated into the table key. Therefore, in the large object management method provided in the embodiments of this specification, the sequence number encoding of the large object data block index is used as the query index for the storage location information of the Lob Piece Data, and the size of the sequence number encoding represents the relative position of the large object data block index.
[0054] Specifically, obtaining the insertion position of the target data can include:
[0055] Query the preceding large objects that are associated with the target data in the data dimension from the stored large object data;
[0056] The insertion position of the target data is determined based on the storage location of the preceding large object.
[0057] For example, if the target data is a piece of text that needs to be inserted into a target large text, then the large object data slice corresponding to the target large text and its storage location can be obtained from the stored large object data. In this way, the storage location of the piece of text to be inserted can be determined, which is the insertion location of the target data.
[0058] In this way, by confirming the insertion position of the target data, the large object data indexes on both sides of the insertion position of the target data and their corresponding sequence numbers can be determined.
[0059] Furthermore, before obtaining the first serial number, the method may further include:
[0060] A spare encoding interval of a preset encoding length is reserved in the encoding interval of the first encoding arrangement order. The spare encoding interval is used for the serial number encoding of the target data to be inserted later.
[0061] In the embodiments of this specification, the encoding range of the first encoding arrangement order can refer to the encoding range corresponding to the level sequence number encoded according to the first encoding arrangement order. For example, continuing the previous example, if the sequence number of the first level (level1) is arranged according to the first encoding arrangement order, then the encoding range corresponding to the sequence number of the first level is the encoding range of the first encoding arrangement order.
[0062] By reserving a spare encoding range of a preset encoding length in the encoding range of the first encoding arrangement order for use as the sequence number encoding when the target data is inserted into storage, the branch index operation is not required every time data is inserted, which can effectively avoid the rapid stacking of hierarchical sequence numbers.
[0063] In practical applications, sequence number encoding can use varchar (maximum byte length 16KB, where B stands for Byte). Generally, a 32-bit (1B = 8 bits, 32 bits = 4B) encoding interval can be used as one level (i.e., one branch index) of sequence number encoding interval, thus representing 16KB / 4B = 4K (4*1024 = 4096) levels of branches. Since a single data insertion operation typically generates a branch index, leading to a push-up of the sequence number encoding level (forming one branch index), the 4096 levels of branch encoding will be consumed relatively quickly.
[0064] In this scenario, a pre-defined encoding length can be reserved as a step size in the branch sequence number encoding at each level. Specifically, if the pre-defined encoding length reserved for a level is 8 bytes, the remaining encoding interval is used as the initial occupied interval for the sequence number encoding at this level. When inserting target data, the reserved encoding interval can be consumed first for the target data sequence number encoding. In this case, the pre-defined encoding length can support at least 8 sequence number encoding operations. Therefore, before the reserved encoding interval is exhausted, the insertion of target data will not create a new branch index. In this way, at each level, the consumption of branch codes at 8 levels can be reduced, which not only avoids the branch code level from being pushed up too quickly, but also provides sufficient encoding space for sequence number encoding.
[0065] Step 103: According to the first coding arrangement order, determine whether the second sequence number adjacent to the first sequence number and located after the first sequence number is occupied, and obtain the first judgment result.
[0066] In the embodiments of this specification, the first sequence number corresponding to the preceding large object and the second sequence number corresponding to the following large object, which are arranged sequentially on both sides of the target data insertion position, may exist or be empty.
[0067] In other words, if both the first and second serial numbers exist, the target data is inserted between the two large object data. If the first serial number is empty, the target data is inserted before the large object data corresponding to the second serial number. If the second serial number is empty, the target data is inserted after the large object data corresponding to the first serial number.
[0068] Specifically, the method may further include:
[0069] If the first determination result indicates that the second sequence number is not occupied, then based on the first encoding arrangement order, the second sequence number that is adjacent to the first sequence number and located after the first sequence number is determined as the sequence number corresponding to the target data.
[0070] In this embodiment of the specification, if the second sequence number is not occupied, indicating that the second sequence number is empty or does not exist, then the sequence numbers corresponding to the target data are sequentially appended after the first sequence number. In this case, the target data is directly inserted after the large object data corresponding to the first sequence number.
[0071] Therefore, the second sequence number following the first sequence number can be identified as the sequence number corresponding to the target data. For example, if the first sequence number is 5, then the second sequence number should be 6, belonging to the same level of sequence number encoding.
[0072] Step 105: If the first judgment result indicates that the second sequence number is occupied, then based on the second encoding arrangement order, determine the branch index sequence number of the target data in the large object data block index.
[0073] In the embodiments of this specification, if the second sequence number is occupied, it means that both the preceding and following large objects exist on both sides of the target data insertion position. In this case, the target data is inserted between the preceding and following large objects.
[0074] Therefore, based on the second encoding arrangement order, a branch index sequence number corresponding to the target data can be generated between the first sequence number and the second sequence number. The second encoding arrangement order can refer to the order in which the sequence numbers in the branch index are encoded and arranged. Specifically, the second encoding arrangement order can be natural numbers, letters, or other identifiers that can represent sequential order, etc., without specific limitations here.
[0075] Specifically, a branch index can refer to adding a branch to the existing large object data block index at the insertion position of the target data to be inserted, and generating a branch sequence number code according to the second encoding arrangement order. In specific application scenarios, for ease of management, the target sequence number can be generated based on the first sequence number.
[0076] In the embodiments of this specification, the arrangement order of the second code may specifically include:
[0077] If the first sequence number is encoded in numerical form, then the branch index sequence number is also encoded in numerical form, and the numerical value corresponding to the branch index sequence number is greater than the numerical value corresponding to the first sequence number.
[0078] For example, if the first serial number is 1 according to the first coding arrangement order and the second serial number is 2, then branch index serial numbers 1.1, 1.2, 1.3, etc. can be generated according to the second coding arrangement order. These are serial numbers that do not belong to the same level as the first and second serial numbers.
[0079] By setting a branch index, when inserting target data, the sequence number of the target data is set in the branch index of the next level, and the branch sequence number is re-encoded. This avoids re-encoding and sorting the sequence number encoding corresponding to the original ordered large object data block index.
[0080] Specifically, serial number codes at the same level can refer to serial number codes belonging to the same branch. For example, the first branch can be defined as the first level (level 1), and the second branch added on the basis of the first branch can be defined as the second level (level 2). So on, from top to bottom, it can be the third level (level 3) branch, the fourth level (level 4) branch, etc., without specific limitations.
[0081] Step 107: Add the index entry containing the branch index sequence number to the large object data block index, wherein the index entry containing the branch index sequence number is located in the large object data block index between the index entry with the first sequence number and the index entry with the second sequence number.
[0082] In the embodiments of this specification, an index entry may refer to a storage record in the large object data block index for each stored large object data, used to store the correspondence between the data identifier, sequence number, storage location, encoding length, etc. of the large object data, so as to facilitate subsequent querying of the stored large object data.
[0083] Furthermore, to facilitate large object data queries, the index entries of the branch index sequence number are added between the index entries of the first sequence number and the index entries of the second sequence number. In other words, the order of each index entry is the same as the order of the corresponding sequence number.
[0084] In the embodiments described in this specification, the method may further include:
[0085] If the encoded length of the stored serial number exceeds the preset encoded length, an offline update operation for the stored serial number will be triggered.
[0086] In practical applications, if an 8-byte step size is used, a step size can support at least 8 insertion operations for sequence number encoding. Therefore, if data insertion is performed at the same insertion position between two consecutive large object data block indices, and each insertion uses a binary search method to retrieve a usable sequence number, even in the worst-case scenario, 32k (8*4K = 32*1024 = 32768) sequence number encoding operations can be supported. However, due to the massive amount of data in large objects, after 32k sequence number encoding operations are completed, further sequence number encoding will be impossible.
[0087] In this case, by setting a trigger condition that the encoded length of the stored serial number exceeds the preset encoded length, an offline update of the encoded serial number can be triggered.
[0088] For example, if the longest sequence number encoding of large object data exceeds 8k, an offline sequence number encoding update task can be triggered in the background. This can update the sequence number encoding to reserve some encoding space for continued encoding, and also avoid the impact of the sequence number encoding update on the business data of the front-end running business.
[0089] In the embodiments of this specification, the offline update operation for the stored serial number may specifically include:
[0090] Based on the sequence number of the stored index entries, the index entries that need to be sorted are determined. The sequence number of the index entries that need to be sorted includes at least the sequence number based on the first encoding arrangement order and the sequence number based on the second encoding arrangement order.
[0091] The index entries that need to be sorted are re-encoded with serial numbers according to the first encoding arrangement order.
[0092] The offline update and reorganization operation of sequence numbers can refer to updating and reorganizing the branch index sequence numbers into the hierarchical sequence numbers of the first encoding arrangement order, that is, merging the branch index sequence numbers. To facilitate the offline update and reorganization operation of sequence numbers, it can be performed based on each index entry stored in the large object data block index.
[0093] Specifically, based on the sequence numbers of the stored index entries, the index entries that need to be reorganized can be determined, that is, the range of sequence numbers that need to be updated can be determined. Then, the index entries that need to be reorganized are re-encoded according to the first encoding arrangement order. In practical applications, the range of sequence numbers that need to be updated can be selected as needed for updating. For example, the sequence number encoding of a portion of the index with many branch levels can be selected for sequence number encoding update.
[0094] Furthermore, before re-encoding the index entries that need to be sorted according to the first encoding arrangement order, the process may further include:
[0095] Determine the encoding range to be used for re-encoding the serial number;
[0096] A preset range of encoding intervals is reserved in the encoding intervals used for re-encoding the serial number. The preset range of encoding intervals is used for the serial number encoding of the target data to be stored subsequently.
[0097] In the embodiments of this specification, the encoding range used for re-encoding the serial number can refer to the encoding range that merges and organizes the serial number range that needs to be updated. By reserving a preset range of encoding range in the encoding range used for re-encoding the serial number, it can be used for the serial number encoding of the target data to be stored later. In this way, the serial number encoding can be updated and organized offline without affecting the serial number encoding of subsequent data insertion or data appending operations.
[0098] Furthermore, the index entries that need to be organized are re-encoded with serial numbers according to the first encoding arrangement order, which may specifically include:
[0099] One of the two endpoint sequence numbers of the reserved encoding interval within the preset range is determined as the starting sequence number;
[0100] Using the starting serial number as the starting point for sorting, the serial numbers of the index entries that need to be sorted are re-encoded.
[0101] In the embodiments of this specification, one of the two endpoint serial numbers of the reserved preset range of encoding interval is used as the starting serial number, and then the starting serial number is used as the sorting starting point to perform offline sorting of serial number encoding according to the preset sorting order.
[0102] In this way, the reconstructed serial number will not cause a primary key conflict with the original serial number.
[0103] As one application example, taking the starting sequence number as the starting point for sorting, the sequence numbers of the index entries that need to be sorted are re-encoded, which may specifically include:
[0104] If the starting sequence number is one of the earlier endpoints in the encoding interval of the preset range, then the starting sequence number is used as the starting point for sorting, and the sequence numbers of the index entries that need to be sorted are re-encoded from back to front in the opposite direction of the order of the sequence numbers of the index entries that need to be sorted.
[0105] As another application embodiment, taking the starting sequence number as the starting point for sorting, the sequence numbers of the index entries that need to be sorted are re-encoded, which may specifically include:
[0106] If the starting sequence number is a later endpoint sequence number in the encoding interval of the preset range, then the starting sequence number is used as the starting point for sorting, and the sequence numbers of the index entries that need to be sorted are re-encoded from front to back according to the order of the sequence numbers of the index entries that need to be sorted.
[0107] Specifically, the offline update range can refer to an encoding interval with a large number of branch layers, etc. The specific offline update range is not specifically limited here. For example, within the encoding interval [20, 60], there are 10 branch indices, occupying a significant amount of encoding space, which can be updated offline. The top-level branch code within the offline update range can refer to the branch located at the top level within this range. Continuing the previous example, within the encoding interval [20, 60], the 10 branch indices have branch layers numbered from top to bottom as the second, third, up to the eleventh layer. Therefore, the top layer is the second-level branch, and all 10 branch indices are re-encoded according to the encoding order of the second-level branches. In the embodiments of this specification, it is assumed that there are two codes with different bit lengths, and the layer containing the code with fewer bits is located above the layer containing the code with more bits.
[0108] For example, if the first-level branch sequence number is 1, 2, 3, 4, and the second-level branch sequence number between 1 and 2 is 1.1, 1.2, and 1.3, then the sequence number codes of these two levels will be re-encoded according to the encoding order of the first-level branch sequence number codes. In other words, the second-level branch sequence number codes will be updated and merged into the first-level branch.
[0109] Specifically, the preset encoding space is [0, 100]. Following a backward update order, the encoding space [76, 100] is reserved for subsequent data appending operations. The original sequence number 4 is updated to sequence number 75, the original sequence number 3 is updated to sequence number 74, and so on. The specific encoding update results are shown in Table 1 below. It should be noted that in another application embodiment, before initially setting the encoding space [0, 100] and before performing offline updates to the sequence number encoding, a portion of the encoding space can be reserved for subsequent offline updates. In this example, we can assume the initial reserved encoding space is [50, 75], which ensures that the currently used updated sequence number encoding is within the reserved encoding space.
[0110] Table 1. Offline Update Results of Serial Number Encoding
[0111] Original serial number encoding Updated serial number encoding 4 75 3 74 2 73 1.3 72 1.2 71 1.1 70 1 69
[0112] During the offline update of serial number encoding, updating from back to front ensures that the re-encoded serial number will not be smaller than the original serial number, thus avoiding primary key conflicts, i.e., conflicts with existing serial number encodings. After the update, a certain range of encoding space can be reserved after the last serial number encoding, so that subsequent data append operations will not be affected.
[0113] The other method, updating from front to back, ensures that the re-encoded serial number will not be larger than the original serial number when updating the serial number code, thus avoiding primary key conflicts. After the update, a certain range of encoding space can be reserved before the first serial number code for subsequent data insertion operations.
[0114] Continuing with the previous example, following the front-to-back update method, the encoding space of [0, 25] is reserved for subsequent data insertion operations. The original sequence number encoding 1 is updated to sequence number encoding 26, and so on. The specific encoding update results are shown in Table 2 below.
[0115] Table 2: Offline Update Results of Serial Number Encoding
[0116] Original serial number encoding Updated serial number encoding 1 26 1.1 27 1.2 28 1.3 29 2 30 3 31 4 32
[0117] This specification provides an embodiment of a method for generating index entries for a large object data block index. When inserting target data, the method obtains the first sequence number of the preceding large object data that is adjacent to the target data in the data dimension among the stored large object data. If the second sequence number adjacent to and following the first sequence number is occupied, the method determines the branch index sequence number of the target data based on a second encoding arrangement order different from the first encoding arrangement order. The method then adds the index entry containing the branch index sequence number to the large object data block index. This transforms the management of large object data into the management of large object data block indexes, which can effectively reduce the read / write amplification problem in large object management. In addition, the branch index sequence number encoding method avoids the influence of the encoding order of the sequence numbers of the stored large object data block indexes, eliminating the need to re-encode all large object data block indexes, thus effectively simplifying the data insertion operation process.
[0118] Figure 2 This is a swimlane diagram corresponding to a method for generating index entries for a large object data block index provided in the embodiments of this specification.
[0119] like Figure 2 As shown, during the storage preparation phase, the storage device stores the record large object identifier in the master table in advance, and stores the correspondence between the large object identifier, the sequence number code, and the large object data slice in the large object data block index table. Macroblocks are used to manage the large object data slice.
[0120] A schematic diagram illustrating the specific application of the storage preparation phase is shown below. Figure 3 As shown, where, Figure 3 This diagram illustrates the correspondence between the main table, the large object data block index table, and the large object data blocks in the embodiments of this specification.
[0121] In this specification, the OceanBase database is used as an example to explain the storage preparation phase. In OceanBase, the unit of space allocated for data files is called a macroblock. Each macroblock is further divided into several 16KB microblocks, which are the smallest unit of database I / O (equivalent to a block in a traditional database). All data in the database is stored within these microblocks. Since the macroblock size is 2MB, and OceanBase uses an LSM Tree structure to store data, which is sorted according to the table's primary key, OceanBase macroblocks can be split, and adjacent macroblocks can be merged if data is deleted.
[0122] During the data insertion and encoding stage, the encoding device confirms the insertion position of the target data, as well as the sequence number encoding of the large object data on both sides of the insertion position.
[0123] Then, it is determined whether serial number encoding can be performed. If encoding can be performed, branch indexing and encoding operations are performed on the target data. If encoding cannot be performed, an offline update task is triggered to perform offline updates on the serial number encoding within the update range.
[0124] The following will combine Figures 4 to 8 This specification provides a detailed explanation of the branch indexing and encoding operations, as well as the offline update task operations, provided in the embodiments of this specification.
[0125] Figure 4 This is a flowchart illustrating the specific application of sequence number encoding in an index entry generation method for a large object data block index provided in an embodiment of this specification. Figure 5 For the corresponding Figure 4 A schematic diagram illustrating specific application scenarios.
[0126] This specification describes the encoding method for serial number encoding in specific examples, and specifically provides a variable-length Varchar encoding method. The specific operation steps are as follows:
[0127] Step 401: Append and store data four times in the large object to obtain the sequence number codes 1-4 corresponding to the large object data block index.
[0128] Step 402: Insert 3 large object data block indices between sequence number codes 1 and 2, and insert 2 large object data block indices between sequence number codes 3 and 4.
[0129] Step 403: Push forward one layer based on the serial number codes 1-4 to form branch codes 1.1, 1.2 and 1.3, and form branch codes 3.1 and 3.2 between serial number codes 3 and 4.
[0130] Step 404: Insert three large object data block indices between serial number codes 3.1 and 3.2.
[0131] Step 405: Push forward one level from the serial number codes 3.1 and 3.2 to form branch codes 3.1.1, 3.1.2 and 3.1.3.
[0132] Specifically, such as Figure 5 As shown, serial numbers 1-4 are located in the first layer, branch codes 1.1, 1.2, 1.3, and branch codes 3.1 and 3.2 are located in the second layer, and branch codes 3.1.1, 3.1.2, and 3.1.3 are located in the third layer.
[0133] like Figure 6 The diagram shown illustrates another specific application of sequence number encoding in an index entry generation method for a large object data block index provided in this embodiment.
[0134] In specific application scenarios, the sequence number encoding uses varchar(16KB) variable-length encoding, with 32 bits as one layer of branch encoding, which can represent a total of 4K layers of branch encoding. Since the preset step size for large object data block indexing is 1 bit, such as... Figure 4 and 5 As shown, a single data insertion operation will cause the coding level to be pushed up once. Therefore, in order to prevent the branch coding level from being pushed up very easily, an 8-byte coding length is reserved as a step size in the coding space of each level.
[0135] Using this encoding method, varchar(16K) can encode a maximum of 4K layers of branch codes, with each layer having 24 bits of encoding space for sequential encoding, allowing for the sequential encoding of 16M sequence numbers. Considering the use of an 8-bit encoding length as the step size, a step size can at least support 8 data insertion operations for sequence number encoding. That is, even in the worst case, when performing data insertion operations between two consecutive large object data indices, it can support 32K sequence number encoding operations.
[0136] like Figures 7 to 9 The diagram shown is a specific application illustration of offline encoding update in an index entry generation method for a large object data block index provided in an embodiment of this specification.
[0137] According to the above encoding method in the embodiments of this specification, in the worst case, after 32k encodings, it may be impossible to continue encoding and the encoding space will be exhausted. In this case, an offline update task in the background of the server can be triggered.
[0138] Alternatively, when the longest encoding length of a large object exceeds 8k, an offline update task can be triggered in the server background.
[0139] It should be noted that the offline update task provided in the embodiments of this specification does not need to perform a global update of the sequence number encoding of all stored large object data block indexes. It only needs to perform a local update of the relevant sequence number encoding within the update range. For example, it is possible to update only all sequence number encodings between 16 and 24.
[0140] As described in the above embodiment of the specification regarding offline update tasks, re-updating the serial number encoding involves re-encoding serial number encodings within a certain range to merge branch encodings within that range. In practical applications, when reordering a small range of encodings, the serial number encodings that need to be re-encoded can be loaded into memory, these records can be deleted from the database, the serial number encodings can be re-sorted and re-encoded in memory, and finally the updated serial number encodings can be reinserted into the database.
[0141] In extreme cases, all serial number codes may need to be updated. The method of loading all serial number codes into memory in advance and then updating them in the above manner may not be feasible in practical applications, which may lead to primary key conflicts. That is, the updated serial number codes may overlap with the existing serial number codes, resulting in at least two identical codes after the update.
[0142] For example, on top Figure 5 All serial number codes are updated again by loading one serial number code and modifying another serial number code. All branch serial number codes are updated and merged into the first level. Then, the original branch serial number codes 1.1, 1.2 and 1.3 will be updated to serial number codes 2, 3 and 4. This overlaps with the existing serial number codes 2, 3 and 4 in the first level, resulting in a primary key conflict.
[0143] To avoid this situation, the embodiments in this specification adopt the following... Figures 7 to 9 The two methods shown are used to update the serial number encoding. In this embodiment, the encoding range is defined as [0, 100].
[0144] Figure 7 For the best Figure 5 In the application scenario, the status diagram after starting the offline update task after inserting serial number code 3 is shown.
[0145] The embodiments in this specification adopt a backward update method. During the update, the encoding range of [76, 100] is reserved to facilitate subsequent data appending operations.
[0146] During the encoding update, starting with sequence number 75, the original sequence number 3 within the update range is updated to generate a new sequence number 75. This process continues backward, and so on, until the first sequence number 1 is updated to sequence number 70. In this way, all the branch codes between the original codes 1 and 3 are merged and updated into the first-level encoding.
[0147] Figure 8 For the above Figure 7 Based on this, the diagram shows the operation after serial number encoding, that is, adding serial number encoding 4, and then inserting multiple serial number encodings between serial number encoding 3 and 4 to form two branch codes.
[0148] Figure 9 Yes Figure 8 The following is a schematic diagram illustrating the specific application after performing an offline update task. In this embodiment, the update encoding is performed in a forward-to-back order. During the update, the encoding range of [0, 25] is reserved to provide possible data insertion operations.
[0149] Using serial number 26 as the starting update point, that is, updating the original first serial number 70 to serial number 26, and so on, updating from front to back, updating the last original serial number 76 to serial number 37. In this way, the original three-layer branch codes are all merged and updated into the first layer code.
[0150] Based on the same inventive concept, embodiments of this specification also provide apparatus corresponding to the above-described methods.
[0151] in, Figure 10 The embodiments provided in this specification correspond to Figure 1 A schematic diagram of the structure of an index entry generation device for a large object data block index.
[0152] In the embodiments of this specification, a correspondence between the large object data block index and the storage location of the large object data slice is pre-constructed, and the large object data block index is sequentially encoded with serial numbers according to a preset order.
[0153] like Figure 10 As shown, the device may include:
[0154] The acquisition module 1001 acquires a first sequence number, which is the sequence number of the preceding large object data that is adjacent to the target data in the data dimension in the stored large object data. The target data is the data to be inserted into the stored large object data. The first sequence number is generated according to the first encoding arrangement order.
[0155] The judgment module 1002 determines, according to the first encoding arrangement order, whether the second sequence number adjacent to and following the first sequence number is occupied, and obtains the first judgment result;
[0156] If the first judgment result indicates that the second sequence number is occupied, the determination module 1003 determines the branch index sequence number of the target data in the large object data block index based on the second encoding arrangement order.
[0157] The generation module 1004 adds the index entry containing the branch index sequence number to the large object data block index, wherein the index entry containing the branch index sequence number is located in the large object data block index between the index entry with the first sequence number and the index entry with the second sequence number.
[0158] based on Figure 10 The embodiments of this specification also provide some specific implementations of the device, which will be described below.
[0159] Optionally, the device may further include:
[0160] If the first determination result indicates that the second sequence number is not occupied, then based on the first encoding arrangement order, the second sequence number that is adjacent to the first sequence number and located after the first sequence number is determined as the sequence number corresponding to the target data.
[0161] Optionally, the second encoding arrangement order may specifically include:
[0162] If the first sequence number is encoded in numerical form, then the branch index sequence number is also encoded in numerical form, and the numerical value corresponding to the branch index sequence number is greater than the numerical value corresponding to the first sequence number.
[0163] Optionally, before obtaining the first serial number, the device may further include:
[0164] A spare encoding interval of a preset encoding length is reserved in the encoding interval of the first encoding arrangement order. The spare encoding interval is used for the serial number encoding of the target data to be inserted later.
[0165] Optionally, the device may further include:
[0166] If the encoded length of the stored serial number exceeds the preset encoded length, an offline update operation for the stored serial number will be triggered.
[0167] Optionally, the offline update operation for the stored serial numbers may specifically include:
[0168] Based on the sequence number of the stored index entries, the index entries that need to be sorted are determined. The sequence number of the index entries that need to be sorted includes at least the sequence number based on the first encoding arrangement order and the sequence number based on the second encoding arrangement order.
[0169] The index entries that need to be sorted are re-encoded with serial numbers according to the first encoding arrangement order.
[0170] Optionally, before re-encoding the index entries that need to be sorted according to the first encoding arrangement order, the process may further include:
[0171] Determine the encoding range to be used for re-encoding the serial number;
[0172] A preset range of encoding intervals is reserved in the encoding intervals used for re-encoding the serial number. The preset range of encoding intervals is used for the serial number encoding of the target data to be stored subsequently.
[0173] Optionally, re-encoding the index entries that need to be sorted according to the first encoding arrangement order may include:
[0174] One of the two endpoint sequence numbers of the reserved encoding interval within the preset range is determined as the starting sequence number;
[0175] Using the starting serial number as the starting point for sorting, the serial numbers of the index entries that need to be sorted are re-encoded.
[0176] Optionally, using the starting sequence number as the starting point for sorting, re-encoding the sequence numbers of the index entries that need to be sorted may include:
[0177] If the starting sequence number is one of the earlier endpoints in the encoding interval of the preset range, then the starting sequence number is used as the starting point for sorting, and the sequence numbers of the index entries that need to be sorted are re-encoded from back to front in the opposite direction of the order of the sequence numbers of the index entries that need to be sorted.
[0178] Optionally, using the starting sequence number as the starting point for sorting, re-encoding the sequence numbers of the index entries that need to be sorted may include:
[0179] If the starting sequence number is a later endpoint sequence number in the encoding interval of the preset range, then the starting sequence number is used as the starting point for sorting, and the sequence numbers of the index entries that need to be sorted are re-encoded from front to back according to the order of the sequence numbers of the index entries that need to be sorted.
[0180] This specification provides an index entry generation device for a large object data block index. When inserting target data, it obtains the first sequence number of the preceding large object data that is adjacent to the target data in the data dimension from the stored large object data. According to the first encoding arrangement order, it determines whether the second sequence number adjacent to and following the first sequence number is occupied, and obtains a first determination result. If the first determination result indicates that the second sequence number is occupied, it determines the branch index sequence number of the target data in the large object data block index based on the second encoding arrangement order, and adds the index entry containing the branch index sequence number to the large object data block index. The position of the index entry containing the branch index sequence number in the large object data block index is between the index entry of the first sequence number and the index entry of the second sequence number.
[0181] By obtaining the first sequence number, and in the case that the second sequence number is occupied, the branch index sequence number of the target data is determined based on the second encoding arrangement order, which is different from the first encoding arrangement order. The index entries containing the branch index sequence number are then added to the large object data block index. This transforms the management of large object data into the management of large object data block indexes, which can effectively reduce the read / write amplification problem in large object management. In addition, the branch index sequence number encoding method can avoid the influence of the encoding order of the sequence numbers of the already stored large object data block indexes, and it is not necessary to re-encode all large object data block indexes, thus effectively simplifying the data insertion operation process.
[0182] Based on the same inventive concept, embodiments of this specification also provide devices corresponding to the above methods.
[0183] in, Figure 11 The embodiments provided in this specification correspond to Figure 1 A schematic diagram of the structure of an index entry generation device for a large object data block index. (See diagram below.) Figure 11 As shown, device 1100 may include:
[0184] At least one processor 1110; and,
[0185] Memory 1130 communicatively connected to the at least one processor; wherein,
[0186] The memory 1130 stores instructions 1120 that can be executed by the at least one processor 1110, the instructions being executed by the at least one processor 1110 to enable the at least one processor 1110 to:
[0187] Obtain a first sequence number, which is the sequence number of the preceding large object data that is adjacent to the target data in the data dimension in the stored large object data. The target data is the data to be inserted into the stored large object data. The first sequence number is generated according to the first encoding arrangement order.
[0188] According to the first coding arrangement order, determine whether the second sequence number adjacent to and following the first sequence number is occupied, and obtain the first determination result;
[0189] If the first determination result indicates that the second sequence number is occupied, then based on the second encoding arrangement order, the branch index sequence number of the target data in the large object data block index is determined;
[0190] An index entry containing the branch index sequence number is added to the large object data block index, wherein the index entry containing the branch index sequence number is located in the large object data block index between the index entry with the first sequence number and the index entry with the second sequence number.
[0191] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on its differences from other embodiments. In particular, for... Figure 11 As the device shown is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0192] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the methodology). However, with technological advancements, many methodological improvements today can be considered direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved methodology into the hardware circuit. Therefore, it cannot be said that a methodological improvement cannot be implemented using hardware physical modules. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logic function is determined by the user programming the device. Designers can program a digital system themselves to "integrate" it onto a PLD, without needing chip manufacturers to design and manufacture dedicated integrated circuit chips. Furthermore, nowadays, instead of manually manufacturing integrated circuit chips, this programming is mostly implemented using "logic compiler" software. Similar to the software compiler used in program development, the original code before compilation must be written in a specific programming language, called a Hardware Description Language (HDL). There are many HDLs, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, and RHDL (Ruby Hardware Description Language). Currently, the most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should understand that by simply performing some logic programming on the method flow using one of these hardware description languages and programming it into an integrated circuit, the hardware circuit implementing the logical method flow can be easily obtained.
[0193] The controller can be implemented in any suitable manner. For example, it can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicon Labs C8051F320. A memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also recognize that, in addition to implementing the controller in purely computer-readable program code form, the same functionality can be achieved by logically programming the method steps to make the controller take the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the means included therein for implementing various functions can also be considered as structures within the hardware component. Alternatively, the means for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.
[0194] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or any combination of these devices.
[0195] For ease of description, the above devices are described separately by function as various units. Of course, in implementing this application, the functions of each unit can be implemented in one or more software and / or hardware.
[0196] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0197] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0198] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0199] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0200] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0201] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0202] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital character versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0203] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0204] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0205] This application can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a specific task or implement a specific abstract data type. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0206] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A method for generating index entries for a large object data block index, the method comprising: Obtain a first sequence number, which is the sequence number of the preceding large object data that is adjacent to the target data in the data dimension in the stored large object data. The target data is the data to be inserted into the stored large object data. The first sequence number is generated according to the first encoding arrangement order. According to the first coding arrangement order, determine whether the second sequence number adjacent to and following the first sequence number is occupied, and obtain the first determination result; If the first determination result indicates that the second sequence number is occupied, then based on the second encoding arrangement order, the branch index sequence number of the target data in the large object data block index is determined; An index entry containing the branch index sequence number is added to the large object data block index, wherein the index entry containing the branch index sequence number is located in the large object data block index between the index entry with the first sequence number and the index entry with the second sequence number.
2. The method of claim 1, further comprising: If the first determination result indicates that the second sequence number is not occupied, then based on the first encoding arrangement order, the second sequence number that is adjacent to the first sequence number and located after the first sequence number is determined as the sequence number corresponding to the target data.
3. The method as described in claim 1, wherein the second encoding arrangement order specifically includes: If the first sequence number is encoded in numerical form, then the branch index sequence number is also encoded in numerical form, and the numerical value corresponding to the branch index sequence number is greater than the numerical value corresponding to the first sequence number.
4. The method as described in claim 1, further comprising, before obtaining the first serial number: A spare encoding interval of a preset encoding length is reserved in the encoding interval of the first encoding arrangement order. The spare encoding interval is used for the serial number encoding of the target data to be inserted later.
5. The method of claim 1, further comprising: If the encoded length of the stored serial number exceeds the preset encoded length, an offline update operation for the stored serial number will be triggered.
6. The method as described in claim 5, wherein the offline update operation for the stored serial number specifically includes: Based on the sequence number of the stored index entries, the index entries that need to be sorted are determined. The sequence number of the index entries that need to be sorted includes at least the sequence number based on the first encoding arrangement order and the sequence number based on the second encoding arrangement order. The index entries that need to be sorted are re-encoded with serial numbers according to the first encoding arrangement order.
7. The method of claim 6, further comprising, before re-encoding the index entries to be sorted according to the first encoding arrangement order: Determine the encoding range to be used for re-encoding the serial number; A preset range of encoding intervals is reserved in the encoding intervals used for re-encoding the serial number. The preset range of encoding intervals is used for the serial number encoding of the target data to be stored subsequently.
8. The method of claim 7, wherein the index entries requiring reorganization are re-encoded with serial numbers according to the first encoding arrangement order, comprising: One of the two endpoint sequence numbers of the reserved encoding interval within the preset range is determined as the starting sequence number; Using the starting serial number as the starting point for sorting, the serial numbers of the index entries that need to be sorted are re-encoded.
9. The method as described in claim 8, wherein the sequence number of the index entries requiring organization is re-encoded using the starting sequence number as the starting point for organization, comprising: If the starting sequence number is one of the earlier endpoints in the encoding interval of the preset range, then the starting sequence number is used as the starting point for sorting, and the sequence numbers of the index entries that need to be sorted are re-encoded from back to front in the opposite direction of the order of the sequence numbers of the index entries that need to be sorted.
10. The method of claim 8, wherein the sequence number of the index entries requiring organization is re-encoded using the starting sequence number as the starting point for organization, comprising: If the starting sequence number is a later endpoint sequence number in the encoding interval of the preset range, then the starting sequence number is used as the starting point for sorting, and the sequence numbers of the index entries that need to be sorted are re-encoded from front to back according to the order of the sequence numbers of the index entries that need to be sorted.
11. An index entry generation apparatus for a large object data block index, the apparatus comprising: The acquisition module acquires a first sequence number, which is the sequence number of the preceding large object data that is adjacent to the target data in the data dimension in the stored large object data. The target data is the data to be inserted into the stored large object data. The first sequence number is generated according to the first encoding arrangement order. The judgment module determines, according to the first encoding arrangement order, whether the second sequence number adjacent to and following the first sequence number is occupied, and obtains the first judgment result; If the first judgment result indicates that the second sequence number is occupied, the determination module determines the branch index sequence number of the target data in the large object data block index based on the second encoding arrangement order. The generation module adds an index entry containing the branch index sequence number to the large object data block index, wherein the index entry containing the branch index sequence number is located in the large object data block index between the index entry with the first sequence number and the index entry with the second sequence number.
12. The apparatus of claim 11, further comprising: If the first determination result indicates that the second sequence number is not occupied, then based on the first encoding arrangement order, the second sequence number that is adjacent to the first sequence number and located after the first sequence number is determined as the sequence number corresponding to the target data.
13. The apparatus of claim 11, wherein the second encoding arrangement order specifically includes: If the first sequence number is encoded in numerical form, then the branch index sequence number is also encoded in numerical form, and the numerical value corresponding to the branch index sequence number is greater than the numerical value corresponding to the first sequence number.
14. The apparatus of claim 11, further comprising: If the encoded length of the stored serial number exceeds the preset encoded length, an offline update operation for the stored serial number will be triggered.
15. The apparatus of claim 14, wherein the offline update operation for the stored serial number specifically includes: Based on the sequence number of the stored index entries, the index entries that need to be sorted are determined. The sequence number of the index entries that need to be sorted includes at least the sequence number based on the first encoding arrangement order and the sequence number based on the second encoding arrangement order. The index entries that need to be sorted are re-encoded with serial numbers according to the first encoding arrangement order.
16. The apparatus of claim 15, further comprising, before re-encoding the index entries to be sorted according to the first encoding arrangement order: Determine the encoding range to be used for re-encoding the serial number; A preset range of encoding intervals is reserved in the encoding intervals used for re-encoding the serial number. The preset range of encoding intervals is used for the serial number encoding of the target data to be stored subsequently.
17. The apparatus of claim 16, wherein the index entries requiring organization are re-encoded with serial numbers according to the first encoding arrangement order, comprising: One of the two endpoint sequence numbers of the reserved encoding interval within the preset range is determined as the starting sequence number; Using the starting serial number as the starting point for sorting, the serial numbers of the index entries that need to be sorted are re-encoded.
18. An index entry generation device for a large object data block index, comprising: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enable the at least one processor to: Obtain a first sequence number, which is the sequence number of the preceding large object data that is adjacent to the target data in the data dimension in the stored large object data. The target data is the data to be inserted into the stored large object data. The first sequence number is generated according to the first encoding arrangement order. According to the first coding arrangement order, determine whether the second sequence number adjacent to and following the first sequence number is occupied, and obtain the first determination result; If the first determination result indicates that the second sequence number is occupied, then based on the second encoding arrangement order, the branch index sequence number of the target data in the large object data block index is determined; An index entry containing the branch index sequence number is added to the large object data block index, wherein the index entry containing the branch index sequence number is located in the large object data block index between the index entry with the first sequence number and the index entry with the second sequence number.
Citation Information
Patent Citations
Data storage method and device, computer equipment and storage medium
CN115203159A
Scalable and user friendly file virtualization for hierarchical storage
US20120030179A1