Distributed sequence number generation method, device, computer equipment and storage medium

By allocating and monitoring distributed serial number segments between multiple secure partitions of power enterprises, the problem that the existing technology cannot synchronize distributed serial numbers across secure partitions is solved, and distributed serial number generation across secure partitions is realized.

CN114064806BActive Publication Date: 2025-04-29CHINA SOUTHERN POWER GRID COMPANY
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111404707.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-24
Publication Date
2025-04-29
Estimated Expiration
2041-11-24

AI Technical Summary

Technical Problem

The prior art cannot span synchronous distributed serial numbers between multiple network isolated security partitions of power enterprises, resulting in the inability to achieve globally unique distributed serial numbers generation.

Method used

By obtaining the database table of the first secure partition, its distributed serial number segment is obtained, and the distributed serial number segment and number segment allocation threshold of the second secure partition are allocated according to the number segment. The distributed serial number usage of the second secure partition is monitored regularly, and the number segment is reassigned if the threshold value is exceeded.

Benefits of technology

The distributed sequence number generation across the secure partition is realized, so that the distributed sequence number of the second secure partition belongs to the number segment of the first secure partition, and the distributed sequence number within the two secure partitions belongs to the "homologous" sequence number.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114064806B_ABST
    Figure CN114064806B_ABST
Patent Text Reader

Abstract

The present application relates to a distributed serial number generation method, device, computer equipment, storage medium and computer program product. The method includes: obtaining a database table of a first security partition, obtaining the first security partition distributed serial number segment corresponding to the database table according to the database table, obtaining the distributed serial number segment and segment allocation threshold of the second security partition according to the first security partition distributed serial number segment, regularly monitoring the use of the distributed serial number segment of the second security partition, obtaining the current distributed serial number of the second security partition, and if the current distributed serial number of the second security partition exceeds the segment allocation threshold, reallocating the corresponding distributed serial number segment and segment allocation threshold of the second security partition. The use of this method can support the generation of distributed serial numbers across security partitions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of electric power technology, and in particular to a distributed serial number generation method, apparatus, computer equipment, storage medium and computer program product. Background Art

[0002] With the development of network technology, enterprise distributed systems have emerged. After the enterprise distributed system is divided into libraries and tables, a globally unique distributed serial number is needed to identify the data. At present, the distributed serial number generation methods include: UUID, database auto-increment ID, database cluster mode, database segment mode, Redis incr to achieve atomic auto-increment, and snowflake algorithm.

[0003] However, the distributed systems of power enterprises are deployed in multiple network-isolated security partitions. Different security partitions deploy databases and Redis (Remote Dictionary Server) independently. High-security partitions can only synchronize data between low-security partitions in one direction. Therefore, the current mainstream global distributed serial number generation method is not suitable for power industry enterprises and there is a problem of being unable to cross security partitions. Summary of the invention

[0004] Based on this, it is necessary to provide a distributed serial number generation method, apparatus, computer device, computer-readable storage medium and computer program product that can support cross-security partitions to address the technical problem that the above-mentioned traditional methods cannot cross security partitions.

[0005] In a first aspect, the present application provides a distributed sequence number generation method. The method comprises:

[0006] Obtain a database table of the first security partition, and obtain the first security partition distributed serial number segment corresponding to the database table according to the database table;

[0007] According to the distributed serial number segment of the first security partition, obtaining the distributed serial number segment and the segment allocation threshold of the second security partition, wherein the security level of the first security partition is higher than the security level of the second security partition;

[0008] Regularly monitor the use of the distributed sequence number segment of the second security partition to obtain the current distributed sequence number of the second security partition;

[0009] If the current distributed serial number of the second security partition exceeds the segment allocation threshold, then the corresponding distributed serial number segment and segment allocation threshold of the second security partition are reallocated;

[0010] Return to the step of periodically monitoring the use of the distributed serial number segment of the second security partition and obtaining the current distributed serial number of the second security partition.

[0011] In one of the embodiments, the distributed serial number segment includes a segment start value, a segment end value, and a segment length.

[0012] In one embodiment, the use of the distributed sequence number segment of the second security partition is monitored regularly to obtain the current distributed sequence number of the second security partition, and then further includes:

[0013] Determine whether the current distributed sequence number of the second security partition exceeds the segment allocation threshold;

[0014] If the current distributed serial number of the second security partition is less than or equal to the segment allocation threshold, return to the step of periodically monitoring the use of the distributed serial number segment of the second security partition to obtain the current distributed serial number of the second security partition.

[0015] In one embodiment, if the current distributed sequence number of the second security partition exceeds the segment allocation threshold, reallocating the corresponding distributed sequence number segment and segment allocation threshold of the second security partition includes:

[0016] If the current distributed sequence number of the second security partition exceeds the segment allocation threshold, obtain the maximum segment termination value of the distributed sequence number of the second security partition of the corresponding database table;

[0017] According to the maximum segment termination value, reallocate the corresponding distributed sequence number segment of the second security partition to obtain the reallocated distributed sequence number segment of the second security partition;

[0018] According to the reallocated distributed serial number segment of the second security partition, the corresponding distributed serial number segment allocation threshold of the second security partition is reallocated to obtain the reallocated distributed serial number segment threshold of the second security partition.

[0019] In one embodiment, reallocating the corresponding distributed sequence number segment of the second security partition according to the maximum segment termination value, and obtaining the reallocated distributed sequence number segment of the second security partition includes:

[0020] Add the first preset value to the maximum segment end value to obtain the start value of the distributed serial number segment of the second security partition after redistribution;

[0021] Add the start value to the segment length to obtain the end value of the reallocated distributed serial number segment of the second security partition;

[0022] According to the start value and the end value, the distributed serial number segment of the second security partition after reallocation is obtained.

[0023] In one embodiment, the distributed sequence number generation method further includes:

[0024] If it is monitored that the current distributed sequence number of the second security partition is used, the current distributed sequence number of the second security partition is added with a second preset value to generate a new distributed sequence number.

[0025] In a second aspect, the present application also provides a distributed sequence number generation device. The device comprises:

[0026] A first security partition number segment acquisition module, used to acquire a database table of the first security partition, and obtain the first security partition distributed serial number segment corresponding to the database table according to the database table;

[0027] A second security partition number segment acquisition module, used to obtain a distributed serial number segment and a segment allocation threshold of a second security partition according to the distributed serial number segment of the first security partition, wherein the security level of the first security partition is higher than the security level of the second security partition;

[0028] A current sequence number acquisition module, used to periodically monitor the use of the distributed sequence number segment of the second security partition and obtain the current distributed sequence number of the second security partition;

[0029] A second security partition reallocation module, configured to reallocate the corresponding distributed sequence number segment and segment allocation threshold of the second security partition if the current distributed sequence number of the second security partition exceeds the segment allocation threshold;

[0030] The monitoring return module is used to control the current sequence number acquisition module to re-execute the operation of regularly monitoring the use of the distributed sequence number segment of the second security partition and obtaining the current distributed sequence number of the second security partition.

[0031] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

[0032] Obtain a database table of the first security partition, and obtain the first security partition distributed serial number segment corresponding to the database table based on the database table; obtain the distributed serial number segment and segment allocation threshold of the second security partition based on the first security partition distributed serial number segment, wherein the security level of the first security partition is higher than the security level of the second security partition; regularly monitor the use of the distributed serial number segment of the second security partition to obtain the current distributed serial number of the second security partition; if the current distributed serial number of the second security partition exceeds the segment allocation threshold, reallocate the corresponding distributed serial number segment and segment allocation threshold of the second security partition; return to the step of regularly monitoring the use of the distributed serial number segment of the second security partition to obtain the current distributed serial number of the second security partition.

[0033] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0034] Obtain a database table of the first security partition, and obtain the first security partition distributed serial number segment corresponding to the database table based on the database table; obtain the distributed serial number segment and segment allocation threshold of the second security partition based on the first security partition distributed serial number segment, wherein the security level of the first security partition is higher than the security level of the second security partition; regularly monitor the use of the distributed serial number segment of the second security partition to obtain the current distributed serial number of the second security partition; if the current distributed serial number of the second security partition exceeds the segment allocation threshold, reallocate the corresponding distributed serial number segment and segment allocation threshold of the second security partition; return to the step of regularly monitoring the use of the distributed serial number segment of the second security partition to obtain the current distributed serial number of the second security partition.

[0035] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0036] Obtain a database table of the first security partition, and obtain the first security partition distributed serial number segment corresponding to the database table based on the database table; obtain the distributed serial number segment and segment allocation threshold of the second security partition based on the first security partition distributed serial number segment, wherein the security level of the first security partition is higher than the security level of the second security partition; regularly monitor the use of the distributed serial number segment of the second security partition to obtain the current distributed serial number of the second security partition; if the current distributed serial number of the second security partition exceeds the segment allocation threshold, reallocate the corresponding distributed serial number segment and segment allocation threshold of the second security partition; return to the step of regularly monitoring the use of the distributed serial number segment of the second security partition to obtain the current distributed serial number of the second security partition.

[0037] The above-mentioned distributed serial number generation method, device, computer equipment, storage medium and computer program product obtain the database table of the first security partition, obtain the first security partition distributed serial number segment corresponding to the database table according to the database table, and then obtain the distributed serial number segment and segment allocation threshold of the second security partition, regularly monitor the use of the distributed serial number segment of the second security partition, obtain the current distributed serial number of the second security partition, determine whether the current distributed serial number of the second security partition exceeds the segment allocation threshold, and reallocate the corresponding distributed serial number segment and segment allocation threshold of the second security partition. This method of obtaining the distributed serial number of the second security partition based on the distributed serial number segment of the first security partition makes the distributed serial number of the second security partition subordinate to the distributed serial number segment of the first security partition, and the distributed serial numbers in the two security partitions are "homologous" serial numbers. Therefore, it can support distributed serial number generation across security partitions. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 An application environment diagram of a distributed sequence number generation method in one embodiment;

[0039] Figure 2 A schematic diagram of a process flow of a distributed sequence number generation method in one embodiment;

[0040] Figure 3 A schematic diagram of a process of generating a distributed sequence number in one embodiment;

[0041] Figure 4 It is a flowchart of a distributed sequence number generation method in another embodiment;

[0042] Figure 5 A schematic flow chart of a distributed sequence number generation step in another embodiment;

[0043] Figure 6 A schematic diagram of a distributed sequence number generation method according to an embodiment;

[0044] Figure 7 A schematic diagram of a distributed sequence number generation method according to another embodiment;

[0045] Figure 8 It is a structural block diagram of a distributed sequence number generating device in one embodiment;

[0046] Fig. 9 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0047] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0048] The distributed sequence number generation method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown in the figure, the first security partition 120 performs one-way communication with the second security partition 140 through the network. The first security partition 120 includes one or more sub-security partitions, each of which includes one or more database tables, and the second security partition 140 includes one or more sub-security partitions, each of which includes one or more database tables. Obtain a database table of the first security partition 120, and obtain the distributed serial number segment of the first security partition 120 corresponding to the database table according to the database table; obtain the distributed serial number segment and segment allocation threshold of the second security partition 140 according to the distributed serial number segment of the first security partition 120, wherein the security level of the first security partition 120 is higher than the security level of the second security partition 140; regularly monitor the use of the distributed serial number segment of the second security partition 140 to obtain the current distributed serial number of the second security partition 140; if the current distributed serial number of the second security partition 140 exceeds the segment allocation threshold, reallocate the corresponding distributed serial number segment and segment allocation threshold of the second security partition 140; return to the step of regularly monitoring the use of the distributed serial number segment of the second security partition 140 to obtain the current distributed serial number of the second security partition 140.

[0049] In one embodiment, Figure 2 As shown, a distributed sequence number generation method is provided, which is applied to Figure 1 Taking the first security partition 120 and the second security partition 140 in FIG. 1 as an example, the method includes the following steps:

[0050] S100: Obtain a database table of a first security partition, and obtain, according to the database table, a first security partition distributed serial number segment corresponding to the database table.

[0051] Among them, the distributed system of the power enterprise deploys multiple network-isolated security partitions. Each security partition deploys one or more sub-security partitions according to different businesses. Each sub-security partition includes one or more database tables. Each database table corresponds to a distributed serial number segment. The database table names of different sub-security partitions can be the same, but the distributed serial number segments corresponding to the same database table name in different sub-security partitions cannot overlap.

[0052] Specifically, a database table of the first security partition is obtained, and based on the database table, a first security partition distributed serial number segment corresponding to the database table is obtained.

[0053] S200: Obtain the distributed serial number segment and segment allocation threshold of the second security partition according to the distributed serial number segment of the first security partition.

[0054] Among them, the first security partition belongs to a local area network partition with a relatively high internal security level, and can only access the low security partition in one direction. The second security partition belongs to a local area network partition with a relatively low internal security level, that is, the security level of the first security partition is higher than that of the second security partition, and the first security partition and the second security partition are isolated from each other through the network. The database table in the first security partition is the same as the database table in the second security partition, but the data in the table is different. The database table in the second security partition only manages the data in its own partition, and the database table in the first security partition summarizes and manages all the data in the second security partition. According to the distributed serial number segment corresponding to the database table of the first security partition, it is synchronized to the second security partition to obtain the distributed serial number segment of the database table corresponding to the second security partition, and the segment allocation threshold is determined according to the distributed serial number segment. The size of the segment allocation threshold should be between the corresponding distributed serial number segment range.

[0055] Specifically, according to the distributed serial number segment of the first security partition, the distributed serial number segment and the segment allocation threshold of the second security partition are obtained.

[0056] S300: Regularly monitor the use of the distributed sequence number segment of the second security partition to obtain the current distributed sequence number of the second security partition.

[0057] Among them, the use of the distributed serial number segment of the second security partition refers to the increase of records in the database table in the second security partition, the distributed serial number segment is used, and the use of the distributed serial number segment of the second security partition is monitored regularly, that is, whether the current distributed serial number of the second security partition is within the range of the distributed serial number segment is monitored regularly. At the same time, the current distributed serial number of the second security partition can be obtained to prevent the current distributed serial number from exceeding the range of the distributed serial number segment.

[0058] Specifically, the use of the distributed sequence number segment of the second security partition is monitored regularly to obtain the current distributed sequence number of the second security partition.

[0059] S400: If the current distributed sequence number of the second security partition exceeds the segment allocation threshold, reallocate the corresponding distributed sequence number segment and segment allocation threshold of the second security partition.

[0060] Among them, the size of the segment allocation threshold should be between the corresponding distributed serial number segment range and minus a certain preset value, that is, the segment allocation threshold is less than the maximum value of the corresponding distributed serial number segment range, and it is judged whether the current distributed serial number of the second security partition obtained exceeds the segment allocation threshold. If the current distributed serial number of the second security partition exceeds the segment allocation threshold, the distributed serial number segment and segment allocation threshold of the database table corresponding to the current serial number are reallocated to the second partition.

[0061] Specifically, if the current distributed serial number of the second security partition exceeds the segment allocation threshold, the corresponding distributed serial number segment and segment allocation threshold of the second security partition are reallocated.

[0062] S500: Return to the step of periodically monitoring the use of the distributed sequence number segment of the second security partition and obtaining the current distributed sequence number of the second security partition.

[0063] After reallocating the distributed serial number segments and segment thresholds of the second security partition, return to periodically monitoring the use of the distributed serial number segments of the second security partition to re-obtain the current distributed serial number of the second security partition.

[0064] Specifically, return to the step of periodically monitoring the use of the distributed serial number segment of the second security partition and obtaining the current distributed serial number of the second security partition.

[0065] In the above-mentioned distributed serial number generation method, by obtaining the database table of the first security partition, according to the database table, the distributed serial number segment of the first security partition corresponding to the database table is obtained, and then the distributed serial number segment and segment allocation threshold of the second security partition are obtained, the use of the distributed serial number segment of the second security partition is monitored regularly, the current distributed serial number of the second security partition is obtained, and it is determined whether the current distributed serial number of the second security partition exceeds the segment allocation threshold, and the corresponding distributed serial number segment and segment allocation threshold of the second security partition are reallocated. This method of obtaining the distributed serial number of the second security partition based on the distributed serial number segment of the first security partition makes the distributed serial number of the second security partition subordinate to the distributed serial number segment of the first security partition, and the distributed serial numbers in the two security partitions belong to the "same source" serial numbers. Therefore, it can support distributed serial number generation across security partitions.

[0066] In one embodiment, Figure 3 As shown, S300 regularly monitors the use of the distributed sequence number segment of the second security partition, obtains the current distributed sequence number of the second security partition, and then further includes:

[0067] S320: Determine whether the current distributed sequence number of the second security partition exceeds the number segment allocation threshold;

[0068] S340: If the current distributed sequence number of the second security partition is less than or equal to the segment allocation threshold, return to the step of periodically monitoring the use of the distributed sequence number segment of the second security partition to obtain the current distributed sequence number of the second security partition.

[0069] In this embodiment, the distributed serial number segment includes a segment start value, a segment end value and a segment length. The segment allocation threshold is the segment value end value minus a certain preset value. It is determined whether the current distributed serial number of the second security partition exceeds the segment allocation threshold, that is, it is determined whether the current distributed serial number of the second security partition is within the second security partition distributed serial number segment range of the corresponding database table. If the current distributed serial number of the second security partition is less than or equal to the segment allocation threshold, that is, the current distributed serial number of the second security partition is within the second security partition distributed serial number segment range of the corresponding database table, and the corresponding distributed serial number segment still has idle segments to be used, then the process returns to the step of periodically monitoring the use of the distributed serial number segment of the second security partition, obtaining the current distributed serial number of the second security partition, and continuing to monitor the use of the distributed serial number segment.

[0070] The scheme of the above embodiment determines whether the current distributed serial number of the second security partition exceeds the segment allocation threshold. If the current distributed serial number of the second security partition is less than or equal to the segment allocation threshold, it returns to the step of periodically monitoring the use of the distributed serial number segment of the second security partition to obtain the current distributed serial number of the second security partition. This method of continuing to obtain the current distributed serial number of the second security partition by determining whether the current distributed serial number of the second security partition exceeds the segment allocation threshold provides a prerequisite for generating distributed serial numbers across security partitions.

[0071] In another embodiment, S400 if the current distributed serial number of the second security partition exceeds the segment allocation threshold, then reallocating the corresponding distributed serial number segment and segment allocation threshold of the second security partition includes: if the current distributed serial number of the second security partition exceeds the segment allocation threshold, obtaining the maximum segment termination value of the distributed serial number of the second security partition of the corresponding database table; according to the maximum segment termination value, reallocating the corresponding distributed serial number segment of the second security partition to obtain the reallocated distributed serial number segment of the second security partition; according to the reallocated distributed serial number segment of the second security partition, reallocating the corresponding distributed serial number segment allocation threshold of the second security partition to obtain the reallocated distributed serial number segment threshold of the second security partition.

[0072] In this embodiment, if the current distributed sequence number of the second security partition exceeds the segment allocation threshold, the maximum segment termination value of the distributed sequence number of the second security partition corresponding to the database table is obtained. Specifically, if the current distributed sequence number of the second security partition exceeds the segment allocation threshold, the table name of the database table where the current distributed sequence number is located is obtained, and according to the table name of the database, the sub-security partition with the same database table name in the second security partition is searched, and the distributed sequence number segments of all corresponding sub-security partitions are obtained, and the maximum segment termination value is obtained in the distributed sequence number segments. According to the maximum segment termination value, the distributed sequence number segment corresponding to the database table is reallocated to obtain the reallocated distributed sequence number segment of the second security partition, and a certain preset value is subtracted from the reallocated distributed sequence number segment termination value of the second security partition to obtain the reallocated distributed sequence number segment threshold of the second security partition, and the reallocated distributed sequence number segment threshold of the second security partition is greater than the reallocated distributed sequence number segment start value of the second security partition and less than the reallocated distributed sequence number segment termination value of the second security partition.

[0073] The scheme of the above embodiment determines whether the current distributed serial number of the second security partition exceeds the segment allocation threshold, obtains the maximum segment termination value of the distributed serial number of the second security partition of the corresponding database table, and reallocates the corresponding distributed serial number segment and segment allocation threshold of the second security partition according to the maximum segment termination value to obtain the reallocated distributed serial number segment and segment threshold of the second security partition. This method of determining whether the current distributed serial number of the second security partition exceeds the segment allocation threshold and obtaining the reallocated distributed serial number segment and segment threshold of the second security partition provides a prerequisite for generating distributed serial numbers across security partitions.

[0074] In one embodiment, Figure 4 As shown, according to the maximum segment termination value, the corresponding distributed serial number segment of the second security partition is reallocated, and the reallocated distributed serial number segment of the second security partition is obtained, including:

[0075] S420: Add the first preset value to the maximum segment end value to obtain the start value of the distributed sequence number segment of the second security partition after redistribution;

[0076] S440: Add the start value to the segment length to obtain the end value of the reallocated distributed sequence number segment of the second security partition;

[0077] S460: Obtain the reallocated distributed sequence number segment of the second security partition according to the start value and the end value.

[0078] In this embodiment, the maximum segment termination value is added to the first preset value to obtain the starting value of the distributed serial number segment of the second security partition after reallocation. Specifically, the maximum termination value of the corresponding database table is added to the first preset value, and the distributed serial number segment of the corresponding database table in the corresponding sub-security partition is reallocated to obtain the starting value of the distributed serial number segment of the corresponding database table in the second security partition after reallocation. The segment starting value is added to the segment length to obtain the ending value of the distributed serial number segment of the corresponding database table in the second security partition after reallocation. The segment starting value and the segment ending value are determined as a segment to obtain the distributed serial number segment of the corresponding database table in the second security partition after reallocation in the corresponding sub-security partition.

[0079] The scheme of the above embodiment, by adding the maximum segment end value plus the first preset value, reallocates the corresponding distributed serial number segment of the second security partition, and obtains the distributed serial number segment start value, segment end value and distributed serial number segment of the reallocated second security partition. This method of obtaining the distributed serial number segment of the reallocated second security partition through the maximum segment end value provides a prerequisite for generating distributed serial numbers across security partitions.

[0080] In another embodiment, Figure 5 As shown, a distributed sequence number generation method also includes:

[0081] S600: If it is detected that the current distributed sequence number of the second security partition is used, the current distributed sequence number of the second security partition is added with a second preset value to generate a new distributed sequence number.

[0082] In this embodiment, the current distributed serial number of the second security partition is monitored at regular intervals. If it is detected that the current distributed serial number of the second security partition is used, the current distributed serial number of the second security partition is added with a preset value to generate a new second security partition distributed serial number. At the same time, the newly generated second security partition distributed serial number should be within the corresponding second security partition distributed serial number segment range, that is, the newly generated second security distributed serial number is greater than or equal to the corresponding second security partition distributed serial number segment starting value, and less than or equal to the corresponding second security partition distributed serial number segment ending value.

[0083] The scheme of the above embodiment determines whether the current distributed serial number of the second security partition is used, adds the second preset value to the current distributed serial number of the second security partition, and generates a new distributed serial number. Based on the method of generating the distributed serial number of the second security partition, it can support the generation of distributed serial numbers across security partitions.

[0084] To explain the distributed sequence number generation method and its effect in detail, the following is a most detailed embodiment:

[0085] The first security partition includes N sub-security partitions, denoted as S1, S2 to SN, each sub-security partition includes 2 database tables, denoted as table1 and table2, the database table of the first security partition is obtained, and the first security partition distributed serial number segment corresponding to the database table is obtained according to the database table. The distributed serial number segment includes the segment start value, the segment end value and the segment length. According to the first security partition distributed serial number segment, the distributed serial number segment and the segment allocation threshold of the second security partition are obtained, wherein the security level of the first security partition is higher than the security level of the second security partition, the use of the distributed serial number segment of the second security partition is regularly monitored, and the current distributed serial number of the second security partition is obtained. The schematic diagram of the process of allocating the second security partition distributed serial number, the segment allocation threshold and the current distributed serial number according to the first security partition is as shown in Figure 6 shown.

[0086] Determine whether the current distributed serial number of the second security partition exceeds the segment allocation threshold. If the current distributed serial number of the second security partition is less than or equal to the segment allocation threshold, return to the step of periodically monitoring the use of the distributed serial number segment of the second security partition to obtain the current distributed serial number of the second security partition. If the current distributed serial number of the second security partition exceeds the segment allocation threshold, obtain the maximum segment termination value of the distributed serial number of the second security partition of the corresponding database table, add the maximum segment termination value to the first preset value, obtain the starting value of the reallocated distributed serial number segment of the second security partition, add the starting value to the segment length, obtain the termination value of the reallocated distributed serial number segment of the second security partition, obtain the reallocated distributed serial number segment of the second security partition according to the starting value and the termination value, reallocate the distributed serial number segment of the second security partition according to the reallocated distributed serial number segment of the second security partition, reallocate the corresponding distributed serial number segment allocation threshold of the second security partition according to the reallocated distributed serial number segment of the second security partition, obtain the reallocated distributed serial number segment threshold of the second security partition, return to the step of periodically monitoring the use of the distributed serial number segment of the second security partition, and obtain the current distributed serial number of the second security partition. The schematic diagram of the process of reallocating the second security partition distributed serial number, the segment allocation threshold, and the current distributed serial number according to the first security partition is shown in FIG. Figure 7 shown.

[0087] If it is monitored that the current distributed sequence number of the second security partition is used, the current distributed sequence number of the second security partition is added with a second preset value to generate a new distributed sequence number.

[0088] The scheme of the above embodiment obtains the database table of the first security partition, obtains the distributed serial number segment of the first security partition corresponding to the database table according to the database table, and then obtains the distributed serial number segment and segment allocation threshold of the second security partition, regularly monitors the use of the distributed serial number segment of the second security partition, obtains the current distributed serial number of the second security partition, determines whether the current distributed serial number of the second security partition exceeds the segment allocation threshold, and reallocates the corresponding distributed serial number segment and segment allocation threshold of the second security partition. This method of obtaining the distributed serial number of the second security partition based on the distributed serial number segment of the first security partition makes the distributed serial number of the second security partition subordinate to the distributed serial number segment of the first security partition, and the distributed serial numbers in the two security partitions are "homologous" serial numbers. Therefore, it can support the generation of distributed serial numbers across security partitions.

[0089] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0090] Based on the same inventive concept, the embodiment of the present application also provides a distributed sequence number generation device for implementing the above-mentioned distributed sequence number generation method. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above-mentioned method, so the specific limitations in one or more distributed sequence number generation device embodiments provided below can refer to the above-mentioned limitations on the distributed sequence number generation method, which will not be repeated here.

[0091] In one embodiment, Figure 8 As shown, a distributed sequence number generating device 700 is provided, comprising: a first security partition number segment acquiring module 710, a second security partition number segment acquiring module 720, a current sequence number acquiring module 730, a second security partition reallocation module 740 and a monitoring return module 750, wherein:

[0092] The first security partition number segment acquisition module 710 is used to acquire the database table of the first security partition, and obtain the first security partition distributed serial number segment corresponding to the database table according to the database table.

[0093] The second security partition number segment acquisition module 720 is used to obtain the distributed serial number segment and segment allocation threshold of the second security partition according to the distributed serial number segment of the first security partition, wherein the security level of the first security partition is higher than the security level of the second security partition.

[0094] The current sequence number acquisition module 730 is used to periodically monitor the use of the distributed sequence number segment of the second security partition and obtain the current distributed sequence number of the second security partition.

[0095] The second security partition reallocation module 740 is used to reallocate the corresponding second security partition's distributed sequence number segment and segment allocation threshold if the current distributed sequence number of the second security partition exceeds the segment allocation threshold.

[0096] The monitoring return module 750 is used to control the current sequence number acquisition module to re-execute the operation of regularly monitoring the use of the distributed sequence number segment of the second security partition and obtaining the current distributed sequence number of the second security partition.

[0097] In the above-mentioned distributed serial number generation device, by obtaining the database table of the first security partition, the distributed serial number segment of the first security partition corresponding to the database table is obtained according to the database table, and then the distributed serial number segment and segment allocation threshold of the second security partition are obtained, the use of the distributed serial number segment of the second security partition is monitored regularly, the current distributed serial number of the second security partition is obtained, it is determined whether the current distributed serial number of the second security partition exceeds the segment allocation threshold, and the corresponding distributed serial number segment and segment allocation threshold of the second security partition are reallocated. This device for obtaining the distributed serial number of the second security partition based on the distributed serial number segment of the first security partition makes the distributed serial number of the second security partition subordinate to the distributed serial number segment of the first security partition, and the distributed serial numbers in the two security partitions belong to the "same source" serial numbers. Therefore, it can support distributed serial number generation across security partitions.

[0098] In one embodiment, the distributed serial number segment in the first security partition segment acquisition module 710 includes a segment start value, a segment end value, and a segment length.

[0099] In one embodiment, the second security partition reallocation module 740 is also used to obtain the maximum segment termination value of the distributed serial number of the second security partition of the corresponding database table if the current distributed serial number of the second security partition exceeds the segment allocation threshold; reallocate the corresponding distributed serial number segment of the second security partition according to the maximum segment termination value to obtain the reallocated distributed serial number segment of the second security partition; reallocate the corresponding distributed serial number segment allocation threshold of the second security partition according to the reallocated distributed serial number segment of the second security partition to obtain the reallocated distributed serial number segment threshold of the second security partition.

[0100] In one embodiment, the second security partition reallocation module 740 is also used to add the maximum segment end value to the first preset value to obtain the starting value of the distributed serial number segment of the reallocated second security partition; add the starting value to the segment length to obtain the ending value of the distributed serial number segment of the reallocated second security partition; and obtain the distributed serial number segment of the reallocated second security partition based on the starting value and the ending value.

[0101] In one embodiment, the distributed serial number generating device 700 is also used to determine whether the current distributed serial number of the second security partition exceeds the number segment allocation threshold; if the current distributed serial number of the second security partition is less than or equal to the number segment allocation threshold, it returns to the step of periodically monitoring the use of the distributed serial number segment of the second security partition to obtain the current distributed serial number of the second security partition.

[0102] In one embodiment, the distributed sequence number generating device 700 is further configured to add a second preset value to the current distributed sequence number of the second security partition to generate a new distributed sequence number if it is detected that the current distributed sequence number of the second security partition is used.

[0103] Each module in the above-mentioned distributed serial number generation device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0104] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig. 9As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the distributed serial numbers, distributed serial number segments and segment allocation thresholds of the first security partition and the second security partition. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a distributed serial number generation method is implemented.

[0105] Those skilled in the art will understand that Fig. 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0106] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0107] Obtain a database table of the first security partition, and obtain the first security partition distributed serial number segment corresponding to the database table according to the database table;

[0108] According to the distributed serial number segment of the first security partition, obtaining the distributed serial number segment and the segment allocation threshold of the second security partition, wherein the security level of the first security partition is higher than the security level of the second security partition;

[0109] Regularly monitor the use of the distributed sequence number segment of the second security partition to obtain the current distributed sequence number of the second security partition;

[0110] If the current distributed serial number of the second security partition exceeds the segment allocation threshold, then the corresponding distributed serial number segment and segment allocation threshold of the second security partition are reallocated;

[0111] Return to the step of periodically monitoring the use of the distributed serial number segment of the second security partition and obtaining the current distributed serial number of the second security partition.

[0112] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0113] The distributed serial number segment includes the segment start value, segment end value and segment length.

[0114] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0115] Determine whether the current distributed serial number of the second security partition exceeds the segment allocation threshold; if the current distributed serial number of the second security partition is less than or equal to the segment allocation threshold, return to the step of periodically monitoring the use of the distributed serial number segment of the second security partition to obtain the current distributed serial number of the second security partition.

[0116] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0117] If the current distributed serial number of the second security partition exceeds the segment allocation threshold, obtain the maximum segment termination value of the distributed serial number of the second security partition of the corresponding database table; reallocate the corresponding distributed serial number segment of the second security partition according to the maximum segment termination value, and obtain the reallocated distributed serial number segment of the second security partition; reallocate the corresponding distributed serial number segment allocation threshold of the second security partition according to the reallocated distributed serial number segment of the second security partition, and obtain the reallocated distributed serial number segment threshold of the second security partition.

[0118] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0119] Add the first preset value to the maximum segment end value to obtain the starting value of the distributed serial number segment of the second security partition after reallocation; add the starting value to the segment length to obtain the ending value of the distributed serial number segment of the second security partition after reallocation; based on the starting value and the ending value, obtain the distributed serial number segment of the second security partition after reallocation.

[0120] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0121] If it is monitored that the current distributed sequence number of the second security partition is used, the current distributed sequence number of the second security partition is added with a second preset value to generate a new distributed sequence number.

[0122] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0123] Obtain a database table of the first security partition, and obtain the first security partition distributed serial number segment corresponding to the database table according to the database table;

[0124] According to the distributed serial number segment of the first security partition, obtaining the distributed serial number segment and the segment allocation threshold of the second security partition, wherein the security level of the first security partition is higher than the security level of the second security partition;

[0125] Regularly monitor the use of the distributed sequence number segment of the second security partition to obtain the current distributed sequence number of the second security partition;

[0126] If the current distributed serial number of the second security partition exceeds the segment allocation threshold, then the corresponding distributed serial number segment and segment allocation threshold of the second security partition are reallocated;

[0127] Return to the step of periodically monitoring the use of the distributed serial number segment of the second security partition and obtaining the current distributed serial number of the second security partition.

[0128] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0129] The distributed serial number segment includes the segment start value, segment end value and segment length.

[0130] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0131] Determine whether the current distributed serial number of the second security partition exceeds the segment allocation threshold; if the current distributed serial number of the second security partition is less than or equal to the segment allocation threshold, return to the step of periodically monitoring the use of the distributed serial number segment of the second security partition to obtain the current distributed serial number of the second security partition.

[0132] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0133] If the current distributed serial number of the second security partition exceeds the segment allocation threshold, obtain the maximum segment termination value of the distributed serial number of the second security partition of the corresponding database table; reallocate the corresponding distributed serial number segment of the second security partition according to the maximum segment termination value, and obtain the reallocated distributed serial number segment of the second security partition; reallocate the corresponding distributed serial number segment allocation threshold of the second security partition according to the reallocated distributed serial number segment of the second security partition, and obtain the reallocated distributed serial number segment threshold of the second security partition.

[0134] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0135] Add the first preset value to the maximum segment end value to obtain the starting value of the distributed serial number segment of the second security partition after reallocation; add the starting value to the segment length to obtain the ending value of the distributed serial number segment of the second security partition after reallocation; based on the starting value and the ending value, obtain the distributed serial number segment of the second security partition after reallocation.

[0136] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0137] If it is monitored that the current distributed sequence number of the second security partition is used, the current distributed sequence number of the second security partition is added with a second preset value to generate a new distributed sequence number.

[0138] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0139] Obtain a database table of the first security partition, and obtain the first security partition distributed serial number segment corresponding to the database table according to the database table;

[0140] According to the distributed serial number segment of the first security partition, obtaining the distributed serial number segment and the segment allocation threshold of the second security partition, wherein the security level of the first security partition is higher than the security level of the second security partition;

[0141] Regularly monitor the use of the distributed sequence number segment of the second security partition to obtain the current distributed sequence number of the second security partition;

[0142] If the current distributed serial number of the second security partition exceeds the segment allocation threshold, then the corresponding distributed serial number segment and segment allocation threshold of the second security partition are reallocated;

[0143] Return to the step of periodically monitoring the use of the distributed serial number segment of the second security partition and obtaining the current distributed serial number of the second security partition.

[0144] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0145] The distributed serial number segment includes the segment start value, segment end value and segment length.

[0146] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0147] Determine whether the current distributed serial number of the second security partition exceeds the segment allocation threshold; if the current distributed serial number of the second security partition is less than or equal to the segment allocation threshold, return to the step of periodically monitoring the use of the distributed serial number segment of the second security partition to obtain the current distributed serial number of the second security partition.

[0148] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0149] If the current distributed serial number of the second security partition exceeds the segment allocation threshold, obtain the maximum segment termination value of the distributed serial number of the second security partition of the corresponding database table; reallocate the corresponding distributed serial number segment of the second security partition according to the maximum segment termination value, and obtain the reallocated distributed serial number segment of the second security partition; reallocate the corresponding distributed serial number segment allocation threshold of the second security partition according to the reallocated distributed serial number segment of the second security partition, and obtain the reallocated distributed serial number segment threshold of the second security partition.

[0150] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0151] Add the first preset value to the maximum segment end value to obtain the starting value of the distributed serial number segment of the second security partition after reallocation; add the starting value to the segment length to obtain the ending value of the distributed serial number segment of the second security partition after reallocation; based on the starting value and the ending value, obtain the distributed serial number segment of the second security partition after reallocation.

[0152] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0153] If it is monitored that the current distributed sequence number of the second security partition is used, the current distributed sequence number of the second security partition is added with a second preset value to generate a new distributed sequence number.

[0154] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0155] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0156] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0157] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A distributed sequence number generation method, characterized in that: The method comprises: Obtain a database table of the first security partition, and obtain, according to the database table, a first security partition distributed serial number segment corresponding to the database table; According to the first security partition distributed serial number segment, obtaining the distributed serial number segment and the segment allocation threshold of the second security partition, wherein the security level of the first security partition is higher than the security level of the second security partition; Regularly monitor the use of the distributed sequence number segment of the second security partition to obtain the current distributed sequence number of the second security partition; If the current distributed serial number of the second security partition exceeds the segment allocation threshold, reallocate the corresponding distributed serial number segment and segment allocation threshold of the second security partition; Returning to the step of periodically monitoring the use of the distributed sequence number segment of the second security partition to obtain the current distributed sequence number of the second security partition; The obtaining, according to the first security partition distributed serial number segment, a distributed serial number segment and a segment allocation threshold of the second security partition includes: According to the distributed serial number segment corresponding to the database table of the first security partition, synchronize to the second security partition to obtain the distributed serial number segment corresponding to the database table of the second security partition.

2. The distributed sequence number generation method according to claim 1, characterized in that: The distributed serial number segment includes a segment start value, a segment end value and a segment length.

3. The distributed sequence number generation method according to claim 1, characterized in that: Regularly monitoring the use of the distributed sequence number segment of the second security partition to obtain the current distributed sequence number of the second security partition, and then further comprising: Determining whether the current distributed sequence number of the second security partition exceeds the number segment allocation threshold; If the current distributed serial number of the second security partition is less than or equal to the segment allocation threshold, return to the step of periodically monitoring the use of the distributed serial number segment of the second security partition to obtain the current distributed serial number of the second security partition.

4. The distributed sequence number generation method according to claim 2, characterized in that: If the current distributed sequence number of the second security partition exceeds the segment allocation threshold, reallocating the corresponding distributed sequence number segment and segment allocation threshold of the second security partition includes: If the current distributed sequence number of the second security partition exceeds the segment allocation threshold, obtaining a maximum segment termination value of the distributed sequence number of the second security partition corresponding to the database table; According to the maximum segment termination value, reallocate the corresponding distributed sequence number segment of the second security partition to obtain the reallocated distributed sequence number segment of the second security partition; According to the reallocated distributed serial number segment of the second security partition, the corresponding distributed serial number segment allocation threshold of the second security partition is reallocated to obtain the reallocated distributed serial number segment threshold of the second security partition.

5. The distributed sequence number generation method according to claim 4, characterized in that: According to the maximum segment termination value, reallocating the corresponding distributed sequence number segment of the second security partition, and obtaining the reallocated distributed sequence number segment of the second security partition includes: Add the first preset value to the maximum segment end value to obtain the start value of the distributed sequence number segment of the second security partition after redistribution; Add the starting value to the segment length to obtain the ending value of the reallocated distributed serial number segment of the second security partition; According to the start value and the end value, the distributed serial number segment of the second security partition after reallocation is obtained.

6. The distributed sequence number generation method according to claim 1, characterized in that: The method further comprises: If it is monitored that the current distributed sequence number of the second security partition is used, the current distributed sequence number of the second security partition is added with a second preset value to generate a new distributed sequence number.

7. A distributed sequence number generating device, characterized in that: The device comprises: A first security partition number segment acquisition module, used to acquire a database table of the first security partition, and obtain, according to the database table, a first security partition distributed serial number segment corresponding to the database table; A second security partition number segment acquisition module, configured to obtain a distributed serial number segment and a segment allocation threshold of a second security partition according to the distributed serial number segment of the first security partition, wherein the security level of the first security partition is higher than the security level of the second security partition; A current sequence number acquisition module, used to periodically monitor the use of the distributed sequence number segment of the second security partition and obtain the current distributed sequence number of the second security partition; A second security partition reallocation module, configured to reallocate the corresponding distributed sequence number segment and segment allocation threshold of the second security partition if the current distributed sequence number of the second security partition exceeds the segment allocation threshold; A monitoring return module, used to control the current sequence number acquisition module to re-execute the operation of regularly monitoring the use of the distributed sequence number segment of the second security partition to obtain the current distributed sequence number of the second security partition; The second security partition number segment acquisition module is further used to: According to the distributed serial number segment corresponding to the database table of the first security partition, synchronize to the second security partition to obtain the distributed serial number segment corresponding to the database table of the second security partition.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

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

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Distributed ID generation method and device, server and readable storage medium

    CN113568891A