CN111125569A - Data identifier generation method and device, electronic equipment and medium - Google Patents

Data identifier generation method and device, electronic equipment and medium Download PDF

Info

Publication number
CN111125569A
CN111125569A CN201911363237.5A CN201911363237A CN111125569A CN 111125569 A CN111125569 A CN 111125569A CN 201911363237 A CN201911363237 A CN 201911363237A CN 111125569 A CN111125569 A CN 111125569A
Authority
CN
China
Prior art keywords
data
application server
database
request
number segment
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911363237.5A
Other languages
Chinese (zh)
Inventor
梁袁冰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Tongbang Zhuoyi Technology Co Ltd
Original Assignee
Beijing Tongbang Zhuoyi Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Tongbang Zhuoyi Technology Co Ltd filed Critical Beijing Tongbang Zhuoyi Technology Co Ltd
Priority to CN201911363237.5A priority Critical patent/CN111125569A/en
Publication of CN111125569A publication Critical patent/CN111125569A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present disclosure provides a method for generating a data identifier, which is applied to a database capable of providing a service for an application server in a distributed environment, and includes: and receiving a first data acquisition request from the first application server, wherein the first data acquisition request is sent by the first application server in response to a first data generation request from a first requester, and the first data generation request is used for indicating generation of the first data identifier. In response to a first data acquisition request, a first number segment corresponding to the first data acquisition request is acquired, wherein the first number segment is determined based on a maximum number value maintained in a database. And returning the first number segment to the first application server, so that the first application server can return a first target number to the first requester based on the first number segment, and the first requester can generate the first data identifier based on the first target number. The present disclosure also provides a device for generating data identifier, an electronic device and a medium.

Description

Data identifier generation method and device, electronic equipment and medium
Technical Field
The present disclosure relates to the field of databases, and more particularly, to a method and an apparatus for generating a data identifier, an electronic device, and a medium.
Background
The role of the service key in the IT system is very critical, and as the identification of the service data, the requirements of global uniqueness, efficient generation and the like need to be met.
The related art also provides some ways to generate the service primary key, such as Universal Unique Identifier (UUID), snowflake algorithm and related variants, various combination algorithms of system time stamp, and distributed middleware (Redis).
However, in implementing the concept of the present disclosure, the inventors found that at least the following problems exist in the related art: the generated integer main key is not unique, and the efficiency is low.
In view of the above problems in the related art, no effective solution has been proposed at present.
Disclosure of Invention
In view of this, the present disclosure provides a method and an apparatus for generating a data identifier, an electronic device, and a medium.
One aspect of the present disclosure provides a method for generating a data identifier, which is applied to a database capable of providing a service for an application server in a distributed environment, and includes: receiving a first data acquisition request from a first application server, wherein the first data acquisition request is sent by the first application server in response to a first data generation request from a first requester, the first data generation request is used for instructing generation of a first data identifier, and in response to the first data acquisition request, acquiring a first number segment corresponding to the first data acquisition request, wherein the first number segment is determined based on a maximum number value maintained in the database, and returning the first number segment to the first application server, so that the first application server can return a first target number to the first requester based on the first number segment, and the first requester can generate the first data identifier based on the first target number.
According to an embodiment of the present disclosure, the acquiring, in response to the first data acquisition request, a first number segment corresponding to the first data acquisition request includes: and in response to the first data acquisition request, adding a distributed lock to the first application server to prevent the database from acquiring a second number segment in response to a second data acquisition request from a second application server, where the second application server is an application server other than the first application server among the plurality of application servers, the second data acquisition request is sent by the second application server in response to a second data generation request from a second requester, and the second data generation request is used for instructing generation of a second data identifier to acquire the first number segment corresponding to the first data acquisition request.
According to an embodiment of the present disclosure, the method further includes: after returning the first number segment to the first application server, the distributed lock is released from the first application server to enable the database to obtain the second number segment in response to the second data obtaining request from the second application server.
According to an embodiment of the present disclosure, the acquiring a first number segment corresponding to the first data acquisition request includes: the method comprises the steps of obtaining a maximum number value maintained in the database, determining an initial value of the first number segment based on the maximum number value, obtaining a first number step maintained in the database, wherein the first number step is used for representing the number quantity in the first number segment, obtaining a first number increment maintained in the database, wherein the first number increment is used for representing the difference value between any two adjacent number values in the first number segment, and determining a first number segment corresponding to the first data obtaining request based on the initial value of the first number segment, the first number step and the first number increment.
According to an embodiment of the present disclosure, the method further includes: updating the maximum number value maintained in the database based on the first number segment.
Another aspect of the present disclosure provides a method for generating a data identifier, applied to a third application server in a distributed environment, including: receiving a third data generation request from a third requester, wherein the third data generation request indicates generation of a third data identifier, sending the third data acquisition request to a database in response to the third data generation request to enable the database to acquire and return a third number segment, wherein the third number segment is determined based on a maximum number value maintained in the database, receiving the third number segment returned by the database, determining a third destination number based on the third number segment, wherein the third destination number is used to generate the third data identifier, and returning the third destination number to the third requester to enable the third requester to generate the third data identifier based on the third destination number.
According to an embodiment of the present disclosure, the sending the third data obtaining request to the database in response to the third data generating request includes: and in response to the third data generation request, detecting whether an available number exists in the third application server, wherein the available number is used for generating the third data identifier, and sending the third data acquisition request to the database when the available number does not exist in the third application server.
According to an embodiment of the present disclosure, the detecting whether there is an available number in the third application server in response to the third data generation request includes: and in response to the third data generation request, adding a local lock to the third application server to make the third application server unable to respond to a fourth data generation request from a fourth requester, and sending the fourth data generation request to the database to make the database capable of acquiring and returning a fourth number segment, so as to detect whether an available number exists in the third application server.
According to an embodiment of the present disclosure, the method further includes: after returning the third destination number to the third requester, the local lock is released to the third application server so that the third application server can send the fourth data generation request to the database in response to the fourth data generation request from the fourth requester so that the database can acquire and return the fourth number segment.
Another aspect of the present disclosure provides a data identifier generation apparatus applied to a database capable of providing services for application servers in a distributed environment, including: a first receiving module configured to receive a first data acquisition request from a first application server, wherein the first data acquisition request is sent by the first application server in response to a first data generation request from a first requestor, the first data generation request is used for indicating generation of a first data identifier, the obtaining module is configured to respond to the first data obtaining request, obtain a first number segment corresponding to the first data obtaining request, wherein the first number segment is determined based on a maximum number value maintained in the database, a first return module configured to return the first number segment to the first application server, so that the first application server can return a first target number to the first requester based on the first number segment, and the first requester can generate the first data identifier based on the first target number.
According to an embodiment of the present disclosure, the obtaining module includes: an adding submodule configured to add a distributed lock to the first application server in response to the first data acquisition request, so that the database cannot acquire a second number segment in response to a second data acquisition request from a second application server, where the second application server is an application server other than the first application server, the second data acquisition request is sent by the second application server in response to a second data generation request from a second requester, and the second data generation request is used for instructing generation of a second data identifier, and the acquiring submodule is configured to acquire the first number segment corresponding to the first data acquisition request.
According to an embodiment of the present disclosure, the obtaining module further includes: a release submodule configured to release the distributed lock from the first application server after returning the first number segment to the first application server, so that the database can acquire the second number segment in response to the second data acquisition request from the second application server.
According to an embodiment of the present disclosure, the obtaining sub-module includes: the first acquiring unit is configured to acquire a maximum number value maintained in the database, the first determining unit is configured to determine a start value of the first number segment based on the maximum number value, the second acquiring unit is configured to acquire a first number step maintained in the database, wherein the first number step is used for representing the number in the first number segment, the third acquiring unit is configured to acquire a first number increment maintained in the database, wherein the first number increment is used for representing a difference value between any two adjacent number values in the first number segment, and the second determining unit is configured to determine a first number segment corresponding to the first data acquisition request based on the start value of the first number segment, the first number step and the first number increment.
According to an embodiment of the present disclosure, the apparatus further includes: an update module configured to update the maximum number value maintained in the database based on the first number segment.
Another aspect of the present disclosure provides a data identifier generating apparatus, applied to a third application server in a distributed environment, including: a second receiving module configured to receive a third data generation request from a third requester, wherein the third data generation request is used for indicating generation of a third data identifier, a sending module configured to send the third data acquisition request to a database in response to the third data generation request, such that said database is capable of retrieving and returning a third number segment, said third number segment being determined based on a maximum number value maintained in said database, a third receiving module configured to receive said third number segment returned by said database, a determining module configured to determine a third destination number based on said third number segment, wherein the third destination number is used for generating the third data identifier, a second returning module configured to return the third destination number to the third requester, such that the third requester can generate the third data tag based on the third destination number.
According to an embodiment of the present disclosure, the sending module includes: a detection sub-module configured to detect whether an available number exists in the third application server in response to the third data generation request, where the available number is used to generate the third data identifier, and a transmission sub-module configured to transmit the third data acquisition request to the database when the available number does not exist in the third application server.
According to an embodiment of the present disclosure, the detection submodule includes: an adding unit configured to add a local lock to the third application server in response to the third data generation request, so that the third application server cannot respond to a fourth data generation request from a fourth requesting party, and send the fourth data generation request to the database, so that the database can acquire and return a fourth number segment, and a detecting unit configured to detect whether an available number exists in the third application server.
According to an embodiment of the present disclosure, the detection sub-module further includes: a releasing unit configured to release the local lock to the third application server after returning the third destination number to the third requester, so that the third application server can transmit the fourth data generation request to the database in response to the fourth data generation request from the fourth requester, so that the database can acquire and return the fourth number segment.
Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions for implementing the method as described above when executed.
Another aspect of the present disclosure provides an electronic device including: one or more processors; a memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of the preceding items.
By the embodiment of the disclosure, at a database side capable of providing services for an application server in a distributed environment, when a data acquisition request sent by the application server side in response to a data generation request of a requester is received, a number segment corresponding to the data acquisition request can be determined based on a maximum number value maintained by the database side, so that the requester can generate a data identifier based on a number in the number segment. The centralized control of the number section range and the batch acquisition of the number sections can be realized. Correspondingly, at the application server, in response to the data identifier generation request of the requester, under the condition that no available number exists locally, the data acquisition request is sent to the database to acquire the number segment, so that the requester can generate the data identifier based on the number in the number segment, the generation of the local number is realized, and the generation efficiency of the data identifier is improved.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent from the following description of embodiments of the present disclosure with reference to the accompanying drawings, in which:
fig. 1 schematically illustrates an application scenario of a generation method of a data identifier according to an embodiment of the present disclosure;
FIG. 2 schematically illustrates a flow chart of a method of generating a data identity for application to a database in accordance with an embodiment of the present disclosure;
fig. 3 schematically shows a flow chart of a method of generating a data identity for application to an application server according to an embodiment of the present disclosure;
fig. 4 schematically shows a system architecture of a method of generating a data identity according to an embodiment of the present disclosure;
FIG. 5 schematically illustrates an overall flow diagram of a method of generating data identifications, in accordance with an embodiment of the present disclosure;
FIG. 6 schematically shows a block diagram of an apparatus for generating data identifications for application to a database according to an embodiment of the present disclosure;
fig. 7 schematically shows a block diagram of a generating device of data identities applied to an application server according to an embodiment of the present disclosure; and
fig. 8 schematically shows a block diagram of an electronic device suitable for implementing the data identification generation method and apparatus according to an embodiment of the present disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is illustrative only and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It is noted that the terms used herein should be interpreted as having a meaning that is consistent with the context of this specification and should not be interpreted in an idealized or overly formal sense.
Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B and C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.). Where a convention analogous to "A, B or at least one of C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B or C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
The present disclosure provides a method for generating a data identifier, which is applied to a database capable of providing a service for an application server in a distributed environment, and includes: first, a first data acquisition request is received from a first application server, wherein the first data acquisition request is sent by the first application server in response to a first data generation request from a first requester, and the first data generation request is used for indicating generation of a first data identifier. Then, in response to the first data acquisition request, a first number segment corresponding to the first data acquisition request is acquired, wherein the first number segment is determined based on a maximum number value maintained in the database. And finally, returning the first number segment to the first application server, so that the first application server can return a first target number to the first requester based on the first number segment, and the first requester can generate the first data identifier based on the first target number.
By applying the data identifier generation method provided by the disclosure, the local generation of the data identifier can be realized in a distributed environment of a plurality of application servers, and the generated data identifier is globally unique.
Fig. 1 schematically illustrates an application scenario 100 of a method of generating a data identity according to an embodiment of the present disclosure. It should be noted that fig. 1 is only an example of an application scenario in which the embodiments of the present disclosure may be applied to help those skilled in the art understand the technical content of the present disclosure, but does not mean that the embodiments of the present disclosure may not be applied to other devices, systems, environments or scenarios.
The disclosed embodiments may be applied in an application scenario of a distributed environment, where the application scenario 100 may include a plurality of application servers and a database. As shown in fig. 1, application servers 101, 102, 103 and a database 104 may be included. The application servers 101, 102, 103 may receive a request from a requesting party for a data identity indicating the generation of traffic data. Specifically, application server 101 may receive request 1, request 2, and request 3 from one or more requesters. Application server 102 may receive request 4 and request 5 from one or more requesters. Application server 103 may receive request 6, request 7, and request 8 from one or more requesters. In the present disclosure, the data identifier is a primary key, and the data identifier may be a data identifier of the service data. Since the business data contains specific business meanings, the data identification in the disclosure needs to meet the requirement of global uniqueness and efficient generation.
The application servers 101, 102, 103 obtain the number segment for generating the data identifier from the database 104, and take out a number from the number segment and return the number to the requesting party, so that the requesting party can generate the data identifier based on the number. The data identifier in the present disclosure may be a data identifier of the service data. Since the business data includes a certain business meaning, the requirement of global uniqueness and efficient generation needs to be satisfied.
It should be noted that, in the application scenario 100 shown in fig. 1, the number of application servers, the number of requesters, and the number of requests received by the application servers are merely exemplary, and are not limited to the number of application servers, the number of requesters, and the number of requests received by the application servers. The embodiments of the present disclosure may be applied in a service scenario involving any number of application servers, requesters, and requests.
In a first aspect, the technical implementation of the present disclosure is set forth from the database-side capable of serving application servers in a distributed environment.
Fig. 2 schematically shows a flow chart of a method of generating a data identity for application to a database according to an embodiment of the present disclosure.
As shown in fig. 2, the method includes operations S210 to S230.
In operation S210, a first data acquisition request from a first application server is received, where the first data acquisition request is sent by the first application server in response to a first data generation request from a first requester, and the first data generation request is used to instruct generation of a first data identifier.
According to an embodiment of the present disclosure, the first application server may be any one of a plurality of application servers in a distributed environment. Taking the multiple application servers shown in fig. 1 as an example, the first application server may be the application server 101, the application server 102, or the application server 103, which is not limited in this disclosure.
In operation S220, in response to the first data acquisition request, a first number segment corresponding to the first data acquisition request is acquired, wherein the first number segment is determined based on a maximum number value maintained in the database.
In the disclosure, in a case where the first application server receives a first data generation request from the first requester for instructing generation of the first data identifier, a first data acquisition request may be sent to the database to request from the database to acquire a batch of numbers for generating the first data identifier.
It should be noted that the number used for generating the first data identifier may be an integer value, and a unique data identifier, i.e. a primary key, may be generated based on the integer value number through a specific combination rule. For example, if the generated integer number is 001 and the specific combination rule is ORDER + time string + number, then the primary key ORDER20190912051423001 can be generated from the time string (20190912051423).
According to the embodiment of the disclosure, the database is configured with the maintenance information of the maximum number. In response to a data acquisition request, a number segment corresponding to the data acquisition request may be determined based on a current maximum number value maintained in a database, whereby it may be ensured that the number segment corresponding to the data acquisition request is different from the current maximum number and is in an increasing trend based on the current maximum number.
In operation S230, the first number segment is returned to the first application server, so that the first application server can return the first destination number to the first requester based on the first number segment, and the first requester can generate the first data identifier based on the first destination number.
According to the embodiment of the disclosure, the database returns the first number segment to the first application server, the first application server selects a first target number from the first number segment and returns the first target number to the requester, and the requester can generate the first data identifier based on the first target number.
In the related art, some methods for generating data identifications are also provided. For example, a method of Universal Unique Identifier (UUID) may be used to generate a 36-bit Unique ID containing characters, letters and letters. Data identification may also be generated using various combinations of algorithms comparing classical snowflake algorithms and related variants, or system time stamps. The incrementing of the service primary key may also be implemented using Redis. However, according to the UUID method, the generated primary key type is a character string type, not an integer type, the storage of the primary key occupies a larger space, the index is large, and the primary key does not contain business significance and has no increasing trend. By using a specific algorithm, the uniqueness of the primary key is difficult to guarantee in a distributed environment, and the unreliable condition can also occur depending on the system time, such as callback occurring in the system time. With the approach of distributed middleware, middleware tends to become a bottleneck in performance and availability.
Through the embodiment of the disclosure, when a data acquisition request sent by an application server end in response to a data generation request of a requester is received, a number segment corresponding to the data acquisition request can be determined based on a maximum number value maintained in a database, and the determined number segment is returned to the application server, so that the application server returns a target number to the requester, and the requester generates a data identifier based on the target number. The technical problems of non-uniqueness and low efficiency in generating integer primary keys in a distributed environment in the related art can be at least partially overcome. At one end of a database which can provide service for an application server in a distributed environment, centralized control and centralized maintenance of number segment ranges can be realized, number segments are determined according to the maximum number value, batch acquisition of numbers is realized, and generation efficiency of data identification is improved.
As an alternative embodiment, the aforementioned operation S220 (obtaining the first number segment corresponding to the first data obtaining request in response to the first data obtaining request) includes: and in response to the first data acquisition request, adding a distributed lock to the first application server to prevent the database from acquiring the second number segment in response to a second data acquisition request from a second application server, wherein the second application server is an application server except the first application server in the plurality of application servers, the second data acquisition request is sent by the second application server in response to a second data generation request from a second requester, and the second data generation request is used for indicating generation of a second data identifier to acquire the first number segment corresponding to the first data acquisition request.
According to an embodiment of the disclosure, the method further comprises: after returning the first number segment to the first application server, the distributed lock is released to the first application server to enable the database to obtain the second number segment in response to a second data acquisition request from the second application server.
In consideration of the concurrency of the service scene data and the characteristics of the distributed environment, a plurality of servers can simultaneously send data acquisition requests to the database. In order to implement global uniqueness of data identification, according to the embodiment of the present disclosure, a concurrency problem is solved by a technical means of a distributed lock (Redis or Zookeeper), that is, when a control database responds to a data acquisition request of any application server, it is unable to respond to data acquisition requests of other application servers, and after the data acquisition request response of any application server is completed, it responds to a data acquisition request of any application server in other application servers.
By the embodiment of the disclosure, the concurrency problem can be solved by using a distributed lock mode, and the global uniqueness of the number segment is realized at the database end of the control number segment.
As an alternative embodiment, acquiring the first number segment corresponding to the first data acquisition request includes: the method comprises the steps of obtaining a maximum number value maintained in a database, determining an initial value of a first number segment based on the maximum number value, obtaining a first number step maintained in the database, wherein the first number step is used for representing the number in the first number segment, obtaining a first number increment maintained in the database, wherein the first number increment is used for representing the difference value between any two adjacent number values in the first number segment, and determining a first number segment corresponding to a first data obtaining request based on the initial value of the first number segment, the first number step and the first number increment.
According to embodiments of the present disclosure, configuration number-related information may be maintained in a database, including but not limited to maximum number values, number steps, and number increments. The information related to the number may be a default, or may be set according to actual service requirements, which is not limited in this disclosure. It should be noted that the ending value of the first number segment may be determined based on the starting value, the first number step size, and the first number increment of the first number segment, and the first number segment may be determined based on the starting value and the ending value. The first number segment is a number segment which is a number interval between a starting value and an ending value range, namely, the starting value is used as the beginning, the ending value is used as the end, the difference value of any two connected numbers is a number increment, and the number segment contains the first number step length number.
For example, based on the maximum number value of 1000, the first number step size of 1000, and the first number increment of 1 maintained in the database, it can be determined that the first number segment has a starting value of 1001, a number of 1000, and an ending value of 2000, and the first number segment has a number interval [1001, 2000] ranging from 1001 to 2000, i.e., a number segment containing 1000 numbers with a beginning of 1001 and an end of 2000, and a difference between any two adjacent numbers of 1 (1001, 1002,.., 1999, 2000). The maximum number value, the number step size, and the number increment are integers, and the number step size and the number increment are integers equal to or greater than 1.
Through the embodiment of the disclosure, the database is used for maintaining the information such as the maximum number, the number step length, the number increment and the like, so that the numbers in the distributed environment can be managed and controlled in a centralized manner, and the accuracy of the global numbers is ensured.
As an alternative embodiment, the method may further include, in addition to the foregoing operations S210 to S230: based on the first number segment, the maximum number value maintained in the database is updated.
In order to ensure that the maximum number value maintained in the database is always the maximum number value among all the number segments in the whole world, according to the embodiment of the present disclosure, after the database returns the first number segment to the first application server, the maximum number value maintained in the database may be updated according to the first number segment.
For example, in the case where the maximum number value is 1000, it is determined that the first number segment is (1001, 1002...., 1999, 2000), the maximum number value may be updated to 2000 after the first number segment is returned to the first application server. And when the second number segment is determined in response to a second data acquisition request of the second application server, determining the second number segment according to the maximum number value of 2000.
By the embodiment of the present disclosure, the maximum number value maintained in the database is updated according to the first number segment returned to the application server, and it can be realized that the number segments allocated to the plurality of application servers are unique and are incremental.
In a second aspect, the technical implementation of the present disclosure is illustrated from the application server side in a distributed environment. Fig. 3 schematically shows a flowchart of a method for generating a data identity for application to an application server according to an embodiment of the present disclosure.
As shown in fig. 3, the method may include operations S310 to S350.
In operation S310, a third data generation request from a third requester is received, wherein the third data generation request is used to indicate generation of a third data identifier.
According to an embodiment of the present disclosure, after receiving a third data generation request from a third requester, the application server may first detect whether there is an available number in a local number pool of the local memory. If available numbers exist, one number is directly selected from the available numbers and returned to the requester, so that the requester can generate a third data identifier based on the number. If there is no available number, operation S320 is performed.
In operation S320, in response to the third data generation request, a third data acquisition request is sent to the database to enable the database to acquire and return a third number segment, wherein the third number segment is determined based on the maximum number value maintained in the database.
It should be noted that the third number segment may be determined by using the aforementioned determination method of the first number segment, and details are not described here.
In operation S330, a third number segment returned by the database is received.
According to the embodiment of the disclosure, after the application server receives the third number segment returned by the server, the third number segment may be stored in a local number pool of the local memory.
In operation S340, a third target number is determined based on the third number segment, wherein the third target number is used for generating a third data identifier.
In operation S350, a third destination number is returned to the third requester, so that the third requester can generate a third data identifier based on the third destination number.
According to the embodiment of the disclosure, the application server may take out a number from the local memory as a destination number, and then return the number to the requester, so that the requester may generate the third data identifier based on the number.
According to the embodiment of the disclosure, at an application server side, a data identifier generation request of a requester is responded, and under the condition that no available number exists locally, a data acquisition request is sent to a database to acquire a number segment, so that the requester can generate the data identifier based on the number in the number segment, and the pressure generated by the data identifier is dispersed to the local memory of each application server by using the resources of multiple application servers in a distributed environment, so that the generation of the local number is realized, and the generation efficiency of the data identifier is improved. As an alternative embodiment, the operation S320 (sending the third data obtaining request to the database in response to the third data generating request) includes: and responding to the third data generation request, detecting whether an available number exists in the third application server, wherein the available number is used for generating a third data identifier, and sending a third data acquisition request to the database under the condition that the available number does not exist in the third application server.
According to the embodiment of the present disclosure, a local number pool is maintained in a local memory of the third application server, and a number used for generating the data identifier is maintained in the local number pool. In response to the third data generation request, it may be determined whether there is an available number in the local number pool, and if so, the available number in the local number pool may be used to be returned to the requestor. And if no available number exists in the local number pool, requesting to send a request to a database to acquire a batch of numbers and storing the numbers in the local number pool.
As an alternative embodiment, detecting whether there is an available number in the third application server in response to the third data generation request includes: and responding to the third data generation request, adding a local lock to the third application server to enable the third application server not to respond to a fourth data generation request from a fourth requester, and sending a fourth data generation request to the database to enable the database to acquire and return a fourth number segment, so as to detect whether an available number exists in the third application server.
As an alternative embodiment, the method further comprises: after returning the third destination number to the third requester, the local lock is released to the third application server, so that the third application server can respond to a fourth data generation request from the fourth requester, and send the fourth data generation request to the database, so that the database can acquire and return the fourth number segment.
In consideration of the concurrency of the service scene data and the characteristics of the distributed environment, the application server can receive a data generation request sent by a plurality of requesters. In order to achieve global uniqueness of data identification.
According to the embodiment of the present disclosure, the concurrency problem is solved by a technical means of a local Lock (Java Lock). Specifically, when the third application server is controlled to respond to the data generation request of the third requester in a manner of adding the local lock to the third application server, the third application server cannot respond to the fourth data generation request of the fourth requester (other requesters except the third requester), and after the third data generation request response of the third requester is completed, the third application server is controlled to respond to the data generation request of the fourth requester again in a manner of releasing the local lock.
Through the embodiment of the disclosure, the concurrency problem can be solved by using a local lock mode, and the uniqueness of the number is controlled, so that the uniqueness of the data identification is controlled.
In a third aspect, the system architecture of the present disclosure is set forth from the perspective of database and application server interaction in a distributed environment.
Fig. 4 schematically shows a system architecture of a method for generating a data identity according to an embodiment of the present disclosure.
As shown in fig. 4, application server 101 receives request 1, request 2, and request 3. Application server 102 receives request 4 and request 5. Application server 103 receives request 6, request 7, and request 8.
The number segment returned by the application server 101 to the database 104 is 0-1000. The number for generating the data identifier corresponding to the request 1 is 1, the number for generating the data identifier corresponding to the request 2 is 2, and the number for generating the data identifier corresponding to the request 3 is 3.
The number segment returned by the database 104 received by the application server 102 is 1001-2000. The number for generating a data identifier corresponding to request 4 is 1001, and the number for generating a data identifier corresponding to request 5 is 1002.
The number segment 2001-3000 returned by the application server 103 to the database 104. The number for generating a data identifier corresponding to request 6 is 2001, the number for generating a data identifier corresponding to request 7 is 2002, and the number for generating a data identifier corresponding to request 8 is 2003.
The maximum number value maintained in database 104 has a current value of 3000 and a number increment value of 1000.
The concurrency problem at the application server side is solved by adding local locks to the application servers 101, 102 and 103, and the concurrency problem at the database side is solved by adding distributed locks to the database 104, so that the global uniqueness and increment of the number segment are controlled, and the global uniqueness and increment of the data identification are further controlled.
In a fourth aspect, the technical implementation of the present disclosure is set forth from the perspective of database and application server interaction in a distributed environment. Fig. 5 schematically illustrates an overall flow diagram of a method of generating data identifications in accordance with an embodiment of the present disclosure.
As shown in fig. 5, the flow includes operations S510 to S590.
In operation S510, a request to generate a data Identification (ID) is acquired.
In operation S520, a local lock is added.
In operation S530, it is determined whether there is a number available locally. If so, operation S570 is performed. If not, operation S540 is performed.
In operation S540, a distributed lock is added.
In operation S550, the number segment is retrieved from the database according to the maximum value and the step length information is stored locally.
In operation S560, the distributed lock is released.
In operation S570, a local number is acquired.
In operation S580, the local lock is released.
In operation S590, an ID is returned.
As shown in fig. 5, after acquiring a request for generating an ID, the application server currently responds to only one request for generating an ID by applying a local lock. Firstly, judging whether available numbers exist locally or not, if yes, directly obtaining a local number from a local number pool, releasing a local lock, and returning the local number to generate a data identifier. And if the data does not exist, adding a distributed lock to the database, and responding the data acquisition request of only one application server by the obtained database currently. And acquiring the number segment from the database, storing the number segment in a local number pool of a local memory, and then releasing the distributed lock. By means of adding the local lock and the distributed lock, the global uniqueness and increment of the number segment and the data identification are controlled, the number generation pressure is dispersed to the local of the application server, the calculation resources are saved, and the data identification generation efficiency is improved.
In a fifth aspect, a data identifier generation apparatus is set forth, which is opposite to the above data identifier generation method provided by the present disclosure, from a database side capable of providing a service to an application server in a distributed environment. Fig. 6 schematically shows a block diagram of a generation apparatus of data identification applied to a database according to an embodiment of the present disclosure.
As shown in fig. 6, the apparatus 600 may include a first receiving module 610, an obtaining module 620, and a first returning module 630.
The first receiving module 610 is configured to, for example, perform the foregoing operation S210, and receive a first data obtaining request from a first application server, where the first data obtaining request is sent by the first application server in response to a first data generating request from a first requesting party, and the first data generating request is used to instruct to generate a first data identifier.
The obtaining module 620 is configured to, for example, perform the aforementioned operation S220, and in response to the first data obtaining request, obtain a first number segment corresponding to the first data obtaining request, where the first number segment is determined based on the maximum number value maintained in the database.
The first returning module 630 is configured to, for example, execute the foregoing operation S230, and return the first number segment to the first application server, so that the first application server can return the first target number to the first requester based on the first number segment, and the first requester can generate the first data identifier based on the first target number.
Through the embodiment of the disclosure, when a data acquisition request sent by an application server end in response to a data generation request of a requester is received, a number segment corresponding to the data acquisition request can be determined based on a maximum number value maintained in a database, and the determined number segment is returned to the application server, so that the application server returns a target number to the requester, and the requester generates a data identifier based on the target number. The technical problems of non-uniqueness and low efficiency in generating integer primary keys in a distributed environment in the related art can be at least partially overcome. At one end of a database which can provide service for an application server in a distributed environment, centralized control and centralized maintenance of number segment ranges can be realized, number segments are determined according to the maximum number value, batch acquisition of numbers is realized, and generation efficiency of data identification is improved.
As an alternative embodiment, the obtaining module 620 includes: the adding submodule is configured to add a distributed lock to a first application server in response to a first data acquisition request, so that the database cannot acquire a second number segment in response to a second data acquisition request from a second application server, wherein the second application server is an application server except the first application server, the second data acquisition request is sent by the second application server in response to a second data generation request from a second requester, and the second data generation request is used for indicating generation of a second data identifier, and the acquiring submodule is configured to acquire the first number segment corresponding to the first data acquisition request.
As an alternative embodiment, the obtaining module 620 further includes: a release submodule configured to release the distributed lock for the first application server after returning the first number segment to the first application server, to enable the database to obtain the second number segment in response to a second data obtaining request from the second application server.
By the embodiment of the disclosure, the concurrency problem can be solved by using a distributed lock mode, and the global uniqueness of the number segment is realized at the database end of the control number segment.
As an alternative embodiment, the obtaining sub-module includes: the device comprises a first obtaining unit, a first determining unit, a second obtaining unit and a third obtaining unit, wherein the first obtaining unit is configured to obtain the maximum number value maintained in the database, the first determining unit is configured to determine the initial value of a first number segment based on the maximum number value, the second obtaining unit is configured to obtain the first number step maintained in the database, the first number step is used for representing the number in the first number segment, the third obtaining unit is configured to obtain the first number increment maintained in the database, the first number increment is used for representing the difference between any two adjacent number values in the first number segment, and the second determining unit is configured to determine the first number segment corresponding to the first data obtaining request based on the initial value of the first number segment, the first number step and the first number increment.
Through the embodiment of the disclosure, the database is used for maintaining the information such as the maximum number, the number step length, the number increment and the like, so that the numbers in the distributed environment can be managed and controlled in a centralized manner, and the accuracy of the global numbers is ensured.
As an alternative embodiment, the apparatus 600 may further include, in addition to the first receiving module 610, the obtaining module 620, and the first returning module 630: an update module configured to update the maximum number value maintained in the database based on the first number segment.
By the embodiment of the present disclosure, the maximum number value maintained in the database is updated according to the first number segment returned to the application server, and it can be realized that the number segments allocated to the plurality of application servers are unique and are incremental.
In a sixth aspect, from the application server side in the distributed environment, a generation apparatus of the data identifier is set forth, which is opposite to the above-mentioned generation method of the data identifier provided by the present disclosure. Fig. 7 schematically shows a block diagram of a data identifier generation apparatus applied to an application server according to an embodiment of the present disclosure.
As shown in fig. 7, the apparatus 700 includes a second receiving module 710, a sending module 720, a third receiving module 730, a determining module 740, and a second returning module 750.
The second receiving module 710 is configured to, for example, execute the foregoing operation S310, and receive a third data generation request from a third requester, where the third data generation request is used to indicate generation of a third data identifier.
The sending module 720 is configured to, for example, perform the aforementioned operation S320, and send a third data obtaining request to the database in response to the third data generating request, so that the database can obtain and return a third number segment, where the third number segment is determined based on the maximum number value maintained in the database.
The third receiving module 730 is configured to, for example, execute the aforementioned operation S330, and receive the third number segment returned by the database.
The determining module 740 is configured to, for example, perform the aforementioned operation S340, and determine a third destination number based on the third number segment, where the third destination number is used for generating a third data identifier.
The second returning module 750 is configured to, for example, execute the foregoing operation S350, and return the third destination number to the third requester, so that the third requester can generate the third data identifier based on the third destination number.
According to the embodiment of the disclosure, at an application server side, a data identifier generation request of a requester is responded, and under the condition that no available number exists locally, a data acquisition request is sent to a database to acquire a number segment, so that the requester can generate the data identifier based on the number in the number segment, and the pressure generated by the data identifier is dispersed to the local memory of each application server by using the resources of multiple application servers in a distributed environment, so that the generation of the local number is realized, and the generation efficiency of the data identifier is improved.
As an alternative embodiment, the foregoing sending module 720 includes: and the sending submodule is configured to send a third data acquisition request to the database under the condition that the available number does not exist in the third application server.
As an alternative embodiment, the detection submodule includes: the adding unit is configured to respond to the third data generation request, add a local lock to the third application server, so that the third application server cannot respond to a fourth data generation request from a fourth requesting party, send the fourth data generation request to the database, so that the database can acquire and return a fourth number segment, and the detecting unit is configured to detect whether an available number exists in the third application server.
As an alternative embodiment, the detection sub-module further includes: and the releasing unit is configured to release the local lock for the third application server after the third target number is returned to the third requester, so that the third application server can respond to a fourth data generation request from the fourth requester and send the fourth data generation request to the database, so that the database can acquire and return the fourth number segment.
Through the embodiment of the disclosure, the concurrency problem can be solved by using a local lock mode, and the uniqueness of the number is controlled, so that the uniqueness of the data identification is controlled.
Any number of modules, sub-modules, units, or at least part of the functionality of any number thereof according to embodiments of the present disclosure may be implemented in one module. Any one or more of the modules, sub-modules, units according to the embodiments of the present disclosure may be implemented by being split into a plurality of modules. Any one or more of the modules, sub-modules, units according to the embodiments of the present disclosure may be implemented at least partially as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in any other reasonable manner of hardware or firmware by integrating or packaging the circuit, or in any one of three implementations of software, hardware, and firmware, or in any suitable combination of any of them. Alternatively, one or more of the modules, sub-modules, units according to embodiments of the disclosure may be implemented at least partly as computer program modules, which, when executed, may perform corresponding functions.
For example, any number of the first receiving module 610, the obtaining module 620, the first returning module 630, the adding sub-module, the obtaining sub-module, the removing sub-module, the first obtaining unit, the first determining unit, the second obtaining unit, the third obtaining unit, the second determining unit, the updating module, or any number of the second receiving module 710, the sending module 720, the third receiving module 730, the determining module 740, the second returning module 750, the detecting sub-module, the sending sub-module, the adding unit, the detecting unit, and the removing unit may be combined and implemented in one module, or any one of them may be split into a plurality of modules. Alternatively, at least part of the functionality of one or more of these modules may be combined with at least part of the functionality of the other modules and implemented in one module. According to an embodiment of the disclosure, at least one of the first receiving module 610, the obtaining module 620, the first returning module 630, the adding submodule, the obtaining submodule, the releasing submodule, the first obtaining unit, the first determining unit, the second obtaining unit, the third obtaining unit, the second determining unit, any plurality of the updating modules or the second receiving module 710, the sending module 720, the third receiving module 730, the determining module 740, the second returning module 750, the detecting submodule, the sending submodule, the adding unit, the detecting unit, the releasing unit may be at least partially implemented as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or any other reasonable way of integrating or packaging a circuit, or in any one of three implementations, software, hardware and firmware, or in any suitable combination of any of them. Alternatively, at least one of the first receiving module 610, the obtaining module 620, the first returning module 630, the adding sub-module, the obtaining sub-module, the releasing sub-module, the first obtaining unit, the first determining unit, the second obtaining unit, the third obtaining unit, the second determining unit, any plurality of the updating modules, or the second receiving module 710, the sending module 720, the third receiving module 730, the determining module 740, the second returning module 750, the detecting sub-module, the sending sub-module, the adding unit, the detecting unit, and the releasing unit may be at least partially implemented as a computer program module, and when the computer program module is executed, the corresponding function may be executed.
Fig. 8 schematically shows a block diagram of an electronic device suitable for implementing the data identification generation method and apparatus according to an embodiment of the present disclosure. The electronic device shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 8, an electronic device 800 according to an embodiment of the present disclosure includes a processor 801 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)802 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. The processor 801 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or associated chipset, and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), among others. The processor 801 may also include onboard memory for caching purposes. The processor 801 may include a single processing unit or multiple processing units for performing different actions of the method flows according to embodiments of the present disclosure.
In the RAM 803, various programs and data necessary for the operation of the electronic apparatus 800 are stored. The processor 801, the ROM802, and the RAM 803 are connected to each other by a bus 804. The processor 801 performs various operations of the method flows according to the embodiments of the present disclosure by executing programs in the ROM802 and/or RAM 803. Note that the programs may also be stored in one or more memories other than the ROM802 and RAM 803. The processor 801 may also perform various operations of method flows according to embodiments of the present disclosure by executing programs stored in the one or more memories.
Electronic device 800 may also include input/output (I/O) interface 805, input/output (I/O) interface 805 also connected to bus 804, according to an embodiment of the present disclosure. The system 800 may also include one or more of the following components connected to the I/O interface 805: an input portion 806 including a keyboard, a mouse, and the like; an output section 807 including a signal such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 808 including a hard disk and the like; and a communication section 809 including a network interface card such as a LAN card, a modem, or the like. The communication section 809 performs communication processing via a network such as the internet. A drive 810 is also connected to the I/O interface 805 as necessary. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as necessary, so that a computer program read out therefrom is mounted on the storage section 808 as necessary.
According to embodiments of the present disclosure, method flows according to embodiments of the present disclosure may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable storage medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 809 and/or installed from the removable medium 811. The computer program, when executed by the processor 801, performs the above-described functions defined in the system of the embodiments of the present disclosure. The systems, devices, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
The present disclosure also provides a computer-readable storage medium, which may be contained in the apparatus/device/system described in the above embodiments; or may exist separately and not be assembled into the device/apparatus/system. The computer-readable storage medium carries one or more programs which, when executed, implement the method according to an embodiment of the disclosure.
According to embodiments of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, which may include, for example but is not limited to: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. For example, according to embodiments of the present disclosure, a computer-readable storage medium may include the ROM802 and/or RAM 803 described above and/or one or more memories other than the ROM802 and RAM 803.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Those skilled in the art will appreciate that various combinations and/or combinations of features recited in the various embodiments and/or claims of the present disclosure can be made, even if such combinations or combinations are not expressly recited in the present disclosure. In particular, various combinations and/or combinations of the features recited in the various embodiments and/or claims of the present disclosure may be made without departing from the spirit or teaching of the present disclosure. All such combinations and/or associations are within the scope of the present disclosure.
The embodiments of the present disclosure have been described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described separately above, this does not mean that the measures in the embodiments cannot be used in advantageous combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be devised by those skilled in the art without departing from the scope of the present disclosure, and such alternatives and modifications are intended to be within the scope of the present disclosure.

Claims (13)

1. A generation method of data identification is applied to a database which can provide services for application servers in a distributed environment, and comprises the following steps:
receiving a first data acquisition request from a first application server, wherein the first data acquisition request is sent by the first application server in response to a first data generation request from a first requester, and the first data generation request is used for indicating generation of a first data identifier;
in response to the first data acquisition request, acquiring a first number segment corresponding to the first data acquisition request, wherein the first number segment is determined based on a maximum number value maintained in the database;
and returning the first number segment to the first application server, so that the first application server can return a first target number to the first requester based on the first number segment, and the first requester can generate the first data identifier based on the first target number.
2. The method of claim 1, wherein said retrieving, in response to the first data retrieval request, a first number segment corresponding to the first data retrieval request comprises:
adding a distributed lock to the first application server in response to the first data acquisition request to prevent the database from acquiring a second number segment in response to a second data acquisition request from a second application server, wherein the second application server is an application server in the plurality of application servers except the first application server, the second data acquisition request is sent by the second application server in response to a second data generation request from a second requester, and the second data generation request is used for indicating generation of a second data identifier;
and acquiring a first number segment corresponding to the first data acquisition request.
3. The method of claim 2, wherein the method further comprises:
after returning the first number segment to the first application server, unlocking the distributed lock to the first application server to enable the database to obtain the second number segment in response to the second data acquisition request from the second application server.
4. The method of claim 2, wherein said obtaining a first number segment corresponding to the first data acquisition request comprises:
obtaining a maximum number value maintained in the database;
determining a starting value of the first number segment based on the maximum number value;
acquiring a first number step length maintained in the database, wherein the first number step length is used for representing the number quantity in the first number segment;
acquiring a first number increment maintained in the database, wherein the first number increment is used for representing a difference value between any two adjacent number values in the first number segment;
and determining a first number segment corresponding to the first data acquisition request based on the initial value of the first number segment, the first number step length and the first number increment.
5. The method of claim 1, wherein the method further comprises:
updating a maximum number value maintained in the database based on the first number segment.
6. A generation method of data identification is applied to a third application server in a distributed environment, and comprises the following steps:
receiving a third data generation request from a third requester, wherein the third data generation request is used for indicating generation of a third data identification;
in response to the third data generation request, sending the third data acquisition request to a database to enable the database to acquire and return a third number segment, wherein the third number segment is determined based on a maximum number value maintained in the database;
receiving the third number segment returned by the database;
determining a third target number based on the third number segment, wherein the third target number is used for generating the third data identifier;
returning the third destination number to the third requester so that the third requester can generate the third data identifier based on the third destination number.
7. The method of claim 6, wherein said sending the third data acquisition request to a database in response to the third data generation request comprises:
detecting whether an available number exists in the third application server in response to the third data generation request, wherein the available number is used for generating the third data identification;
and sending the third data acquisition request to the database under the condition that the available number does not exist in the third application server.
8. The method of claim 7, wherein said detecting whether there are available numbers in said third application server in response to said third data generation request comprises:
responding to the third data generation request, adding a local lock to the third application server to enable the third application server not to respond to a fourth data generation request from a fourth requester, and sending the fourth data generation request to the database to enable the database to obtain and return a fourth number segment;
detecting whether an available number exists in the third application server.
9. The method of claim 8, wherein the method further comprises:
after returning the third destination number to the third requestor, releasing the local lock from the third application server to enable the third application server to send the fourth data generation request to the database in response to the fourth data generation request from the fourth requestor to enable the database to obtain and return the fourth number segment.
10. A data identifier generation apparatus applied to a database capable of providing services for application servers in a distributed environment, comprising:
the device comprises a first receiving module, a first data acquisition module and a second receiving module, wherein the first receiving module is configured to receive a first data acquisition request from a first application server, the first data acquisition request is sent by the first application server in response to a first data generation request from a first requester, and the first data generation request is used for indicating generation of a first data identifier;
an obtaining module configured to obtain, in response to the first data obtaining request, a first number segment corresponding to the first data obtaining request, wherein the first number segment is determined based on a maximum number value maintained in the database;
a first returning module configured to return the first number segment to the first application server, so that the first application server can return a first target number to the first requester based on the first number segment, and the first requester can generate the first data identifier based on the first target number.
11. An apparatus for generating a data identifier, applied to a third application server in a distributed environment, comprising:
a second receiving module configured to receive a third data generation request from a third requester, wherein the third data generation request is used for indicating generation of a third data identifier;
a sending module configured to send, in response to the third data generation request, the third data acquisition request to a database to enable the database to acquire and return a third number segment, the third number segment being determined based on a maximum number value maintained in the database;
a third receiving module configured to receive the third number segment returned by the database;
a determining module configured to determine a third target number based on the third number segment, wherein the third target number is used for generating the third data identifier;
a second returning module configured to return the third destination number to the third requester so that the third requester can generate the third data identifier based on the third destination number.
12. An electronic device, comprising:
one or more processors;
a memory for storing one or more programs,
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any of claims 1-9.
13. A computer-readable storage medium storing computer-executable instructions that, when executed, perform the method of any of claims 1 to 9.
CN201911363237.5A 2019-12-25 2019-12-25 Data identifier generation method and device, electronic equipment and medium Pending CN111125569A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911363237.5A CN111125569A (en) 2019-12-25 2019-12-25 Data identifier generation method and device, electronic equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911363237.5A CN111125569A (en) 2019-12-25 2019-12-25 Data identifier generation method and device, electronic equipment and medium

Publications (1)

Publication Number Publication Date
CN111125569A true CN111125569A (en) 2020-05-08

Family

ID=70502768

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911363237.5A Pending CN111125569A (en) 2019-12-25 2019-12-25 Data identifier generation method and device, electronic equipment and medium

Country Status (1)

Country Link
CN (1) CN111125569A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112256930A (en) * 2020-10-09 2021-01-22 北京沃东天骏信息技术有限公司 Method, device and system for batch generation of identification codes for distributed services
CN112559558A (en) * 2020-12-07 2021-03-26 北京理房通支付科技有限公司 Serial number generation method and device, computing device and storage medium
CN113163027A (en) * 2021-04-22 2021-07-23 北京奇艺世纪科技有限公司 Data identifier generation method, device, equipment and storage medium
CN113553196A (en) * 2021-06-28 2021-10-26 深圳云之家网络有限公司 Service request processing method and device, computer equipment and storage medium
CN113905014A (en) * 2021-08-27 2022-01-07 拉卡拉支付股份有限公司 Method, server and storage medium for assigning ID number to terminal device
CN116501997A (en) * 2023-06-28 2023-07-28 太平金融科技服务(上海)有限公司深圳分公司 Short link generation method, device, electronic equipment and storage medium
CN113905014B (en) * 2021-08-27 2024-05-28 拉卡拉支付股份有限公司 Method, server and storage medium for assigning ID number to terminal device

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106506663A (en) * 2016-11-22 2017-03-15 北京科摩仕捷科技有限公司 A kind of number distributing method, server and system
CN106911780A (en) * 2017-02-28 2017-06-30 北京三快在线科技有限公司 Traffic ID generation method, apparatus and system
CN107622102A (en) * 2017-09-11 2018-01-23 平安科技(深圳)有限公司 Entity card number generation method and terminal device
CN109104490A (en) * 2018-08-29 2018-12-28 北京达佳互联信息技术有限公司 Service identification management method, device, electronic equipment and storage medium
CN109165712A (en) * 2018-08-01 2019-01-08 广州唯品会信息科技有限公司 Distributed generation method, device and computer storage medium by stages number
CN109597853A (en) * 2018-10-22 2019-04-09 平安科技(深圳)有限公司 Business scenario element sequence generation method, device, medium and computer equipment
CN110222048A (en) * 2019-05-06 2019-09-10 平安科技(深圳)有限公司 Sequence generating method, device, computer equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106506663A (en) * 2016-11-22 2017-03-15 北京科摩仕捷科技有限公司 A kind of number distributing method, server and system
CN106911780A (en) * 2017-02-28 2017-06-30 北京三快在线科技有限公司 Traffic ID generation method, apparatus and system
CN107622102A (en) * 2017-09-11 2018-01-23 平安科技(深圳)有限公司 Entity card number generation method and terminal device
CN109165712A (en) * 2018-08-01 2019-01-08 广州唯品会信息科技有限公司 Distributed generation method, device and computer storage medium by stages number
CN109104490A (en) * 2018-08-29 2018-12-28 北京达佳互联信息技术有限公司 Service identification management method, device, electronic equipment and storage medium
CN109597853A (en) * 2018-10-22 2019-04-09 平安科技(深圳)有限公司 Business scenario element sequence generation method, device, medium and computer equipment
CN110222048A (en) * 2019-05-06 2019-09-10 平安科技(深圳)有限公司 Sequence generating method, device, computer equipment and storage medium

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112256930A (en) * 2020-10-09 2021-01-22 北京沃东天骏信息技术有限公司 Method, device and system for batch generation of identification codes for distributed services
CN112559558A (en) * 2020-12-07 2021-03-26 北京理房通支付科技有限公司 Serial number generation method and device, computing device and storage medium
CN112559558B (en) * 2020-12-07 2024-04-09 北京理房通支付科技有限公司 Method and device for generating serial numbers, computing equipment and storage medium
CN113163027A (en) * 2021-04-22 2021-07-23 北京奇艺世纪科技有限公司 Data identifier generation method, device, equipment and storage medium
CN113553196A (en) * 2021-06-28 2021-10-26 深圳云之家网络有限公司 Service request processing method and device, computer equipment and storage medium
CN113905014A (en) * 2021-08-27 2022-01-07 拉卡拉支付股份有限公司 Method, server and storage medium for assigning ID number to terminal device
CN113905014B (en) * 2021-08-27 2024-05-28 拉卡拉支付股份有限公司 Method, server and storage medium for assigning ID number to terminal device
CN116501997A (en) * 2023-06-28 2023-07-28 太平金融科技服务(上海)有限公司深圳分公司 Short link generation method, device, electronic equipment and storage medium
CN116501997B (en) * 2023-06-28 2023-09-26 太平金融科技服务(上海)有限公司深圳分公司 Short link generation method, device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN111125569A (en) Data identifier generation method and device, electronic equipment and medium
US7673029B2 (en) Grid automation bus to integrate management frameworks for dynamic grid management
CN110222775B (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
US10126980B2 (en) Managing data operations in a quorum-based data replication system
CN109933585B (en) Data query method and data query system
CN110909355A (en) Unauthorized vulnerability detection method, system, electronic device and medium
US10725771B2 (en) Artifact transformation in network devices
US20240126846A1 (en) Identifying and consenting to permissions for workflow and code execution
US20140068005A1 (en) Identification, caching, and distribution of revised files in a content delivery network
US20210042148A1 (en) Dynamic insertion of variablized secrets in a pipeline integration system
CN113535726A (en) Database capacity expansion method and device
CN111831453A (en) Information processing method, information processing apparatus, electronic device, and medium
US20220229858A1 (en) Multi-cloud object store access
US11461284B2 (en) Method, device and computer program product for storage management
CN114168607A (en) Global serial number generation method, device, equipment, medium and product
CN114968552A (en) Cache allocation method, apparatus, device, storage medium and program product
CN113032820B (en) File storage method, access method, device, equipment and storage medium
CN113986833A (en) File merging method, system, computer system and storage medium
CN114039962A (en) Node selection method, system, electronic device and storage medium
CN107256170B (en) Method and device for activating input method setting items of terminal equipment
CN111325456B (en) Asset data processing method and apparatus, computer system, and storage medium
CN113347250B (en) Data access method, data access device, electronic equipment and readable storage medium
CN116820354B (en) Data storage method, data storage device and data storage system
CN114721882B (en) Data backup method and device, electronic equipment and storage medium
CN111722933B (en) Deadlock resolution between distributed processes

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination