CN117271619A - Sequence processing system, method and device of database and computer equipment - Google Patents

Sequence processing system, method and device of database and computer equipment Download PDF

Info

Publication number
CN117271619A
CN117271619A CN202311316010.1A CN202311316010A CN117271619A CN 117271619 A CN117271619 A CN 117271619A CN 202311316010 A CN202311316010 A CN 202311316010A CN 117271619 A CN117271619 A CN 117271619A
Authority
CN
China
Prior art keywords
sequence
manager
database
cluster
sequence processing
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
CN202311316010.1A
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.)
Jinzhuan Xinke Co Ltd
Original Assignee
Jinzhuan Xinke 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 Jinzhuan Xinke Co Ltd filed Critical Jinzhuan Xinke Co Ltd
Priority to CN202311316010.1A priority Critical patent/CN117271619A/en
Publication of CN117271619A publication Critical patent/CN117271619A/en
Pending legal-status Critical Current

Links

Classifications

    • 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/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2474Sequence data queries, e.g. querying versioned data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1458Management of the backup or restore process
    • 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
    • G06F16/275Synchronous replication

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Software Systems (AREA)
  • Probability & Statistics with Applications (AREA)
  • Fuzzy Systems (AREA)
  • Computing Systems (AREA)
  • Quality & Reliability (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present disclosure provides a sequence processing system, method, apparatus and computer device of a database, wherein the system includes a computing node, a global sequence manager cluster and a database cluster; the method comprises the steps that a computing node acquires Structured Query Language (SQL) sentences sent by an application program, determines a sequence processing request corresponding to the SQL sentences, wherein the SQL sentences comprise sentences used for manipulating data in a database; the global sequence manager cluster sends the sequence processing request to the corresponding cluster sequence processing thread, and returns the sequence processing result corresponding to the sequence processing request to the computing node; the database cluster executes SQL sentences and returns execution results to the computing nodes so that the computing nodes return the execution results to the application program, and sequence processing request management between the computing nodes and the database cluster is performed through the global sequence manager cluster, so that the management efficiency of sequence data is improved, and the maintenance cost of the sequence data is reduced.

Description

Sequence processing system, method and device of database and computer equipment
Technical Field
The present disclosure relates to the field of database technologies, and in particular, to a sequence processing system, a method, an apparatus, and a computer device for a database.
Background
The sequence is a number sequence which is automatically increased by a database system according to a certain rule, the main purpose of the sequence is to generate a main key value of a table, the main key value can be referenced in an inserted sentence, the current value can be checked through inquiry, or the sequence is increased to the next value, and the sequence is an important function in production and use.
However, in large-scale distributed database systems, which typically include multiple database clusters, to ensure unique incremental character of sequences within a single database cluster, data synchronization between multiple compute nodes of the single database cluster is required. However, the number of computing nodes generally included in each database cluster is large, so that sequence data management is disordered, and meanwhile, data synchronization pressure is high, so that maintenance cost of the sequence data is increased.
Disclosure of Invention
The embodiment of the disclosure at least provides a sequence processing system, a sequence processing method, a sequence processing device and computer equipment of a database.
In a first aspect, an embodiment of the present disclosure provides a sequence processing system of a database, including: computing nodes, a global sequence manager cluster, and a database cluster;
The computing node acquires a Structured Query Language (SQL) statement sent by an application program, and determines a sequence processing request corresponding to the SQL statement, wherein the SQL statement comprises a statement for manipulating data in a database;
the global sequence manager cluster sends the sequence processing request to a corresponding cluster sequence processing thread, and returns a sequence processing result corresponding to the sequence processing request to the computing node;
and the database cluster executes the SQL sentence and returns an execution result to the computing node so that the computing node returns the execution result to the application program.
In an alternative embodiment, the global sequence manager cluster further includes: a master manager and a standby manager;
the master manager initiates a pre-application request, responds to the application request, determines a sequence value matched with the computing node, distributes the sequence value to the computing node, and sends a sequence data synchronization request to the standby manager;
and the standby manager is used for backing up the sequence value in response to the sequence data synchronization request to obtain backup data, and returning a synchronization result to the main manager so that the main manager determines a sequence processing result based on the synchronization result.
In an alternative embodiment, the sequence processes the request, including: applying for a request; the master manager is further configured to: and after the sequence value is distributed to the computing node, receiving an application request initiated by the computing node aiming at the sequence value.
In an alternative embodiment, when the available value of the sequence value does not meet the allocation condition of the preset value, the master manager is further configured to: and in response to the application request, reassigning a sequence value to the computing node.
In an alternative embodiment, the sequence processing request includes a sequence modification request and a sequence deletion request; the master manager is further configured to: and determining incremental data based on the sequence processing result, and synchronizing the incremental data to the standby manager so that the standby manager updates the backup data according to the incremental data.
In an alternative embodiment, the standby manager is further configured to: and re-determining a target manager in the standby manager when the main manager is in a target state, and indicating the target manager to synchronize sequence data to the main manager when the main manager is not in the target state.
In an alternative embodiment, the master manager further comprises: merging threads;
and the merging thread merges a plurality of sequence pre-application results of a plurality of clusters, and generates backup manager synchronization based on the merged content.
In an alternative embodiment, the global sequence manager further includes: the system comprises a plurality of cluster sequence processing threads, wherein the cluster sequence processing threads are corresponding threads preset for each database in the database cluster; the global sequence manager is further configured to: after the sequence processing result is obtained, determining a target database cluster corresponding to the sequence processing result, and sending the sequence processing result to a target cluster sequence processing thread corresponding to the target database cluster.
In a second aspect, an embodiment of the present disclosure further provides a sequence processing method of a database, which is applied to a distributed database, where the distributed database includes a plurality of database clusters, including:
acquiring a Structured Query Language (SQL) statement sent by an application program, and determining a sequence processing request corresponding to the SQL statement, wherein the SQL statement comprises a statement for manipulating data in a database;
And executing the sequence processing request to obtain a sequence processing result corresponding to the database cluster, and executing the SQL sentence in the database cluster.
In a third aspect, an embodiment of the present disclosure further provides a sequence processing apparatus of a database, including:
the determining unit is used for acquiring a Structured Query Language (SQL) statement sent by an application program and determining a sequence processing request corresponding to the SQL statement, wherein the SQL statement comprises a statement for manipulating data in a database;
and the execution unit is used for executing the sequence processing request to obtain a sequence processing result corresponding to the database cluster, and executing the SQL sentence in the database cluster.
In a fourth aspect, embodiments of the present disclosure further provide a computer device, comprising: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory in communication via the bus when the computer device is running, the machine-readable instructions when executed by the processor performing the steps of the first aspect, or any of the possible implementations of the first aspect.
In a fifth aspect, the present application further provides a computer storage medium storing computer executable instructions for performing the method for sequence processing of a database according to any one of the above-mentioned aspects of the present application.
Compared with the prior art, the technical scheme provided by the embodiment of the application has the following advantages: according to the method provided by the embodiment of the application, firstly, a Structured Query Language (SQL) statement sent by an application program can be obtained through a computing node, and a sequence processing request corresponding to the SQL statement is determined. Then, the sequence processing request can be sent to the sequence processing thread of the corresponding cluster through the global sequence manager cluster, and the sequence processing result corresponding to the sequence processing request is returned to the computing node. After the database cluster receives the SQL statement, the SQL statement can be executed, and an execution result is returned to the computing node, so that the computing node returns the execution result to the application program, and sequence processing request management between the computing node and the database cluster is performed through the global sequence manager cluster, thereby improving the management efficiency of the sequence data and reducing the maintenance cost of the sequence data.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for the embodiments are briefly described below, which are incorporated in and constitute a part of the specification, these drawings showing embodiments consistent with the present disclosure and together with the description serve to illustrate the technical solutions of the present disclosure. It is to be understood that the following drawings illustrate only certain embodiments of the present disclosure and are therefore not to be considered limiting of its scope, for the person of ordinary skill in the art may admit to other equally relevant drawings without inventive effort.
FIG. 1 illustrates an architecture diagram of a database sequential processing system provided by an embodiment of the present disclosure;
FIG. 2 illustrates an architecture diagram of another database sequential processing system provided by embodiments of the present disclosure;
FIG. 3 illustrates a flowchart of a method for sequence processing of a database provided by an embodiment of the present disclosure;
FIG. 4 shows a schematic diagram of a sequence processing apparatus of a database provided by an embodiment of the present disclosure;
fig. 5 shows a schematic diagram of a computer device provided by an embodiment of the present disclosure.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present disclosure more apparent, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the drawings in the embodiments of the present disclosure, and it is apparent that the described embodiments are only some embodiments of the present disclosure, but not all embodiments. The components of the embodiments of the present disclosure, which are generally described and illustrated in the figures herein, may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present disclosure provided in the accompanying drawings is not intended to limit the scope of the disclosure, as claimed, but is merely representative of selected embodiments of the disclosure. All other embodiments, which can be made by those skilled in the art based on the embodiments of this disclosure without making any inventive effort, are intended to be within the scope of this disclosure.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures.
The term "and/or" is used herein to describe only one relationship, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist together, and B exists alone. In addition, the term "at least one" herein means any one of a plurality or any combination of at least two of a plurality, for example, including at least one of A, B, C, and may mean including any one or more elements selected from the group consisting of A, B and C.
It is found that the sequence is a number sequence which is automatically increased by a database system according to a certain rule, the main purpose of the sequence is to generate a main key value of a table, the main key value can be referenced in an inserted sentence, the current value can be checked through inquiry, or the sequence is increased to the next value, and the sequence is an important function in production and use.
However, in large-scale distributed database systems, which typically include multiple database clusters, to ensure unique incremental character of sequences within a single database cluster, data synchronization between multiple compute nodes of the single database cluster is required. However, the number of computing nodes generally included in each database cluster is large, so that sequence data management is disordered, and meanwhile, data synchronization pressure is high, so that maintenance cost of the sequence data is increased.
Based on the above study, the present disclosure provides a sequence processing system, method, apparatus and computer device for a database. In the embodiment of the disclosure, firstly, a Structured Query Language (SQL) statement sent by an application program can be acquired through a computing node, and a sequence processing request corresponding to the SQL statement is determined. Then, the sequence processing request can be sent to the corresponding cluster sequence processing thread through the global sequence manager cluster, and the sequence processing result corresponding to the sequence processing request is returned to the computing node. After the database cluster receives the SQL statement, the SQL statement can be executed, and an execution result is returned to the computing node, so that the computing node returns the execution result to the application program, and sequence processing request management between the computing node and the database cluster is performed through the global sequence manager cluster, thereby improving the management efficiency of the sequence data and reducing the maintenance cost of the sequence data.
For the sake of understanding the present embodiment, a detailed description will be first given of a sequence processing system of a database disclosed in an embodiment of the present disclosure, where the sequence processing system of the database includes a global sequence manager cluster, a computing node, and a database cluster. Here, the global sequence manager (Globale Sequence Manager, hereinafter abbreviated as GSM) cluster is generally a multi-copy high availability cluster architecture composed of a host and multiple standby computers, so that when the host is down, a plurality of available standby computers with complete sequence copies can take over the host, and the normal use of the database sequence functions is maintained. Each GSM cluster corresponds to one GSM cluster, so that high performance of sequence processing is guaranteed, and meanwhile, multiple GSM clusters ensure isolation of sequence processing among clusters and better disaster recovery capability. A Computing Node (CN) may bind with a database cluster through a connection instance (for an external service port, etc.), and establish a link with a host in a GSM cluster corresponding to the database cluster. The plurality of database clusters form the distributed database system, wherein each database cluster comprises a plurality of database nodes (Data notes, DNs).
Referring to fig. 1, an architecture diagram of a sequence processing system of a database according to an embodiment of the disclosure is provided, where the system includes: a compute node 10, a global sequence manager cluster 20, and a database cluster 30, wherein:
the computing node 10 acquires a Structured Query Language (SQL) statement sent by an application program, and determines a sequence processing request corresponding to the SQL statement, wherein the SQL statement comprises a statement for manipulating data in a database.
In an embodiment of the present disclosure, the computing node is configured to parse a received SQL statement to determine a data table and specific operation contents of an operation indicated by the SQL statement, and generate a sequence processing request based on the operation contents and the data table.
For example, when an SQL statement is used to indicate that a data table is created, the sequence processing request may be used to indicate that a sequence number is generated for a row in the data table, or when an SQL statement is used to indicate that row data is deleted in the data table, the sequence processing request may be used to indicate that the sequence number corresponding to the row data is deleted.
Specifically, the SQL statement may include: DDL statements (Data Definition Language, data definition statements) and DML statements (Data Manipulation Language, data manipulation statements).
Here, the DDL statement described above may be used to indicate that data is created, such as creating a DATABASE statement CREATE DATABASE, a data TABLE creation statement CREATE TABLE, and the like. In addition, the DML statement may be used to query or manipulate existing data in the database, such as data insertion statement insert, data deletion statement delete, data update, etc.
In the process of merging SQL sentences, the SQL sentences which are operated on the same data can be subjected to de-duplication merging. For example, if statement 1 is modified for data a and statement 2 is deleted for that data a, then the target statement obtained by de-overlapping statement 1 and statement 2 may be used to indicate that data a is deleted.
The global sequence manager cluster 20 sends the sequence processing thread to the corresponding cluster sequence processing thread, and returns the sequence processing result corresponding to the sequence processing request to the computing node.
In the embodiments of the present disclosure, the GSM cluster is generally a multi-copy high availability cluster architecture composed of a host and multiple standby computers, and includes a main manager and multiple standby managers. Here, the database cluster corresponding to the SQL statement may be determined by the master manager first, and the SQL statement may be sent to the database cluster for execution.
In view of the above-mentioned distributed database system including a plurality of database clusters, each database cluster is provided with a corresponding sequence, in order to ensure the unique incremental property of each sequence, a corresponding cluster sequence processing thread may be provided for each database cluster in the above-mentioned GSM cluster, so as to process the sequence processing request corresponding to the database cluster through the cluster sequence processing thread. After the sequence processing request is processed by the cluster sequence processing thread, the obtained sequence processing result can be returned to the computing node so as to respond to the sequence processing request corresponding to the computing node, and the sequence processing flow is completed.
And the database cluster 30 executes the SQL sentence and returns an execution result to the computing node so that the computing node returns the execution result to the application program.
In the embodiment of the disclosure, the received SQL statement may be sent to the corresponding database cluster through the computing node, and after the database cluster executes the SQL statement, the execution result may be returned to the computing node, so that the computing node returns the computation result to the application program that initiates the request.
For example, if the request initiated by the application program is to store the target data, after the target data is stored in the corresponding database cluster through the SQL statement, the database cluster may determine an execution result for indicating the storage result, and return the execution result to the application program as a response of the request.
As can be seen from the foregoing description, in the embodiment of the present disclosure, first, a structured query language SQL statement sent by an application program may be obtained through a computing node, and a sequence processing request corresponding to the SQL statement is determined. Then, the sequence processing request can be sent to the corresponding cluster sequence processing thread through the global sequence manager cluster, and the sequence processing result corresponding to the sequence processing request is returned to the computing node. After the database cluster receives the SQL statement, the SQL statement can be executed, and an execution result is returned to the computing node, so that the computing node returns the execution result to the application program, and sequence processing request management between the computing node and the database cluster is performed through the global sequence manager cluster, thereby improving the management efficiency of the sequence data and reducing the maintenance cost of the sequence data.
In an alternative embodiment, the global sequence manager cluster 20 further includes: a main manager 21 and a standby manager 22;
the master manager 21 initiates a pre-application request, determines a sequence value matched with the computing node in response to the application request, distributes the sequence value to the computing node, and sends a sequence data synchronization request to the standby manager.
The standby manager 22, in response to the sequence data synchronization request, backs up the sequence value to obtain backup data, and returns a synchronization result to the primary manager, so that the primary manager determines a sequence processing result based on the synchronization result.
In an embodiment of the present disclosure, the sequence value may be used to indicate a storage space allocated in advance for a computing node in a database cluster, and after receiving a sequence processing request sent by the computing node, a master manager may generate a pre-application request for the computing node, and allocate the sequence value for the computing node in response to the pre-application request.
As can be seen from the above, the GSM cluster is generally a multi-copy high-availability cluster architecture formed by a host and multiple standby computers, and includes a main manager and multiple standby managers, where the standby managers can be used for backing up data in the main manager, so as to improve disaster tolerance of the GSM cluster.
In the implementation, the main manager includes a plurality of processing threads, so that the sequence values pre-applied by each processing thread can be combined, and the combined result is transmitted to the standby manager, so that the backup times are reduced, and the data synchronization pressure of the global sequence manager is reduced.
In the embodiment of the disclosure, a section of sequence value can be pre-applied to the GSM cluster through a pre-application request, so that the number of times of sequence value application is reduced, and the data synchronization pressure of the global sequence manager is reduced.
In an alternative embodiment, the sequence processes the request, including: the application request, the master manager 21 is further configured to: and after the sequence value is distributed to the computing node, receiving an application request initiated by the computing node aiming at the sequence value.
In the embodiment of the present disclosure, after the sequence value is allocated to the computing node, if an application request of the computing node for the sequence value is detected subsequently, the remaining numerical space of the sequence value may be checked first. If the remaining numerical space meets the allocation condition of the preset value, the preset value can be allocated to the computing node in the remaining numerical space in response to the application request.
For example, if the numerical space corresponding to the sequence value is 0-B, CN requests the number B of sequences, where B < B. And when each computing node passes the application request, a value corresponding to B can be allocated to the computing node in a numerical space corresponding to the sequence value, and the rest space is B-B. It should be understood that if the remaining numerical space B-B > B2, the remaining numerical space may be considered to satisfy the allocation condition of the preset value.
In the embodiment of the disclosure, when the residual numerical space meets the allocation condition, data synchronization to the standby machine is not needed, so that the number of times of data synchronization between the main and standby GSM is reduced.
In an alternative embodiment, when the available value of the sequence value does not meet the allocation condition of the preset value, where the available value is the remaining numerical space, the master manager 21 is further configured to: and in response to the application request, reassigning a sequence value to the computing node.
In the disclosed embodiments, after the sequence value pre-applied for a computing node is exhausted, the sequence value may be reassigned for the computing node in response to an application request.
Specifically, it may be first determined whether the available value of the sequence value satisfies an allocation condition, where the allocation condition may be that the available value is greater than a preset value. If not, the sequence value is re-allocated, so that allocation failure caused by smaller available value is avoided.
In the embodiment of the disclosure, after the sequence value allocated to the computing node in advance is used up, the sequence value can be allocated to the computing node again, so that the sequence value allocation times are reduced, and the data synchronization pressure of the global sequence manager is further reduced.
In an alternative embodiment, the sequence processing request includes a sequence modification request and a sequence deletion request, and the master manager 21 is further configured to: and determining incremental data based on the sequence processing result, and synchronizing the incremental data to the standby manager so that the standby manager updates the backup data according to the incremental data.
In the embodiment of the disclosure, the incremental data may be used to indicate the changed data in the full sequence data stored in the GSM cluster. For example, if the full sequence data stored in the GSM cluster is C1, C2, and C3, the delta data may be used to indicate deletion of C3 therein.
Based on this, the master manager may first determine an incremental request, e.g., a sequence modification request, a sequence deletion request, etc., in the sequence processing request, and determine incremental data based on the execution result of the incremental request, and synchronize the incremental data to the slave manager. For example, if the full sequence data stored in the GSM cluster is C1, C2, and C3, after C3 in the GSM cluster is modified based on the sequence modification request, the modified C3 may be used as delta data.
In the embodiment of the disclosure, when the sequence processing request includes an increment request, the master manager may determine increment data corresponding to the increment request and synchronize the increment data to the standby manager, so that the standby manager updates the backup data according to the increment data, thereby reducing the data amount during data synchronization between the master manager and the standby manager under the condition of ensuring that the backup data is not lost.
In an alternative embodiment, the standby manager 22 is further configured to: and re-determining a target manager in the standby manager when the main manager is in a target state, and indicating the target manager to synchronize sequence data to the main manager when the main manager is not in the target state.
In the embodiment of the present disclosure, the target state may be a failure state, and when the primary manager fails, the target manager may be redetermined in the standby manager to replace the primary manager, so as to ensure that the GSM cluster operates normally when the primary machine is down.
It should be appreciated that after the original master management resumes a normal operating state, the original master manager may send a data synchronization request to the target manager. The target manager may obtain full amount data corresponding to the local sequence data and the delta data in response to the data synchronization request, and determine new sequence data during the time when the original master manager is in the target state. The newly added sequence data may then be returned to the original master manager as a response result to cause the original master manager to synchronize the newly added sequence data through a local persistence operation.
In the embodiment of the disclosure, in the GSM cluster, the standby manager can quickly take over the primary manager when the primary manager is down, and correctly process the related requests of the sequence. If the primary and standby machine is switched, the original main machine automatically acquires sequence information from the current main machine and performs local persistence after being recovered, so that the disaster tolerance of the GSM cluster is improved.
In an alternative embodiment, the master manager 21 further includes: and the merging thread performs merging processing on the plurality of sequence processing results and performs data synchronization on the standby manager based on the merged content.
In the embodiment of the disclosure, considering that the volume of the database cluster is generally huge, the number of computing nodes is also large, and the concurrency of the requests of the SQL statement is also large, so the number of the sequence processing requests is also huge. On the basis, a plurality of sequence processing results can be combined, and the combined content is sent to the standby manager, so that the data synchronization times between the main and standby managers are reduced.
When the method is implemented, a merging thread can be set in the main manager, after the main manager processes the sequence processing request, the determined sequence processing result can be stored in a task queue, and the merging thread can periodically merge the sequence processing result in the task queue.
Here, when merging the sequence processing results, the target processing result corresponding to the application request may be determined first, the target processing result is merged, and the data synchronization is performed to the standby manager based on the merged content.
In the embodiment of the disclosure, considering that the volume of the database cluster is generally huge and the concurrency of the requests of the SQL statement is also large, the number of the sequence processing requests is also huge. On the basis, a plurality of sequence processing results can be combined, and the combined content is sent to the standby manager, so that the data synchronization times between the main and standby managers are reduced, and further the sequence management pressure of the GSM cluster is reduced.
In an alternative embodiment, the global sequence manager 20 further includes: a plurality of cluster sequence processing threads 23, wherein the cluster sequence processing threads are corresponding threads preset for each database in the database cluster; the global sequence manager 20 is further configured to: after the sequence processing result is obtained, determining a target database cluster corresponding to the sequence processing result, and sending the sequence processing result to a target cluster sequence processing thread corresponding to the target database cluster.
Here, considering that the distributed database system generally includes a plurality of database clusters, in order to improve the processing efficiency of the request in the distributed database system, a corresponding cluster sequence processing thread may be set for each database in the GSM cluster, where the cluster sequence processing thread is used to obtain an SQL statement related to the database cluster, and send the SQL statement to the merging thread. After the sequence processing result returned by the merging thread is obtained, a target cluster sequence processing thread related to the sequence processing result can be determined, and the sequence processing result is distributed to the target cluster sequence processing thread as a response result.
In the embodiment of the present disclosure, considering that the above distributed database system generally includes a plurality of database clusters, a corresponding cluster sequence processing thread may be set for each database cluster, thereby improving the processing efficiency for the request in the distributed database system.
Referring to fig. 2, an architecture diagram of another database sequential processing system according to an embodiment of the present disclosure is shown, where the system includes: application, compute node, primary GSM, backup GSM, and database cluster, wherein:
And the application program sends the SQL sentence to the computing node and acquires the processing result of the SQL sentence returned by the database cluster.
The computing node comprises a merging thread and a plurality of first processing threads, wherein each first processing thread is provided with a corresponding database in a database cluster, and the first processing threads are used for analyzing SQL sentences to obtain sequence processing requests.
And the main GSM acquires a sequence processing request, sends the sequence processing request to a second processing thread, and after the second processing thread executes the sequence processing request to obtain a sequence processing result, returns the sequence processing result to the corresponding computing node. And simultaneously forwarding the sequence processing result to a merging thread, merging the sequence processing result by the merging thread, and then sending the merged sequence processing result to the standby GSM, and obtaining a synchronous response result of the standby GSM.
And the standby GSM responds to the backup request of the main GSM, performs localized storage on the received sequence processing result, and synchronizes the response result to the main GSM after the localized storage.
And the database cluster receives and executes the SQL statement and returns an execution result to the computing node so that the computing node returns the execution result to the application program.
To sum up, in the embodiment of the disclosure, firstly, a structured query language SQL statement sent by an application program may be obtained through a computing node, and a sequence processing request corresponding to the SQL statement is determined. Then, the sequence processing request can be sent to the corresponding cluster sequence processing thread through the global sequence manager cluster, and the sequence processing result corresponding to the sequence processing request is returned to the computing node. After the database cluster receives the SQL statement, the SQL statement can be executed, and an execution result is returned to the computing node, so that the computing node returns the execution result to the application program, and sequence processing request management between the computing node and the database cluster is performed through the global sequence manager cluster, thereby improving the management efficiency of the sequence data and reducing the maintenance cost of the sequence data.
For the sake of understanding the present embodiment, a detailed description may also be given of a method for processing a sequence of a database disclosed in the present embodiment, where an execution body of the method for processing a sequence of a database provided in the present embodiment is generally a computer device with a certain computing capability, and in some possible implementations, the method for processing a sequence of a database may be implemented by a processor calling computer readable instructions stored in a memory.
Referring to fig. 3, a flowchart of a sequence processing method of a database according to an embodiment of the present disclosure is provided, where the method is applied to a distributed database, and the distributed database includes a plurality of database clusters, and the method includes steps S101 to S103, where:
s101: and acquiring a Structured Query Language (SQL) statement sent by an application program, and determining a sequence processing request corresponding to the SQL statement, wherein the SQL statement comprises a statement for manipulating data in a database.
S103: and executing the sequence processing request to obtain a sequence processing result corresponding to the database cluster, and executing the SQL sentence in the database cluster.
In the embodiment of the disclosure, firstly, a structured query language SQL statement sent by an application program can be obtained, and a sequence processing request corresponding to the SQL statement is determined. The SQL statement may then be sent to the corresponding database cluster to cause the database cluster to execute the SQL statement. Meanwhile, the sequence processing request can be executed to obtain a sequence processing result, so that the sequence processing request management between the computing node and the database cluster is performed through the global sequence manager cluster, the management efficiency of the sequence data is improved, and the maintenance cost of the sequence data is reduced.
It will be appreciated by those skilled in the art that in the above-described method of the specific embodiments, the written order of steps is not meant to imply a strict order of execution but rather should be construed according to the function and possibly inherent logic of the steps.
Based on the same inventive concept, the embodiments of the present disclosure further provide a sequence processing device of a database corresponding to the sequence processing method of the database, and since the principle of solving the problem by the device in the embodiments of the present disclosure is similar to that of the sequence processing method of the database in the embodiments of the present disclosure, the implementation of the device may refer to the implementation of the method, and the repetition is omitted.
Referring to fig. 4, a schematic diagram of a sequence processing apparatus of a database according to an embodiment of the disclosure is shown, where the apparatus includes: a determination unit 41 and an execution unit 42; wherein,
a determining unit 41, configured to obtain a structured query language SQL statement sent by an application program, and determine a sequence processing request corresponding to the SQL statement, where the SQL statement includes a statement for manipulating data in a database;
and the execution unit 42 is configured to execute the sequence processing request, obtain a sequence processing result corresponding to the database cluster, and execute the SQL statement in the database cluster.
In the embodiment of the disclosure, firstly, a structured query language SQL statement sent by an application program can be obtained, and a sequence processing request corresponding to the SQL statement is determined. The SQL statement may then be sent to the corresponding database cluster to cause the database cluster to execute the SQL statement. Meanwhile, the sequence processing request can be executed to obtain a sequence processing result, so that the sequence processing request management between the computing node and the database cluster is performed through the global sequence manager cluster, the management efficiency of the sequence data is improved, and the maintenance cost of the sequence data is reduced.
In a possible implementation, the execution unit 42 is further configured to:
initiating a pre-application request, responding to the application request, determining a sequence value matched with the computing node, distributing the sequence value to the computing node, and sending a sequence data synchronization request to the standby manager;
and in response to the sequence data synchronization request, backing up the sequence value to obtain backup data, and returning a synchronization result to the master manager so that the master manager determines a sequence processing result based on the synchronization result.
In a possible implementation, the sequence processes the request, including: the application request, the execution unit 42 is further configured to:
And after the sequence value is distributed to the computing node, receiving an application request initiated by the computing node aiming at the sequence value.
In a possible implementation manner, when the available value of the sequence value does not meet the allocation condition of the preset value, the execution unit 42 is further configured to:
and in response to the application request, reassigning a sequence value to the computing node.
In a possible implementation manner, the sequence processing request comprises a sequence modification request and a sequence deletion request; execution unit 42, further configured to:
and determining incremental data based on the sequence processing result, and synchronizing the incremental data to the standby manager so that the standby manager updates the backup data according to the incremental data.
In a possible implementation, the execution unit 42 is further configured to:
and re-determining a target manager in the standby manager when the main manager is in a target state, and indicating the target manager to synchronize sequence data to the main manager when the main manager is not in the target state.
In a possible implementation, the determining unit 41 is further configured to:
and combining the plurality of sequence processing results, and carrying out data synchronization on the standby manager based on the combined content.
In a possible implementation, the determining unit 41 is further configured to:
after the sequence processing result is obtained, determining a target database cluster corresponding to the sequence processing result, and sending the sequence processing result to a target cluster sequence processing thread corresponding to the target database cluster.
The process flow of each unit in the apparatus and the interaction flow between units may be described with reference to the related descriptions in the above method embodiments, which are not described in detail herein.
Corresponding to the sequence processing method of the database in fig. 3, the embodiment of the disclosure further provides a computer device 500, as shown in fig. 5, which is a schematic structural diagram of the computer device 500 provided in the embodiment of the disclosure, including:
a processor 51, a memory 52, and a bus 53; memory 52 is used to store execution instructions, including memory 521 and external storage 522; the memory 521 is also referred to as an internal memory, and is used for temporarily storing operation data in the processor 51 and data exchanged with the external memory 522 such as a hard disk, and the processor 51 exchanges data with the external memory 522 through the memory 521, and when the computer device 500 is operated, the processor 51 and the memory 52 communicate with each other through the bus 53, so that the processor 51 executes the following instructions:
Acquiring a Structured Query Language (SQL) statement sent by an application program, and determining a sequence processing request corresponding to the SQL statement, wherein the SQL statement comprises a statement for manipulating data in a database;
and executing the sequence processing request to obtain a sequence processing result corresponding to the database cluster, and executing the SQL sentence in the database cluster.
The disclosed embodiments also provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the sequence processing method of the database described in the method embodiments above. Wherein the storage medium may be a volatile or nonvolatile computer readable storage medium.
The embodiments of the present disclosure further provide a computer program product, where the computer program product carries a program code, where instructions included in the program code may be used to perform steps of a sequence processing method of a database described in the foregoing method embodiments, and specifically reference may be made to the foregoing method embodiments, which are not described herein.
Wherein the above-mentioned computer program product may be realized in particular by means of hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied as a computer storage medium, and in another alternative embodiment, the computer program product is embodied as a software product, such as a software development kit (Software Development Kit, SDK), or the like.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described system and apparatus may refer to corresponding procedures in the foregoing method embodiments, which are not described herein again. In the several embodiments provided in the present disclosure, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. The above-described apparatus embodiments are merely illustrative, for example, the division of the units is merely a logical function division, and there may be other manners of division in actual implementation, and for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some communication interface, device or unit indirect coupling or communication connection, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present disclosure may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer readable storage medium executable by a processor. Based on such understanding, the technical solution of the present disclosure may be embodied in essence or a part contributing to the prior art or a part of the technical solution, or in the form of a software product stored in a storage medium, including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in the embodiments of the present disclosure. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Finally, it should be noted that: the foregoing examples are merely specific embodiments of the present disclosure, and are not intended to limit the scope of the disclosure, but the present disclosure is not limited thereto, and those skilled in the art will appreciate that while the foregoing examples are described in detail, it is not limited to the disclosure: any person skilled in the art, within the technical scope of the disclosure of the present disclosure, may modify or easily conceive changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features thereof; such modifications, changes or substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the disclosure, and are intended to be included within the scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.

Claims (11)

1. A sequence processing system for a database, comprising: computing nodes, a global sequence manager cluster, and a database cluster;
the computing node acquires a Structured Query Language (SQL) statement sent by an application program, and determines a sequence processing request corresponding to the SQL statement, wherein the SQL statement comprises a statement for manipulating data in a database;
the global sequence manager cluster sends the sequence processing request to a corresponding cluster sequence processing thread, and returns a sequence processing result corresponding to the sequence processing request to the computing node;
and the database cluster executes the SQL sentence and returns an execution result to the computing node so that the computing node returns the execution result to the application program.
2. The system of claim 1, wherein the global sequence manager cluster further comprises: a master manager and a standby manager;
the master manager initiates a pre-application request, responds to the application request, determines a sequence value matched with the computing node, distributes the sequence value to the computing node, and sends a sequence data synchronization request to the standby manager;
And the standby manager is used for backing up the sequence value in response to the sequence data synchronization request to obtain backup data, and returning a synchronization result to the main manager so that the main manager determines a sequence processing result based on the synchronization result.
3. The system of claim 2, wherein the sequence processes the request, comprising: applying for a request; the master manager is further configured to: and after the sequence value is distributed to the computing node, receiving an application request initiated by the computing node aiming at the sequence value.
4. A system according to claim 3, wherein the master manager is further configured to, when the available value of the sequence value does not satisfy the allocation condition of the preset value: and in response to the application request, reassigning a sequence value to the computing node.
5. The system of claim 2, wherein the sequence processing request comprises a sequence modification request, a sequence deletion request; the master manager is further configured to: and determining incremental data based on the sequence processing result, and synchronizing the incremental data to the standby manager so that the standby manager updates the backup data according to the incremental data.
6. The system of claim 2, wherein the standby manager is further configured to: and re-determining a target manager in the standby manager when the main manager is in a target state, and indicating the target manager to synchronize sequence data to the main manager when the main manager is not in the target state.
7. The system of claim 2, wherein the master manager further comprises: merging threads;
and the merging thread performs merging processing on the plurality of sequence processing results and performs data synchronization on the standby manager based on the merged content.
8. The system of claim 7, wherein the global sequence manager further comprises: the system comprises a plurality of cluster sequence processing threads, wherein the cluster sequence processing threads are corresponding threads preset for each database in the database cluster; the global sequence manager is further configured to: after the sequence processing result is obtained, determining a target database cluster corresponding to the sequence processing result, and sending the sequence processing result to a target cluster sequence processing thread corresponding to the target database cluster.
9. A method for processing a sequence of databases, which is applied to a distributed database, wherein the distributed database comprises a plurality of database clusters, and the method comprises the following steps:
acquiring a Structured Query Language (SQL) statement sent by an application program, and determining a sequence processing request corresponding to the SQL statement, wherein the SQL statement comprises a statement for manipulating data in a database;
and executing the sequence processing request to obtain a sequence processing result corresponding to the database cluster, and executing the SQL sentence in the database cluster.
10. A sequence processing apparatus of a database, comprising:
the determining unit is used for acquiring a Structured Query Language (SQL) statement sent by an application program and determining a sequence processing request corresponding to the SQL statement, wherein the SQL statement comprises a statement for manipulating data in a database;
and the execution unit is used for executing the sequence processing request to obtain a sequence processing result corresponding to the database cluster, and executing the SQL sentence in the database cluster.
11. A computer device, comprising: a processor, a memory and a bus, said memory storing machine readable instructions executable by said processor, said processor and said memory communicating over the bus when the computer device is running, said machine readable instructions when executed by said processor performing the steps of the sequence processing method of the database of claim 10.
CN202311316010.1A 2023-10-11 2023-10-11 Sequence processing system, method and device of database and computer equipment Pending CN117271619A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311316010.1A CN117271619A (en) 2023-10-11 2023-10-11 Sequence processing system, method and device of database and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311316010.1A CN117271619A (en) 2023-10-11 2023-10-11 Sequence processing system, method and device of database and computer equipment

Publications (1)

Publication Number Publication Date
CN117271619A true CN117271619A (en) 2023-12-22

Family

ID=89210349

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311316010.1A Pending CN117271619A (en) 2023-10-11 2023-10-11 Sequence processing system, method and device of database and computer equipment

Country Status (1)

Country Link
CN (1) CN117271619A (en)

Similar Documents

Publication Publication Date Title
CN103077222B (en) Cluster file system distributed meta data consistance ensuring method and system
CN105814544B (en) System and method for supporting persistent partition recovery in a distributed data grid
US20110153570A1 (en) Data replication and recovery method in asymmetric clustered distributed file system
CN107402722B (en) Data migration method and storage device
CN108509462B (en) Method and device for synchronizing activity transaction table
US20140108358A1 (en) System and method for supporting transient partition consistency in a distributed data grid
US9501544B1 (en) Federated backup of cluster shared volumes
CN109739935A (en) Method for reading data, device, electronic equipment and storage medium
CN101136728A (en) Cluster system and method for backing up a replica in a cluster system
KR101670343B1 (en) Method, device, and system for peer-to-peer data replication and method, device, and system for master node switching
CN109710388A (en) Method for reading data, device, electronic equipment and storage medium
CN107329859B (en) Data protection method and storage device
CN105574187A (en) Duplication transaction consistency guaranteeing method and system for heterogeneous databases
CN110515557B (en) Cluster management method, device and equipment and readable storage medium
US10445295B1 (en) Task-based framework for synchronization of event handling between nodes in an active/active data storage system
CN116680256B (en) Database node upgrading method and device and computer equipment
CN109783578A (en) Method for reading data, device, electronic equipment and storage medium
CN111078119B (en) Data reconstruction method, system, device and computer readable storage medium
WO2021082925A1 (en) Transaction processing method and apparatus
EP3377970B1 (en) Multi-version removal manager
US10671482B2 (en) Providing consistency in a distributed data store
US20220197761A1 (en) Cloud architecture for replicated data services
CN116303789A (en) Parallel synchronization method and device for multi-fragment multi-copy database and readable medium
CN111680040A (en) Data table processing method and device
CN117271619A (en) Sequence processing system, method and device of database and computer equipment

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