CN107528816B - Processing method, management system and server of ID in distributed database - Google Patents

Processing method, management system and server of ID in distributed database Download PDF

Info

Publication number
CN107528816B
CN107528816B CN201610458012.8A CN201610458012A CN107528816B CN 107528816 B CN107528816 B CN 107528816B CN 201610458012 A CN201610458012 A CN 201610458012A CN 107528816 B CN107528816 B CN 107528816B
Authority
CN
China
Prior art keywords
information
session
module
distributed database
server
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.)
Active
Application number
CN201610458012.8A
Other languages
Chinese (zh)
Other versions
CN107528816A (en
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.)
ZTE Corp
China Citic Bank Corp Ltd
Original Assignee
ZTE Corp
China Citic Bank Corp 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 ZTE Corp, China Citic Bank Corp Ltd filed Critical ZTE Corp
Priority to CN201610458012.8A priority Critical patent/CN107528816B/en
Priority to PCT/CN2017/087096 priority patent/WO2017219848A1/en
Publication of CN107528816A publication Critical patent/CN107528816A/en
Application granted granted Critical
Publication of CN107528816B publication Critical patent/CN107528816B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/40Network security protocols
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/1066Session management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • 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/22Indexing; Data structures therefor; Storage structures
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/1066Session management
    • H04L65/1083In-session procedures

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • General Business, Economics & Management (AREA)
  • Business, Economics & Management (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention provides an ID processing method in a distributed database, which comprises the following steps: sending an ID generation request to an ID server according to ID demand information of a client, wherein the ID demand information comprises session identification information and ID quantity information; receiving N IDs returned by the ID server, wherein N is an integer and is larger than the quantity value in the ID quantity information; and caching the N IDs into a session area corresponding to the session identification information according to the session identification information. A certain number of pre-fetching IDs are cached in the corresponding session area, the ID application frequency is reduced, and the performance consumption of the distributed database system is reduced to a greater extent.

Description

Processing method, management system and server of ID in distributed database
Technical Field
The invention relates to the field of distributed databases, in particular to a processing method, a management system and a server of IDs in the distributed databases.
Background
As the conventional database technology becomes mature and the internet application is developed at a high speed, the database application has been commonly found on the internet. The traditional centralized database system also shows the following defects: by adopting centralized management, a performance bottleneck is caused, the single improvement of hardware performance cannot meet the requirements of large data volume and concurrent query writing of the current internet, and a large amount of hardware maintenance and upgrading cost is generated. In addition, centralized management of databases often causes multiple database associations, and once a database crashes, the entire system crashes. The development of distributed database systems is not prohibitive.
Each local database in the distributed database should satisfy the consistency, serializability and recoverability of the centralized database, and besides, should ensure the global consistency of the database, the serializability of the parallel operation and the global recoverability of the system, which are all independent of a global unique IDentifier (ID). However, in the related art, the generation manner of the globally unique ID may cause a certain performance bottleneck to the distributed database system and the ID server, for example, when a client sends an ID application, the distributed database management system needs to send the application to the ID server, and the ID server generates a corresponding ID and then the corresponding ID is distributed to the client by the distributed database management system. With the increasing of the traffic volume and the high concurrency in peak hours, the ID processing method causes the performance of the distributed database system to be affected due to frequent ID applications.
Disclosure of Invention
In order to solve the problem that the performance of a distributed database system in the related art is affected, the invention provides a processing method, a management system and a server for an ID in a distributed database, so as to at least solve the problem.
According to one aspect of the present invention, there is provided a method for processing an identifier ID in a distributed database, including: sending an ID generation request to an ID server according to ID demand information of a client, wherein the ID demand information comprises session identification information and ID quantity information; receiving N IDs returned by the ID server, wherein N is an integer and is larger than the quantity value in the ID quantity information; and caching the N IDs into a session area corresponding to the session identification information according to the session identification information.
Optionally, before sending the ID generation request to the ID server according to the ID requirement information of the client, the method further includes: according to the ID demand information, whether the ID meeting the demand exists in the session area corresponding to the session identification information is inquired; and if so, allocating the ID to the client.
Optionally, after assigning the ID to the client, the method further includes: and updating the ID information cached in the session area.
Optionally, in a case that the session is ended, the method further includes: and when the unused ID exists in the session area, sending a recovery notification message to the ID server, wherein the recovery notification message comprises the unused ID information.
According to another aspect of the present invention, there is also provided a method for processing an identifier ID in a distributed database, including: receiving an ID generation request sent by a distributed database management system, wherein the ID generation request comprises ID number information; inquiring whether available IDs exist in an ID storage table according to the ID generation request; if yes, returning the available ID to the distributed database management system; wherein the usable ID is written back to the ID storage table when the N IDs are cached in the session area corresponding to the session identification information and are not used.
Optionally, after querying whether there is an available ID in the ID storage table according to the ID generation request, the method further includes: if not, generating a corresponding ID according to the ID generation request; the ID is returned to the distributed database management system.
Optionally, in a case that the session is ended, the method further includes: receiving a recovery notification message sent by a distributed database management system, wherein the recovery notification message comprises unused ID information; and according to the recovery notification message, writing back the unused ID into the ID storage table.
Optionally, writing back the unused ID to the ID storage table includes: inquiring whether a queue matched with the unused ID exists according to the recovery notification message; if so, writing back the unused ID to the queue; if not, a queue is newly built in the ID storage table and the unused ID is written back to the newly built queue.
Optionally, the ID is a sequence value generated sequentially.
According to still another aspect of the present invention, there is provided a distributed database management system including: the system comprises a control module, a session identification module and a client, wherein the control module is used for sending an ID generation request to an ID server according to ID demand information of the client, and the ID demand information comprises session identification information and ID quantity information; the receiving module is used for receiving N IDs returned by the ID server, wherein N is an integer and is greater than the quantity value in the ID quantity information; and the caching module is used for caching the N IDs into the session areas corresponding to the session identification information according to the session identification information.
Optionally, the system further comprises: the query module is used for querying whether the ID meeting the requirement exists in the session area corresponding to the session identification information according to the ID requirement information before sending an ID generation request to the ID server according to the ID requirement information of the client; and the distribution module is used for distributing the ID meeting the requirement to the client.
Optionally, the system further comprises: and the updating module is used for updating the ID information cached in the session area after the distributing module distributes the ID meeting the requirement to the client.
Optionally, the system further comprises: and the recovery notification module is used for sending a recovery notification message to the ID server when the session is ended and an unused ID exists in the session area, wherein the recovery notification message comprises unused ID information.
According to still another aspect of the present invention, there is also provided an ID server including:
the system comprises a receiving request module, a sending module and a receiving module, wherein the receiving request module is used for receiving an ID generating request sent by a distributed database management system, and the ID generating request comprises ID number information; the pre-check module inquires whether an available ID exists in an ID storage table according to the ID generation request; a feedback module for returning the available ID to the distributed database management system when the available ID exists in the ID storage table; wherein the usable ID is written back to the ID storage table when the N IDs are cached in the session area corresponding to the session identification information and are not used.
Optionally, the server further comprises: a generation module, configured to generate a corresponding ID according to the ID generation request when there is no available ID in the ID storage table; and the feedback module is also used for returning the ID to the distributed database management system.
Optionally, the server further comprises: the system comprises a recovery monitoring module, a recovery monitoring module and a recovery monitoring module, wherein the recovery monitoring module is used for receiving a recovery notification message sent by a distributed database management system under the condition that a session is ended, and the recovery notification message comprises unused ID information; and the write-back module is used for writing back the unused ID into the ID storage table according to the recovery notification message.
Optionally, the write-back module further comprises: a matching unit, configured to query whether a queue matching an unused ID exists in the ID storage table according to the recycle notification message; a write-back unit for writing back the unused ID into a queue when the queue matching the unused ID exists; when there is no queue matching the unused ID, the matching unit is further configured to create a new queue in the ID storage table, and the write-back unit is further configured to write back the unused ID to the new queue.
Optionally, the ID is a sequence value generated sequentially.
According to the method and the device, an ID generation request is sent to an ID server according to ID demand information of a client, wherein the ID demand information comprises session identification information and ID quantity information; receiving N IDs returned by the ID server, wherein N is an integer and is larger than the quantity value in the ID quantity information; and caching the N IDs into a session area corresponding to the session identification information according to the session identification information. A certain number of pre-fetching IDs are cached in the corresponding session area, the ID application frequency is reduced, and the performance consumption of the distributed database system is reduced to a greater extent.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a flow chart of a method for ID processing in a distributed database according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method for ID processing in a distributed database according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a distributed database system and ID server networking architecture according to an embodiment of the present invention;
FIG. 4 is a block diagram of a distributed database management system architecture in accordance with an embodiment of the present invention;
FIG. 5 is a block diagram of a distributed database management system architecture according to an embodiment of the present invention;
FIG. 6 is a block diagram of an ID server according to an embodiment of the present invention;
FIG. 7 is a block diagram of an ID server configuration according to an embodiment of the present invention;
FIG. 8 is a schematic diagram of an ID generation flow according to a first embodiment of the present invention;
FIG. 9 is a schematic flow chart of ID application according to the second embodiment of the present invention;
fig. 10 is a schematic diagram of an ID recovery flow according to the third embodiment of the present invention.
Detailed Description
The invention will be described in detail hereinafter with reference to the accompanying drawings in conjunction with embodiments. It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict.
An embodiment of the present invention provides an ID processing method in a distributed database, where fig. 1 is a first flowchart of an ID processing method in a distributed database according to an embodiment of the present invention, and as shown in fig. 1, the method includes:
s102, an ID generation request is sent to an ID server according to ID demand information of a client, wherein the ID demand information of the client comprises session identification information and ID quantity information, and the quantity of the client is not limited;
the session identification information and the ID number information may be carried by the client when sending the ID application to the distributed database management system, or may be added by the distributed database management system when sending the ID generation request to the ID server according to the ID application.
S104, receiving N IDs returned by the ID server, wherein N is an integer and is larger than the quantity value in the ID quantity information;
in this step, two situations are distinguished: firstly, after knowing the number of IDs actually required by a client, for example, 10 IDs, a distributed database management system applies for 10 IDs from an ID server, but the ID server returns 100 IDs; secondly, after knowing the number of IDs actually required by the client, for example, 10 IDs, the distributed database management system applies for 100 IDs from the ID server, and the ID server returns exactly 100 IDs.
S106, caching the N IDs into a session area corresponding to the session identification information according to the session identification information; the session area corresponding to the session identification information, namely the session area matched with the client side which provides the ID application, is on the uniform side of the distributed database system, wherein the distributed database system comprises the distributed database management system.
After the N IDs are cached in the session zone, there are various ways to enable the client to obtain the required ID, for example, the client may actively detect the ID in the session zone or actively obtain the ID required by the client in the session zone after receiving the relevant notification message; the distributed database management system can also distribute the IDs according to the number of the IDs required by the client. After the requirement of the client is met, the rest IDs are taken as the pre-fetching IDs to be continuously cached in the session area and are distributed when the next requirement is met.
According to the embodiment of the invention, an ID generation request is sent to an ID server according to the ID demand information of a client, wherein the ID demand information comprises session identification information and ID quantity information; receiving N IDs returned by the ID server, wherein N is an integer and is larger than the quantity value in the ID quantity information; and caching the N IDs into a session area corresponding to the session identification information according to the session identification information. A certain number of pre-fetching IDs are cached in the corresponding session area, the ID application frequency is reduced, and the performance consumption of the distributed database system is reduced to a greater extent.
In an embodiment of the present invention, before step S102, that is, before sending the ID generation request to the ID server according to the ID requirement information of the client, it may also be selected to query whether there is an ID meeting the requirement in the session area corresponding to the session identification information according to the ID requirement information. In this embodiment, the session area corresponding to the session identifier information, that is, the session area matched with the client side, is generally in a current link state, and the session area is on the unified side of the distributed database.
When the ID meeting the requirement is inquired, the ID is directly allocated to the client for use.
If the ID satisfying the requirement is not found, the step S102 is restarted.
In one embodiment of the invention, when the existence of the ID meeting the requirement is inquired in the session area, the ID is directly allocated to the client for use. And updating the session area, specifically, updating the ID information in the session area, and no longer reserving or marking the ID that has been allocated for use.
In one embodiment of the present invention, when a session is ended, if an unused ID is cached in the session area, the distributed database management system sends a recovery notification message to the ID server to notify the ID server to recover the unused ID, so as to avoid ID waste; especially, when the ID is a continuous sequence value, the sequence hole phenomenon can be avoided. The recovery notification message includes information related to the applied ID but not the ID.
An embodiment of the present invention further provides an ID processing method in a distributed database, where fig. 2 is a flowchart of a ID processing method in a distributed database according to an embodiment of the present invention, and as shown in fig. 2, the method includes:
s202, receiving an ID generation request sent by a distributed database management system, wherein the ID generation request comprises ID number information;
the ID number information may be carried by the client when sending the ID application to the distributed database management system, or may be added by the distributed database management system when sending the ID generation request to the ID server according to the ID application.
S204, inquiring whether available IDs exist in an ID storage table according to the ID generation request;
the usable ID to be inquired in the step is the part of ID which is written back to the ID storage table when the N IDs are cached in the session area but are not used; the write-back process is generally performed by the ID server after the ID server receives the recovery notification message sent by the distributed database management system, the ID storage table is stored at the ID server side, and the type of the ID storage table may be various and is determined by the manner of generating the ID.
S206, if the available ID exists in the ID storage table, directly returning the available ID to the distributed database management system, and generating the ID according to the ID generation request is not needed; the ID in the present embodiment is preferably a sequence value generated sequentially, and may be an identifier of another format.
According to the embodiment of the invention, an ID generation request sent by a distributed database management system is received, wherein the ID generation request comprises ID number information; inquiring whether available IDs exist in an ID storage table according to the ID generation request; if so, returning the available ID to the distributed database management system; wherein the available ID is written back to the ID storage table if the N IDs are cached to a session zone corresponding to the session identification information and are unused. The ID server can return the recovered ID to the distributed database system again for use, so that ID waste is avoided, and particularly when the ID is a continuous sequence value, a sequence cavity phenomenon can be avoided.
In one embodiment of the present invention, if it is found that there is no available ID after querying the ID storage table according to the ID generation request, the ID server generates a corresponding ID according to the ID generation request, and returns the generated ID to the distributed database management system.
The number of IDs generated by the ID server may be equal to or greater than the number required in the ID generation request.
In one embodiment of the invention, when a session is ended, if unused IDs are cached in the session area, the distributed database management system sends a recovery notification message to the ID server to notify the ID server to recover the unused IDs; correspondingly, the ID server receives a recovery notification message sent by the distributed database management system, where the recovery notification message includes information related to the applied ID but not used. The ID server writes the unused ID back to the ID storage table according to the recovery notification message so as to avoid ID waste; especially, when the ID is a continuous sequence value, the sequence hole phenomenon can be avoided.
In an embodiment of the present invention, after receiving a recovery notification message sent by a distributed database management system, an ID server first queries whether a queue matching the unused ID already exists in an ID storage table of the ID server, and the two cases are distinguished according to the query: first, if there is a queue matching the unused ID, the unused ID may be written into the queue according to a rule; if not, a new queue is created in the ID storage table and the unused ID is written into the new queue according to the rule.
Fig. 3 is a schematic diagram of a networking architecture of a distributed database system and an ID server according to an embodiment of the present invention, where the distributed database system includes the distributed database management system; fig. 4 is a block diagram of a distributed database management system according to an embodiment of the present invention, and as shown in fig. 3 and 4, the system includes:
the control module 402 is a main control module of the distributed database management system in this embodiment, and after obtaining ID requirement information of the client, the control module 402 may select to send an ID generation request to the ID server, where the ID requirement information of the client includes session identification information and ID number information, and the number of the clients is not limited;
the session identification information and the ID number information may be carried by the client when sending the ID application to the distributed database management system, or may be added by the distributed database management system when sending the ID generation request to the ID server according to the ID application.
A receiving module 404, configured to execute a receiving task when the ID server returns N IDs, where N is an integer and is greater than a quantity value in the ID quantity information;
the receiving module 404 receives the returned N IDs and distinguishes two cases: firstly, after knowing the number of IDs actually required by the client, for example, 10 IDs are requested from the ID server, the control module 402 applies for 10 IDs, but the ID server returns 100 IDs, and the receiving module 404 receives the 100 IDs; secondly, after learning the number of IDs actually required by the client, for example, the number is 10, the control module 402 applies for 100 IDs from the ID server, and the ID server returns exactly 100 IDs, and the receiving module 404 receives the 100 IDs.
A caching module 406, configured to cache the N IDs in a session area corresponding to the session identification information according to the session identification information; the session area corresponding to the session identification information, namely the session area matched with the client side which provides the ID application, is on the uniform side of the distributed database system, wherein the distributed database system comprises the distributed database management system.
After the N IDs are cached in the session zone, there are various ways to enable the client to obtain the required ID, for example, the client may actively detect the ID in the session zone or actively obtain the ID required by the client in the session zone after receiving the relevant notification message; the distributed database management system can also distribute the IDs according to the number of the IDs required by the client. After the requirement of the client is met, the rest IDs are taken as the pre-fetching IDs to be continuously cached in the session area and are distributed when the next requirement is met.
Through the embodiment of the present invention, the control module 402 sends an ID generation request to the ID server according to the ID requirement information of the client, where the ID requirement information includes session identification information and ID number information; the receiving module 404 receives N IDs returned by the ID server, where N is an integer and is greater than the quantity value in the ID quantity information; the caching module 406 caches the N IDs in the session area corresponding to the session identification information according to the session identification information. A certain number of pre-fetching IDs are cached in the corresponding session area, the ID application frequency is reduced, and the performance consumption of the distributed database system is reduced to a greater extent.
In an embodiment of the present invention, fig. 5 is a block diagram of a distributed database management system according to an embodiment of the present invention, and as shown in fig. 3 and fig. 5, the system further includes:
the query module 508, that is, before sending the ID generation request to the ID server according to the ID requirement information of the client, the query module 508 may also select to query whether there is an ID meeting the requirement in the session area corresponding to the session identification information according to the ID requirement information. In this embodiment, the session area corresponding to the session identifier information, that is, the session area matched with the client side, is generally in a current link state, and the session area is on the unified side of the distributed database.
When it is found that there is an ID that satisfies the requirement, the ID is directly assigned to the client for use by the assignment module 510.
In one embodiment of the present invention, as shown in fig. 3 and 5, the system further includes:
and an updating module 512, when the query module 508 queries that there is an ID meeting the requirement in the session area, the allocating module 510 directly allocates the ID to the client for use. At this time, the session area is updated by the update module 512, specifically, the ID information in the session area is updated, and the update module 512 may not reserve or mark the ID that has been allocated for use.
In one embodiment of the present invention, as shown in fig. 3 and 5, the system further includes:
a recycling notification module 514, when a session is ended, if an unused ID is cached in the session area, the recycling notification module 514 sends a recycling notification message to the ID server to notify the ID server to recycle the unused ID, so as to avoid ID waste; especially, when the ID is a continuous sequence value, the sequence hole phenomenon can be avoided. The recovery notification message includes information related to the applied ID but not the ID.
An embodiment of the present invention further provides an ID server, fig. 6 is a first structural block diagram of the ID server according to the embodiment of the present invention, and as shown in fig. 3 and fig. 6, the ID server includes:
a request receiving module 602, configured to receive an ID generation request when the ID generation request is sent by the distributed database management system, where the ID generation request includes ID number information; the ID number information may be carried by the client when sending the ID application to the distributed database management system, or may be added by the distributed database management system when sending the ID generation request to the ID server according to the ID application.
A preview module 604, wherein when the ID generation request is received by the request receiving module 602, the preview module 604 queries whether an available ID exists in an ID storage table according to the ID generation request, and the ID storage table is on the side of the ID server;
the usable ID to be queried by the preview module 604 is the part of ID that is written back to the ID storage table when the N IDs are cached in the session area but are not used; the write-back process is generally performed by the ID server after the ID server receives the recovery notification message sent by the distributed database management system, and the type of the ID storage table may be various, and is determined by the manner of generating the ID.
A feedback module 606, if the available ID exists in the ID storage table, the feedback module 606 directly returns the available ID to the distributed database management system, and the ID server does not generate an ID according to the ID generation request; the ID in the present embodiment is preferably a sequence value generated sequentially, and may be an identifier of another format.
Through the embodiment of the present invention, the receiving request module 602 receives an ID generation request sent by a distributed database management system, where the ID generation request includes ID number information; the preview module 604 queries whether there is an available ID in the ID storage table according to the ID generation request; if so, the feedback module 606 returns the available ID to the distributed database management system; wherein the available ID is written back to the ID storage table if the N IDs are cached to a session zone corresponding to the session identification information and are unused. The ID server can return the recovered ID to the distributed database system again for use, so that ID waste is avoided, and particularly when the ID is a continuous sequence value, a sequence cavity phenomenon can be avoided.
In an embodiment of the present invention, fig. 7 is a block diagram of a second ID server structure according to an embodiment of the present invention, and as shown in fig. 3 and 7, the server further includes:
after the preview module 704 queries the ID storage table according to the ID generation request, the generation module 708 finds that there is no available ID, and then the generation module 708 generates a corresponding ID according to the ID generation request, and then the feedback module 706 returns the generated ID to the distributed database management system.
The number of IDs generated by the ID server may be equal to or greater than the number required in the ID generation request.
In an embodiment of the present invention, as shown in fig. 3 and 7, the server further includes:
a recycling monitoring module 710, when a session is over, if unused ID is cached in the session area, the distributed database management system sends a recycling notification message to the ID server, notifying the ID server to recycle the unused ID; correspondingly, the recycling monitoring module 710 in the ID server receives a recycling notification message sent by the distributed database management system, where the recycling notification message includes information related to the applied ID but not used.
A write-back module 708, wherein after the recovery monitoring module 710 receives the recovery notification message, the write-back module 708 writes back the unused ID into the ID storage table according to the recovery notification message, so as to avoid ID waste; especially, when the ID is a continuous sequence value, the sequence hole phenomenon can be avoided.
In one embodiment of the present invention, as shown in fig. 3 and fig. 7, the write-back module 708 in the server includes:
a matching unit 7002 and a write-back unit 7004;
after the recovery snooping module 710 in the ID server receives the recovery notification message sent by the distributed database management system, the matching unit 7002 in the write-back module 708 firstly queries whether a queue matching the unused ID already exists in the ID storage table of the ID server, and the two cases are distinguished according to the query condition: first, if there is a queue matching the unused ID, the write-back unit 7004 may write the unused ID in the queue according to a rule; if not, the matching unit 7002 newly creates a queue in the ID storage table, and the write-back unit 7004 writes the unused ID in the newly created queue according to the rule.
The process of the invention will be described in more detail below with reference to the accompanying drawings and examples:
example one
Fig. 8 is a schematic diagram of an ID generation flow according to a first embodiment of the present invention, where the ID in the first embodiment is a sequence value generated sequentially, as shown in fig. 3 and fig. 8, the ID generation flow includes:
an ID server receives an ID generation request sent by a distributed database management system, wherein the ID generation request comprises ID number information;
the ID number information may be carried by the client when sending the ID application to the distributed database management system, or may be added by the distributed database management system when sending the ID generation request to the ID server according to the ID application.
The ID server inquires whether available IDs exist in an ID storage table stored locally according to the ID generation request;
the usable ID to be inquired in the step is the part of ID which is written back to the ID storage table when the N IDs are cached in the session area but are not used; the write-back process is generally performed by the ID server after the ID server receives the recovery notification message sent by the distributed database management system, the ID storage table is stored at the ID server side, and the type of the ID storage table may be various and is determined by the manner of generating the ID.
If available IDs exist in the ID storage table and the number can meet the requirement, the available IDs are directly returned to the distributed database management system.
If the ID server finds that no available ID exists or the number of available IDs can not meet the requirement after querying the ID storage table according to the ID generation request, the ID server generates a certain number of sequence values in sequence according to the ID generation request, the sequence values are obtained through Hash calculation, and the generated sequence values are returned to the distributed database management system as the IDs.
The number of sequence values generated by the ID server may be equal to or greater than the number required in the ID generation request.
Example two
Fig. 9 is a schematic diagram of an ID application flow according to a second embodiment of the present invention, where the ID in the second embodiment is a sequentially generated sequence value, and the sequence value is obtained by hash calculation, as shown in fig. 3 and fig. 9, the application flow includes:
the distributed database management system receives the ID application sent by the client and acquires the requirement information of the client, and the distributed database management system inquires whether the ID meeting the requirement exists in the currently linked session area or not, namely the sequence value, according to the ID requirement information. The session zone is on the distributed database system side.
When the available sequence value exists in the session area of the current link and can meet the requirement of the current service, the sequence value is directly distributed to the client for use. And then updating the sequence value range in the current linked session area, namely updating the ID information in the session area, and keeping or marking the sequence value which is allocated for use.
When inquiring that no available sequence value exists in a currently linked session area or the existing sequence value cannot meet the requirement of the current service, the distributed database management system sends an ID generation request to an ID server according to ID requirement information of a client, wherein the ID requirement information of the client comprises session identification information and ID quantity information, and the quantity of the client is not limited;
the session identification information and the ID number information may be carried by the client when sending the ID application to the distributed database management system, or may be added by the distributed database management system when sending the ID generation request to the ID server according to the ID application.
Then, the distributed database management system receives N sequence values returned by the ID server, and the sequence values are obtained through Hash calculation, wherein N is an integer and is larger than the quantity value in the ID quantity information;
in this step, two situations are distinguished: firstly, after knowing the number of IDs actually required by a client, for example, 10 IDs, a distributed database management system applies for 10 IDs from an ID server, but the ID server returns 100 IDs; secondly, after knowing the number of IDs actually required by the client, for example, 10 IDs, the distributed database management system applies for 100 IDs from the ID server, and the ID server returns exactly 100 IDs.
The distributed database management system caches the N IDs to a currently linked session area, namely, a session area matched with a client side which proposes an ID application, wherein the session area is on a uniform side of a distributed database, and the distributed database management system comprises the distributed database management system.
After the N IDs are cached in the session zone, there are various ways to enable the client to obtain the required ID, for example, the client may actively detect the ID in the session zone or actively obtain the ID required by the client in the session zone after receiving the relevant notification message; the distributed database management system can also distribute the IDs according to the number of the IDs required by the client. After the requirement of the client is met, the rest IDs are taken as the pre-fetching IDs to be continuously cached in the session area and are distributed when the next requirement is met.
Then, the distributed database management system updates the sequence value range in the current linked session area, that is, updates the ID information in the session area, and no longer reserves or marks the sequence value that has been allocated for use.
EXAMPLE III
Since in the embodiment of the present invention, the number of cached IDs in the currently linked session area is likely to exceed the number actually needed, if the redundant and unused IDs are not returned to the ID server at the end of the session, the IDs will be lost in the distributed database system. In order to prevent the waste caused by ID loss and possible sequence holes, the embodiment of the invention provides a solution. Fig. 10 is a schematic diagram of an ID recovery process according to a third embodiment of the present invention, where the ID in the third embodiment is a sequentially generated sequence value, and the sequence value is obtained by hash calculation, as shown in fig. 3 and fig. 10, the process includes:
when the ID server receives the recovery notification message sent by the distributed database management system, it is first queried whether a queue matching the unused ID (i.e., the sequence value) already exists in the ID storage table of the ID server, which is the hash table in this embodiment. Specifically, the ID server extracts a sequence name from the recovery notification message, performs hash calculation on the sequence name to generate a hash VALUE, and performs a query on a hash table to determine whether a corresponding queue exists, using the hash VALUE as a KEY (KEY) and using a linked list address storing the hash VALUE as a VALUE (VALUE).
Two cases are distinguished according to the query situation: first, if there is a queue matching the unused ID, the unused ID may be written into the queue according to a rule; specifically, the list is subjected to reverse sorting according to the maximum value of the sequence range in the hash table, and the sequence value range needing to be written back is inserted into the list.
If not, a new queue is created in the ID storage table and the unused ID is written into the new queue according to the rule.
It will be apparent to those skilled in the art that the modules or steps of the present invention described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (14)

1. A method for processing an identifier ID in a distributed database, comprising:
the distributed database management system sends an ID generation request to an ID server according to ID demand information of a client, wherein the ID demand information comprises session identification information and ID quantity information;
receiving N IDs returned by the ID server, wherein N is an integer and is greater than the quantity value in the ID quantity information;
and caching the N IDs into a session area corresponding to the session identification information according to the session identification information.
2. The method of claim 1, before sending the ID generation request to the ID server according to the ID requirement information of the client, further comprising:
according to the ID demand information, whether the ID meeting the demand exists in a conversation area corresponding to the conversation identification information is inquired;
and if so, distributing the ID to the client.
3. The method of claim 2, wherein after assigning the ID to the client, further comprising:
and updating the ID information cached in the session area.
4. A method according to any of claims 1 to 3, wherein in case of a session ending, the method further comprises:
and when an unused ID exists in the session area, sending a recovery notification message to the ID server, wherein the recovery notification message comprises unused ID information.
5. A method for processing an identifier ID in a distributed database, comprising:
the method comprises the steps that an ID server receives an ID generation request sent by a distributed database management system, wherein the ID generation request comprises ID number information and session identification information;
inquiring whether an available ID exists in an ID storage table according to the ID generation request;
if so, returning the available ID to the distributed database management system;
wherein the available ID is written back to the ID storage table if N IDs are cached to a session zone corresponding to the session identification information and are not used;
in case of session ending, the method further comprises:
receiving a recovery notification message sent by a distributed database management system, wherein the recovery notification message comprises unused ID information;
inquiring whether a queue matched with the unused ID exists in the ID storage table or not according to the recovery notification message;
if so, writing the unused ID back to the queue;
and if the unused ID does not exist, a queue is newly built in the ID storage table and the unused ID is written back to the newly built queue.
6. The method of claim 5, wherein after querying whether there is an available ID in the ID storage table according to the ID generation request, further comprising:
if not, generating a corresponding ID according to the ID generation request;
returning the ID to the distributed database management system.
7. The method according to claim 5 or 6, wherein the ID is a sequentially generated sequence value.
8. A distributed database management system, comprising:
the system comprises a control module, a session identification module and a client, wherein the control module is used for sending an ID generation request to an ID server according to ID demand information of the client, and the ID demand information comprises session identification information and ID quantity information;
the receiving module is used for receiving N IDs returned by the ID server, wherein N is an integer and is larger than the quantity value in the ID quantity information;
and the caching module is used for caching the N IDs into a session area corresponding to the session identification information according to the session identification information.
9. The system of claim 8, further comprising:
the query module is used for querying whether the ID meeting the requirement exists in a session area corresponding to the session identification information according to the ID requirement information before sending an ID generation request to an ID server according to the ID requirement information of the client;
and the distribution module is used for distributing the ID meeting the requirement to the client.
10. The system of claim 9, further comprising:
and the updating module is used for updating the ID information cached in the session area after the distributing module distributes the ID meeting the requirement to the client.
11. The system of any one of claims 8 to 10, further comprising:
and the recovery notification module is used for sending a recovery notification message to the ID server when the session is ended and the unused ID exists in the session area, wherein the recovery notification message comprises the unused ID information.
12. An ID server, comprising:
the system comprises a receiving request module, a sending module and a receiving module, wherein the receiving request module is used for receiving an ID generating request sent by a distributed database management system, and the ID generating request comprises ID number information and session identification information;
the pre-check module inquires whether an available ID exists in an ID storage table according to the ID generation request;
a feedback module for returning an available ID to the distributed database management system when the available ID exists in the ID storage table;
wherein the available ID is written back to the ID storage table if N IDs are cached to a session zone corresponding to the session identification information and are unused;
the system comprises a recovery monitoring module, a recovery monitoring module and a recovery monitoring module, wherein the recovery monitoring module is used for receiving a recovery notification message sent by a distributed database management system under the condition that a session is ended, and the recovery notification message comprises unused ID information;
a write back module, the write back module comprising:
a matching unit, configured to query whether a queue matching the unused ID exists in the ID storage table according to the recycling notification message;
a write-back unit configured to write back the unused ID into a queue when there is a queue matching the unused ID;
when the queue matched with the unused ID does not exist, the matching unit is also used for establishing a new queue in the ID storage table, and the write-back unit is also used for writing back the unused ID to the new ID queue.
13. The server of claim 12, further comprising:
a generating module, configured to generate a corresponding ID according to the ID generation request when there is no available ID in the ID storage table;
the feedback module is further configured to return the ID to the distributed database management system.
14. The server according to claim 12 or 13, wherein the ID is a sequentially generated sequence value.
CN201610458012.8A 2016-06-22 2016-06-22 Processing method, management system and server of ID in distributed database Active CN107528816B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201610458012.8A CN107528816B (en) 2016-06-22 2016-06-22 Processing method, management system and server of ID in distributed database
PCT/CN2017/087096 WO2017219848A1 (en) 2016-06-22 2017-06-02 Id processing method in distributed database, management system, and server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610458012.8A CN107528816B (en) 2016-06-22 2016-06-22 Processing method, management system and server of ID in distributed database

Publications (2)

Publication Number Publication Date
CN107528816A CN107528816A (en) 2017-12-29
CN107528816B true CN107528816B (en) 2021-05-18

Family

ID=60734158

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610458012.8A Active CN107528816B (en) 2016-06-22 2016-06-22 Processing method, management system and server of ID in distributed database

Country Status (2)

Country Link
CN (1) CN107528816B (en)
WO (1) WO2017219848A1 (en)

Families Citing this family (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108733802B (en) * 2018-05-17 2023-03-24 腾讯科技(深圳)有限公司 Identification code generation and analysis method and device, storage medium and electronic equipment
CN109165712B (en) * 2018-08-01 2021-06-29 广州唯品会信息科技有限公司 Method and device for generating distributed option number and computer storage medium
CN109347935B (en) * 2018-09-30 2021-08-03 珠海信达九州科技有限公司 Method for realizing real-time communication message synchronization based on block chain
CN110555078A (en) * 2019-09-02 2019-12-10 上海摩库数据技术有限公司 Distributed ID generation
CN110795632B (en) * 2019-10-30 2022-10-04 北京达佳互联信息技术有限公司 State query method and device and electronic equipment
CN110968589A (en) * 2019-12-18 2020-04-07 浙江明度智控科技有限公司 Self-adding ID management method and device in distributed system
CN113726830B (en) * 2020-05-25 2023-09-12 网联清算有限公司 Message identifier generation method and device
CN111741081A (en) * 2020-06-05 2020-10-02 安徽三实信息技术服务有限公司 Distributed server management system
CN111782694B (en) * 2020-06-28 2023-10-20 百度在线网络技术(北京)有限公司 Information writing method and device and electronic equipment
CN111949406A (en) * 2020-08-13 2020-11-17 深圳市睿策者科技有限公司 Numbering resource allocation processing method and device, computer and storage medium
CN111985187B (en) * 2020-08-31 2021-06-08 卫宁健康科技集团股份有限公司 Distributed ID acquisition method, device, electronic equipment and storage medium
CN112751748B (en) * 2020-12-28 2023-04-18 百果园技术(新加坡)有限公司 Session message management method, device, server and readable storage medium
CN113568891B (en) * 2021-08-05 2024-02-20 深圳墨世科技有限公司 Distributed ID generation method, device, server and readable storage medium
CN116418783B (en) * 2023-06-12 2023-09-29 太初(无锡)电子科技有限公司 ID number dynamic reassignment method, computer equipment and medium
CN117714275A (en) * 2023-07-11 2024-03-15 荣耀终端有限公司 Identity management method and related device for distributed application
CN117478722B (en) * 2023-12-22 2024-03-15 深圳市一恒科电子科技有限公司 P2P identifier allocation method, system, electronic equipment and storage medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1588359A (en) * 2004-10-09 2005-03-02 武汉大学 Method for recovering and reutilizing object marking symbol in data base
CN101661430A (en) * 2008-08-29 2010-03-03 中兴通讯股份有限公司 Storage block recovery judgment device and storage block management system
CN101826073A (en) * 2009-03-06 2010-09-08 华为技术有限公司 Synchronous method, apparatus and system for distributed database
CN102156717A (en) * 2011-03-25 2011-08-17 中国有色矿业集团有限公司 Method and device for mapping entity object into database
CN103561128A (en) * 2013-11-04 2014-02-05 福建星网锐捷网络有限公司 FC ID recycling method and network equipment
CN104317749A (en) * 2014-10-31 2015-01-28 小米科技有限责任公司 Information writing method and device
CN104486407A (en) * 2014-12-12 2015-04-01 北京国双科技有限公司 Method and device for generating numbers
US9141653B2 (en) * 2012-11-02 2015-09-22 Accenture Global Services Limited Real-time data management for a power grid
CN105117439A (en) * 2015-08-11 2015-12-02 小米科技有限责任公司 Global identifier generation method and apparatus

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20040099253A (en) * 2002-04-23 2004-11-26 마쯔시다덴기산교 가부시키가이샤 Server device and program management system
CN102148760B (en) * 2011-04-02 2014-01-22 福建星网锐捷网络有限公司 Identification (ID) application method, device and system
CN202906964U (en) * 2012-05-28 2013-04-24 深圳市谷米科技有限公司 An ID generator with high compatibility
EP3028491B1 (en) * 2013-07-31 2018-04-18 Telefonaktiebolaget LM Ericsson (publ) Method and apparatus for assigning cell identifier values and method and apparatus for managing assignment of cell identifier values in a communication network

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1588359A (en) * 2004-10-09 2005-03-02 武汉大学 Method for recovering and reutilizing object marking symbol in data base
CN101661430A (en) * 2008-08-29 2010-03-03 中兴通讯股份有限公司 Storage block recovery judgment device and storage block management system
CN101826073A (en) * 2009-03-06 2010-09-08 华为技术有限公司 Synchronous method, apparatus and system for distributed database
CN102156717A (en) * 2011-03-25 2011-08-17 中国有色矿业集团有限公司 Method and device for mapping entity object into database
US9141653B2 (en) * 2012-11-02 2015-09-22 Accenture Global Services Limited Real-time data management for a power grid
CN103561128A (en) * 2013-11-04 2014-02-05 福建星网锐捷网络有限公司 FC ID recycling method and network equipment
CN104317749A (en) * 2014-10-31 2015-01-28 小米科技有限责任公司 Information writing method and device
CN104486407A (en) * 2014-12-12 2015-04-01 北京国双科技有限公司 Method and device for generating numbers
CN105117439A (en) * 2015-08-11 2015-12-02 小米科技有限责任公司 Global identifier generation method and apparatus

Also Published As

Publication number Publication date
CN107528816A (en) 2017-12-29
WO2017219848A1 (en) 2017-12-28

Similar Documents

Publication Publication Date Title
CN107528816B (en) Processing method, management system and server of ID in distributed database
US10534776B2 (en) Proximity grids for an in-memory data grid
CN107733957B (en) Distributed service configuration system and version number distribution method
CN101969468B (en) Inquiry server cluster system and inquiry method
CN106777311B (en) Flight space state caching method and system
CN112084258A (en) Data synchronization method and device
CN110196860B (en) Unique identifier allocation method and device, electronic equipment and storage medium
CN109344122B (en) Distributed metadata management method and system based on file pre-creation strategy
CN101188566A (en) A method and system data buffering and synchronization under cluster environment
CN101706781A (en) Method and system for centralized management of database caches
CN101447937A (en) Rapid data positioning method based on path division and multi-distributed-directory
CN106326239A (en) Distributed file system and file meta-information management method thereof
CN105095313A (en) Data access method and equipment
US20150248350A1 (en) Apparatus and method for managing cache in cache distributed environment
CN104133783A (en) Method and device for processing distributed cache data
CN104750757A (en) Data storage method and equipment based on HBase
CN107277188B (en) Method, client, server and service system for determining IP address attribution information
KR20190139095A (en) Method for controlling near cache in distributed cache environment, and distributed cache server using the same
CN105320676A (en) Customer data query service method and device
CN108174147A (en) Video source and the Automatic Optimal distribution method of Scout service device in video monitoring system
CN112328632B (en) Distributed two-level caching method and system
CN114490744B (en) Data caching method, storage medium and electronic device
CN107273047B (en) Cache management method, cache manager and storage management software
CN109376001A (en) A kind of method and apparatus of resource allocation
CN115203255A (en) Data query method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
TA01 Transfer of patent application right

Effective date of registration: 20180130

Address after: 518057 Nanshan District science and technology, Guangdong Province, South Road, No. 55, No.

Applicant after: ZTE Corporation

Applicant after: China Citic Bank Co., Ltd.

Address before: 518057 Nanshan District science and Technology Industrial Park, Guangdong high tech Industrial Park, ZTE building

Applicant before: ZTE Corporation

TA01 Transfer of patent application right
CB03 Change of inventor or designer information

Inventor after: Ding Yan

Inventor after: Chen Xiaoqiang

Inventor after: Li Yanzhong

Inventor after: Liu Wentao

Inventor after: Deng Qiong

Inventor after: Chen Jianfeng

Inventor before: Ding Yan

Inventor before: Chen Xiaoqiang

Inventor before: Li Yanzhong

CB03 Change of inventor or designer information
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant