A method for managing global objects in a distributed database

By introducing a layered design of proxy modules, service modules, and storage modules into the distributed database, the problem of low efficiency in global object management is solved, achieving efficient and scalable global object management and ensuring data consistency and system performance.

CN119760026BActive Publication Date: 2025-11-04TIANJIN NANKAI UNIV GENERAL DATA TECH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510251758.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-05
Publication Date
2025-11-04
Estimated Expiration
2045-03-05

AI Technical Summary

Technical Problem

In existing technologies, global object management in distributed databases is inefficient, especially under high concurrency, where system performance bottlenecks are obvious, making it difficult to guarantee data consistency and high availability.

Method used

A layered design is introduced, consisting of a proxy module, a service module, and a storage module. The proxy module acts as an intermediary to handle global object requests, the service module generates response packets and saves them in the storage module, and the storage module performs intelligent updates between memory and disk.

Benefits of technology

It improves the response efficiency of global object management, reduces system latency, ensures data consistency and durability, and enhances database performance and scalability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119760026B_ABST
    Figure CN119760026B_ABST
Patent Text Reader

Abstract

The application provides a management method of a global object in a distributed database, and the method comprises the following steps: receiving a global object request package sent by an agent module in the distributed database, wherein the global object request package is obtained by encapsulating a global object request initiated by a computing node or a data node through the agent module; generating a response package corresponding to the global object request package based on a request type of the global object request; returning the response package to the computing node or the data node which initiates the global object request, and saving a corresponding global object in the response package in a storage module; updating historical global objects in the storage module based on the corresponding global object in the response package to obtain updated global objects, and saving the updated global objects in the memory or the disk at the same time. The method provided by the application can efficiently manage the global objects.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of distributed database, in particular to a management method of global objects in a distributed database. BACKGROUND

[0002] With the continuous development of science and technology, people's requirements for data processing are also getting higher and higher. In a distributed database, some key objects need to be managed by a central node. The key objects may be, for example, global transaction numbers, global time stamps, global sequences, etc., which have the requirement of uniqueness and therefore must be managed by the central node. The central node is responsible for maintaining these objects and quickly returning them after calculation according to the requests of other nodes.

[0003] In the prior art, in order to achieve the above-mentioned goal, a global object manager is designed separately to act as the responsibility of the central node. However, the management efficiency of the key objects by the global object manager in the prior art is low.

[0004] Therefore, how to improve the management efficiency of the key objects has become a technical problem to be solved by the person skilled in the art. SUMMARY

[0005] Based on the above problems, the present application provides a management method of global objects in a distributed database. The method is designed with a unique proxy module, a service module and a storage module. The proxy module resides on the computing nodes and data nodes and is used to proxy the interaction between the computing nodes and data nodes and the global object manager. The service module resides on the global object manager and is the core of the global object manager, responsible for processing requests from the proxy module. The storage module also resides on the global object manager and is responsible for saving and restoring global objects. Through the unique design, efficient management of global objects in a distributed database is achieved.

[0006] The present application provides a management method of global objects in a distributed database, which comprises:

[0007] receiving a global object request package sent by a proxy module in a distributed database, the global object request package being obtained by encapsulating a global object request initiated by a computing node or a data node through the proxy module, and each computing node and data node being provided with a proxy module;

[0008] generating a response package corresponding to the global object request package based on the request type of the global object request;

[0009] returning the response package to the computing node or data node that initiates the global object request, and saving the corresponding global object in the response package in a storage module;

[0010] updating the historical global object in the storage module based on the corresponding global object in the response packet to obtain an updated global object, and saving the updated global object to the memory or the disk.

[0011] In a possible implementation, the generating the response packet corresponding to the global object request packet based on the request type of the global object request comprises:

[0012] if the request type of the global object request is a global transaction number type, generating a global transaction number based on a historical global transaction number in the historical global object, the global transaction number being a globally unique transaction number;

[0013] encapsulating the global transaction number as the response packet of the global object request packet.

[0014] In a possible implementation, the generating the response packet corresponding to the global object request packet based on the request type of the global object request comprises:

[0015] if the request type of the global object request is a global timestamp type, generating a global timestamp based on a historical global timestamp in the historical global object or a clock source of the distributed database, the global timestamp being a globally unique and monotonically increasing timestamp;

[0016] encapsulating the global timestamp as the response packet of the global object request packet.

[0017] In a possible implementation, the generating the response packet corresponding to the global object request packet based on the request type of the global object request comprises:

[0018] if the request type of the global object request is a global sequence number type, generating a global sequence number based on a historical global sequence number in the historical global object, the global sequence number being a globally unique sequence number;

[0019] encapsulating the global sequence number as the response packet of the global object request packet.

[0020] In a possible implementation, the method further comprises:

[0021] when the distributed database is restarted, restoring the global object in the memory of the computing node in the distributed database based on the global object stored in the storage module.

[0022] In a possible implementation, the proxy module comprises at least two types of queues, and the method further comprises:

[0023] When the proxy module processes multiple global object requests, the multiple global object requests are added into a second type queue according to a preset rule;

[0024] The global object requests in the first type queue are processed;

[0025] When the global object requests in the first type queue are processed, the first type queue and the second type queue are switched through an atomic operation, and the global object requests in the first type queue are continuously processed.

[0026] In a possible implementation, when the response packet is returned to a computing node or a data node which initiates the global object request, the proxy module enters a dormant state until a next request is received to wake up and continue to process the new request.

[0027] The application further provides a global object management device in a distributed database, the device comprising:

[0028] a receiving module configured to receive a global object request packet sent by a proxy module in the distributed database, the global object request packet being obtained by encapsulating a global object request initiated by a computing node or a data node through the proxy module, and the proxy module being arranged on each computing node and data node;

[0029] a generating module configured to generate a response packet corresponding to the global object request packet based on a request type of the global object request;

[0030] a processing module configured to return the response packet to the computing node or the data node which initiates the global object request, and save a corresponding global object in the response packet in a storage module;

[0031] an updating module configured to update historical global objects in the storage module based on the corresponding global object in the response packet to obtain updated global objects, and save the updated global objects in a memory or a disk;

[0032] The global object management device is constructed based on a computing node, and the global object management device has all capabilities of the computing node.

[0033] The application further provides an electronic device, the electronic device comprising a processor and a memory:

[0034] The memory is configured to store a computer program and transmit the computer program to the processor;

[0035] The processor is configured to execute steps of the global object management method in the computer program according to instructions in the computer program.

[0036] The application also provides a computer readable storage medium for storing a computer program, which, when executed by an electronic device, implements the steps of the method for managing a global object in a distributed database.

[0037] Compared with the prior art, the application has the following beneficial effects:

[0038] In the method provided by the application, the hierarchical design of the proxy module, the service module and the storage module is introduced in the distributed database, which greatly improves the management efficiency of the global object. As an intermediary for requests, the proxy module can encapsulate the global object requests from the computing nodes or data nodes and process them asynchronously. The design of the proxy module makes the request and response process not directly dependent on the business logic of the computing nodes or data nodes, and can independently manage the life cycle of the global object request. This design decouples the request processing from other operations of the computing nodes and data nodes, thereby improving the response efficiency of global object management. The proxy module of each node can respond to requests in a timely manner, avoiding the performance bottleneck when directly accessing the service module and ensuring efficient operation of the system under high concurrency. The storage module of the global object intelligently updates and manages between the memory and the disk. When the global object is updated, the storage module saves the updated object in the memory and periodically synchronizes the updated object to the disk. This mechanism not only ensures efficient storage of the global object, but also guarantees data consistency and persistence, effectively reducing disk write pressure and improving the performance of the entire database. Through the design of the proxy module, the processing task of the global object request is handed over to the service module, avoiding the direct interaction between the computing nodes and data nodes and the global object manager, thereby reducing the response delay of the system. The service module is responsible for generating corresponding response packets according to the request type, and this process is independent and efficient, and has good concurrency capability, which can effectively handle a large number of concurrent requests. Since the proxy module of each request node can be independently processed, the service module of the global object management device supports concurrency, and this scheme can be flexibly extended to more computing nodes and data nodes, effectively guaranteeing the scalability of the system. BRIEF DESCRIPTION OF DRAWINGS

[0039] In order to more clearly illustrate the technical solutions in the embodiments of the application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description only constitute some embodiments of the application, and for those skilled in the art, other drawings can also be obtained from these drawings without creative labor.

[0040] Figure 1 A flowchart of a method for managing a global object in a distributed database provided by an embodiment of the application;

[0041] Figure 2 A structure schematic diagram of a global object management device in a distributed database provided by an embodiment of the present application. DETAILED DESCRIPTION

[0042] As described above, in the distributed database, some key objects need to be managed by a central node. The key objects can be, for example, global transaction numbers, global time stamps, global sequences, etc., which have the requirement of uniqueness and thus must be managed by the central node. The central node is responsible for maintaining these objects and quickly returning the objects after calculation according to the request of other nodes.

[0043] It is found through research that, in order to achieve the above-mentioned target, a global object manager is designed separately to serve as the central node. This manager is usually designed independently, has a single function, supports only a small number of interfaces, and synchronizes data between the primary and standby hosts through customized messages. When a node fails, the high-availability capability is insufficient, which easily causes problems such as data loss and makes recovery difficult. The management efficiency of the key objects by the global object manager in the related art is low.

[0044] In order for those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of the present application.

[0045] It can be understood that the method provided by the present application can be applied to a processing device that can receive a global object request package sent by a proxy module in a distributed database, such as a terminal device or a server that can receive a global object request package sent by a proxy module in a distributed database. The method provided by the present application can be independently executed by a terminal device or a server, or can be applied to a network scenario in which a terminal device and a server communicate and cooperate to execute. The terminal device can be a computer, a mobile phone or the like. The server can be an application server or a Web server. In actual deployment, the server can be a standalone server or a cluster server.

[0046] Figure 1 A flowchart of a global object management method in a distributed database provided by the present application, the method comprising the following steps:

[0047] S101: receiving a global object request package sent by a proxy module in a distributed database.

[0048] The service module receives the global object request package sent by the proxy module in the distributed database. The global object request package is obtained by encapsulating the global object request initiated by the computing node or the data node through the proxy module. The proxy module is arranged on each computing node and data node.

[0049] Next, different modules are described. The main function of the proxy module (Proxy) is to act as an intermediary between the computing node (CN), the data node (DN), and the service module. It is responsible for receiving requests from the computing node and the data node, forwarding them to the service module (Server), and returning the results to the requesting task after receiving the response from the service module.

[0050] When the proxy module works, it initiates a request for a global object (such as a global transaction number, a global timestamp, a serial number, etc.) from the computing node or the data node (CN / DN). The task is submitted to the proxy module asynchronously. After receiving the request, the proxy module encapsulates the task information and forwards it to the service module through an asynchronous mechanism. After sending the request, the proxy module enters a blocked state and waits for a response from the service module.

[0051] The proxy module maintains at least two types of queues, a first type of queue and a second type of queue. When the proxy module processes multiple global object requests, it adds multiple global object requests to the second type of queue according to a predetermined rule. The proxy module processes the global object requests in the first type of queue. When the global object requests in the first type of queue are processed, the proxy module switches the first type of queue and the second type of queue through an atomic operation and continues to process the global object requests in the first type of queue.

[0052] The first type of queue can be a current request queue, and the second type of queue can be a pending request queue. In each request processing, the proxy module exchanges the queues through an atomic operation to ensure that the requests are processed in order.

[0053] The advantage of this design is that it can achieve high-concurrency request processing and reduce interference between requests, improving the response efficiency of the system.

[0054] When the service module returns a response, the proxy module distributes the results to the corresponding task and wakes up the waiting task to complete the response. The proxy module also checks whether there is a new request to process. If there is a new request, it will continue to process the next request; if there is no new request, it will enter a sleep state.

[0055] The service module (Server) is the core part of the global object manager, responsible for receiving requests from the proxy module, performing calculation and processing, and returning results. It is responsible for generating and managing global objects, such as global transaction numbers (GXID), global timestamps, and global serial numbers.

[0056] The service module is the core part of the global object manager, responsible for receiving requests from the agent module, performing calculation processing, and returning results. It is responsible for generating and managing global objects such as global transaction numbers, global timestamps, global sequence numbers, etc.

[0057] After the service module is started, it will listen to the connection request of the agent module and record the basic information of each agent module.

[0058] When the agent module sends a request, the service module will perform the corresponding operation according to the request type. For example: when requesting a global transaction number, the service module will generate a unique transaction number. When requesting a global timestamp, the service module will generate a unique timestamp according to the current time and system state. When requesting a global sequence number, the service module will increment and return the current unique sequence number.

[0059] The service module is responsible for generating globally unique transaction identifiers to ensure that transaction numbers in all distributed nodes are not repeated. The service module ensures that the generated timestamp is unique in the distributed environment and consistent between nodes. Each node obtains a globally unique incremental sequence number through the service module to ensure that there are no duplicate sequence numbers in the system.

[0060] When processing each request, the service module will perform calculations according to the management rules of global objects to ensure that the results meet the consistency and uniqueness requirements of the system. After processing the request, the service module returns the result to the agent module for subsequent processing.

[0061] The role of the storage module (Store) is to ensure the persistence and recovery of global objects. It is responsible for storing the latest values of global objects and recovering global objects from disk in the event of system restart or failure, ensuring high availability of the system.

[0062] When the service module generates new global objects (such as transaction numbers, timestamps, sequence numbers, etc.), the storage module updates them to the memory for fast access.

[0063] At the same time, the storage module periodically checks the difference between the global objects in memory and the object values stored in the disk. When the difference between the global objects in memory and the disk is less than a certain threshold (threshold A), the storage module will increase the object value in the disk by a threshold (threshold B) and then write it to the disk, ensuring that the object value on the disk is large enough. This mechanism avoids frequent disk writes and improves performance.

[0064] When global objects are updated (such as requesting new global timestamps, sequence numbers, etc.), the storage module ensures that the data in memory is updated in a timely manner and periodically writes the updated object data back to the disk. The storage module controls the update frequency to reduce disk I / O operations and improve system performance.

[0065] When the system is restarted or fails, the storage module loads the latest global object value from the disk, which is necessarily different from the value already used in the system due to the foregoing design, ensuring the uniqueness of the global object. To ensure the uniqueness and consistency of the global object, the storage module ensures that the recovered global object value is greater than the used value, avoiding conflicts or loss.

[0066] S102: generating a response packet corresponding to the global object request packet based on the request type of the global object request.

[0067] The service module generates a response packet corresponding to the global object request packet based on the request type of the global object request.

[0068] In a possible implementation, if the request type of the global object request is a global transaction number type, the service module generates a global transaction number based on a historical global transaction number in a historical global object, and the global transaction number guarantees global uniqueness.

[0069] The service module encapsulates the global transaction number as a response packet of the global object request packet.

[0070] In another possible implementation, if the request type of the global object request is a global timestamp type, the service module generates a global timestamp based on a historical global timestamp in a historical global object or a clock source of the distributed database, and the global timestamp guarantees global uniqueness and monotonically increasing.

[0071] The service module encapsulates the global timestamp as a response packet of the global object request packet.

[0072] In still another possible implementation, if the request type of the global object request is a global sequence number type, the service module generates a global sequence number based on a historical global sequence number in a historical global object, and the global sequence number guarantees global uniqueness.

[0073] The service module encapsulates the global sequence number as a response packet of the global object request packet.

[0074] In yet another possible implementation, one global object request can also include multiple request types, and multiple different request types can correspond to one global object request.

[0075] The global timestamp is used to identify the time order of transactions or operations in the distributed database, ensuring that the processing order of transactions is globally consistent between different nodes. The global timestamp generally adopts a logical clock or is generated based on a local clock of a node.

[0076] The global sequence number is mainly used for identifying the order of data operations, for example, assigning a unique sequence number for each operation in data insertion, update or deletion operation. The goal of global sequence number generation is to ensure uniqueness and incrementality in the global range, avoiding the occurrence of duplicate sequence numbers.

[0077] S103: returning the response packet to the computing node or data node initiating the global object request, and saving the corresponding global object in the response packet in the storage module.

[0078] The service module returns the response packet to the computing node or data node initiating the global object request, and saves the corresponding global object in the response packet in the storage module.

[0079] S104: updating the historical global object in the storage module based on the corresponding global object in the response packet to obtain an updated global object.

[0080] The service module updates the historical global object in the storage module based on the corresponding global object in the response packet to obtain an updated global object, and the updated global object is saved in the memory or the disk at the same time.

[0081] In a possible implementation, after the distributed database is restarted, the service module can recover the global object in the memory of the global object management device in the distributed database based on the global object stored in the storage module.

[0082] In the method provided in the application, the hierarchical design of introducing the agent module, the service module and the storage module in the distributed database greatly improves the management efficiency of the global object. The agent module, as an intermediary of the request, can encapsulate the global object request from the computing node or the data node and process it asynchronously. The design of the agent module makes the request and response process not directly dependent on the business logic of the computing node or the data node, and can independently manage the life cycle of the global object request. This design decouples the request processing from other operations of the computing node and the data node, thereby improving the response efficiency of global object management. The agent module of each node can respond to the request in time, avoiding the performance bottleneck when directly accessing the service module and ensuring the efficient operation of the system under high concurrency. The storage module of the global object intelligently updates and manages between the memory and the disk. When the global object is updated, the storage module saves the updated object in the memory and periodically writes the updated object data in the disk back to the disk. This mechanism not only ensures the efficient storage of the global object, but also guarantees the consistency and persistence of the data, effectively reducing the disk write pressure and improving the performance of the entire database. Through the design of the agent module, the processing task of the global object request is completed by the service module, avoiding the direct interaction between the computing node and the data node and the global object manager, thereby reducing the response delay of the system. The service module is responsible for generating the corresponding response packet according to the request type, and this process is independent and efficient, and has good concurrency capability, which can effectively cope with a large number of concurrent requests. Since the agent module of each request node can be independently processed, the service module of the global object management device supports concurrency, and this scheme can be flexibly extended to more computing nodes and data nodes, and the scalability of the system is effectively guaranteed.

[0083] The application also provides a structure diagram of a global object management device in a distributed database, as shown in the figure. Figure 2 The global object management device 200 in the distributed database comprises:

[0084] The receiving module 201 is configured to receive the global object request packet sent by the agent module in the distributed database, and the global object request packet is obtained by encapsulating the global object request initiated by the computing node or the data node through the agent module. Each computing node is provided with an agent module, a service module and a storage module, and each data node is provided with an agent module.

[0085] The generating module 202 is configured to generate a response packet corresponding to the global object request packet based on the request type of the global object request.

[0086] The processing module 203 is configured to return the response packet to the computing node or the data node initiating the global object request, and save the corresponding global object in the response packet in the storage module.

[0087] The updating module 204 is configured to update the historical global object in the storage module based on the corresponding global object in the response packet to obtain an updated global object, and save the updated global object in the memory or the disk.

[0088] In the device provided in the present application, the hierarchical design of the proxy module, the service module and the storage module is introduced in the distributed database, which greatly improves the management efficiency of the global object. The proxy module, as an intermediary of the request, can encapsulate the global object request from the computing node or the data node and process it asynchronously. The design of the proxy module makes the request and response process not directly dependent on the business logic of the computing node or the data node, and can independently manage the life cycle of the global object request. This design decouples the request processing from other operations of the computing node and the data node, thereby improving the response efficiency of the global object management. The proxy module of each node can respond to the request in time, avoiding the performance bottleneck when directly accessing the service module, and ensuring the efficient operation of the system under high concurrency. The storage module of the global object intelligently updates and manages between the memory and the disk. When the global object is updated, the storage module saves the updated object in the memory and periodically writes the updated object data in the disk back to the disk. This mechanism not only ensures the efficient storage of the global object, but also guarantees the consistency and persistence of the data, effectively reduces the disk write pressure, and improves the performance of the entire database. Through the design of the proxy module, the processing task of the global object request is completed by the service module, avoiding the direct interaction between the computing node and the data node and the global object manager, thereby reducing the response delay of the system. The service module is responsible for generating the corresponding response packet according to the request type, and this process is independent and efficient, and has good concurrency capability, which can effectively cope with a large number of concurrent requests. Since the proxy module of each request node can be independently processed, the service module of the global object management device supports concurrency, and this scheme can be flexibly extended to more computing nodes and data nodes, and the scalability of the system is effectively guaranteed.

[0089] The present application also provides a global object management device in a distributed database, wherein the device comprises a memory and a processor, the memory is configured to store instructions or codes, and the processor is configured to execute the instructions or codes to enable the device to perform the steps of the global object management method in the distributed database according to any of the embodiments of the present application.

[0090] In practical application, the computer-readable storage medium can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium.

[0091] The computer-readable storage medium may, for example, be, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the above. More specific examples (a non-exhaustive list) of the computer-readable storage medium include an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium can be any tangible medium that contains or stores a program used by an instruction execution system, apparatus, or device to function or be combined with the instruction execution system, apparatus, or device.

[0092] The computer-readable signal medium can include a data signal traveling in a baseband or a carrier wave traveling in a baseband, in which computer-readable program code is carried. Such a traveling data signal can take a variety of forms, including but not limited to electro-magnetic, optical, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium that is not a storage medium and that can be used to carry or transmit a program for use by or in connection with an instruction execution system, apparatus, or device.

[0093] The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wire line, optical fiber cable, RF, etc., or any suitable combination of the above.

[0094] Computer program code for carrying out operations of the present application can be written in any combination of one or more programming languages, including an object-oriented programming language such as Java, Smalltalk, C++, or the like, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, application specific circuitry, or field programmable gate array (FPGA) circuitry can execute the program code.

[0095] It should be noted that each of the embodiments described in the specification of the present application adopts a progressive description manner, and the same or similar parts between the embodiments can be referred to each other. Each embodiment focuses on the difference from other embodiments. In particular, the device embodiments are described more simply because they are basically similar to the method embodiments, and the relevant parts can be referred to the part of the method embodiments. The device embodiments described above are merely illustrative, and the units described as separate components can or can not be physically separated, and the components indicated as units can or can not be physical units, i.e., they can be located in one place or distributed on multiple network units. Part or all of the modules can be selected to achieve the purpose of the embodiments according to the actual needs. Those skilled in the art can understand and implement it without creative labor.

[0096] The above describes only one specific implementation of the present application, but the protection scope of the present application is not limited to this. Any skilled person in the art can easily think of changes or replacements within the technical range disclosed in the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A method for managing global objects in a distributed database, characterized in that, include: The system receives a global object request packet sent by the proxy module in the distributed database. The global object request packet is obtained by encapsulating a global object request initiated by a computing node or a data node through the proxy module. Each computing node and data node is equipped with a proxy module. Generate a response packet corresponding to the global object request packet based on the request type of the global object request; The response packet is returned to the compute node or data node that initiated the global object request, and the corresponding global object in the response packet is saved in the storage module; The historical global object in the storage module is updated based on the global object corresponding to the response packet to obtain the updated global object, and the updated global object is simultaneously saved to memory or disk. Specifically, when the difference between the global object value in memory and the object value on disk is less than a preset threshold A, the storage module writes the object value on disk to disk after raising it by a threshold B, thereby reducing the write frequency and ensuring that the object value on disk meets the recovery lower bound. When the distributed database restarts, the global objects in the memory of the computing node are restored based on the global objects stored in the storage module, so that the restored global object value is greater than the used value. When the proxy module processes multiple global object requests, it adds the multiple global object requests to a second type of queue according to preset rules and processes the global object requests in the first type of queue. After the global object requests in the first type of queue are processed, the first type of queue and the second type of queue are switched through atomic operations, and the global object requests in the first type of queue are continuously processed. After the response packet is returned to the computing node or data node that initiated the global object request, the proxy module enters a sleep state until it is awakened by the next request.

2. The method according to claim 1, characterized in that, The process of generating a response packet corresponding to the global object request packet based on the request type of the global object request includes: If the request type of the global object request is a global transaction number type, then a global transaction number is generated based on the historical global transaction number in the historical global object, and the global transaction number is a globally unique transaction number. The global transaction number is encapsulated into a response packet of the global object request packet.

3. The method according to claim 1, characterized in that, The process of generating a response packet corresponding to the global object request packet based on the request type of the global object request includes: If the request type of the global object request is a global timestamp type, then a global timestamp is generated based on the historical global timestamp in the historical global object or the clock source of the distributed database. The global timestamp is a globally unique and monotonically increasing timestamp. The global timestamp is encapsulated into a response packet of the global object request packet.

4. The method according to claim 1, characterized in that, The process of generating a response packet corresponding to the global object request packet based on the request type of the global object request includes: If the request type of the global object request is a global sequence number type, then a global sequence number is generated based on the historical global sequence number in the historical global object, and the global sequence number is a globally unique sequence number; The global serial number is encapsulated into a response packet of the global object request packet.

5. The method according to claim 1, characterized in that, The method further includes: When the distributed database restarts, the global objects in the memory of the computing nodes in the distributed database are restored based on the global objects stored in the storage module.

6. The method according to claim 1, characterized in that, The proxy module includes at least two types of queues, and the method further includes: When the proxy module processes multiple global object requests, it adds the multiple global object requests to the second type of queue according to preset rules; Process global object requests in the first type of queue; Once the global object requests in the first queue have been processed, the first queue and the second queue are switched through an atomic operation, and the global object requests in the first queue are continuously processed.

7. The method according to claim 1, characterized in that, When the response packet returns to the compute node or data node that initiated the global object request, the proxy module enters a sleep state until it is awakened by the next request and continues to process the new request.

8. A management device for global objects in a distributed database, characterized in that, include: The receiving module is used to receive global object request packets sent by the proxy module in the distributed database. The global object request packets are obtained by the proxy module encapsulating global object requests initiated by computing nodes or data nodes. Each computing node and data node is equipped with a proxy module. The generation module is used to generate a response packet corresponding to the global object request packet based on the request type of the global object request; The processing module is used to return the response packet to the computing node or data node that initiated the global object request, and to save the corresponding global object in the response packet in the storage module; The update module is used to update the historical global object in the storage module based on the global object corresponding to the response packet to obtain the updated global object, and the updated global object is simultaneously saved to memory or disk; The global object management device is built on computing nodes and has all the capabilities of computing nodes; Specifically, when the difference between the global object value in memory and the object value on disk is less than a preset threshold A, the storage module writes the object value on disk to disk after raising it by a threshold B, thereby reducing the write frequency and ensuring that the object value on disk meets the recovery lower bound. When the distributed database restarts, the global objects in the memory of the computing node are restored based on the global objects stored in the storage module, so that the restored global object value is greater than the used value. When the proxy module processes multiple global object requests, it adds the multiple global object requests to a second type of queue according to preset rules and processes the global object requests in the first type of queue. After the global object requests in the first type of queue are processed, the first type of queue and the second type of queue are switched through atomic operations, and the global object requests in the first type of queue are continuously processed. After the response packet is returned to the computing node or data node that initiated the global object request, the proxy module enters a sleep state until it is awakened by the next request.

9. An electronic device, characterized in that, Includes memory and processor, wherein: The memory is used to store computer programs; The processor is configured to execute the computer program to implement the method for managing global objects in a distributed database as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, Used to store computer programs, wherein the computer programs, when executed by a processor, implement the method for managing global objects in a distributed database as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Global transaction management method and system, electronic equipment and storage medium

    CN114625949A