Identification management methods, devices, electronic equipment and storage media

By assigning a target identifier to the object to be assigned based on the already assigned identifier mask when the value of the candidate identifier exceeds the maximum value that the candidate identifier mask can represent, the problem of ID value exhaustion is solved, and the efficiency of identifier allocation and the space for ID usage are improved without significantly modifying the system performance.

CN115292290BActive Publication Date: 2025-12-02SHANGHAI DAMENG DATABASE
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210985352.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-17
Publication Date
2025-12-02
Estimated Expiration
2042-08-17

AI Technical Summary

Technical Problem

Existing technologies, when ID values ​​are exhausted, use data types with a larger data range to represent object IDs through system upgrades, resulting in time-consuming system reconstruction and wasted space. How can we improve the efficiency of identifier allocation without significantly modifying system performance?

Method used

By assigning a target identifier mask to the object to be assigned based on the already assigned identifier mask when the value of the candidate identifier is greater than the largest value that the candidate identifier mask can represent, and determining the target identifier based on the target identifier mask, the efficiency of identifier allocation is improved.

Benefits of technology

Without making major modifications to the system and performance, the scope of ID usage has been expanded, ensuring the efficiency of ID-based quick type determination and ID allocation operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115292290B_ABST
    Figure CN115292290B_ABST
Patent Text Reader

Abstract

This invention discloses an identifier management method, apparatus, electronic device, and storage medium. The identifier management method includes: determining a candidate identifier mask corresponding to an object to be assigned from an already allocated identifier mask; determining a candidate identifier for the object to be assigned based on a first identifier already assigned under the candidate identifier mask, wherein the first identifier is the identifier with the largest value already assigned under the candidate identifier mask; determining a target identifier mask for the object to be assigned based on the already allocated identifier mask when the value of a candidate identifier is greater than the value of a second identifier, wherein the second identifier is the identifier with the largest value that the candidate identifier mask can represent; and determining the target identifier for the object to be assigned based on the target identifier mask. This method improves the efficiency of identifier allocation by determining the target identifier mask based on the already allocated identifier mask when the value of a candidate identifier is greater than the identifier with the largest value that the candidate identifier mask can represent, and then determining the target identifier based on the target identifier mask.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data storage, and in particular to an identification management method, apparatus, electronic device and storage medium. Background Technology

[0002] In the field of data storage, using integers as the common method for managing object identifiers (IDs) is crucial. When there are multiple object types, one or more bytes of the high-order bits of the ID can be used as an identifier mask byte to distinguish different object types. This allows for quick determination of the object type corresponding to an ID using the identifier mask.

[0003] Using one or more bytes of the high-order bits of the ID as an identifier mask byte reduces the actual ID value space, easily leading to the exhaustion of ID values. To address this issue, current technology can address it through system upgrades by using data types with a larger data range to represent object IDs.

[0004] However, expanding the scope of ID usage by using data types with a wider data range to represent object IDs requires rebuilding records for all data object IDs in the system, which is both time-consuming and space-intensive. Therefore, improving the efficiency of identifier allocation is a pressing technical problem that needs to be solved. Summary of the Invention

[0005] This invention provides a method, apparatus, electronic device, and storage medium for identifier management, which can improve the efficiency of identifier allocation without significant modifications to the system and its performance.

[0006] In a first aspect, embodiments of the present invention provide an identifier management method, including:

[0007] From the allocated identifier masks, determine the candidate identifier mask corresponding to the object to be assigned, wherein the object to be assigned is the object to be assigned an identifier;

[0008] Based on the first identifier already assigned under the candidate identifier mask, the candidate identifier of the object to be assigned is determined, wherein the first identifier is the identifier with the largest value already assigned under the candidate identifier mask;

[0009] When the value of the candidate identifier is greater than the value of the second identifier, the target identifier mask of the object to be assigned is determined based on the assigned identifier mask, wherein the second identifier is the identifier with the largest value that the candidate identifier mask can represent;

[0010] The target identifier of the object to be assigned is determined based on the target identifier mask.

[0011] Secondly, embodiments of the present invention provide an identification management device, comprising:

[0012] The first determining module is used to determine the candidate identifier mask corresponding to the object to be assigned from the allocated identifier masks, wherein the object to be assigned is the object to be assigned an identifier;

[0013] The second determining module is used to determine the candidate identifier of the object to be assigned based on the first identifier already assigned under the candidate identifier mask, wherein the first identifier is the identifier with the largest value already assigned under the candidate identifier mask;

[0014] The third determining module is used to determine the target identifier mask of the object to be assigned based on the assigned identifier mask when the value of the candidate identifier is greater than the value of the second identifier, wherein the second identifier is the identifier with the largest value that the candidate identifier mask can represent;

[0015] The fourth determining module is used to determine the target identifier of the object to be assigned based on the target identifier mask.

[0016] Thirdly, embodiments of the present invention provide an electronic device, including:

[0017] At least one processor; and

[0018] A memory communicatively connected to the at least one processor; wherein,

[0019] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the identifier management method as described in the first aspect.

[0020] Fourthly, embodiments of the present invention provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the identifier management method as described in the first aspect.

[0021] The technical solution of this invention improves the allocation efficiency of identifiers by allocating a target identifier mask to the object to be allocated based on the allocated identifier mask when the value of the candidate identifier is greater than the largest identifier that can be represented by the candidate identifier mask.

[0022] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0023] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0024] Figure 1 This is a flowchart of an identification management method provided according to Embodiment 1 of the present invention;

[0025] Figure 2 This is a flowchart of an identification management method provided according to Embodiment 2 of the present invention;

[0026] Figure 3 This is a flowchart of an identification management method provided according to Embodiment 3 of the present invention;

[0027] Figure 4 This is a schematic diagram of the structure of an identification management device according to Embodiment 4 of the present invention;

[0028] Figure 5 This is a schematic diagram of the structure of an electronic device that implements the identification management method of this invention. Detailed Implementation

[0029] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0030] It should be noted that the terms "first," "second," etc., used in this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0031] It is understood that before using the technical solutions disclosed in the various embodiments of the present invention, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.

[0032] Example 1

[0033] Figure 1 This is a flowchart of an identification management method according to Embodiment 1 of the present invention. This embodiment is applicable to situations involving identification management of objects. The method can be executed by an identification management device, which can be implemented in software and / or hardware and integrated into an electronic device. Further, the electronic device includes, but is not limited to, computers, laptops, smartphones, servers, etc. Figure 1 As shown, the method includes:

[0034] S110. From the allocated identifier masks, determine the candidate identifier mask corresponding to the object to be assigned, where the object to be assigned is the object to be assigned an identifier.

[0035] An identifier mask can be a mask used to indicate the type of object corresponding to an identifier. Here, an identifier can refer to a code that can be identified.

[0036] An object to be assigned can refer to an object that is yet to be assigned an identifier. A candidate identifier mask can refer to a candidate identifier mask for the object to be assigned. An assigned identifier mask can refer to an identifier mask that has already been assigned.

[0037] In an assigned identifier mask, different assigned identifier masks can correspond to different object types. When there are multiple object types, the assigned identifier masks can be arranged in ascending order according to the object type. For example, in a database management system, there are object types such as tables, indexes, views, and sequences. A four-byte integer is used as the identifier of the database object. The high-order byte is used as the identifier mask, and the remaining three bytes are used as the identifier value. An identifier mask of 00000000 can be assigned to a table, 00000001 to an index, and 00000010 to a view. Then, 00000001 00001000 10010010 10000011 is the identifier of an index. The object type corresponding to the identifier mask can be determined by the identifier mask, and the identifier mask corresponding to the object type can also be determined by the object type.

[0038] The method for determining the candidate identifier mask corresponding to the object to be allocated from the already allocated identifier masks is not limited, as long as it is possible to determine the candidate identifier mask corresponding to the object to be allocated from the already allocated identifier masks. For example, the mapping relationship between the allocated identifier masks and the corresponding object types can be stored locally on the electronic device. Here, the mapping relationship can refer to the relationship between the allocated identifier masks and the corresponding object types. By querying the mapping relationship locally on the electronic device, the identifier mask corresponding to the object type of the object to be allocated can be obtained through the object type of the object to be allocated, and this can be used as the candidate identifier mask corresponding to the object to be allocated.

[0039] S120. Based on the first identifier already assigned under the candidate identifier mask, determine the candidate identifier of the object to be assigned. The first identifier is the identifier with the largest value already assigned under the candidate identifier mask.

[0040] The first identifier is the identifier with the largest value already assigned under the candidate identifier mask. Multiple identifiers can be assigned under the candidate identifier mask, and these identifiers can be assigned in ascending order of their values. Each identifier represents a different object.

[0041] The method for determining the candidate identifier of the object to be allocated based on the first identifier already assigned under the candidate identifier mask is not limited, as long as it can determine the candidate identifier of the object to be allocated based on the first identifier already assigned under the candidate identifier mask. For example, adding one to the first identifier already assigned under the candidate identifier mask can be used as the candidate identifier of the object to be allocated.

[0042] In one embodiment, a four-byte integer is used as the object's identifier, with the high-order byte serving as the identifier mask and the remaining three bytes as the identifier value. An identifier mask of 00000000 can be assigned to a table. Under the identifier mask corresponding to the table, identifiers 00000000 00000000 00000000 00000000, 00000000 000000000000001, and 00000000 00000000 000000000000010 are assigned to represent different tables. Therefore, when the object to be assigned is a table, the candidate identifier mask is 00000000, and the first identifier already assigned under the candidate identifier mask is 0000000000000000 00000000 00000010. Thus, the candidate identifier for the object to be assigned can be 00000000. 000000000000000 00000011.

[0043] S130. When the value of the candidate identifier is greater than the value of the second identifier, the target identifier mask of the object to be assigned is determined based on the assigned identifier mask, wherein the second identifier is the identifier with the largest value that can be represented by the candidate identifier mask.

[0044] The target identifier mask refers to the final identifier mask assigned to the object to be allocated. The target identifier mask can be the same as or different from the candidate identifier mask, depending on the specific circumstances. When the value of the candidate identifier is greater than the value of the second identifier, the target identifier mask is different from the candidate identifier mask. When the value of the candidate identifier is less than or equal to the value of the second identifier, the target identifier mask is the same as the candidate identifier mask.

[0045] The second identifier is the identifier with the largest value that the candidate identifier mask can represent. This can be understood as the identifier with the largest value under the candidate identifier mask. For example, in the above example, the candidate identifier mask is 00000000, and the largest identifier value that the candidate identifier mask can represent is 00000000 11111111 11111111 11111111. When the value of the candidate identifier is greater than the largest identifier value that the candidate identifier mask can represent, the identifier mask of the first byte (highest byte) will change. Therefore, the candidate identifier mask cannot be used as the target identifier mask for the object to be allocated. Thus, the target identifier mask for the object to be allocated needs to be determined based on the already allocated identifier mask.

[0046] When the value of a candidate identifier is greater than the value of the second identifier, there are no restrictions on how the target identifier mask of the object to be assigned is determined based on the already assigned identifier masks, as long as the target identifier mask of the object to be assigned can be determined based on the already assigned identifier masks. For example, assuming that the identifier masks are assigned in ascending order and the number of already assigned identifier masks does not exceed the maximum value of the identifier masks that can be assigned, then the largest assigned identifier mask plus one can be used as the target identifier mask, or the number of already assigned identifier masks can be used as the target identifier mask.

[0047] In one embodiment, the allocated identifier masks are: 00000000, 00000001, and 00000010 for the table. When assigning identifiers to the table, if the value of a candidate identifier is greater than the value of the second identifier, the target identifier mask can be obtained by adding one to the number of allocated identifier masks (00000011) or the largest allocated identifier mask (00000010).

[0048] S140. Determine the target identifier of the object to be assigned based on the target identifier mask.

[0049] The target identifier can refer to the identifier that is ultimately assigned to the object to be allocated.

[0050] The method for determining the target identifier of the object to be assigned based on the target identifier mask is not limited, as long as the target identifier of the object to be assigned can be determined from the target identifier mask. For example, the identifier with the smallest value under the target identifier mask can be selected as the target identifier of the object to be assigned.

[0051] The technical solution of this invention improves the allocation efficiency of identifiers by allocating a target identifier mask to the object to be allocated based on the allocated identifier mask when the value of the candidate identifier is greater than the largest identifier that can be represented by the candidate identifier mask.

[0052] Furthermore, after determining the candidate identifiers of the objects to be assigned, the process also includes:

[0053] If the value of the candidate identifier does not exceed the value of the second identifier, then the candidate identifier mask is used as the target identifier mask, and the candidate identifier is used as the target identifier.

[0054] The fact that the value of the candidate identifier does not exceed the value of the second identifier can be understood as the fact that the value of the candidate identifier does not exceed the largest value that the candidate identifier mask can represent. In other words, the identifier mask under the candidate identifier can still represent the object type corresponding to the object to be allocated, and there is no need to allocate a new identifier mask for the object to be allocated.

[0055] In one embodiment, the candidate identifier mask can be 00000000, and the candidate identifier of the object to be allocated can be 00000000 00000000 0000000 00000011. If the candidate identifier does not exceed the value of the second identifier 00000000 1111111111111111 11111111, then 00000000 is used as the target identifier mask, and 00000000 00000000000000000 00000011 is used as the target identifier.

[0056] When the value of the candidate identifier does not exceed the value of the second identifier, the candidate identifier mask is used as the target identifier mask. Using the candidate identifier as the target identifier can reduce resource waste and make identifier management more convenient and efficient.

[0057] Furthermore, identification management methods also include:

[0058] Establish a mapping relationship between the target identifier mask and the object type corresponding to the object to be allocated;

[0059] Store the mapping relationship and target identifier.

[0060] The mapping relationship between the target identifier mask and the object type corresponding to the object to be allocated can be understood as the correspondence between the target identifier mask and the object type corresponding to the object to be allocated.

[0061] The form of the mapping relationship is not limited. For example, it can be in the form of a mapping array, which stores the correspondence between the target identifier mask and the object type corresponding to the object to be allocated.

[0062] In the mapping relationship between target identifier mask and the object type corresponding to the object to be allocated, the object type corresponding to the object to be allocated can be found through the target identifier mask, and the corresponding target identifier mask can be found through the object type corresponding to the object to be allocated.

[0063] There are no restrictions on how the mapping relationship and target identifier are stored. For example, the mapping relationship and target identifier can be stored in a database, and the electronic device can query the database when it needs to find the mapping relationship and target identifier.

[0064] By establishing a mapping relationship between the target identifier mask and the corresponding object type of the object to be allocated, and storing the mapping relationship and the target identifier, it is convenient to find the object type corresponding to the target identifier mask in the mapping relationship based on the target identifier mask under the target identifier.

[0065] Example 2

[0066] Figure 2 This is a flowchart of an identifier management method according to Embodiment 2 of the present invention. This embodiment is based on Embodiment 1 above and specifies the situation before determining the candidate identifier mask corresponding to the object to be assigned from the allocated identifier masks.

[0067] In this embodiment, before determining the candidate identifier mask corresponding to the object to be assigned from the allocated identifier masks, the method further includes: assigning a corresponding identifier mask to the type of object to be assigned, wherein the identifier mask corresponds one-to-one with the type of object to be assigned; establishing a mapping relationship between the identifier mask and the type of object to be assigned; assigning an identifier to the object corresponding to the type of object to be assigned; when there are at least two types of object to be assigned, the assignment order of each identifier mask is from smallest to largest; when there are at least two objects corresponding to the type of object to be assigned, the assignment order of each identifier is from smallest to largest.

[0068] like Figure 2 As shown, the method includes:

[0069] S101. Assign a corresponding identifier mask to the type of object to be allocated. The identifier mask corresponds one-to-one with the type of object to be allocated.

[0070] The object type to be allocated can refer to the object type for which an identifier mask will be assigned. There is no limit to the number of object types to be allocated; the specific number can be determined based on actual needs. The object type to be allocated is not limited; it can include object types such as tables, indexes, views, and sequences in a database management system.

[0071] Assign a corresponding identifier mask to the type of object to be allocated. The identifier mask corresponds one-to-one with the type of object to be allocated. This can be understood as giving each type of object to be allocated a unique identifier mask. The type of object to be allocated can be determined by the identifier mask, and the identifier mask corresponding to the type of object to be allocated can also be determined by the type of object to be allocated.

[0072] In one embodiment, the types of objects to be allocated can be counted first, and then corresponding identifier masks can be assigned to the types of objects to be allocated in ascending order, wherein the identifier mask corresponds one-to-one with the types of objects to be allocated.

[0073] S102. Establish the mapping relationship between the identifier mask and the type of the object to be allocated.

[0074] The mapping relationship can refer to the correspondence between an identifier mask and the type of the object to be allocated. The form of the mapping relationship is not limited; it can be in the form of a mapping array, which stores the correspondence between the identifier mask and the type of the object to be allocated.

[0075] Before determining the candidate identifier mask corresponding to the object to be assigned from the allocated identifier masks, an identifier mask corresponding to the type of the object to be assigned is assigned, and a mapping relationship between the identifier mask and the type of the object to be assigned is established. At this time, the identifier mask and the type of the object to be assigned are in one-to-one correspondence. The unique identifier mask can be found through the type of the object to be assigned, and the unique type of the object to be assigned can also be found through the identifier mask.

[0076] In one embodiment, the mapping relationship may include a mapping relationship between identifier masks and object types to be assigned. It may also include a mapping relationship between the target identifier mask and the corresponding object type of the object to be assigned, after determining the candidate identifier mask corresponding to the object to be assigned from the already assigned identifier masks, when the determined target identifier mask differs from the candidate identifier masks. When the candidate identifier mask differs from the target identifier mask, in the mapping relationship, one object type can correspond to multiple identifier masks, but each identifier mask has only one corresponding object type.

[0077] S103. Assign an identifier to the object corresponding to the type of object to be assigned.

[0078] Assigning an identifier to an object corresponding to the type of object to be assigned can be understood as giving the object corresponding to the type of object to be assigned a unique identifier, which can be used to identify the object corresponding to the type of object to be assigned.

[0079] When there are at least two object types to be allocated, the allocation order of each identifier mask is from smallest to largest; when there are at least two objects corresponding to the object types to be allocated, the allocation order of each identifier is from smallest to largest.

[0080] When there are at least two object types to be assigned, the allocation order of each identifier mask is from smallest to largest. Specifically, if no identifier has been assigned to the objects corresponding to the existing object types to be assigned, the identifier masks corresponding to the object types to be assigned are assigned in ascending order of one; or if an identifier has been assigned to the objects corresponding to the existing object types to be assigned, the identifier masks corresponding to the already assigned identifiers are removed, and then identifier masks are assigned to the object types to be assigned in ascending order of one.

[0081] When there are at least two objects corresponding to the object type to be assigned, the allocation order of each identifier is from smallest to largest. Specifically, an identifier mask is determined according to each object type to be assigned. Under each identifier mask, identifiers are assigned to the objects corresponding to the object type to be assigned in ascending order. Each identifier represents an object corresponding to an object type to be assigned.

[0082] S110. From the allocated identifier masks, determine the candidate identifier mask corresponding to the object to be assigned, where the object to be assigned is the object to be assigned an identifier.

[0083] S120. Based on the first identifier already assigned under the candidate identifier mask, determine the candidate identifier of the object to be assigned. The first identifier is the identifier with the largest value already assigned under the candidate identifier mask.

[0084] S130. When the value of the candidate identifier is greater than the value of the second identifier, the target identifier mask of the object to be assigned is determined based on the assigned identifier mask, wherein the second identifier is the identifier with the largest value that can be represented by the candidate identifier mask.

[0085] S140. Determine the target identifier of the object to be assigned based on the target identifier mask.

[0086] The technical solution of this invention allocates a corresponding identifier mask for the type of object to be allocated before determining the candidate identifier mask corresponding to the object to be allocated from the allocated identifier masks, and establishes a mapping relationship between the identifier mask and the type of object to be allocated. Identifiers are allocated to objects corresponding to the type of object to be allocated, which makes it easier to determine the type of object to be allocated corresponding to the identifier through the identifier mask in the future. When there is a new object to be allocated that needs to be identified, the target identifier mask can be determined based on the allocated identifier mask, and the target identifier can be determined based on the target identifier mask, which can improve the efficiency of identifier allocation.

[0087] Furthermore, before assigning the corresponding identifier mask to the type of the object to be allocated, the following steps are also included:

[0088] When setting identification information to indicate that a data upgrade is to be performed, the types of objects to be assigned are counted.

[0089] Setting identification information can refer to information indicating that an identification mask needs to be allocated. When a data upgrade is required, setting the identification information indicates that a data upgrade is needed, that is, an identification mask needs to be allocated. Counting the types of objects to be allocated can refer to counting the number of object types to be allocated.

[0090] When setting identification information to indicate that a data upgrade is to be performed, the types of objects to be assigned are counted. This makes it easier to assign identification masks to the types of objects to be assigned during the data upgrade.

[0091] Example 3

[0092] Figure 3 This is a flowchart of an identifier management method provided according to Embodiment 3 of the present invention. This embodiment is based on Embodiment 1 above, and further refines the determination of the target identifier mask of the object to be assigned based on the allocated identifier mask when the value of the candidate identifier is greater than the value of the second identifier; and the determination of the target identifier of the object to be assigned based on the target identifier mask.

[0093] In this embodiment, when the value of the candidate identifier is greater than the value of the second identifier, the target identifier mask of the object to be assigned is determined based on the assigned identifier mask, including: when the value of the candidate identifier is greater than the value of the second identifier, if the number of assigned identifier masks does not exceed the maximum value of the assignable identifier mask, then the maximum assigned identifier mask is incremented by one as the target identifier mask, or the number of assigned identifier masks is used as the target identifier mask.

[0094] In this embodiment, when the value of the candidate identifier is greater than the value of the second identifier, the target identifier mask of the object to be assigned is determined based on the assigned identifier mask. This includes: when the value of the candidate identifier is greater than the value of the second identifier, if the number of assigned identifier masks does not exceed the maximum value of the assignable identifier masks, then the target mask among the assignable identifier masks is used as the target identifier mask. The target mask is the identifier mask among the assignable identifier masks excluding the assigned identifier masks.

[0095] In this embodiment, determining the target identifier of the object to be assigned based on the target identifier mask includes: using the smallest identifier that the target identifier mask can represent as the target identifier of the object to be assigned.

[0096] like Figure 3 As shown, the method includes:

[0097] S110. From the allocated identifier masks, determine the candidate identifier mask corresponding to the object to be assigned, where the object to be assigned is the object to be assigned an identifier.

[0098] S120. Based on the first identifier already assigned under the candidate identifier mask, determine the candidate identifier of the object to be assigned. The first identifier is the identifier with the largest value already assigned under the candidate identifier mask.

[0099] S131. When the value of the candidate identifier is greater than the value of the second identifier, if the number of allocated identifier masks does not exceed the maximum value of the allocated identifier masks, then the maximum allocated identifier mask plus one is used as the target identifier mask, or the number of allocated identifier masks is used as the target identifier mask.

[0100] The allocatable identifier mask refers to the identifier mask that can be used for identifier allocation. The maximum value of the allocatable identifier mask can be determined based on the number of bytes used to represent the identifier mask in the identifier. Specifically, the number of bytes used to represent the identifier mask can be determined according to actual needs. For example, if the identifier mask is represented by the high-order byte, then the maximum value of the allocatable identifier mask is 11111111.

[0101] In one embodiment, the allocated identifier mask is: table 00000000, index 00000001, view 00000010, and the number of allocated identifier masks 00000011 does not exceed the maximum value of the allocated identifier masks 11111111. When the value of a candidate identifier is greater than the value of a second identifier, the maximum allocated identifier mask 00000010 plus one, resulting in 00000011, can be used as the target identifier mask, or the number of allocated identifier masks 00000011 can be used as the target identifier mask.

[0102] S132. When the value of the candidate identifier is greater than the value of the second identifier, if the number of allocated identifier masks does not exceed the maximum value of the available identifier masks, then the target mask among the available identifier masks is used as the target identifier mask. The target mask is the identifier mask among the available identifier masks excluding the allocated identifier masks.

[0103] The allocated identifier mask can include the identifier mask corresponding to the previously allocated identifier when an identifier has been allocated to an existing object to be allocated. The target mask is the identifier mask other than the allocated identifier mask among the available identifier masks. It can be understood that the target mask is the identifier mask that has not been allocated. There can be one or more target masks, and one of them can be selected as the target identifier mask in ascending order during allocation.

[0104] S141. The smallest identifier that the target identifier mask can represent is taken as the target identifier of the object to be allocated.

[0105] Using the smallest identifier that the target identifier mask can represent as the target identifier of the object to be assigned can be understood as selecting the identifier with the smallest value under the target identifier mask as the target identifier of the object to be assigned.

[0106] In one embodiment, the target identifier mask can be 00000011, and the smallest identifier that the target identifier mask can represent, 00000011 00000000 00000000 00000001, can be used as the target identifier of the object to be assigned.

[0107] The technical solution of this invention refines the process of determining the target identifier mask of the object to be assigned based on the already allocated identifier mask when the value of the candidate identifier is greater than the value of the second identifier, and determines the target identifier of the object to be assigned based on the target identifier mask, thereby making the identifier allocation process clearer and improving the identifier allocation efficiency.

[0108] The present invention will be described by way of example below:

[0109] In some systems, using integers as the IDs of managed objects is a common practice. Furthermore, for situations with multiple object types, there is an existing ID management method: using one or more bytes of the high-order bits of the ID as a type mask (i.e., identifier mask) byte, and setting different mask values ​​(i.e., identifier mask values) for each object type. The ID of a certain type of object will have its mask byte set to the mask value of that type. In this way, the system can quickly determine the object type corresponding to an ID.

[0110] In a database management system, there are object types such as tables, indexes, views, and sequences. If a four-byte integer is used as the ID of a database object, and the high-order byte is used as a type mask, then the actual ID value for each type is only three bytes, which can easily lead to an exhaustion of ID values. When IDs are exhausted, there are two solutions to continue using new ID values: either reuse previously available IDs, or upgrade the system to expand the data type of object IDs. However, the former is a slow and time-consuming operation to allocate available IDs each time; while system upgrades use a new data type with a larger data range to represent object IDs (for example, using an 8-byte integer instead of a 4-byte integer to represent object IDs).

[0111] This invention proposes an object ID management method based on this type-mask-based ID management approach. This method expands the ID usage space without requiring significant modifications to the system or its performance, while still maintaining the efficiency of quickly determining the type of operations and allocating IDs based on their values. This invention primarily addresses situations where existing systems run out of IDs, allowing for minimal-cost patch upgrades to expand the ID usage space.

[0112] In real-world systems, the number of managed object types does not reach the maximum number that the mask can represent (for example, in a database management system, if the highest byte (2 bytes) is used...). 8 The type mask (=256) can represent 256 object types. However, in reality, the number of database object types actually used in a database may not exceed N (e.g., 80), far less than the maximum number of types it can represent (256). Thus, M unused types (i.e., unused mask values) result in significant waste, M = 256 - N. This invention aims to extend the use of these wasted unused mask values ​​after all three bytes of a certain type have been used up in an existing system, while maintaining the efficiency of fast ID type determination and ID allocation operations.

[0113] In one embodiment, an identifier management method includes:

[0114] This functionality is achieved by adding a mapping array within the system to record the mapping relationship between ID mask (i.e., identifier mask) and object type.

[0115] For ease of description, the following conventions are used:

[0116] IDCLS: The high-order mask value of the ID in the system (i.e., the identifier mask value);

[0117] IDCLS_NUM: The number of IDCLS currently in use (i.e., the number of allocated identifier masks);

[0118] IDCLS_MAP: A mapping array between IDCLS and object types. The value located by IDCLS is the corresponding object type (i.e., establishing a mapping relationship between the identifier mask and the object type).

[0119] When determining the object type (obj_type) of an ID, you can use the ID mask to find the corresponding object type in the mapping array IDCLS_MAP[idcls].

[0120] When allocating a new ID for an object of type obj_type (i.e., the object to be allocated), the logic is as follows:

[0121] 1. Obtain the last assigned LAST_ID (i.e., the first assigned identifier under the candidate identifier mask);

[0122] 2. The new NEXT_ID = LAST_ID + 1; if the new NEXT_ID (i.e., the candidate identifier) ​​exceeds the maximum value that the current ID mask can represent (i.e., the value of the second identifier), then proceed to step 3; otherwise, proceed to step 5;

[0123] 3. Assign a new IDCLS for this object type and construct the NEXT_ID:

[0124] (1) NEW_IDCLS = IDCLS_NUM (that is, the number of allocated identifier masks is used as the target identifier mask);

[0125] (2) IDCLS_MAP[IDCLS_NUM] = obj_type (that is, to establish a mapping relationship between the target identifier mask and the object type corresponding to the object to be allocated);

[0126] (3) IDCLS_NUM++ (increment the number of allocated identifier masks by one);

[0127] (4) Construct the smallest ID that NEW_IDCLS can represent as NEXT_ID (i.e., determine the target identifier of the object to be allocated based on the target identifier mask);

[0128] 4. The ID management module writes the modified IDCLS_NUM and IDCLS_MAP into the module (i.e., stores the number of allocated identifier masks and their mapping relationships);

[0129] 5. The ID management module writes the NEXT_ID into the module (i.e., stores the target identifier).

[0130] Taking a database management system as an example, the database stores data in data pages, and uses special ID pages to manage the IDs of its data objects (i.e., objects to be assigned), which record the LAST_ID of each type of object.

[0131] Assume the ID data type is stored as a 4-byte integer, with the high-order byte used as the ID mask. Assume the database supports 60 object types, each with a predefined ID mask.

[0132] In the ID page, 1 byte is allocated to record IDCLS_NUM, and 256 bytes are used to store IDCLS_MAP.

[0133] 1. When the system starts, IDCLS_NUM and IDCLS_MAP from the data page are loaded into the ID management module;

[0134] 2. When you need to obtain the object type of the ID, you can use the ID mask to map the corresponding object type in the array ICLS_MAP[idcls].

[0135] 3. When assigning an ID to a certain type obj_type:

[0136] (1) Read the LAST_ID of the current obj_type from the ID page;

[0137] (2) NEXT_ID = LAST_ID + 1; If it exceeds the maximum value that the current ID mask can represent, proceed to step 3; otherwise, proceed to step 5;

[0138] (3) Assign a new IDCLS to the object type and construct NEXT_ID;

[0139] (4) Write the new modifications in the new IDCLS_NUM and IDCLS_MAP to the corresponding positions in the ID page;

[0140] (5) Write NEXT_ID to the corresponding position in the ID page.

[0141] Traditional methods are used in some older systems. When the ID value field is exhausted, the method of this invention can be flexibly used for improvement and upgrading.

[0142] In older systems, because unused data bytes in data pages are all 0, there are several ways to upgrade and handle this:

[0143] Option 1 involves refactoring and managing all existing and planned-to-be-expanded IDs in the old system using this invention. Specifically, it involves checking if the IDCLS_NUM stored in the data page is 0. If it is, it indicates that the method of this invention has not been used in the previous old system. In this case, a data upgrade is performed. Following the method of this invention, all object types in the existing system are statistically analyzed, i.e., the types of objects to be assigned are counted, and then corresponding identifier masks are assigned to these types. Based on the statistical results, the value of IDCLS_NUM and the object types (i.e., the types of objects to be assigned) corresponding to the preset mask (i.e., the identifier mask) are adjusted. IDs to be expanded can be assigned identifiers based on the already assigned identifier masks using the identifier management method provided by this invention, determining the target identifier mask.

[0144] Option 2 involves using this invention to modify and manage the extended IDs, while leaving the existing IDs in the old system untouched. Specifically, the ID information, excluding the preset N ID masks, is directly recorded in the ID page. That is, since existing IDs already occupy a portion of the identifier mask, when assigning identifiers to extended IDs, the already occupied identifier masks can be removed, and the unassigned identifier masks can be assigned to the object type corresponding to the extended ID.

[0145] Example 4

[0146] Figure 4 This is a schematic diagram of an identification management device according to Embodiment 4 of the present invention. This embodiment is applicable to situations where identification management of objects is performed. Figure 4 As shown, the specific structure of the device includes:

[0147] The first determining module 21 is used to determine the candidate identifier mask corresponding to the object to be assigned from the allocated identifier mask, wherein the object to be assigned is the object to be assigned an identifier.

[0148] The second determining module 22 is used to determine the candidate identifier of the object to be assigned based on the first identifier already assigned under the candidate identifier mask, wherein the first identifier is the identifier with the largest value already assigned under the candidate identifier mask;

[0149] The third determining module 23 is used to determine the target identifier mask of the object to be assigned based on the assigned identifier mask when the value of the candidate identifier is greater than the value of the second identifier. The second identifier is the identifier with the largest value that the candidate identifier mask can represent.

[0150] The fourth determination module 24 is used to determine the target identifier of the object to be assigned based on the target identifier mask.

[0151] The identifier management device provided in this embodiment first determines the candidate identifier mask corresponding to the object to be assigned from the allocated identifier masks by the first determining module 21. The object to be assigned is the object to be assigned an identifier. Second, the second determining module 22 determines the candidate identifier of the object to be assigned based on the first identifier already assigned under the candidate identifier mask. The first identifier is the identifier with the largest value already assigned under the candidate identifier mask. Then, the third determining module 23 determines the target identifier mask of the object to be assigned based on the allocated identifier masks when the value of the candidate identifier is greater than the value of the second identifier. The second identifier is the identifier with the largest value that can be represented by the candidate identifier mask. Finally, the fourth determining module 24 determines the target identifier of the object to be assigned based on the target identifier mask.

[0152] Furthermore, before determining the candidate identifier mask corresponding to the object to be assigned from the already assigned identifier masks, the device further includes:

[0153] The first allocation module is used to allocate a corresponding identifier mask for the type of object to be allocated, and the identifier mask corresponds one-to-one with the type of object to be allocated.

[0154] The first module is used to establish the mapping relationship between the identifier mask and the type of the object to be allocated;

[0155] The second allocation module is used to assign identifiers to objects corresponding to the object types to be allocated.

[0156] When there are at least two object types to be allocated, the allocation order of each identifier mask is from smallest to largest; when there are at least two objects corresponding to the object types to be allocated, the allocation order of each identifier is from smallest to largest.

[0157] Furthermore, before assigning a corresponding identifier mask to the type of object to be allocated, the device also includes:

[0158] The pending object type statistics module is used to count the types of objects to be assigned when the set identification information indicates that a data upgrade is to be performed.

[0159] Furthermore, after determining the candidate identifiers of the objects to be assigned, the device also includes:

[0160] The fifth determining module is used to use the candidate identifier mask as the target identifier mask and the candidate identifier as the target identifier if the value of the candidate identifier does not exceed the value of the second identifier.

[0161] Furthermore, the third determining module 23 is specifically used for:

[0162] When the value of the candidate identifier is greater than the value of the second identifier, if the number of allocated identifier masks does not exceed the maximum value of the allocated identifier masks, then the maximum allocated identifier mask is incremented by one as the target identifier mask, or the number of allocated identifier masks is used as the target identifier mask.

[0163] Furthermore, the third determining module 23 is specifically used for:

[0164] When the value of the candidate identifier is greater than the value of the second identifier, if the number of allocated identifier masks does not exceed the maximum value of the available identifier masks, then the target mask among the available identifier masks is used as the target identifier mask. The target mask is the identifier mask among the available identifier masks excluding the allocated identifier masks.

[0165] Furthermore, the device also includes:

[0166] The second module is used to establish a mapping relationship between the target identifier mask and the object type corresponding to the object to be allocated;

[0167] The storage module is used to store mapping relationships and target identifiers.

[0168] Furthermore, the fourth determining module 24 is specifically used for:

[0169] The smallest identifier that the target identifier mask can represent is used as the target identifier of the object to be assigned.

[0170] The identification management device provided in this embodiment of the invention can execute the identification management method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method execution.

[0171] Example 5

[0172] Figure 5This is a schematic diagram of the structure of an electronic device implementing the identification management method of this invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0173] like Figure 5 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0174] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0175] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as the identity management method.

[0176] In some embodiments, the identifier management method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the identifier management method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the identifier management method by any other suitable means (e.g., by means of firmware).

[0177] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0178] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0179] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0180] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0181] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0182] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0183] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0184] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A method for managing identification, characterized in that, include: From the allocated identifier masks, determine the candidate identifier mask corresponding to the object to be assigned, wherein the object to be assigned is the object to be assigned an identifier; Based on the first identifier already assigned under the candidate identifier mask, the candidate identifier of the object to be assigned is determined, wherein the first identifier is the identifier with the largest value already assigned under the candidate identifier mask; When the value of the candidate identifier is greater than the value of the second identifier, the target identifier mask of the object to be assigned is determined based on the assigned identifier mask, wherein the second identifier is the identifier with the largest value that the candidate identifier mask can represent; The target identifier of the object to be assigned is determined based on the target identifier mask; Wherein, when the value of the candidate identifier is greater than the value of the second identifier, the target identifier mask of the object to be assigned is determined based on the already assigned identifier mask, including: When the value of the candidate identifier is greater than the value of the second identifier, if the number of allocated identifier masks does not exceed the maximum value of the allocated identifier masks, then the maximum allocated identifier mask plus one is used as the target identifier mask, or the number of allocated identifier masks is used as the target identifier mask.

2. The method according to claim 1, characterized in that, Before determining the candidate identifier mask corresponding to the object to be assigned from the already assigned identifier masks, the process also includes: Assign a corresponding identifier mask to the type of object to be allocated, and the identifier mask corresponds one-to-one with the type of object to be allocated; Establish a mapping relationship between the identifier mask and the type of the object to be allocated; Assign an identifier to the object corresponding to the type of object to be assigned; When there are at least two object types to be assigned, the allocation order of each identifier mask is from smallest to largest; when there are at least two objects corresponding to the object types to be assigned, the allocation order of each identifier is from smallest to largest.

3. The method according to claim 2, characterized in that, Before assigning the corresponding identifier mask to the type of the object to be allocated, the following is also included: When setting identification information to indicate that a data upgrade is to be performed, the types of objects to be allocated are counted.

4. The method according to claim 1, characterized in that, After determining the candidate identifiers of the objects to be assigned, the process also includes: If the value of the candidate identifier does not exceed the value of the second identifier, then the candidate identifier mask is used as the target identifier mask, and the candidate identifier is used as the target identifier.

5. The method according to claim 1, characterized in that, When the value of the candidate identifier is greater than the value of the second identifier, the target identifier mask of the object to be assigned is determined based on the already assigned identifier mask, including: When the value of the candidate identifier is greater than the value of the second identifier, if the number of allocated identifier masks does not exceed the maximum value of the available identifier masks, then the target mask among the available identifier masks is used as the target identifier mask. The target mask is the identifier mask among the available identifier masks excluding the allocated identifier masks.

6. The method according to claim 1, characterized in that, Also includes: Establish a mapping relationship between the target identifier mask and the object type corresponding to the object to be allocated; Store the mapping relationship and the target identifier.

7. The method according to claim 1, characterized in that, Based on the target identifier mask, the target identifier of the object to be assigned is determined, including: The smallest identifier that the target identifier mask can represent is taken as the target identifier of the object to be assigned.

8. An identification management device, characterized in that, include: The first determining module is used to determine the candidate identifier mask corresponding to the object to be assigned from the allocated identifier masks, wherein the object to be assigned is the object to be assigned an identifier; The second determining module is used to determine the candidate identifier of the object to be assigned based on the first identifier already assigned under the candidate identifier mask, wherein the first identifier is the identifier with the largest value already assigned under the candidate identifier mask; The third determining module is used to determine the target identifier mask of the object to be assigned based on the assigned identifier mask when the value of the candidate identifier is greater than the value of the second identifier, wherein the second identifier is the identifier with the largest value that the candidate identifier mask can represent; The fourth determining module is used to determine the target identifier of the object to be assigned based on the target identifier mask; The third determining module is specifically used for: When the value of the candidate identifier is greater than the value of the second identifier, if the number of allocated identifier masks does not exceed the maximum value of the allocated identifier masks, then the maximum allocated identifier mask plus one is used as the target identifier mask, or the number of allocated identifier masks is used as the target identifier mask.

9. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor to enable the at least one processor to perform the method as described in any one of claims 1-7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Data processing method and device, equipment and storage medium

    CN114444114A

  • Method for performing a sensitive data encryption with masking, and corresponding encryption apparatus and computer program product

    US20170033923A1