A method for generating a unique ID primary key through distributed software

A software generation and distributed technology, applied in the direction of software design, etc., can solve the problems of poor readability, bulky, inconvenient indexing, etc., to achieve the effect of ensuring readability

Active Publication Date: 2019-06-28
成都章鱼侠科技股份有限公司
View PDF3 Cites 4 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

It can be seen from this that GUID has unique characteristics, but its volume is relatively large (128-bit

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • A method for generating a unique ID primary key through distributed software
  • A method for generating a unique ID primary key through distributed software
  • A method for generating a unique ID primary key through distributed software

Examples

Experimental program
Comparison scheme
Effect test

Embodiment

[0025] The present invention is mainly based on three development language environments of .Net, Java, and NodeJs. This embodiment is mainly introduced based on the .Net language. In addition, this embodiment is specifically introduced in detail with a 64-bit ULONG numerical type CUID, a total of 8 bytes, in order to achieve an incremental effect, the timestamp occupies 6 bytes, and the prefix code Hi occupies 2 bytes. The uniqueness between different deployments is guaranteed, and the timestamp is incremental, accurate to the subtle level, which can ensure that different timestamps are generated under the same deployment. The 2-byte prefix code space can generate theoretically 2 to the 16th power ≈ 65536 prefix codes, and each deployment only needs to allocate one Hi, and different prefix codes can determine that each machine generates a different CUID, which is enough to satisfy a single A distributed deployment environment for programs.

[0026] The specific algorithm of t...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention discloses a method for generating a unique ID primary key through distributed software, the unique ID primary key is set as a CUID, the CUID comprises a prefix code Hi and a timestamp obtained through system time, and the prefix code Hi is a ULONG value obtained after hash calculation is carried out on a machine code and a program path. The method comprises the following steps: initializing a global prefix code Hi; Verifying the system time, checking whether a log file generated by the CUID last time exists locally or not, and skipping checking if the log file does not exist; ifthe log file is read, the log file is taken out, the timestamp for generating the CUID for the last time is analyzed, the current system time is compared, and if the time for generating the CUID for the last time is longer than the current system time, the log file is directly thrown out to be abnormal, and system operation is not allowed; obtaining the information of the SteID, distributing the SteID to each site, and enabling each deployed prefix code Hi to be unique; and generating a CUID value, and splicing the prefix code Hi and the character string of the current timestamp. The uniqueness of the generated ID is ensured.

Description

technical field [0001] The invention relates to the technical field of software development, in particular to a method for generating a unique ID primary key by distributed software Background technique [0002] Most of the software development process is inseparable from the use of the database, and the unique identification of the data becomes particularly important. It is necessary to ensure that each piece of data has a unique ID identification. The distributed deployed data will not be merged into the database at the end. A primary key violation occurred. The design of the primary key of the traditional database uses self-increasing ID. Every time a new piece of data is added to the database, the primary key ID is incremented. This self-increasing field is simple and the storage capacity is not large. The JOIN operation performance of the data form Also high, the numerical ID is more convenient for fast indexing of relational databases. However, there is a big problem...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
IPC IPC(8): G06F8/20
Inventor 张国彬
Owner 成都章鱼侠科技股份有限公司
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products